text:
Q: Names of the ghosts or monsters in Pac-Man Not sure if they're ghosts or monsters, but what are the names of those chasing our beloved and fearless hero, Pac-Man, around the maze?
Do they even have names? Do they also have distinct personalities?

A: The ghosts have both names and distinct personalities. Here is a detailed description (and another one). The summary is:

*

*Blinky (red): Speeds up after you've eaten a certain amount of dots. Tends to chase more closely than any other ghost.

*Pinky (pink): Tends to move anti-clockwise. Is usually the first ghost to scatter to the corners of the maze.

*Inky (blue): Takes seemingly random decisions at junction points, so is harder to predict than the other ghosts.

*Clyde (orange): Often gives up the chase, so is the easiest of the ghosts to avoid.

A: The Character (Personality), nicknames and behavior for the enemies are:

*

*Red: Shadow "Blinky" In Japan, his character is represented by the word oikake, which means "to run down or pursue". (Chases Pac-Man all the time, Also speeds up after you've eaten a certain amount of dots, which gets less for each level.)

*Pink: Speedy "Pinky" In Japan, he is characterized as machibuse, meaning "to perform an ambush". (Fast but random movement.)

*Cyan: Bashful "Inky" In Japan, he is portrayed as kimagure, meaning "a fickle, moody, or uneven temper". (Shy and tries to stay away from pac-man, unless approached too much, after which it will chase Pac-Man too.)

*Orange: Pokey "Clyde" In Japan, his character is described as otoboke, meaning "pretending ignorance", and his nickname is "Guzuta", meaning "one who lags behind". (Slow and Random Movement)
Now, on the ghost vs. monster topic, The arcade cabinet refered to the enemies as "monsters", but the when the Atari 2600 home version was released with pale, flickering enemies, the manual dubbed them "ghosts", to add to the confusion, the TV series refers to them as "ghost monsters" (I personally prefer ghosts.)
Source for the behaviours:

*

*Mateas, Michael (2003). "Expressive AI: Games and Artificial Intelligence" (PDF). Proceedings of Level Up: Digital Games Research Conference, Utrecht, Netherlands.

*Pittman, Jamey (2011), The Pac-Man Dossier

A: The original game called the creatures monsters when they are chasing you (red, pink, blue, orange) and called them ghosts when they are running from you (purple/peach) after you eat an energizer.
The Japanese names for the monsters are:

*

*Red: Oikake a.k.a. "Akabei" (the chaser)

*Pink: Kimagure a.k.a. "Pinky" (fickle/whimsy)

*Cyan: Machibuse a.k.a. "Aosuke" (the ambusher)

*Orange: Otoboke a.k.a. "Guzuta" (plays dumb)

(The pink monster had the nickname "Pinky" in both the U.S. and Japan.)


text:
Q: Does one still need to report p-value & effect size if one has reported the confidence interval (CI)? I am unclear about the degree of overlap in the information contained by the CI as opposed to that contained in the p-value and effect size of that same statistic/estimate.
I know of course that if a 95% CI does not include the zero value of a particular effect, then it can be inferred that said effect is statistically significant, in the same way that this would be inferred from a p<0.05. And, of course, that CIs can be calculated from p-values, and vice-versa.
But what is unclear to me is:
1) if the CI is reported, is there any need at all to still provide the p-value? In other words, does it give any extra information that the CI does not already give?
2) if I want to describe, say, the difference in means between two groups, does it still make sense to provide a measure of effect size such as Cohen's d if I have already provided the CI of the sample point-estimate?
Reading the paper "Confidence Interval or P-Value?" by du Prel et al. (2009) has left me still in doubt unfortunately, so further reading that addresses my question would be appreciated in an answer - thanks in advance.
I should also mentin that this question follows on from an earlier one to which I never obtained a satisfactory answer, just as searching previous questions on here was not entirely enlightening.

A: While information such as differences in means and p-values can often be back-calculated from a confidence interval (especially if it is of the form $\hat{\delta}\pm c_{1-\alpha/2} \text{SE}(\hat{\delta})$) potentially after some transformation), it is not easy for people to do this in their head. So, it is better to do these calculatons for them. Particularly the difference in means should really be provided in my opinion, while it is in many fields expected to also be provided p-values (even if people usually mis-interpret them).
Talking for my specific field, for controlled clinical trials the standard set of information I would always expect is difference in means (or some other point estimate), confidence interval (or something else such as a credible interval) and p-value (especially if it is multiplicity adjusted - multiplicity adjusted confidence intervals are rarely reported and hard to obtain). In addition, I would normally expect to see something like adjusted least-squares means (or some similar measure) for each group with confidence interval or standard error, as well as information on the number of patients in each group. This covers a diverse set of needs: an idea of the effect size, an idea of the uncertainty around it, what people are used to seeing, what you would need to include the trial into a meta-analysis, what you would need to construct a historical prior for a new trial, what you need to get an idea of the variability of the outcome (useful for sample size calculations for new trials) etc.

A: I will share what I tell my students: our job in conveying statistical information to our "clients" is to quantify what was observed and to provide some measure of how this evidence can be assessed. I would argue that the sample statistics and effect sizes address the former, and confidence intervals (CI) or $P$-values address the latter.  Thus, I would suggest reporting both the CI and the effect size, such as $d$ or $R^2$. However, reporting both the CI and the $P$-value would be redundant.
Regarding the 2nd query, the size of the CI depends on $n$, and thus can be misleading. That is, you can have two CIs with the same distance from zero and the same $d$.  One CI could be very large and the other very small. Thus, you do provide additional information by reporting the effect size, as well.
Lastly, regarding additional readings, I can't think of any right now. But, there is a lot that shows up in most modern statistics/research-design textbooks (particularly with applied focus, like for social science researchers).

redpajama_set_name: RedPajamaStackExchange


text: Q: How to print existing pdf file on specific printer with iTextSharp? I'm working on a c# project that needs to print some pdf files saved on my computer, but I need send it to printer which is specified by the user in the system, so I don't want to open the system printers modal. I've searched a lot and didn't find how to do this with iTextSharp (version 5.5.13). Anyone can help me?


text:
Q: How we can add Html Tags in Titanium iOS label I'm working on Appcelerator studio .i want to add html tags in label text.how i can add this in label.
var labThesisDetail = Titanium.UI.WebView({
        text : "
Master Of Science in Land Resource Management

",
        width : Ti.UI.FILL,
        height : Ti.UI.SIZE,
        right : 20,
        top : 20,
        editable : false,
        backgroundColor : 'white',
        left : 20,
        color : "black",
        font : {
            fontSize : 13,
            //fontFamily : "Signika-Regular",
            fontWeight : 'normal'
        }
    });
    viewCourseSummary.add(labThesisDetail);

A: Android only has an html property to do this : http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Label-property-html
I you want crossplatform code, you can use this module : http://gitt.io/component/ti.styledlabel (it's more lighter than using a WebView)
var StyledLabel = require('ti.styledlabel');
var label = StyledLabel.createLabel({
    height: Ti.UI.SIZE || 'auto',
    top: 5, right: 5, bottom: 5, left: 5,
    html: 'Loading, please wait.'
});


text:
Q: Enable textbox and select using radiobutton in javascript following my post awhile ago, this is my code for textbox and select to enable them using radiobuttons.

Student Filter

            <input type="radio" id="rad1" onclick="Radiobutton()"/>
            <input type="text" placeholder="Search ID" id="searchid" runat="server" class="form-control" style="width: 50%; display: inline-block" disabled />

            <input type="radio" id="rad2" onclick="Radiobutton()"/>
            <select class="form-control" runat="server" id="Year" style="width: 91%; display: inline-block" disabled>
                <option value="yearselected12" selected disabled>Filter by Year(student)</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
            </select>

            <input type="radio" id="rad3" onclick="Radiobutton()" />
            <select class="form-control" runat="server" id="YearFrom" style="width: 49%; display: inline-block" disabled>
                <option value="yearfrom1" selected disabled>Year From</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
            </select>

            <select class="form-control" runat="server" id="YearTo" style="width: 42%; display: inline-block" disabled>
                <option value="yearto2" selected disabled>Year To</option>
                <option value="5">5</option>
                <option value="4">4</option>
                <option value="3">3</option>
                <option value="2">2</option>
                <option value="1">1</option>
            </select>

        <button type="button" runat="server" onserverclick="Allstudent_Click" id="ListofStudent" class="btn btn-primary">View Student</button>
        <button type="button" runat="server" onserverclick="Clear_Click" id="clearfilter" class="btn btn-default">Clear</button>

        asd

And this is my javascript code for the radiobutton.

When I click one of the radiobutton for each they will enabled all the textbox and select. How do I make it my radiobutton to enable only one radiobutton and if I enable another one the other radiobutton is uncheck and the input tag is disabled and so on?

A: Your first question is: How do set up a radiobutton in html? You need to define the name property on each of them. And make sure it is the same.
<input type="radio" name="radiobuttonlistname" id="rad1" onclick="Radiobutton()"/>
<input type="radio" name="radiobuttonlistname" id="rad2" onclick="Radiobutton()"/>
<input type="radio" name="radiobuttonlistname" id="rad3" onclick="Radiobutton()" />

And to answer your second question. The javascript is correct and seems to work for me.
See this fiddle


text:
Q: Align overlapping image in center I need to align the play button image in the center of another image.
The example that I have is breaking when titles are long.
How can we align blue color image exactly over the large image
Fiddle

        " />

 this is video short video title

A: Just put your play-item-wrapper inside the container video-image-wrapper and add a relative positioning on it.

                " />

            this is video short video title

And in CSS
.video-image-wrapper { position: relative; }

JSFiddle: https://jsfiddle.net/L51bd8vr/


text:
Q: Javascript - Get the content of a string from inside a parenthesis I have a string which I get back from an ajax request. The string is in this format:
  POINT(417135.05230943 4187636.37572952)

What I want is to get the content in the parenthesis to use it to make a marker (latitude, longitude).
Right now I do this:
response = response.replace("POINT(",'');
response = response.replace(")",'');
response = response.replace(" ",',');
//alert(response);
var latlotArr = response.split(',');

Which I don't like at all. Is there another way to do it? I suppose is not possible to convert this to JSon. What alternatives do I have?

A: Bunch of ways to do it.
One way is a basic regular expression to match the two groups of numbers separated by a space.
var str = "POINT(417135.05230943 4187636.37572952)";
var points = str.match(/(\d+.\d+)\s(\d+.\d+)/);
console.log(points[1], points[2]);

You can get more specific if you want, up to you.


text:
Q: Visual Complex Analysis - Transformation and Rotations of complex numbers I have just learned about the transformation and rotations of complex numbers from the Visual complex analysis book. Example on page 18, makes total sense:
$$\mathcal R_a^{\theta}(z) = (\mathcal T_v \circ \mathcal R_0^{\theta} \circ \mathcal T ^{-1}_v)(z)$$
And thus one can show that a single rotation can be decomposed into the following:
$$\mathcal R_a^{\theta}(z) = (\mathcal T_k \circ \mathcal R_0^{\theta})(z) $$
where $k=a(1-e^{i\theta})$
Conversely one can show that rotaiton about the origin and then translation can be expressed as a single rotation, i.e. that:
$$(\mathcal T_v \circ \mathcal R_0^a)(z) = ?$$
And this is my problem. I cannot show that it is equal to a single rotation. I cannot find that value of $c$...

A: "rotaiton about the origin and then translation can be expressed as a single rotation": no.
$$e^{i\theta}z+a=ze^{i\theta'}$$ cannot hold.
Take $z=0$: this implies $a=0$.

But if you allow rotation about another point $c$,
$$e^{i\theta}z+a=(z-c)e^{i\theta'}+c$$ is obviously solved by
$$\theta'=\theta,\\c=\frac a{1-e^{i\theta}}.$$

A: Reading between lines, I guess that your question is about the commutation of rotation and translation. It all mounts to the identity
$$(z+a)e^{i\theta}=ze^{i\theta}+ae^{i\theta}.$$
Rotating a translated point is the same as rotating then translating by the rotated vector.
Reciprocally
$$ze^{i\theta}+a=(z+ae^{-i\theta})e^{i\theta}.$$
Rotating then translating a point is the same as translating by the counter-rotated vector, then rotating.

Rotating about another point than the origin can be expressed as a combination of a rotation followed by a translation or conversely.
$$(z-a)e^{i\theta}+a=ze^{i\theta}+(a-ae^{i\theta})=(z+(ae^{-i\theta}-a))e^{i\theta}.$$


text:
Q: Can I say "I will knock your door" to point that "I will send you another email again FYI"? As the title points out, I don't want to say "I will send you an e-mail again" to somebody. Instead, I try to rephrase that sentence, so does "knock your door" address the same meaning in an e-mail conversation?

A: No, that does not have the same meaning.
In a professional or respectful setting, a good option would be

I will get back to you (next week).

The (next week) part is optional.
Just as a fun sidenote, if you're talking to very close friends in a very colloquial setting, you could say "I'll hit you up (later)." This is slang in the United States for texting/calling/communicating with someone later. This definitely shouldn't be used in any sort of setting with coworkers or even family.

A: No, that would not make sense.

I will knock (on) your door

does't really have any other meaning other than literally knocking on someone's door.
Knock usually takes a preposition.
I suppose you could use the slang

I'll come knocking

which means I will come look for you, but it implies physically going and looking, and it might be a stretch. However, if you still need a phrase that has a physical contact connotation, then :

I'll be in touch

is possible, and by email can always be added at the end :

I'll be in touch by email.

but that has the quality of being in contact in general, not specifically about emails.
Are you asking about sending an initial email, a followup email, or an additional email?
I find the again in your question ambiguous


text:
Q: GIT install on AS/400 I'm trying to install on a AS/400 running V7.2.
I have install IBM I Access Client Solution and install the open source code for GIT.
I have done the following, then I had this error.
Has anyone install GIT on a AS/400 running V7.2 ?
qsh
cd /qsys.lib/gitbckup.lib/qrpglesrc.file
git init
/QSYS.LIB/GITBCKUP.LIB/QRPGLESRC.FILE/.git: Error 3014 occurred.
$

I have found this online so far...
EBADNAME
3014 - The object name specified is not correct.

A: Git for PASE has been released by IBM and packaged as an RPM. You install it with yum, which you can issue at a Qshell command line (QSH) or in a PASE session (CALL QP2TERM, or log in via SSH):
yum install git

Or you can do the equivalent via the GUI for IBM i Access Client Solutions (ACS).
If you do not already have yum installed, see instructions here.

A: Git on IBM i only works on IFS files in the Root and QOpenSys filesystems. It does not work on files in the QSYS.LIB filesystem or other file systems like QDLS.


text:
Q: Flutter - Dropdown - Items - Disable? I discovered the DropdownButton Widget in Flutter and I played around with the items.My question is now, why is there no option to disable an item in the dropdownmenuitem widget? Or is there a way to do it?
My Idea was that I have multiple dropdowns with the same itemList and if I choose one item in an dropdown it should be disabled in the other ones. Any Idea?

A: https://dartpad.dev/d2b1688b14270bdf56ae952adfac93d2
there is no official way to disable some DropdownMenuItem but you can simulate this by not selecting the disabled item when selected and by changing its color.
otherwise, you would need to copy DropdownButton and add this capability yourself.
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      home: Scaffold(
        appBar: AppBar(title: const Text(_title)),
        body: Center(
          child: MyStatefulWidget(),
        ),
      ),
    );
  }
}

class MyStatefulWidget extends StatefulWidget {
  MyStatefulWidget({Key key}) : super(key: key);

  @override
  _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}

class _MyStatefulWidgetState extends State<MyStatefulWidget> {
  final disabledItems  = ['Free', 'Four'];

  String dropdownValue = 'One';

  @override
  Widget build(BuildContext context) {
    return DropdownButton<String>(
      value: dropdownValue,
      icon: Icon(Icons.arrow_downward),
      iconSize: 24,
      elevation: 16,
      style: TextStyle(color: Colors.deepPurple),
      underline: Container(
        height: 2,
        color: Colors.deepPurpleAccent,
      ),
      onChanged: (String newValue) {
        if (!disabledItems.contains(newValue)) {
          setState(() {
            dropdownValue = newValue;
          });
        }
      },
      items: <String>['One', 'Two', 'Free', 'Four']
          .map<DropdownMenuItem<String>>((String value) {
        return DropdownMenuItem<String>(
          value: value,
          child: Text(
            value,
            style: TextStyle(
              color: disabledItems.contains(value) ? Colors.grey : null,
            ),
          ),
        );
      }).toList(),
    );
  }
}

A: Just try this:
return DropdownButtonFormField(
      value: dropValue,
      items: DropItems.map((String value) {
        if (value == "a") {
          return DropdownMenuItem<String>(
            child: Text(value, style: const TextStyle(color: Colors.grey)),
            value: value,
            onTap: () => null,
            enabled: false, // disable this item
          );
        }
        return DropdownMenuItem<String>(child: Text(value), value: value);
      }).toList(),
      onTap: (){
           // some code
      },
      onChanged: (){
           // some code
      },
    );
)

A: A slightly different version:
Creates all the items, but the ones which must be disabled have onTap => null && Color = grey.
You can merge this solution with @humazed's, to check if an element is contained inside an exclusion list.

String selectedValue;

...

 DropdownButtonFormField(
            decoration: InputDecoration(
                icon: const Icon(Icons.category),
                labelText: 'Disabled dropdown menu'),
            items: ['a', 'b', 'c'].map((value) {
              // normal options
              if (value != 'c') {
                return DropdownMenuItem<String>(
                  value: value,
                  child: new Text(value,
                      style: new TextStyle(color: Colors.black)),
                );
              // the disabled one ("c")
              } else {
                return DropdownMenuItem<String>(
                  child: Text(value, style: TextStyle(color: Colors.grey)),
                  onTap: () => null,
                );
              }
            }).toList(),
            value: selectedValue,
            onChanged: (String newValue) {
              setState(() {
                selectedValue = newValue;
              });
            },
          ),

Wouldn't be nice to set onTap() => null and have the menu option already disabled? Like a disabled button works. I've sent an improvement request on Flutter's github


text:
Q: java.io.IOException: Your InputStream was neither an OLE2 stream, nor an OOXML stream while Reading xls file from S3 I am trying to read xls File from S3. However, I get the following error:
java.io.IOException: Your InputStream was neither an OLE2 stream, nor an OOXML stream

My code looks like this:
       public Object readFile() {
    String fileName = "<file_name_with_path";

    S3Object object = this.s3Client.getObject(new GetObjectRequest(bucketName, fileName));
    InputStream objectData = object.getObjectContent();
    // Process the objectData stream.

    InputStream targetStream = null;

    try {
        String reader = new BufferedReader(new InputStreamReader(object.getObjectContent()))
            .lines()
            .parallel()
            .collect(Collectors.joining(System.lineSeparator()));

        targetStream = new ByteArrayInputStream(reader.getBytes());
        //          objectData.close();

    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        //          Workbook wb = new HSSFWorkbook(targetStream);
        Workbook wb = WorkbookFactory.create(targetStream);
        Sheet sheet = wb.getSheetAt(0);
        FormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator();
        for (Row row: sheet) // iteration over row using for each loop
        {
            for (Cell cell: row) // iteration over cell using for each loop
            {
                System.out.println(String.valueOf(checkNull(cell)));
            }
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

The error is thrown at this line :
Workbook wb = WorkbookFactory.create(file);

Any idea on what is the mistake I might be making?


text:
Q: Reset cookies with SFSafariViewController How to reset/remove cookies in a SFSafariViewController ?
Nothing seems available in class documentation.
Any advice to reset the cookies ?

A: SFSafariViewConroller's cookies are shared with Safari.
Meaning cookies can be reset in Settings by resetting Safari's cookies.
Hope this helps,
Liam


text:
Q: Kill a process on a remote machine in C# This only helps kills processes on the local machine. How do I kill processes on remote machines?

A: I like this (similar to answer from Mubashar):
ManagementScope managementScope = new ManagementScope("\\\\servername\\root\\cimv2");
managementScope.Connect();
ObjectQuery objectQuery = new ObjectQuery("SELECT * FROM Win32_Process Where Name = 'processname'");
ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(managementScope, objectQuery);
ManagementObjectCollection managementObjectCollection = managementObjectSearcher.Get();
foreach (ManagementObject managementObject in managementObjectCollection)
{
    managementObject.InvokeMethod("Terminate", null);
}

A: You can use wmi. Or, if you don't mind using external executable, use pskill

A: I use the following code. psKill is also a good way to go but sometimes you need to check the some other stuff, for example in my case remote machine was running multiple instances of same process but with different command line arguments, so following code worked for me.
ConnectionOptions connectoptions = new ConnectionOptions();
connectoptions.Username = string.Format(@"carpark\{0}", "domainOrWorkspace\RemoteUsername");
connectoptions.Password = "remoteComputersPasssword";

ManagementScope scope = new ManagementScope(@"\\" + ipAddress + @"\root\cimv2");
scope.Options = connectoptions;

SelectQuery query = new SelectQuery("select * from Win32_Process where name = 'MYPROCESS.EXE'");

using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
{
       ManagementObjectCollection collection = searcher.Get();

       if (collection.Count > 0)
       {
           foreach (ManagementObject mo in collection)
           {
                uint processId = (uint)mo["ProcessId"];
                string commandLine = (string) mo["CommandLine"];

                string expectedCommandLine = string.Format("MYPROCESS.EXE {0} {1}", deviceId, deviceType);

                if (commandLine != null && commandLine.ToUpper() == expectedCommandLine.ToUpper())
                {
                     mo.InvokeMethod("Terminate", null);
                     break;
                }
            }
       }
}


text:
Q: how to validate only http:// or https:// starting urls using python My code:
import re
url=input("enter the url")
match_obj=re.match( r'^(?:http)s?://',url,re.I|re.M)
if match_obj:
    print("valid url",match_obj.group())
else:
    print("invalid url")

Is there a better way to do it?

A: Instead of regex, you could just use str.startswith():
url = input('Enter the url: ').lower()

if url.startswith(('http://', 'https://')):
    print('valid url')
else:
    print('invalid url')

A: Try this:
import re

url=input("enter the url")
regex = re.compile(r'https?:\/\/([^\/]*)')
regObj = regex.findall(url)
if regObj :
    print("valid url")
else:
    print("invalid url")


text:
Q: How can I solve this array problem on vuejs or any other solution? I am trying to create a web in vuejs that is multilanguage, so far the only idea that has occurred to me is to insert in an array the translations that will then be referenced in the html document using JSX. If someone has a more profitable idea and helps me implement it, I will be grateful.
HTML:
<template>

            <select name="language-selector" id="language-selector">
              <option v-for="lang in langs" :value="lang.value">{{lang.name}}</option>
            </select>

Home

About

Services

Team

Careers

</template>

Script:

As you can see, I have a Select element with their respective values and names. So I need that when the value of the select is English, the content of the page is in English and so on with all languages.
As you can see, I have an array called navItems that stores in an object each element of the navigation list respectively.
What I try to do with the changeLang method is to save them all in a new array called selectedLang and then be called with JSX as mentioned above. Any idea how to do it?

A: Add v-model inside your select tag and whatever data will be selected it will automatically save to v-model. Remove this code
var option = document.getElementById("language-selector")[0].value; if(option.value === "English"){
        this.selectedLang[0] == navItems[0]
      }

and change it to this.
this.selectedLang = []
navItems.forEach(lang=>{
    if(lang.id == this.languageSelected){
     this.selectedLang.push(lang)
     }
})

*

*Add languageSelected = 'es' after the selectedLang:[] //so that english will be the default language that will be selected

*Add languageSelected as v-model in select. <select v-model="languageSelected" name="language-selector" id="language-selector">

*Change value of lang object same as the id of navItems


text:
Q: Concatenates the values of string expressions in azure synapse serverless pool I would like to write a query in serverless pool for concatenation of string values from multiple rows into single row with comma separated values. I  am getting below error when I use COALESE function which I am unable to fix "Queries referencing variables are not supported in distributed processing mode"
Input rows :
A
B
C
A
B
Output row (Looking for distinct values only while creating a list like below)
A,B,C

A: You can use STRING_AGG() function to concatenate values from multiple rows to a single row with comma-separated.
Get distinct values of a column and apply STRING_AGG on the results as below.
select STRING_AGG(col1, ',') output_col1 from (select distinct col1 from #tb1) a


text:
Q: Spring 3 - Stop serializing an autowired bean I have a session object which contains a reference to another object that I do not wish to serialize.
Is it possible to do so using annotations?
@Component
 public class Model implements Serializable{
private static final long serialVersionUID = 1L;

    @Autowired
    private Validator validator;

Thanks in advance,

A: You can mark it with transient, though it would be null after deserialization.

A: You can also move the validation out of the POJO into a helper class.  You could use the validation annotations from javax.validation describe in JSR-303.  Here is a howto link:
http://www.openscope.net/2010/02/08/spring-mvc-3-0-and-jsr-303-aka-javax-validation/


text:
Q: Type hint in Python tuples I have the code below, I understand that the function takes 2 integers, so (n : int, m : int), and it returns a tuple with integers of any length, therefore -> tuple[int,...]:
I think this also correct for an empty tuple T : tuple[()] since the tuple at some point in the function has only one value.
However I get this error
main.py:14: error: Incompatible types in assignment (expression has type "Tuple[int]", variable has type "Tuple[]")

What am I missing?

def vectorise(n : int, m : int) -> tuple[int,...]:
  '''creates a tuple of element n repeated m times'''
  T : tuple[()] = () #empty tuple
  counter : int = 0
  while counter < m:
    T = T + (n,) #in Python (n,) is a tuple with one element n
    counter+=1
  #as a result, T can be of arbitrary length
  return T

L = vectorise(100, 5)

A: The variable T has the type "empty tuple". You are trying to assign something to it which is not an empty tuple. Therefore, you get a type error.
You either need to make sure that you are only assigning empty tuples to T, or make sure that the type of T admits non-empty tuples.


text:
Q: Where do I Store Time Zone and Language in Active Directory? My program keeps user data in Active Directory. For each AD user I need to store his time zone and language. Are there standard AD attributes to store this information?

A: You can simply add custom attributes to your AD.
Here is an example of tutorials.
Custom AD attributes


text:
Q: Visual Studio 2005 + AjaxToolkit I have an ASP.NET Web application. I am building it with Visual Studio 2005. One of my user controls requires the AJAX Control Toolkit. For some reason though, my project will not build. However, I have referenced the AjaxControlToolkit assembly. It is appearing in the project references.
Does anyone have any ideas as to why this application will not build?
Thank you!

A: The UpdatePanel is part of System.Web.Extensions.dll and does not need to be explicitly added to the bin folder of the project as it gets installed into the GAC (global assembly cache).
See the ASP.NET AJAX documentation for more information. The ASP.NET 2.0 AJAX Extensions 1.0 msi can be downloaded here.
(I'll leave the rest of the answer here as it may prove useful for someone else)

It sounds like the AJAX Control Toolkit is not referenced in the page. Make sure you have
using AjaxControlToolkit;

in the code-behind.
Also, you might want to add this to the web.config
<pages>
  <controls>
    <add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
  </controls>
</pages>

This specifies the tag prefix for the AJAX Control Toolkit controls when used in the aspx markup.

A: As per http://www.ajaxtoolkit.net/ ...

Note: This Septemeber 2009 release: Toolkit version 3.0.30930 is only
  for users who are building on top of .NET Framework 3.5 using
  Visual Studio 2008.
If you are using .NET Framework 2.0 and Visual Studio 2005 then
  you should use the earlier Toolkit version 1.0.20229 at CodePlex.

So unfortunately, if you're still developing in VS2005, you are stuck with a very old and buggy version of the Ajax
For .Net 2.0 (not 3.5!), download it from here.
Please note: If your web app is using a mix of .Net 2 and 3.5 or more, you can theoritically have two (or more) versions of the Ajax installed to cater for more than one .Net framework. But you have to give them separate assemblies. See here and here.


text:
Q: Why doesn't wstring::c_str cause a memory leak if not properly deleted Code Segment 1:
wchar_t *aString()
{
     wchar_t *str = new wchar[5];
     wcscpy(str, "asdf\0");
     return str;
}
wchar_t *value1 = aString();

Code Segment 2
wstring wstr = L"a value";
wchar_t *value = wstr.c_str();

If value from code segment 2 is not deleted then an memory leak does not occur. However, if value1 from code segment 1 is not deleted there is a memory leak. The internal code to wstring::c_str looks the same to me.

A: Because c_str() returns you a pointer to the internal representation of the wstring. The class keeps control of the data it contains.

A: Taken from the basic_string::c_str() documentation from MSDN:

The returned C-style string should not
  be modified, as this could invalidate
  the pointer to the string, or deleted,
  as the string has a limited lifetime
  and is owned by the class string.

A: An important rule: you must use delete on anything that was created by new, and you mustn't delete anything else.
wstr.c_str() returns a pointer to a buffer that's managed by the wstring object. It will be deallocated when the string is destroyed, after which the pointer will no longer be valid. Using delete on this is wrong. The pointer will also be invalidated if you modify the string.
aString() returns a pointer to a buffer that was created using new[], so you must delete it when you've finished with it (using delete[], to match new[]). This is error-prone, which is why it is better practice to use resource-managing classes (like string, wstring, containers and smart pointers) rather than passing around raw pointers and hoping they are treated correctly.

A: I'm going to go out on a limb and say that a wstring is not a wchar_t, but instead a class that has an operator to return a wchar_t *, so in the destructor of wstring, it likely frees its own copy of the wchar_t * it returns.


text:
Q: Use vpnc For Specific URL And Port I'm on Ubuntu 14.04 and I use vpnc client to connect to a client's network. However due to this all of my traffic (web browser, streaming, skype, etc) gets routed through the VPN even though I only need to access a particular URL through the VPN.
How can I configure vpnc (or other VPN client) to only use the VPN when accessing a particular URL (say http://example.com:8080)?
I tried to use an SSH tunnel but I couldn't find how to use it with IPSec gateways.

A: I found this tutorial which is working for me! Hope this helps.
http://lists.unix-ag.uni-kl.de/pipermail/vpnc-devel/2009-February/002990.html
Quoted relevant text below.
8.1 Step 1
----------

List all the hosts you need to access in the corporate network.
In the following example we will consider:
- mail server, to read messages: pop3.mycom.com;
- smtp server, to send messages out: smtp.mycom.com;
- ldap server, to search mail accounts: ldap.mycom.com;
- internet proxy, to access internal websites: proxy.mycom.com.
Avoid a long list; keep security in mind and just map what you really need.

8.2 Step 2
----------

Resolve IP address of all the names you listed in Step 1, and put them in your
local file /etc/hosts. We suppose all of them are fixed IP.
Sometimes two or more servers are mapped to the same IP. Practically it is the
same server that implements multiple functions. In the example below, we
suppose that pop3 and smtp services are on the same server.
Example of /etc/hosts:
    ______________________________________________________________________
    127.0.0.1   localhost.localdomain localhost
    ::1     localhost6.localdomain6 localhost6
    10.0.0.130  pop3.mycom.com smtp.mycom.com
    10.0.14.1   ldap.mycom.com
    10.1.0.5    proxy.mycom.com
    ______________________________________________________________________

8.3 Step 3
----------

Create a copy of your working vpnc config file:
#> cp /etc/vpnc/corp.conf /etc/vpnc/split.conf

8.4 Step 4
----------

Edit the new file "split.conf" and add the following line:
    Script /etc/vpnc/vpnc-script-corp-split
It will force this new configuration to use a special script file.

8.5 Step 5
----------

Create the file /etc/vpnc/vpnc-script-corp-split with following content
    ______________________________________________________________________
    #!/bin/sh

    # Add one IP to the list of split tunnel
    add_ip ()
    {
        export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_ADDR=$1
            export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_MASK=255.255.255.255
            export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_MASKLEN=32
            export CISCO_SPLIT_INC=$(($CISCO_SPLIT_INC + 1))
    }

    # Initialize empty split tunnel list
    export CISCO_SPLIT_INC=0

    # Delete DNS info provided by VPN server to use internet DNS
    # Comment following line to use DNS beyond VPN tunnel
    unset INTERNAL_IP4_DNS

    # List of IPs beyond VPN tunnel
    add_ip 10.0.0.130   # pop3.mycom.com and smtp
    add_ip 10.0.14.1    # ldap.mycom.com
    add_ip 10.1.0.5     # proxy.mycom.com

    # Execute default script
    . /etc/vpnc/vpnc-script

    # End of script
    ______________________________________________________________________

Parameter passed to "add_ip" is used, in /etc/vpnc/vpnc-script, to set routing
table by running either "ip" or "route" command, depending on system
configuration.
While "route" accepts both host names and IP in the command line, "ip"
strictly requires numeric IP.
This is quite annoying, since would be easier using only host names in the
script abobe, keeping numeric IP relations in /etc/hosts only.
Eventually, could be possible improving the script above by resolving names
before running /etc/vpnc/vpnc-script.
The command "gethostip" could be used for name resolution. Does anybody knows
if the command "gethostip" is present in every Linux distro?

8.6 Step 6
----------

At last, provide the proper execution permission:
#> chmod 755 /etc/vpnc/vpnc-script-corp-split

That's all, folks!
You can now run:
#> vpnc split.conf

Reading routing table, you can verify the split is active.
#> route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
proxy.mycom.com *               255.255.255.255 UH    0      0        0 tun0
ldap.mycom.com  *               255.255.255.255 UH    0      0        0 tun0
pop3.mycom.com  *               255.255.255.255 UH    0      0        0 tun0
vpn.mycom.com   192.168.1.1     255.255.255.255 UGH   0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
10.2.0.0        *               255.255.255.0   U     0      0        0 tun0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0


text:
Q: Why my menu don't work c++ case switch enter image description here
i'm only start in c++ and i have problem with my class homework
a simple problem i hope
I know that i have only 2 methods of 1 and 2 in menu,but it don't work for first and second together?
my code `
[Link] http://pastebin.com/b8CRUJbw

A: cin>>tester1;
while(!cin) { // If integers are not inputted
    cin.clear(); // Clear the error flag and stream buffer
    cin.sync();
    cout << "Please enter an integer!!" << endl;
    cout << " >>";
    cin>>tester1; // Input again
}
array[counter].registry=tester1;


text:
Q: Order by group of columns in SQL Server My problem is to sort the data from 2 results. The count is same in both resultsets ( now, I have both the resultsets in one, filtered by Source - a or b). I have to display the data such as - for each ID1 & ID2 combination, display them in the source order; source 'a' - first, then source 'b'). Source b may have all null values for the ID1 & ID2 combination; but  for sure have a record.
The schema is - Source, ID1, ID2, Name1, Name2.
I wrote a small cursor to handle this and setting the sequence order with a flag. this worked with small amount of data. But for 1000+ records, its taking lot of time.

A: Try this:
SELECT
  t1.Source,
  t1.Id1,
  t1.ID2,
  t1.Name1,
  t1.Name2,
  ROW_NUMBER() OVER(PARTITION BY ID1, ID2
                    ORDER BY SortOrder.sortId) rownum
FROM Table1 t1
INNER JOIN
(
   SELECT 1 AS sortId, 'a' Source
   UNION ALL
   SELECT 2, 'b'
) SortOrder ON t1.Source = SortOrder.Source
ORDER BY rownum, SortOrder.sortId;

SQL Fiddle Demo


text:
Q: What colors of lightsaber crystals are there (and where can I get them)? Seeing this question How do I get a Magenta Lightsaber Crystal?, I see that there are more lightsaber colors than I thought.
I know there are:

*

*Red

*Yellow

*Purple

*Green

*Blue

*Yellow + Dark center (preorder)

What else is there?

A: Standard
Green quality items. Requires low-level Artifice to craft (items at level 7 and above); found in standard weapons and as drops/rewards.

*

*Red

*Blue

*Green

*Yellow

Prototype
Blue quality items.

*

*All the above

*Orange (first drops are level 31; artifice-craftable beginning with level 47)

Artifact
Purple quality items.
Artifice 400

*

*All the above (Orange level 50 schematics drop from the Primal Destroyer world boss on Belsavis)

*Magenta, AKA "Light Red" (must be crafted)
Artifice 500

*

*White-Purple-Blue (added with Patch 3.0; not to be confused with White-Blue-Purple)

*White-Yellow-Orange (added with Patch 3.0)

Operations Drops
The PvE versions drop from Explosive Conflict, Terror from Beyond, and Scum and Villainy.  They can be reverse engineered to learn the crafting schematic.  The PvP versions come directly from the PvP Items vendor and cannot be learned via RE.

*

*Black-Orange

*Black-Purple

*Black-Red

*Black-Blue

*Cyan, AKA "Light Blue" (PvP schematic drops from Grade 6 PvP crafting boxes)

*Purple (PvP schematic drops from Grade 6 PvP crafting boxes)

Cartel Pack Crystals
These crystals can be sold on the GTN or traded/mailed after a lockout period.  There were no crystals in Shipment 4.
Shipment 1: Cartel Packs

*

*White (all packs except Black Market)

*Pink-Purple (Black Market and Crime Lord's packs)

*Cyan-Blue (Blockade Runner's pack)

*Orange-Red (Skip Tracer's pack)

*Lime-Green (Space Pirate's pack)
Shipment 2: Contraband Packs

*

*White-Black (all packs except Regulator's)

*Derelict-Purple (Regulator's and Enforcer's packs)

*Silver-Blue (Vice Commandant's pack)

*Mint-Green (Archon's pack)

*Copper (Supreme Mogul's pack)
Shipment 3: Bounty Packs

*

*Hot Orange (all packs except Contractor's)

*Blood Red (Contractor's and Freelancer's packs)

*Blue Core (Pursuer's pack)

*Charred Orange (Tracker's pack)

*Yellow Blue (Opportunist's pack)
Nightlife Packs

*

*Pink Magenta (Star Cluster Nightlife Pack)

*Yellow Core (Club Vertica Nightlife Pack)
Shipment 5: Stronghold Packs

*

*Gold Core (all packs except Builder's)

*Blue Outline (Builder's and Gatekeeper's packs)

*Pink Core (Constable's pack)

*Sea Green (Seneschal's pack)

*Purple Outline (Architect's Pack)
Shipment 6: Shadow Packs

*

*Black-Pink (all packs except Initiate's)

*Purple-Black (Initiate's and Pilgrim's packs)

*White-Blue-Purple (Acolyte's pack)

*Pink-Red (Apprentice's pack)

*Pink-Yellow (Master's pack)
Shipment 7: Explorer Packs

*

*Green Empeth (all packs except Core Worlds)

*Blue-Cyan-Indigo (Core Worlds and Deep Core packs)

Cartel Market Crystals
These are sold directly from the Cartel Market and do not appear in the gambling packs.

*

*Orange-Yellow

*Green Core

Special

*

*White (world boss drop during beta; sold on the fleets prior to Patch 1.2)

*Black-Green (Rakghoul Outbreak and Rakghoul Resurgence event rewards)

*Black-Silver Striated (Season 4 low-tier group and mid-tier solo Ranked PvP reward)

Discontinued
These are still in the game but can no longer be acquired if you don't have them already.

*

*Black-Yellow (for pre-ordering the game)

*Razer Black/Green (for buying a Razer SWTOR peripheral.  This is a different color than the standard Black/Green; see this image)

*Black-Purple Striated (March 2015 Subscriber reward)
Ranked PvP Rewards

*

*Furious Red-Yellow (Season 3 reward, any rating)

*Black-Blue Striated (Season 4 mid-tier reward)

Unavailable
These are part of the game assets but have not been made generally available.

*

*Black-Cyan

*Black-White (the inverse of White-Black)

A: *

*Red

*Blue

*Green

*Yellow

*Orange

*Purple

*White (world boss drop)

*Magenta (mentioned in patch notes, "Added rare Magenta Adegan color crystal schematics for Artifice")

*Yellow/Black (Pre-Order Crystal)

PVP Rewards, insanely hard to get:

*

*Red/Black

*Blue/Black

*Purple/Black

*Orange/Black


text:
Q: Ionic 3 inappbrowser download files I'm developing a mobile app using Ionic 3.
I use InAppBrowser native plugin to show an external website using his.inAppBrowser.create(url, '_blank', this.options);  method in Ionic 3.
The external website displays dashboard and other web design. In some pages dashboard has download pdf/xl option,  When I click the download buttons, it works fine in all browsers.
But when I call that external website from InAppBrowser in the Ionic 3 Mobile app, the download links in that page are not functional.
How can I download files from website using ionic 3 inappbrowser? Please help me anybody
Web dashboard has developed web team using Spring boot, java. One of the functionality of this website is to generate form data to pdf/xl and donwload as file when it is needed.
I have a two buttons for pdf and xl to download options to download. When you click a file to download, Server side code will create file from the Server and attached it with HTTP Response.
I have been trying this past two days but there is no LUCK :-(
Tried below links,
Phonegap/Cordova InAppbrowser File Download issue
But not getting any solution
Below is my ionic 3 code
   let target = "_blank";
   this.inAppBrowser.create(url, target, this.options);
   this.inAppBrowser.addEventListener('loadstart', function (event) {
   console.log("eventeventevent -- ", event);
   });

Please help me anybody regarding this

A: I faced the same issue few days back when I noticed that the PDF files could not be downloaded through "InAppBrowser".
So, what I did was I changed the target to "_system". When you do that your PDF File will be opened in the app through which you normally open your PDF Files (You must have set it in your preferences) or it would give you a prompt like "Open file with ... ".


text:
Q: center img vertically and horizontally inside div overflow:hidden I have a div height:520px; and width:100%; and I have a slideshow imgs inside it.
I wanted the imgs to be centered in full div. just like the background-size:cover center center but with img.
Here is my code (tried several things, didn't work perfectly):

CSS:
.cont{
height:520px;
width:100%;
margin:0;
padding:0;
margin: 0 auto;
overflow:hidden;
position: relative;
}

img{
min-width:100%;
position:absolute;
margin:auto;
}

A: This guide by Chris Coyer on CSS Tricks is a great resource for such things.
If you don't know the images' height, you can do this:
.cycle-slideshow {
  position: relative;
}

.cycle-slideshow img {
  margin: 0 auto;               // – for centering them horizontally

  position: absolute;           // – relative should work as well, if the `img`s are
                                //   the only children of `.cycle-slideshow`

  top: 50%;                     // – for centering them vertically.
  transform: translateY(-50%);  // – don't forget vendor prefixes:
                                //   http://caniuse.com/#search=transform
}


text:
Q: Packages in same namespace: can't import module in setup script I'm curious about the following situation. Let's say I have two projects named project_alpha and project_bravo, both defining a top-level namespace package mymeta. The layout:
project_alpha/
   -> mymeta/
        -> __init__.py
        -> project_alpha/
             -> __init__.py
             -> version.py
   -> setup.py

project_bravo/
   -> mymeta/
        -> __init__.py
        -> project_bravo/
             -> __init__.py
             -> version.py
   -> setup.py

Both mymeta/__init__.pys contain only the line __import__('pkg_resources').declare_namespace(__name__) (according to namespace section in setuptools docs). Contents of both version.pys:

__version_info__ = (0, 9, 9, 'dev0')
__version__ = '.'.join((str(entry) for entry in __version_info__))

The setup.py script for project_alpha is pretty simple. The namespace package mymeta is declared, and the version is taken from the version module:

# project_alpha
from setuptools import find_packages, setup
from mymeta.project_alpha.version import __version__

setup(
    name='mymeta.project-alpha',
    version=__version__,
    namespace_packages=['mymeta'],
    packages=find_packages(),
)

The setup.py script for project_bravo has the same structure, but with a twist: project_bravo depends on project_alpha when building:

from setuptools import find_packages, setup
from mymeta.project_bravo.version import __version__

setup(
    name='mymeta.project-bravo',
    version=__version__,
    namespace_packages=['mymeta'],
    setup_requires=['mymeta.project-alpha'],
    packages=find_packages(),
)

When building project_bravo, I get the following error:
~/project_bravo $ python setup.py sdist
Traceback (most recent call last):
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 156, in save_modules
    yield saved
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 197, in setup_context
    yield
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 246, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 276, in run
    return func()
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 245, in runner
    _execfile(setup_script, ns)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 47, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-ahmxos98/mymeta.project-alpha-0.9.9.dev0/setup.py", line 6, in <module>
    try:
ImportError: No module named 'mymeta.project_alpha'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    packages=find_packages(),
  File "/usr/lib64/python3.5/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/dist.py", line 315, in __init__
    self.fetch_build_eggs(attrs['setup_requires'])
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
    replace_conflicting=True,
  File "/tmp/tstenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 853, in resolve
    dist = best[req.key] = env.best_match(req, ws, installer)
  File "/tmp/tstenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1125, in best_match
    return self.obtain(req, installer)
  File "/tmp/tstenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1137, in obtain
    return installer(requirement)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
    return cmd.easy_install(req)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 665, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 695, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 876, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 1115, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 1101, in run_setup
    run_setup(setup_script, args)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 249, in run_setup
    raise
  File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 197, in setup_context
    yield
  File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 168, in save_modules
    saved_exc.resume()
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 143, in resume
    six.reraise(type, exc, self._tb)
  File "/tmp/tstenv/lib/python3.5/site-packages/pkg_resources/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 156, in save_modules
    yield saved
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 197, in setup_context
    yield
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 246, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 276, in run
    return func()
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 245, in runner
    _execfile(setup_script, ns)
  File "/tmp/tstenv/lib/python3.5/site-packages/setuptools/sandbox.py", line 47, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-ahmxos98/mymeta.project-alpha-0.9.9.dev0/setup.py", line 6, in <module>
    try:
ImportError: No module named 'mymeta.project_alpha'

Unfortunately, I don't understand the error here. It has something to do with the imports order, right? If I comment out the import of mymeta.project_bravo.version in project_bravo/setup.py and replace the version with some hard-coded string, suddenly the build succeeds...

Edit: I introduced a workaround for this issue. Instead of trying to import the version directly, I exec the version module to avoid the import problems. Of course, this is not a proper solution, thus not posting this as answer, but still here it is:

__version__ = None # if the exec fails, leave the version unset, the resulting build version will be 0.0.0
version_script_path = os.path.relpath(os.path.join(os.path.dirname(__file__), 'mymeta', 'project_alpha', 'version.py'))
with open(version_script_path) as version_script:
    exec(version_script.read())

After the version script is read and executed, the version is initialized, thus no need to import anything from mymeta package.

A: Almost one year later, I once again faced this issue and the solution for python>=3.3 is to use implicit namespace packages as specified in PEP 420. The project structure is barely changed, just both the __init__.pys for pkgutil-style namespace package mymeta are gone:
project_alpha/
   -> mymeta/
        -> project_alpha/
             -> __init__.py
             -> version.py
   -> setup.py

project_bravo/
   -> mymeta/
        -> project_bravo/
             -> __init__.py
             -> version.py
   -> setup.py

To make setuptools happy, both setup scripts need to be adjusted as well:
...
setup(
    ...
    packages=['mymeta.' + pkg for pkg in find_packages('mymeta')],
)

Now the imports will be resolved correctly when building project-bravo.

A: As mentioned in the comments: The command
$ python setup.py sdist

for mymeta.project_bravo downloads an egg of mymeta.project_alpha from a private pypi repo.
Namespace packages are very delicate concerning their imports.
e.g. I found out that when I install ns.a and ns.b regularly in my environment and supply the import path of ns.d in a .pth file in the site-packages directory, it will not work, no matter what. However when I symlink to ns.d in site-packeges/ns directory it will work.
If I install none of the components and supply all paths in a .pth in the site-packages directory, everything works fine.
If I install all of the components regularly also everything works fine.
Just when I mix concepts it will not work.
Therefore I suspect that this might also be the issue here: Different strategies for the import paths.
You might want to try to modify your __init__.py file to:
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__)

I regret my decision to do namespace packages. I would never do it again.


text:
Q: MSI-X interrupts in WDF I'm having a lot of trouble getting MSI-X interrupts implemented in a Windows bus driver we're writing in WDF / KMDF.
I've read the MSDN documentation, and there's not really a lot of helpful info there. My understanding is that it should really just "work".
I've changed our driver's INF file to add the appropriate registry keys and confirmed that they are being set working properly on install. I'm properly querying the PCI config space and determining whether MSI-X interrupts are supported.
The problem is that once I have this information, I don't know how to change my code to specifically set up the interrupt to be MSI-X. I do the standard calls to configure a WDF_INTERRUPT_CONFIG_INIT stuct and call WdfInterruptCreate, but the interrupt that is created is not message-signaled, and I don't know what needs to be done to actually make this happen.
Is there a WDF version of the steps here, or should I just be doing the standard WDFINTERRUPT creation steps here?
Does anyone have any experience doing this? Can anyone provide a source example?

A: I have been struggling with something similar in the last week.  My application is slightly different because I am trying to get plain MSI interrupts rather than MSI-X interrupts to work.  But I am using the WDF framework in pretty much the same way.
I realize you posted your original question around April of 2013, but there are no updates.  Have you solved your original problem?  If so, I would like to see your own solution.
In my WDF driver, I am mapping an incoming hardware resource list and parsing it using the WdfCmResourceListGetDescriptor() function to examine each PCM_PARTIAL_RESOURCE_DESCRIPTOR item in the WDFCMRESLIST list.  I was able to obtain a single CmResourceTypeInterrupt descriptor, but it was always for a legacy interrupt instead of MSI interrupt.  My device does support MSI.   I did not understand why the MSI descriptor was not in the resource list, even after setting up the extra registry entries in my .inf file as you described.
It turns out I had a typo in my .inf file.  I had forgotten to append the ".HW" suffix in my device install section.  Adding this suffix allows the Bus manager to modify the pcie config addresses in the device and create the appropriate MSI interrupt resource descriptor, which must be hooked by the driver.
[Standard.NT$ARCH$]
%tdvr.DeviceDesc%=tdvr_Device, PCI\VEN_104C&DEV_B800

[tdvr_Device.NT]
CopyFiles=Drivers_Dir

[tdvr_Device.NT.HW]
AddReg=MSI_Interrupts

[Drivers_Dir]
tdvr.sys

;http://msdn.microsoft.com/en-us/library/windows/hardware/ff544246(v=vs.85).aspx
;To receive message-signaled interrupts (MSIs), a driver's INF file must enable MSIs in the
;registry during installation. Use the Interrupt Management\MessageSignaledInterruptProperties
;subkey of the device's hardware key to enable MSI support.

[MSI_Interrupts]
HKR,Interrupt Management,,0x00000010
HKR,Interrupt Management\MessageSignaledInterruptProperties,,0x00000010
HKR,Interrupt Management\MessageSignaledInterruptProperties,MSISupported,0x00010001,1

When the MSI interrupt resource descriptor is found in the resource list (for example in a evtMapHWResources callback), the descriptor is used as an input to the WdfInterruptCreate() function.   The "tdvr" prefixes here are for my own driver naming convention.
NTSTATUS
tdvrConfigureInterrupts(
    _Inout_ PDEVICE_CONTEXT deviceContext,
    _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR interruptDescRaw,
    _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR interruptDescTranslated
    )
{
    NTSTATUS status;
    PAGED_CODE();
    FuncEntry();

    // What kind of interrupt has been provided?
    if (CM_RESOURCE_INTERRUPT_MESSAGE & interruptDescTranslated->Flags)
    {
        TraceInterrupt(TRACE_LEVEL_INFORMATION,
            "Message Interrupt level 0x%0x, Vector 0x%0x, MessageCount %u\n"
            ,interruptDescTranslated->u.MessageInterrupt.Translated.Level
            ,interruptDescTranslated->u.MessageInterrupt.Translated.Vector
            ,interruptDescTranslated->u.MessageInterrupt.Raw.MessageCount
            );
    }
    else
    {
        TraceInterrupt(TRACE_LEVEL_INFORMATION,
            "Legacy Interrupt level: 0x%0x, Vector: 0x%0x\n"
            ,interruptDescTranslated->u.Interrupt.Level
            ,interruptDescTranslated->u.Interrupt.Vector
            );
    }

    //
    // Create WDFINTERRUPT object.
    //
    WDF_INTERRUPT_CONFIG interruptConfig;
    WDF_INTERRUPT_CONFIG_INIT(
        &interruptConfig,
        tdvrEvtInterruptIsr,
        tdvrEvtInterruptDpc
        );

    // Each interrupt has some context data
    WDF_OBJECT_ATTRIBUTES interruptAttributes;
    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(
        &interruptAttributes,
        INTERRUPT_CONTEXT
        );

    //
    // These first two callbacks will be called at DIRQL.  Their job is to
    // enable and disable interrupts.
    //
    interruptConfig.EvtInterruptEnable  = tdvrEvtInterruptEnable;
    interruptConfig.EvtInterruptDisable = tdvrEvtInterruptDisable;

    // If the driver calls WdfInterruptCreate from EvtDriverDeviceAdd, the InterruptRaw and
    // InterruptTranslated members of the WDF_INTERRUPT_CONFIG structure must be NULL.
    // the driver calls WdfInterruptCreate from EvtDevicePrepareHardware, these members must both be valid.
    interruptConfig.InterruptTranslated = interruptDescTranslated;
    interruptConfig.InterruptRaw = interruptDescRaw;

    // Our driver must call WdfInterruptCreate once for each interrupt vector that its device requires.
    // If the device supports message-signaled interrupts (MSI), the driver must create an interrupt object
    // for each message that the device can support.
    status = WdfInterruptCreate(
        deviceContext->WdfDevice,
        &interruptConfig,
        &interruptAttributes,
        &deviceContext->WdfInterrupt
        );

    if (!NT_SUCCESS(status))
    {
        TraceInterrupt(TRACE_LEVEL_ERROR, "WdfInterruptCreate FAILED: %!STATUS!\n", status);
    }
    else
    {
        PINTERRUPT_CONTEXT interruptContext = InterruptGetContext(deviceContext->WdfInterrupt);
        // do whatever with context info
    }

    FuncExit();
    return status;
}

Like I said hopefully by now you have this all figured out, but I thought I would post something anyway to contribute.


text:
Q: SSIS package to load data to Salesforce using BULK API I am using SSIS and trying to load object data to the Salesforce with REST API using Script Task, but the load request timeout in between without any error. I have to monitor the progress of the load and manually stop the job in case the data is not getting inserted and start again. I am trying to explore the option to use BULK API but not able to get the C# code which I can use in script task. Can someone suggest how to avoid the timeout error or use BULK API. Below is the code for reference:
HttpContent content = new StringContent(requestMessage, Encoding.UTF8, "application/json");
string uri = sfServiceUrl + "/services/data/v25.0/sobjects/Sales__c";
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, uri);

request.Headers.Add("Authorization", "Bearer " + sfOauthToken);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Content = content;
HttpResponseMessage response = await createClient.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();

A: This is about increating the timeout value.
Assuming your createClient object is of type HttpClient, there is a Timeout property.
You can try to set the timeout to a bigger value, before you call SendAsync
For e.g., to have timeout of an hour, createClient.Timeout = TimeSpan.FromMinutes(60);
Docs:

The default value is 100,000 milliseconds (100 seconds).

To set an infinite timeout, set the property value to InfiniteTimeSpan.


text:
Q: Updating user role using asp.net identity I have the following problem. While using the following code below to change the user's current role i am getting an exception with the message like below:
    [HttpPost]
    [ValidateAntiForgeryToken]
    public virtual ActionResult Edit(User user, string role)
    {
        if (ModelState.IsValid)
        {
            var oldUser = DB.Users.SingleOrDefault(u => u.Id == user.Id);
            var oldRoleId = oldUser.Roles.SingleOrDefault().RoleId;
            var oldRoleName = DB.Roles.SingleOrDefault(r => r.Id == oldRoleId).Name;
            if (oldRoleName != role)
            {
                Manager.RemoveFromRole(user.Id, oldRoleName);
                Manager.AddToRole(user.Id, role);
            }
            DB.Entry(user).State = EntityState.Modified;

            return RedirectToAction(MVC.User.Index());
        }
        return View(user);
    }

Attaching an entity of type 'Models.Entities.User' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.
Does anybody know a good solution to this problem ?

A: The problem is that your Manager and DB doesn't use the same DbContext. So when you send an user from the context of your DB to the Manager it will handle it as a "new" one - and then you cant remove it from the role. You have two ways to go here. The easiest is to get the User from your Manager.
[HttpPost]
[ValidateAntiForgeryToken]
public virtual ActionResult Edit(User user, string role)
{
    if (ModelState.IsValid)
    {
        // THIS LINE IS IMPORTANT
        var oldUser = Manager.FindById(user.Id);
        var oldRoleId = oldUser.Roles.SingleOrDefault().RoleId;
        var oldRoleName = DB.Roles.SingleOrDefault(r => r.Id == oldRoleId).Name;

        if (oldRoleName != role)
        {
            Manager.RemoveFromRole(user.Id, oldRoleName);
            Manager.AddToRole(user.Id, role);
        }
        DB.Entry(user).State = EntityState.Modified;

        return RedirectToAction(MVC.User.Index());
    }
    return View(user);
}

The more elegant way is to start using an DI-framework like AutoFac (https://code.google.com/p/autofac/wiki/MvcIntegration) and set your DbContext as InstancePerApiRequest.
builder.RegisterType<YourDbContext>().As<DbContext>().InstancePerApiRequest();

A: My roles are managed in the seed method of my DbMigrationsConfiguration class and I renamed it like this:
        if (context.Roles.Any(r => r.Name == "User"))
        {
            var store = new RoleStore<IdentityRole>(context);
            var manager = new RoleManager<IdentityRole>(store);
            var role = manager.Roles.First(r => r.Name == "User");

            role.Name = "NewNameForUser";
            manager.Update(role);
        }

A: In Identity Version 6.0.8
It's work for me.
if (role != currentrole)
            {
                _context.UserRoles.Remove(userIdData);
                _context.SaveChanges();
                userIdData.RoleId = aspnetroleId.Single();
                userIdData.UserId = userId;
                _context.UserRoles.Add(userIdData);
                _context.SaveChanges();

            }


text:
Q: Angular: How to select a specific Excel worksheet before importing file? I'm implementing a feature that allows the user to select a specific Excel worksheet from a dropdown select list before importing the file, however, I'm unsure how to add the worksheet names to the dropdown list. I've currently placeholder names in the dropdown list as I'm not sure how to incorporate the "sheetNames" function into the current "Worksheet" interface.
Dropdown Select:
<mat-form-field id="worksheetStyle"appearance="fill">
                        <mat-label>Excel Worksheet</mat-label>
                        <mat-select>
                          <mat-option *ngFor="let worksheet of worksheets" [value]="worksheet.value">
                            {{worksheet.viewValue}}
                          </mat-option>
                        </mat-select>
                      </mat-form-field>

Typescript:
  worksheets: Worksheet[] = [
    {value: '1', viewValue: 'Sheet_1'},
    {value: '2', viewValue: 'Sheet_2'},
    {value: '3', viewValue: 'Sheet_3'},
  ];

  sheetNames(workbook) {
    var arr = new Array;

    for (let i = 0; i <= workbook.length; i++) {
      arr.push(workbook.SheetNames[i])
    }

A: I made a simple example for you. You necessarily don't need to process the sample data you have provided. But incase you do want to do that, I refactored that part slightly as well. You were on the right track, some small syntax. If you can get your workbook in such an object as your sample data that would be great. But on a side note, sounds sketchy to know the file name before user even attempts to import it (e.g add file via input), but perhaps that data is coming from somewhere else which is not the topic of the question.
<mat-form-field id="worksheetStyle" appearance="fill">
  <mat-label>Excel Worksheet</mat-label>
  <mat-select [(value)]="selected">
    <mat-option *ngFor="let worksheet of worksheets" [value]="worksheet.value">
      {{ worksheet.viewValue }}
    </mat-option>
  </mat-select>
</mat-form-field>

You have selected {{ selected }}

SheetNames() = {{ arr }}

@Component({
  selector: 'material-app',
  templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit {

  selected: any;
  arr = [];

  worksheets: any[] = [
    { value: '1', viewValue: 'Sheet_1' },
    { value: '2', viewValue: 'Sheet_2' },
    { value: '3', viewValue: 'Sheet_3' },
  ];

  /**
   * This is uneccessary (for selecting on template at least)
   */
  ngOnInit() {
    this.sheetNames(this.worksheets)
  }

  sheetNames(workbook: any) {

    for (let sheet of workbook) {
      this.arr.push(sheet.viewValue)
    }
    console.log(this.arr)
  }
}

https://stackblitz.com/edit/mat-dialog-example-zngwtj?file=app%2Fapp.component.ts


text:
Q: Upgraded to angular 9.1 - error is Property 'supportsDOMEvents' Here is the issue
error TS2416: Property 'supportsDOMEvents' in type 'ɵangular_packages_platform_browser_p
latform_browser_o' is not assignable to the same property in base type 'ɵDomAdapter'.

A: As @DrTeeth already mentioned, it's hard to help w/o any further infos.
But I've had a similar problem and want to share what had helped for me: This was a simple inconsistency of my dependencies. I', using a 3rd party Angular Component Library which was incompatible with the newer (Ivy-enabled) version, after I updated Angular itself. For me, the error message had some details about the package in question and after updating it, too, everything worked fine.


text:
Q: How can I create a javascript function that takes text from one HTML page and prints it to another? I am trying to create a function that takes text from a table on one HTML page and prints it to another table on another HTML page. I am using one Javascript file that is linked to both HTML pages.
I've added click event listeners to buttons on each table row, so that when they are clicked they pull up the text in the selected table row. From there I want to be able to put that text into another table that is on another html page.
The issue is, is that when I try get the table element with document.getElementById(), it returns null or says its not a function. I have made sure to put the javascript at the end of the body in each HTML page so that the HTML can load before the script, but it is still responding with
document.getElementsById is not a function
Here is the HTML that I am trying to take from:

              Trails
              Province
              Country

              Lion's Head
              Western Cape
              South Africa<button class="save">Save</button>

              Pipe Track
              Western Cape
              South Africa<button class="save">Save</button>

And here is the javascript file that has the function that works on clicking the "Save Buttons".
let buttons = document.querySelectorAll(".save");
console.log(buttons);

buttons.forEach((button) => {
  button.addEventListener("click", (event) => {
    const row = event.target.closest("tr");

    let newRow = row.innerText;
    let td1 = row.children[0].innerText;
    let td2 = row.children[1].innerText;
    let td3 = row.children[2].innerText;

    let td4 = td3.slice(0, -4);

    let myArray = [];
    let myObject = {
      trail: td1,
      province: td2,
      Country: td4,
    };

    myArray.push(td1, td2, td4);

    let newObj = JSON.stringify(myArray);

    localStorage.setItem("myObject", JSON.stringify(myArray));

    //Here below, is where the issue is occuring.
    var y = document.getElementsById("newTable");
    var savedRow = y.insertRow(1);

    var cell1 = savedRow.insertCell(0);
    var cell2 = savedRow.insertCell(1);
    var cell3 = savedRow.insertCell(2);
  });
});

And finally, here is the HTML page that has the table that I am trying to print the text into:

        Waka
        Waka
        Eh

I have tried targeting the table that I want to print the text to by using the document.getElementById("newTable)". I have also tried putting the Javascript scripts to the body of the body in each HTML page so that it loads after the HTML. I was expecting for the javascript to be able to find the table, but instead it says that
Uncaught TypeError: document.getElementsById is not a function
    at HTMLButtonElement.<anonymous> (saveForLater.js:28:22)

Is this perhaps to do with the function working on each button?
I'm new to coding and so I appreciate the help everyone. Thanks

A: UPDATE:
This is a hacky solution and I would not put this on any real server -
UPDATE the on click handler with this -
button.addEventListener("click", (event) => {
   // we will simply fetch the data and store
   // it in localStorage on this side.
   const row = event.target.closest("tr");

   let newRow = row.innerText;
   let td1 = row.children[0].innerText;
   let td2 = row.children[1].innerText;
   let td3 = row.children[2].innerText;
   let td4 = td3.slice(0, -4);
   let myObject = {
      trail: td1,
      province: td2,
      country: td4,
   };
   localStorage.setItem("myObject", JSON.stringify(myObject));
});

AND add the following code to your script file -
// This will start running as soon as the window is loaded
window.onload = handleTableData;

function handleTableData () {
    // We will keep checking to see if localStorage
    // contains the data we need. If it does, we fetch it
    // find the table. Inject it to the table, and remove
    // it from the localStorage (to prevent unnecessary overwriting)
    setInterval( () => {
       var data = localStorage.getItem('myObject') || null;
       if (data) {
          var tableData = JSON.parse(data);
          var table = document.getElementById('newTable');
          if (table && tableData) {
              var savedRow = y.insertRow(1);
              var cell1 = savedRow.insertCell(0);
              var cell2 = savedRow.insertCell(1);
              var cell3 = savedRow.insertCell(2);
              cell1.appendChild(tableData.trail);
              cell2.appendChild(tableData.province);
              cell3.appendChild(tableData.country);
              localStorage.removeItem('myObject')
          }
       }
    }, 1000);
}

There's a simple solution to your error -

document.getElementsById is not a function

The command is document.getElementById()
Element not Elements.

A: I managed to solve this problem, I made it so that the function that is adding the data to the new table onloads when the second page is opened. I did this by writing this

in the body of the second pages html so that when the page is opened the function can find the table on that page that I am printing the data onto.
Below I also have the full function:
function addData() {
  let data = JSON.parse(localStorage.getItem("myObject"));
  console.log(data);
  console.log(data[0]);
  console.log(data[1]);
  console.log(data[2]);

  let table = document.getElementById("newTable");
  console.log(table);

  var row = table.insertRow(1);

  var cell1 = row.insertCell(0);
  var cell2 = row.insertCell(1);
  var cell3 = row.insertCell(2);

  cell1.innerHTML = data[0];
  cell2.innerHTML = data[1];
  cell3.innerHTML = data[2];
}

A: function testJS()
{
var b = document.getElementByclass('tableRow').value
document.getElementByclass('saved').innerHTML = b;
}


text:
Q: width:100% across partial screen? I have a conundrum: I need the darkest-gray bar you see on the bottom right (after opening the below code locally) spanning across as much space as the browser window will allow WITHOUT crossing over the light-gray section I have set up on the left. Here is my code:

CSS:
.clearfix { clear: both; }

.timeline-wrapper { position: relative; }

.timeline-section {
    background: #3d3d3d;
    bottom: 0px;
    height: 276px;
    left: 0px;
    width: 100%;
    position: absolute;
    padding: 0px;}

.mini-timline {
    background: #474747;
    margin: 0px;
    float: left;
    height: 276px;
    width: 500px;
    display: inline-block;}

.timeline {
    background: #232323;
    height: 200px;
    width: 60%;
    float: left;
    display: inline-block;
    position: relative;}

A: One method is not to float the timeline element.
Just set a margin-left for the width of the mini-timeline:
.timeline {
    background: #232323;
    height: 200px;
    margin-left:500px;
    position: relative;
    color:#FFF;
}

http://jsfiddle.net/rLzAM/1/

A: Try this:
.timeline {
    background: #232323;
    height: 200px;
    width: 100%;
    display: inline-block;
    position: absolute;
}


text:
Q: how to know which boolean is true According to this thread Elegantly determine if more than one boolean is "true"
using this part of code...
public bool ExceedsThreshold(int threshold, IEnumerable<bool> bools)
{
   int trueCnt = 0;
   foreach(bool b in bools)
      if (b && (++trueCnt > threshold))
          ***//here i need to know which of b is the true***
          return true;
   return false;
}

I want to know which of bools variable is true?

A: If you want to know the indices of the true values, use the overload of Select that includes an index parameter:
IList<int> indices = bools.Select((b, i) => new {Index = i, IsTrue = b})
                          .Where(x => x.IsTrue)
                          .Select(x => x.Index)
                          .ToList();

A: Given a list of bool, this will return a list of the indexes that are true:
var myList = new List<bool>{false, false, true, true, false};

// Will return an IEnumerable containing {2, 3}:
var trueStuff = myList.Select((value, pos) => pos).Where(pos => myList[pos]);

Update: As pointed out in the comment below, the above would only work for a List, and not for an IEnumerable. I'll still leave it here though, as it may be useful in another similar situation.
Also, just for the record, here's a solution (albeit a slightly less elegant one) that should work in either case:
// Note: IEnumerable this time:
IEnumerable<bool> myList = new List<bool> { false, false, true, true, false };

var trueStuff = new List<int>();
int pos = 0;
foreach (var b in myList)
{
    if(b){ trueStuff.Add(pos); }
    pos++;
}

A:
I want to know which of bools variable is true?

this one uses LINQ
IList<bool> _result = bools.Where(x => x == true);

A: I'm not sure if I am understanding this correctly, but if you wanted to know which Boolean values in an enumerated list are true and which ones are false, you could modify that routine to be something like this:
public static string GetBoolString(IEnumerable<bool> bools)
{
  var boolArray = bools.ToArray();
  char[] data = new char[boolArray.Length];
  for (int i = 0; i < boolArray.Length; i++)
  {
    data[i] = boolArray[i] ? '1' : '0';
  }
  return new string(data);
}

Note that I am not presenting any "elegant" solution; just getting it done.

A: Don't use IEnumerable if you want to work with indices, but use arrays.
To get indices use for loop and iterate over the array.

A: If you switch from IEnumerable to something with an inbuilt index (like an array or List), you can do this, to return a list of the indices that are true:
public IEnumerable<int> GetTrueIndices(bool[] b)
{
    return Enumerable.Range(0, b.Length).Where(i => b[i]);
}

with a list it would be this:
public IEnumerable<int> GetTrueIndices(List<bool> b)
{
    return Enumerable.Range(0, b.Count).Where(i => b[i]);
}

A: var firsttrue = bools.First(b => b);


text:
Q: Is there a C# library that will perform the Excel NORMINV function? I'm running some Monte Carlo simulations and making extensive use of the Excel function NORM.INV using Office Interrop. This functions takes three arguments (probability, average, standard deviation) and returns the inverse of the cumulative distribution.
I'd like to move my code into a web app, but that will require installing Excel on the server. Does anybody know of a C# statistics library that has an equivalent function to NORM.INV?

A: https://numerics.mathdotnet.com/ has a pretty neat looking library that deals with stats (so I assume the CDF), I've not used it so I can't say for definite that it's what you want, but it seems like it should be.

A: I was also needing a C# implementation of NORMINV, the closest thing I found was a C++ implementation http://www.wilmott.com/messageview.cfm?catid=10&threadid=38771, so I made a quick and dirty translation to C#, the details here http://weblogs.asp.net/esanchez/archive/2010/07/29/a-quick-and-dirty-implementation-of-excel-norminv-function-in-c.aspx. I have made only a few basic tests so be careful if you decide to use it, anyway, hope it helps!

A: The inverse normal CDF, including coefficients, is described here.  And the absolute value of the relative error is less than 1.15 × 10−9
public static class NormalDistributionConfidenceCalculator
{
    /// <summary>
    ///
    /// </summary>
    public static double InverseNormalDistribution(double probability, double min, double max)
    {
        double x = 0;
        double a = 0;
        double b = 1;

        double precision = Math.Pow(10, -3);

        while ((b - a) > precision)
        {
            x = (a + b) / 2;
            if (NormInv(x) > probability)
            {
                b = x;
            }
            else
            {
                a = x;
            }
        }

        if ((max > 0) && (min > 0))
        {
            x = x * (max - min) + min;
        }
        return x;
    }

    /// <summary>
    /// Returns the cumulative density function evaluated at A given value.
    /// </summary>
    /// <param name="x">A position on the x-axis.</param>
    /// <param name="mean"></param>
    /// <param name="sigma"></param>
    /// <returns>The cumulative density function evaluated at <C>x</C>.</returns>
    /// <remarks>The value of the cumulative density function at A point <C>x</C> is
    /// probability that the value of A random variable having this normal density is
    /// less than or equal to <C>x</C>.
    /// </remarks>
    public static double NormalDistribution(double x, double mean, double sigma)
    {
        // This algorithm is ported from dcdflib:
        // Cody, W.D. (1993). "ALGORITHM 715: SPECFUN - A Portabel FORTRAN
        // Package of Special Function Routines and Test Drivers"
        // acm Transactions on Mathematical Software. 19, 22-32.
        int i;
        double del, xden, xnum, xsq;
        double result, ccum;
        double arg = (x - mean) / sigma;
        const double sixten = 1.60e0;
        const double sqrpi = 3.9894228040143267794e-1;
        const double thrsh = 0.66291e0;
        const double root32 = 5.656854248e0;
        const double zero = 0.0e0;
        const double min = Double.Epsilon;
        double z = arg;
        double y = Math.Abs(z);
        const double half = 0.5e0;
        const double one = 1.0e0;

        double[] a =
            {
                2.2352520354606839287e00, 1.6102823106855587881e02, 1.0676894854603709582e03,
                1.8154981253343561249e04, 6.5682337918207449113e-2
            };

        double[] b =
            {
                4.7202581904688241870e01, 9.7609855173777669322e02, 1.0260932208618978205e04,
                4.5507789335026729956e04
            };

        double[] c =
            {
                3.9894151208813466764e-1, 8.8831497943883759412e00, 9.3506656132177855979e01,
                5.9727027639480026226e02, 2.4945375852903726711e03, 6.8481904505362823326e03,
                1.1602651437647350124e04, 9.8427148383839780218e03, 1.0765576773720192317e-8
            };

        double[] d =
            {
                2.2266688044328115691e01, 2.3538790178262499861e02, 1.5193775994075548050e03,
                6.4855582982667607550e03, 1.8615571640885098091e04, 3.4900952721145977266e04,
                3.8912003286093271411e04, 1.9685429676859990727e04
            };
        double[] p =
            {
                2.1589853405795699e-1, 1.274011611602473639e-1, 2.2235277870649807e-2,
                1.421619193227893466e-3, 2.9112874951168792e-5, 2.307344176494017303e-2
            };

        double[] q =
            {
                1.28426009614491121e00, 4.68238212480865118e-1, 6.59881378689285515e-2,
                3.78239633202758244e-3, 7.29751555083966205e-5
            };
        if (y <= thrsh)
        {
            //
            // Evaluate  anorm  for  |X| <= 0.66291
            //
            xsq = zero;
            if (y > double.Epsilon) xsq = z * z;
            xnum = a[4] * xsq;
            xden = xsq;
            for (i = 0; i < 3; i++)
            {
                xnum = (xnum + a[i]) * xsq;
                xden = (xden + b[i]) * xsq;
            }
            result = z * (xnum + a[3]) / (xden + b[3]);
            double temp = result;
            result = half + temp;
        }

            //
        // Evaluate  anorm  for 0.66291 <= |X| <= sqrt(32)
        //
        else if (y <= root32)
        {
            xnum = c[8] * y;
            xden = y;
            for (i = 0; i < 7; i++)
            {
                xnum = (xnum + c[i]) * y;
                xden = (xden + d[i]) * y;
            }
            result = (xnum + c[7]) / (xden + d[7]);
            xsq = Math.Floor(y * sixten) / sixten;
            del = (y - xsq) * (y + xsq);
            result = Math.Exp(-(xsq * xsq * half)) * Math.Exp(-(del * half)) * result;
            ccum = one - result;
            if (z > zero)
            {
                result = ccum;
            }
        }

            //
        // Evaluate  anorm  for |X| > sqrt(32)
        //
        else
        {
            xsq = one / (z * z);
            xnum = p[5] * xsq;
            xden = xsq;
            for (i = 0; i < 4; i++)
            {
                xnum = (xnum + p[i]) * xsq;
                xden = (xden + q[i]) * xsq;
            }
            result = xsq * (xnum + p[4]) / (xden + q[4]);
            result = (sqrpi - result) / y;
            xsq = Math.Floor(z * sixten) / sixten;
            del = (z - xsq) * (z + xsq);
            result = Math.Exp(-(xsq * xsq * half)) * Math.Exp(-(del * half)) * result;
            ccum = one - result;
            if (z > zero)
            {
                result = ccum;
            }
        }

        if (result < min)
            result = 0.0e0;
        return result;
    }

    /// <summary>
    /// Given a probability, a mean, and a standard deviation, an x value can be calculated.
    /// </summary>
    /// <returns></returns>
    public static double NormInv(double probability)
    {
        const double a1 = -39.6968302866538;
        const double a2 = 220.946098424521;
        const double a3 = -275.928510446969;
        const double a4 = 138.357751867269;
        const double a5 = -30.6647980661472;
        const double a6 = 2.50662827745924;

        const double b1 = -54.4760987982241;
        const double b2 = 161.585836858041;
        const double b3 = -155.698979859887;
        const double b4 = 66.8013118877197;
        const double b5 = -13.2806815528857;

        const double c1 = -7.78489400243029E-03;
        const double c2 = -0.322396458041136;
        const double c3 = -2.40075827716184;
        const double c4 = -2.54973253934373;
        const double c5 = 4.37466414146497;
        const double c6 = 2.93816398269878;

        const double d1 = 7.78469570904146E-03;
        const double d2 = 0.32246712907004;
        const double d3 = 2.445134137143;
        const double d4 = 3.75440866190742;

        //Define break-points
        // using Epsilon is wrong; see link above for reference to 0.02425 value
        //const double pLow = double.Epsilon;
        const double pLow = 0.02425;

        const double pHigh = 1 - pLow;

        //Define work variables
        double q;
        double result = 0;

        // if argument out of bounds.
        // set it to a value within desired precision.
        if (probability <= 0)
            probability = pLow;

        if (probability >= 1)
            probability = pHigh;

        if (probability < pLow)
        {
            //Rational approximation for lower region
            q = Math.Sqrt(-2 * Math.Log(probability));
            result = (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q + 1);
        }
        else if (probability <= pHigh)
        {
            //Rational approximation for lower region
            q = probability - 0.5;
            double r = q * q;
            result = (((((a1 * r + a2) * r + a3) * r + a4) * r + a5) * r + a6) * q /
                     (((((b1 * r + b2) * r + b3) * r + b4) * r + b5) * r + 1);
        }
        else if (probability < 1)
        {
            //Rational approximation for upper region
            q = Math.Sqrt(-2 * Math.Log(1 - probability));
            result = -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q + 1);
        }

        return result;
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="probability"></param>
    /// <param name="mean"></param>
    /// <param name="sigma"></param>
    /// <returns></returns>
    public static double NormInv(double probability, double mean, double sigma)
    {
        double x = NormInv(probability);
        return sigma * x + mean;
    }
}

A: Meta.Numerics has exactly what you are looking for. Here is the code to do it using that library:
Distribution n = new NormalDistribution(mean, standardDeviation);
double x = n.InverseLeftProbability(probability);

If you are doing this in order to generate normal deviates, the GetRandomValue function is even faster.

A: I do not know of a library, but found this link - http://home.online.no/~pjacklam/notes/invnorm/ - describing an algoritm. It has implementations in a number of languages, but not C#. You could use the VB.NET version, or port it yourself.

A: Maybe you can try this component,http://www.smartxls.com,it has an Excel compatible runtime calculation engine and it does not need Excel installed.

A: add a chart control
double result = Chart1.DataManipulator.Statistics.InverseNormalDistribution(probability);
probability eg : 0.9,  0.4


text:
Q: Which algorithm to use to populate the data in tree structure I have this table in my database and I want to populate the data on a wabpage.
parent_topic    child_topic
      4             5
      4             6
      4             7
      5             8
      5             9
      5             11
      5             11
      5             13
      12            14
      13            15
      8             16
      8             17
      8             18
      16            19
      9             20
      20            21
      9             22
      9             23
      6             24
      25            25
      24            26
      6             27
      24            25
      25            21

I am working on python. What algorithm should I use in order to populate this table.
The format is like following...

*

*Main Topic 1(Topic without any parents)

*

*child Topic

*

*child Topic

*

*child Topic

*child Topic

*Main Topic 2

*

*child topic

and so on...
(Child topics are according to the table).

I was trying to use nested dictionary, but I was unable to create such dictionary.
Thanks in advance.

A: I would strongly recommend you to read this blog Storing Hierarchical Data in a Database.
The blog gives a detailed introduction to two major approaches used in industry on how to store hierarchical data in a relational database: the adjacency list model, and the modified preorder tree traversal algorithm.
The adjacency list model approach is the one your database used. You iterate the tree by recursion from the top node. In many cases, people don't want to or can't load all the data into memory, so the iteration on each node will triage a new SQL query. That's the biggest disadvantage of the adjacency list approach.
django-treebeard is a library that implements efficient tree implementations based on Adjacency List for the Django framework. Thought you may not use django, you can still learn a lot from django.
The modified preorder tree traversal algorithm approach is more efficient when the number of reads to the tree is larger than changes to the tree (Usually this is true for web sites) so it is more popular than the
the adjacency list approach.
There is also a excellent implementation of the modified preorder tree traversal algorithm for django : django-mptt

A: Sorry for my Pseudo-Python :)
Assuming you have list topics of objects with method get_lines() that returns lines of topic:
def PrintTopic(topic, margin):
    for line in topics[topic].get_lines():
        print "   " * margin + line

def PrintRecursiveTopic(db, currentTopic, depth):
    PrintTopic(currentTopic, depth)
    for topic in db.topics.where(lambda x: x.parent_topic == currentTopic):
        PrintRecursiveTopic(db, topic.child_topic, depth + 1)

depth is for PrintTopic to print with margin

A: A recursive approach...
list_pc = [
    (4,5),
    (4,6),
    (4,7),
    (5,8),
    (5,9),
    (5,11),
    (5,11),
    (5,13),
    (12,14),
    (13,15),
    (8,16),
    (8,17),
    (8,18),
    (16,19),
    (9,20),
    (20,21),
    (9,22),
    (9,23),
    (6,24),
    (24,25),
    (24,26),
    (6,27),
    (24,25),
    (25,21),
]

dict_pc = {}
parents = set()
children = set()
for p, c in list_pc:
    parents.add(p)
    children.add(c)
    dict_pc.setdefault(p, []).append(c)

roots = sorted(list(parents - children))
def print_tree(level, p):
    global dict_pc
    print '.'*level, p
    for c in dict_pc.get(p, []):
        print_tree(level + 1, c)

for r in roots:
    print_tree(0, r)

output:
 4
. 5
.. 8
... 16
.... 19
... 17
... 18
.. 9
... 20
.... 21
... 22
... 23
.. 11
.. 11
.. 13
... 15
. 6
.. 24
... 25
.... 21
... 26
... 25
.... 21
.. 27
. 7
 12
. 14


text:
Q: How to bypass toHtml() To print html tags in Magento At first let me admit, I'm not a programmer, although I have a lot of expierence in tweaking small bits of php here and there.
Also I'm not very familiar with Magento's ways of coding.
I have this client who wants to add the manufacturer's brandname to the breadcrumb with a link to the brandname in it. We're using layered navigation that's where I got the link from.
The output I get is Home / Categoryname / productname of Brandname
Here in which the html doesn't get rendered because of the breadcrumbs block being echoed with the function toHtml().
Is there anyway I can bypass this?
Here's my code: (the code was put in the view.phtml of product)
//Get current category url
$current_category = Mage::registry('current_category')->getUrl();

//Get brandname
$brandname = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('manufacturer');

//Strip .html and add the stuff from the layered navigation to it
$brandurl = str_replace(".html", "/l/". strtolower($brandname) .".html", $current_category);
$brandnamemurl = "of " . $brandname . "";

//breadcrumb stuff
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
$breadcrumbs->addCrumb('manufacturer', array('label'=>$brandnamemurl, 'title'=>$brandname));
echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();

http://pastebin.com/csueRX6T

A: html_entity_decode did the trick!
//I Added these two lines
$breadcrumbblock = $this->getLayout()->getBlock('breadcrumbs')->toHtml();
echo html_entity_decode($breadcrumbblock);