text:
Q: How to add a scroll bar in this below code? I am making an app in react . So , here , I have the following code :

body{
  font-family: 'Raleway', sans-serif;
  background:#3E4651;
}
.list-choice{
  width:300px;
  margin:1em auto;
  position: relative;
  cursor: pointer;
}
.list-choice input[type="radio"]{
  position:absolute;
  left:-9999px;
}

.list-choice-title {
width: 100%;
display: block;
background: #D8D8D8;
text-align: center;
padding: 0.55em 1em;
box-sizing: border-box;
color: #FFF;
text-shadow: 0 1px 0 #CACACA;
border-radius: 0.2em;
}
.list-choice:hover .list-choice-title {
border-radius:0.2em 0.2em 0 0;
}
.list-choice-objects label:nth-last-of-type(1) span{
  border-radius:0 0 0.2em 0.2em;
}
.list-choice input[type="radio"] + span {
color: #FFF;
background: #D8D8D8;
padding: 0.55em 1em;
display: block;
text-align: center;
box-sizing: border-box;
cursor: pointer;
width: 100%;
}
.list-choice-objects {
position: absolute;
top: 0;
padding-top: 2.1em;
box-sizing: border-box;
width: 100%;
overflow: hidden;
max-height: 0;
transition: all 250ms ease;
}
.list-choice:hover .list-choice-objects  input[type="radio"] + span {
position: relative;
top: 0;
transition: all 250ms ease-in-out;
}
.list-choice:hover input[type="radio"] + span:hover {
background:#BBB;
}
.list-choice:hover input[type="radio"]:checked + span:hover {
background:#74D68E;
}
.list-choice input[type="radio"]:checked + span {
background: #74D68E;
position: absolute;
top: 0em;
border-radius: 0.2em;
}
.list-choice:hover input[type="radio"]:checked + span {
border-radius: 0;
}
.list-choice:hover .list-choice-objects label:nth-last-of-type(1) input[type="radio"]:checked + span{
  border-radius:0 0 0.2em 0.2em;
}

.list-choice:hover .list-choice-objects {
max-height: 540px;
}

Month

                  <input
                    onChange={this.changeUsState}
                    type="radio"
                    name="month"
                    value="Alabama"
                  />
                  Alabama

                  <input
                    onChange={this.changeUsState}
                    value="Alaska"
                    type="radio"
                    name="month"
                  />
                  Alaska

                  <input
                    onChange={this.changeUsState}
                    value="Arizona"
                    type="radio"
                    name="month"
                  />
                  Arizona

                  <input
                    onChange={this.changeUsState}
                    value="Arkansas"
                    type="radio"
                    name="month"
                  />
                  Arkansas

                  <input
                    onChange={this.changeUsState}
                    value="California"
                    type="radio"
                    name="month"
                  />
                  California

                  <input
                    onChange={this.changeUsState}
                    value="Colorado"
                    type="radio"
                    name="month"
                  />
                  Colorado

                  <input
                    onChange={this.changeUsState}
                    value="Connecticut"
                    type="radio"
                    name="month"
                  />
                  Connecticut

                  <input
                    onChange={this.changeUsState}
                    value="Delaware"
                    type="radio"
                    name="month"
                  />
                  Delaware

                  <input
                    onChange={this.changeUsState}
                    value="Florida"
                    type="radio"
                    name="month"
                  />
                  Florida

                  <input
                    onChange={this.changeUsState}
                    value="Georgia"
                    type="radio"
                    name="month"
                  />
                  Georgia

                  <input
                    onChange={this.changeUsState}
                    value="Hawaii"
                    type="radio"
                    name="month"
                  />
                  Hawaii

                  <input
                    onChange={this.changeUsState}
                    type="radio"
                    name="month"
                    value="Alabama"
                  />
                  Alabama

                  <input
                    onChange={this.changeUsState}
                    value="Alaska"
                    type="radio"
                    name="month"
                  />
                  Alaska

                  <input
                    onChange={this.changeUsState}
                    value="Arizona"
                    type="radio"
                    name="month"
                  />
                  Arizona

                  <input
                    onChange={this.changeUsState}
                    value="Arkansas"
                    type="radio"
                    name="month"
                  />
                  Arkansas

                  <input
                    onChange={this.changeUsState}
                    value="California"
                    type="radio"
                    name="month"
                  />
                  California

                  <input
                    onChange={this.changeUsState}
                    value="Colorado"
                    type="radio"
                    name="month"
                  />
                  Colorado

                  <input
                    onChange={this.changeUsState}
                    value="Connecticut"
                    type="radio"
                    name="month"
                  />
                  Connecticut

                  <input
                    onChange={this.changeUsState}
                    value="Delaware"
                    type="radio"
                    name="month"
                  />
                  Delaware

                  <input
                    onChange={this.changeUsState}
                    value="Florida"
                    type="radio"
                    name="month"
                  />
                  Florida

                  <input
                    onChange={this.changeUsState}
                    value="Georgia"
                    type="radio"
                    name="month"
                  />
                  Georgia

                  <input
                    onChange={this.changeUsState}
                    value="Hawaii"
                    type="radio"
                    name="month"
                  />
                  Hawaii

So , when I run this code, it works well , but , the problem is that some of the options are appearing below , and it can't be reached . So I think so that adding a scroll bar would fix the problem but how do I do that ?
thanks .

A: You may set a size and overflow to the list-choice.
You may also use position:sticky;top:0;z-index:1; on the list-choice-title element to keep at top.
Example

body{
  font-family: 'Raleway', sans-serif;
  background:#3E4651;
}
.list-choice{
  width:300px;
  margin:1em auto;
  position: relative;
  cursor: pointer;
  height:70vh;/* any value you like */
  overflow:auto;/* sets scrollbar if content overflows */
}
.list-choice input[type="radio"]{
  position:absolute;
  left:-9999px;
}

.list-choice-title {
width: 100%;
display: block;
background: #D8D8D8;
text-align: center;
padding: 0.55em 1em;
box-sizing: border-box;
color: #FFF;
text-shadow: 0 1px 0 #CACACA;
border-radius: 0.2em;
position:sticky;/* stick me */
top:0;/* stick me here */
z-index:1;/* let me be hover others */
box-shadow:0 0 2px;/* whatever to make a little difference */
}
.list-choice:hover .list-choice-title {
border-radius:0.2em 0.2em 0 0;
}
.list-choice-objects label:nth-last-of-type(1) span{
  border-radius:0 0 0.2em 0.2em;
}
.list-choice input[type="radio"] + span {
color: #FFF;
background: #D8D8D8;
padding: 0.55em 1em;
display: block;
text-align: center;
box-sizing: border-box;
cursor: pointer;
width: 100%;
}
.list-choice-objects {
position: absolute;
top: 0;
padding-top: 2.1em;
box-sizing: border-box;
width: 100%;
overflow: hidden;
max-height: 0;
transition: all 250ms ease;
}
.list-choice:hover .list-choice-objects  input[type="radio"] + span {
position: relative;
top: 0;
transition: all 250ms ease-in-out;
}
.list-choice:hover input[type="radio"] + span:hover {
background:#BBB;
}
.list-choice:hover input[type="radio"]:checked + span:hover {
background:#74D68E;
}
.list-choice input[type="radio"]:checked + span {
background: #74D68E;
position: absolute;
top: 0em;
border-radius: 0.2em;
}
.list-choice:hover input[type="radio"]:checked + span {
border-radius: 0;
}
.list-choice:hover .list-choice-objects label:nth-last-of-type(1) input[type="radio"]:checked + span{
  border-radius:0 0 0.2em 0.2em;
}

.list-choice:hover .list-choice-objects {
max-height: 540px;
}

Month

                  <input
                    onChange={this.changeUsState}
                    type="radio"
                    name="month"
                    value="Alabama"
                  />
                  Alabama

                  <input
                    onChange={this.changeUsState}
                    value="Alaska"
                    type="radio"
                    name="month"
                  />
                  Alaska

                  <input
                    onChange={this.changeUsState}
                    value="Arizona"
                    type="radio"
                    name="month"
                  />
                  Arizona

                  <input
                    onChange={this.changeUsState}
                    value="Arkansas"
                    type="radio"
                    name="month"
                  />
                  Arkansas

                  <input
                    onChange={this.changeUsState}
                    value="California"
                    type="radio"
                    name="month"
                  />
                  California

                  <input
                    onChange={this.changeUsState}
                    value="Colorado"
                    type="radio"
                    name="month"
                  />
                  Colorado

                  <input
                    onChange={this.changeUsState}
                    value="Connecticut"
                    type="radio"
                    name="month"
                  />
                  Connecticut

                  <input
                    onChange={this.changeUsState}
                    value="Delaware"
                    type="radio"
                    name="month"
                  />
                  Delaware

                  <input
                    onChange={this.changeUsState}
                    value="Florida"
                    type="radio"
                    name="month"
                  />
                  Florida

                  <input
                    onChange={this.changeUsState}
                    value="Georgia"
                    type="radio"
                    name="month"
                  />
                  Georgia

                  <input
                    onChange={this.changeUsState}
                    value="Hawaii"
                    type="radio"
                    name="month"
                  />
                  Hawaii

                  <input
                    onChange={this.changeUsState}
                    type="radio"
                    name="month"
                    value="Alabama"
                  />
                  Alabama

                  <input
                    onChange={this.changeUsState}
                    value="Alaska"
                    type="radio"
                    name="month"
                  />
                  Alaska

                  <input
                    onChange={this.changeUsState}
                    value="Arizona"
                    type="radio"
                    name="month"
                  />
                  Arizona

                  <input
                    onChange={this.changeUsState}
                    value="Arkansas"
                    type="radio"
                    name="month"
                  />
                  Arkansas

                  <input
                    onChange={this.changeUsState}
                    value="California"
                    type="radio"
                    name="month"
                  />
                  California

                  <input
                    onChange={this.changeUsState}
                    value="Colorado"
                    type="radio"
                    name="month"
                  />
                  Colorado

                  <input
                    onChange={this.changeUsState}
                    value="Connecticut"
                    type="radio"
                    name="month"
                  />
                  Connecticut

                  <input
                    onChange={this.changeUsState}
                    value="Delaware"
                    type="radio"
                    name="month"
                  />
                  Delaware

                  <input
                    onChange={this.changeUsState}
                    value="Florida"
                    type="radio"
                    name="month"
                  />
                  Florida

                  <input
                    onChange={this.changeUsState}
                    value="Georgia"
                    type="radio"
                    name="month"
                  />
                  Georgia

                  <input
                    onChange={this.changeUsState}
                    value="Hawaii"
                    type="radio"
                    name="month"
                  />
                  Hawaii

A: I positioned the month as absolute and added a z-index so it always stays at the top and added an overflow:auto to the option content to make it have a scroll bar.

body {
  font-family: 'Raleway', sans-serif;
  background: #3E4651;
}

.list-choice {
  width: 300px;
  margin: 1em auto;
  position: relative;
  cursor: pointer;
}

.list-choice input[type="radio"] {
  position: absolute;
  left: -9999px;
}

.list-choice-title {
  width: 100%;
  display: block;
  background: #D8D8D8;
  text-align: center;
  padding: 0.55em 1em;
  box-sizing: border-box;
  color: #FFF;
  text-shadow: 0 1px 0 #CACACA;
  border-radius: 0.2em;
  position: absolute;
  z-index: 1000;
}

.list-choice:hover .list-choice-title {
  border-radius: 0.2em 0.2em 0 0;
}

.list-choice-objects label:nth-last-of-type(1) span {
  border-radius: 0 0 0.2em 0.2em;
}

.list-choice input[type="radio"]+span {
  color: #FFF;
  background: #D8D8D8;
  padding: 0.55em 1em;
  display: block;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
  width: 100%;
}

.list-choice-objects {
  position: absolute;
  top: 0;
  padding-top: 2.1em;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  max-height: 0;
  transition: all 250ms ease;
}

.list-choice:hover .list-choice-objects input[type="radio"]+span {
  position: relative;
  top: 0;
  transition: all 250ms ease-in-out;
}

.list-choice:hover input[type="radio"]+span:hover {
  background: #BBB;
}

.list-choice:hover input[type="radio"]:checked+span:hover {
  background: #74D68E;
}

.list-choice input[type="radio"]:checked+span {
  background: #74D68E;
  position: absolute;
  top: 0em;
  border-radius: 0.2em;
}

.list-choice:hover input[type="radio"]:checked+span {
  border-radius: 0;
}

.list-choice:hover .list-choice-objects label:nth-last-of-type(1) input[type="radio"]:checked+span {
  border-radius: 0 0 0.2em 0.2em;
}

.list-choice:hover .list-choice-objects {
  max-height: 400px;
  overflow: auto;
}

Month

      <input
        onChange={this.changeUsState}
        type="radio"
        name="month"
        value="Alabama"
      />
Alabama

                  <input
                    onChange={this.changeUsState}
                    value="Alaska"
                    type="radio"
                    name="month"
                  />
                  Alaska

                  <input
                    onChange={this.changeUsState}
                    value="Arizona"
                    type="radio"
                    name="month"
                  />
                  Arizona

                  <input
                    onChange={this.changeUsState}
                    value="Arkansas"
                    type="radio"
                    name="month"
                  />
                  Arkansas

                  <input
                    onChange={this.changeUsState}
                    value="California"
                    type="radio"
                    name="month"
                  />
                  California

                  <input
                    onChange={this.changeUsState}
                    value="Colorado"
                    type="radio"
                    name="month"
                  />
                  Colorado

                  <input
                    onChange={this.changeUsState}
                    value="Connecticut"
                    type="radio"
                    name="month"
                  />
                  Connecticut

                  <input
                    onChange={this.changeUsState}
                    value="Delaware"
                    type="radio"
                    name="month"
                  />
                  Delaware

                  <input
                    onChange={this.changeUsState}
                    value="Florida"
                    type="radio"
                    name="month"
                  />
                  Florida

                  <input
                    onChange={this.changeUsState}
                    value="Georgia"
                    type="radio"
                    name="month"
                  />
                  Georgia

                  <input
                    onChange={this.changeUsState}
                    value="Hawaii"
                    type="radio"
                    name="month"
                  />
                  Hawaii

                  <input
                    onChange={this.changeUsState}
                    type="radio"
                    name="month"
                    value="Alabama"
                  />
                  Alabama

                  <input
                    onChange={this.changeUsState}
                    value="Alaska"
                    type="radio"
                    name="month"
                  />
                  Alaska

                  <input
                    onChange={this.changeUsState}
                    value="Arizona"
                    type="radio"
                    name="month"
                  />
                  Arizona

                  <input
                    onChange={this.changeUsState}
                    value="Arkansas"
                    type="radio"
                    name="month"
                  />
                  Arkansas

                  <input
                    onChange={this.changeUsState}
                    value="California"
                    type="radio"
                    name="month"
                  />
                  California

                  <input
                    onChange={this.changeUsState}
                    value="Colorado"
                    type="radio"
                    name="month"
                  />
                  Colorado

                  <input
                    onChange={this.changeUsState}
                    value="Connecticut"
                    type="radio"
                    name="month"
                  />
                  Connecticut

                  <input
                    onChange={this.changeUsState}
                    value="Delaware"
                    type="radio"
                    name="month"
                  />
                  Delaware

                  <input
                    onChange={this.changeUsState}
                    value="Florida"
                    type="radio"
                    name="month"
                  />
                  Florida

                  <input
                    onChange={this.changeUsState}
                    value="Georgia"
                    type="radio"
                    name="month"
                  />
                  Georgia

                  <input
                    onChange={this.changeUsState}
                    value="Hawaii"
                    type="radio"
                    name="month"
                  />
                  Hawaii

A: Created a simple stackblitz please check
https://stackblitz.com/edit/html-basics-ujcmaj?file=style.css


text:
Q: Trying to run Django and getting AttributeError: module 'secrets' has no attribute 'choice' '''
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/init.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/commands/startproject.py", line 18, in handle
options['secret_key'] = get_random_secret_key()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/utils.py", line 82, in get_random_secret_key
return get_random_string(50, chars)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/utils/crypto.py", line 74, in get_random_string
return ''.join(secrets.choice(allowed_chars) for i in range(length))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/utils/crypto.py", line 74, in
return ''.join(secrets.choice(allowed_chars) for i in range(length))
AttributeError: module 'secrets' has no attribute 'choice'
'''

A: Make sure you don't have any file or folders named secrets.py or secrets anywhere in your python path and/or current working directory. That may shadow the built in secrets module.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to abuse the Association Bonus I figured out a method to abuse the Association Bonus, however I'm unsure whether or not this is a serious issue. Are there anti systems in place that prevent this?
Prerequisites:
1 account with the Association bonus, and
1 account with 100 reputation on a different site.
Step 1:
Create a bounty on the first account using the association bonus on the site on which the second account has 100 reputation, and award it to the second account.
The second account now has 200 reputation and will receive the Association Bonus.
Step 2:
Abuse the bounty system to give the association bonus from the second account back to the first.
Step 3:
Create a third account, and again abuse the bounty system to gift 200 reputation to it from the second account.
Step 4:
Repeat steps 2 and 3 in order to gain infinite reputation.
Step 5:
Give the 200 reputation back to the first account.
Please don't actually do this.

A: This might be possible, but consider:

*

*You have to get to 200 reputation points on one site, and 100 points on another. To do that you need to ask a few decent questions and/or write some decent answers so they get positive votes.

*To award the first bounty, you have to write a decent question/answer pair that will pass muster on the site. If the question isn't good enough to stay open or the answer is drek that will be downvoted into oblivion, you're going to lose reputation points. And a bounty on a less-than-great answer is going to raise suspicion.

*You then have to do it again, with the authors reversed, in order to give the bounty back.

*It's also pretty transparent. All it takes is for someone to notice that one person gave a bounty and the other gave it right back, and this pattern repeated on another site. It wouldn't take long for a moderator to get a flag and to investigate. Once they can see IP addresses it should be pretty obvious what's going on.
But what if you don't get caught? So what? What has happened? You've gained a few hundred reputation points on disconnected accounts. What can you do with that? Downvote? Reduce Ads? Create Tags? Certainly nothing really dangerous. To do that, you'll need to have done this quite a few times, which means you'll need to have created quite a bit of decent content. Because if the content doesn't pass muster so that it gets some upvotes, your whole scheme will fall apart. You'd have to do this a lot to get into "dangerous" territory, like accessing the review queues, and even then there's little that you can do all by yourself. And if you're pulling this scheme that much, it'll definitely be spotted.
But say you do this for a couple of accounts and don't get caught. Sure, you might have an account with more privileges than you would have got naturally, but not much. In the meantime, Stack Exchange has gotten some pretty decent content out of you. Imagine how much more it could have gotten if you'd just played fair and asked/answered questions to earn your reputation points, and how many more points you would have gotten.


text:
Q: How do I preform a script on an entire folder? I wrote a script that performs some adjustments, saves then closes the image:
preferences.rulerUnits = Units.PIXELS;
imageWidth = activeDocument.width.as('px');
imageHeight = activeDocument.height.as('px')-30;
activeDocument.resizeCanvas(imageWidth,imageHeight,AnchorPosition.TOPCENTER);
app.activeDocument.save();
app.activeDocument.close();

Is there a way I can get this to run on a whole folder of images?
Thanks

A: You can try something like this:
#target photoshop
#strict on

main();
function main()
{
    var path = "/d/Images/";

    var inputFolder = new Folder(path );
    var inputFiles = inputFolder.getFiles("*.*");

    for(index in inputFiles)
    {
        // open the file
        var fileToOpen = new File(inputFiles[index]);
        open(fileToOpen);

        // do the processing
        preferences.rulerUnits = Units.PIXELS;
        imageWidth = activeDocument.width.as('px');
        imageHeight = activeDocument.height.as('px')-30;
        activeDocument.resizeCanvas(imageWidth,imageHeight,AnchorPosition.TOPCENTER);
        app.activeDocument.save();
        app.activeDocument.close();

    }
}

I did not try, but it should work.
Hope it helps.


text:
Q: is Async Task = Thread + Handler in android? Can some one tell me if I have understood it right that
what we achieve using async task can be achieved using thread and handler?

A: They are pretty the same.But you can cancle() asynctask if you need.


text:
Q: The headquarters has different  tag and it's name is in another  tag and it is changing how can i get all headquarters names correctly? I need help in correctly scrap the headquarters data from all the links in the http://www.cincinnati.com/story/money/2016/11/26/see-which-companies-16-deloitte-100/94441104/' website
class ProjectSpider(scrapy.Spider):
    name = "cin100"
    allowed_domains = ['cincinnati.com']
    start_urls = ['http://www.cincinnati.com/story/money/2016/11/26/see-which-companies-16-deloitte-100/94441104/']

    def parse(self, response):

        # get selector for all 100 companies
        sel_companies = response.xpath('//p[contains(.,"Here are the companies")]/following-sibling::p/a')

        # create request for every single company detail page from href
        for sel_companie in sel_companies:
            href = sel_companie.xpath('./@href').extract_first()
            url = response.urljoin(href)
            request = scrapy.Request(url, callback=self.parse_company_detail)
            yield request

    def parse_company_detail(self, response):

        # On detail page create item
        item = ProjectItem()
        # get detail information with specific XPath statements
        # e.g. title is the first paragraph
        item['title'] = response.xpath('//div[@role="main"]/p[1]//text()').extract_first().rsplit('-')[1]
        # e.g. family owned has a label we can select
        item['owned'] = response.xpath('//div[@role="main"]/p[contains(.,"Family owned")]/text()').extract_first()
    item['Revenue2014'] ='$'+response.xpath('//div[@role="main"]/p[contains(.,"2014")]/text()').extract_first().rsplit('$')[1]
    item['Revenue2015'] ='$'+response.xpath('//div[@role="main"]/p[contains(.,"$")]/text()').extract_first().rsplit('$')[1]
        item['Website'] = response.xpath('//div[@role="main"]/p/a[contains(.,"com")]/text()').extract_first()
    item['Rank'] = response.xpath('//div[@role="main"]/p[contains(.,"rank")]/text()').extract_first()
    item['Employees'] = response.xpath('//div[@role="main"]/p[contains(.,"Employ")]/text()').extract_first()
    item['headquarters'] = response.xpath('//div[@role="main"]/p[10]//text()').extract()
    item['FoundedYear'] = response.xpath('//div[@role="main"]/p[contains(.,"founded")]/text()').extract()
        # Finally: yield the item
        yield item

A: While the headquarter has a preceding header labeled "Headquarter" I would take this as anchor and select the content of next following <p> tag like so:
//p[contains(.,"Headquarters")]/following-sibling::p[1]

Maybe you want to have a look at this XPath Tutorial to get a better understanding of the commands (and find a better solution).


text:
Q: Disable automatic vertical maximise of windows when scaled to bottom of screen I have the following problem: when scaling a window to the bottom of the screen, it gets automatically maximised vertically.
This is very annoying as I want to decide how to scale my windows!
I found no option that triggers this.
The compiz plugin grid is disabled.
Everything I find when searching for my problem, are references to grid ...
My System:
Ubuntu 14.04.1 LTS
Kernel 3.13.0-32-generic
Compiz 0.9.11.2
Gnome 3.8+4ubuntu3
Using Gnome Fallback Mode

A: Ok, finally found the reason for the automatic window maximising:
the compiz resize plugin!
The settings for this plugin contain an option called Maximize Vertically if screen edge hit in the tab General. This did the trick.
Though I checked each compiz plugin within the windows scope a thousand times before, I did not found this checkbox earlier. This is because I searched for a setting of type active screen edge and not of type checkbox.

Note: due to the lack of this information within the compiz plugin settings, I guessed the underlying name of this plugin being resize!
The german localized title is "Fenster skalieren aktivieren" which - directly translated - should be s. th. like "Activate Window Scaling" or "Activate Window Resizing". There is another plugin called "Skalieren" from which I assume, it corresponds to the underlying "scale" plugin, so "resize" should be the right one.
If anyone can confirm or correct this, I will edit my answer.

Update 2016-07-13
The "CompizConfig Einstellungs-Manager" is the "CompizConfig Settings Manager" and used to adjust all parameters of "compiz".
It may not be preinstalled on your system!
Check this by opening a terminal and enter ccsm.
If this command is not found, you can install it with:
sudo apt-get install compizconfig-settings-manager
Note: this install package name was changed somewhen in the past - if you have a really old system it may be named ccsm as well, if I remember this correctly.

A: I find the same setting on my Ubuntu 14.04 and confirm it works too.
Since Nicolas' screenshot is not completely English, here are my steps to find it:
CompizConfig Setting Manager-> Window Management -> Resize window -> General (Tab).
For the folks don't have CompizConfig Settings Manager installed, it could be found at:
https://apps.ubuntu.com/cat/applications/compizconfig-settings-manager/

A: You may find conflicts in CCSM between 'Window Management' plugins.
I wanted to stop the window filling the top half of the screen when I took it to the top edge.  The behaviour seems to be determined by Grid and Maximumize.  I found that even if I unticked:
'Maximumise' 'maximumize to up' and set
'Grid' 'Corners/Edges' 'Top Edge = None'
it still half fills the screen when I hit the top edge.
However if I disable the plugin 'Maximumize' it ceases this irritating behaviour.


text:
Q: How to remove word from .split function? (Javascript) I have written a program that extracts text from a given webpage.
I used .split to put the words into an array. I'd like to remove any word that does not start with a letter e.g. 5X would not be classed as a word but X5 would be.
My code doesn't work.
function getWords(node) {
    var text = node.innerText;
    output.textContent = inputValidation(text)
}
function inputValidation(text) {
    var wordData = text.split();
    for (i in wordData) {
        if (isLetter(i[0] == False)) {
            wordData.splice(i, 1);
        }

    } return wordData
}

function isLetter(str) {
    return str.length === 1 && str.match(/[a-z]/i);
}

A: You can easily pack this into a filter, like so:

let output = document.querySelector("#output");
getWords(document.querySelector("p"));

function getWords(node) {
  let text = node.innerText;
  output.textContent = text.split(" ").filter(word => word[0].toLowerCase().match(/[a-z]{1}/));
}

Hello world! Click here Goodbye world! X7 9x

A: Your code seems to be incorrect as you are passing boolean value in isLetter function as isLetter(i[0] == False) which is again incorrect as F should be lowercase i.e, false. There are plenty of error in your code but you can however use parseInt() and isNaN() to check that the entire word start with character or digit.

//when you have a letter as a first character
var word = 'X5';
var isLetter = isNaN(parseInt(word));
console.log(isLetter);

//when you dont have a letter as a first character
word = '5ABC';
isLetter = isNaN(parseInt(word));
console.log(isLetter);

A: Change your isLetter to
function isLetter(str) {
if (str.match(/^\d/)) {
   return true;
}
return false;
}

A: I think the issue is on this line of code
    if (isLetter(i[0] == False)) {

should be
    if (isLetter(i[0]) == False) {

or better
    if (!isLetter(i[0])) {

A: Example:
var text="abc def 10hij kl 3GH";

var splitedtext=text.split(" ");
var dummyarray=[];

for(var i=0;i<splitedtext.length;i++){
    var thistext=parseInt(splitedtext[i]);
  if( thistext.toString() == "NaN" ){
        dummyarray.push(splitedtext[i]);
  }
}

$("body").html(dummyarray.join(" "));

jsfiddle demo : http://jsfiddle.net/geogeorge/hztdxv4w/2/


text:
Q: Water quality analysis using Repeated Measures ANOVA I am trying to analyse the change in water quality properties over a period of time stored in different containers. I have collected drinking water from same source on 4 different days and stored in 5 different containers with 3 replications for each container for each period. I have done Repeated Measures ANOVA to see whether the water quality (for e.g TDS mg/l) varied significantly over, 1. different time periods, 2. between different containers and 3. Whether the effect of container on TDS depends on periods of storage (That is based on type of container the TDS values change over time).For this I used Repeated measures ANOVA, and the table will look this
Source     Sum of Squares   df  Mean Square    F    Prob.   Sig.
Between
Containers     .069        5    .014         .476   .788    Ns
Error(A)       .346       12    .029
Between Days   .125        3    .042         2.801  .054    Ns
days VS Sample .201       15    .013          .899  .572    Ns
Error(B)       .538       36    .015

Is this method correct? If not what is the best method of ANOVA
(I have changed the values nevertheless this is how I did the analysis).


text:
Q: amdgpu_trace.h: No such file or directory When trying to build amdgpu The full error message from make:
In file included from /home/username/linux-5.0.0/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h:496,
             from /home/username/linux-5.0.0/drivers/gpu/drm/amd/amdgpu/amdgpu_trace_points.c:29:
./include/trace/define_trace.h:89:42: fatal error: ../../drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h: No such file or directory
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
                                          ^
compilation terminated.

(replace username with my home folder name above)
I've been trying to follow this to modify, build, and insert the amdgpu module into the already built kernel without having to build the whole kernel as I do always because of this bug.
It happens when I run make -C /lib/modules/$(uname -r)/build M=$(pwd) modules from the directory ~/linux-4.18.0/drivers/gpu/drm/amd/amdgpu/.

A: Edit amdgpu_trace.h file, and change the line:
#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/amd/amdgpu

to
#define TRACE_INCLUDE_PATH ../../../../../drivers/gpu/drm/amd/amdgpu


text:
Q: How to retrieve page ids based on type using FQL? I want to retrieve page ids of all those pages whose type is Musician/Band. I tried to retrive it from page table as
SELECT page_id from page where type='MUSICIAN/BAND'
but it is not allowing that.Its giving error:
Your statement is not indexable. The WHERE clause must contain an indexable column.
How to go about this?

A: You simply cannot do that query.  You need to include at least one of the indexable columns in your query (page_id or name).


text:
Q: My IDE doesn't accept code that worked a month ago? The only thing i have changed is downloaded pygame on my mac via the terminal.
When i type the follwing code -
name = input("what is your name?")
print ("Hello", name)

into my IDE i get this in the terminal -

what is your name? Traceback (most recent call last):   File
  "/Users/mikeyboy/PycharmProjects/untitled11/waht.py", line 1, in

      name = input("what is your name?")   File "", line 0
^ SyntaxError: unexpected EOF while parsing

Process finished with exit code 1

What's gone wrong this code worked perfectly a month ago?

A: I solved this by putting
    name = raw_input("What is your name?")
instead of ...
    name = input("What is your name?")
Anybody know why the latter worked before and now it doesn't?


text:
Q: Examples of problems that are easier by knowing eigenvalues/vectors I've recently started studying some of perturbation theory and I've noted that there are several operators that doesn't have any eigenvalue in their spectrum, but by adding little perturbations you can add even countable of them. The analysis is interesting by itself, I would like to know more about applications though. I know that somewhere there have to be plenty of them.
I've actually seen some examples in my PDE course, for example the Laplace's problem on certain domains is transformed into a fourier series problem by just knowing the eigenvalues/vectors, and the same happen when you take the heat equation on bounded domains.
So the question is: Do you know any other examples of problems with operators that are easier to solve by knowing their eigenvalues/vectors? I hope the question is not too open.


text:
Q: preprocess_views_view not getting called Drupal 7,
Views,
Bootstrap theme sub theme in use
I have a views-view-table.tpl.php file in my sub theme and I am trying to preprocess some of the variables sent to this tpl. I created a function bootstrap_preprocess_views_view(&$vars) in my template.php and it is not getting called when I visit one of my views pages. Why would this be? Other preprocess functions are getting called from the same template file. I have tried flushing the cache.
function bootstrap_preprocess_views_view(&$vars) {
  dsm($vars);
  dsm("aaaa");
  die;
}

A: Adam,
I'm assume you've tried all the regular things like clearing your cache, etc before expecting to see the change.
If yes, perhaps this old Drupal issue may be affecting your function: http://drupal.org/node/258089 (since your syntax looks fine).
Do you actually have a corresponding template file in your sub-theme?  If you place one in there (even just by copying and pasting the default one from the views module), does it solve your issue?
Let us know!


text:
Q: iOS IAP - Receipt ok but nothing on itunesconnect I released my first iOS app.
There is some in app purchases, a user bought two things on 9th Junuary.
I still can't see anything on the itunesconnect side:

All the receipts are validated and applied on the server-side.
Here is the response from apple's servers ( https://buy.itunes.apple.com/verifyReceipt ):
{
    "status":0,
    "environment":"Production",
    "receipt":{..}
}

What can explain this issue?


text:
Q: How to disable a button if no items displayed in a ListView I have created a student enrolment wizard that they go through every year that uses the MultiView control and I have multiple View Controls within it. An example of one View control can be seen below;
<asp:View ID="address_view" runat="server">

Address:

<asp:Button ID="add_new_address" CssClass="blue" runat="server" Text="Add New Address" OnClick="add_new_address_Click" />

    <asp:DropDownList ID="address_dropdown_insert" runat="server">
                <asp:ListItem Value="Home">Home Address</asp:ListItem>
                <asp:ListItem Value="Term">Term Time Address</asp:ListItem>
                <asp:ListItem Value="Mail">Mail Address</asp:ListItem>
                <asp:ListItem Value="Business">Business Address</asp:ListItem>
            </asp:DropDownList>

            Address 1:
            <asp:TextBox Text="" runat="server" ID="address_1TextBox" />

            Address 2:
            <asp:TextBox Text="" runat="server" ID="address_2TextBox" />

            Town/City:
            <asp:TextBox Text="" runat="server" ID="town_cityTextBox" />

            County:
            <asp:TextBox Text="" runat="server" ID="countyTextBox" />

            PostCode:
            <asp:TextBox Text="" runat="server" ID="postcodeTextBox" />

            Country:
            <asp:TextBox Text="" runat="server" ID="countryTextBox" />
            <asp:Button runat="server" CommandName="Insert" Text="Insert" ID="InsertButton" OnClick="insert_address_button_Click" />
            <asp:Button runat="server" CommandName="Cancel" Text="Clear" ID="Button4" OnClick="cancel_address_button_Click" />

    <asp:ListView ID="address_list" runat="server" DataSourceID="user_address" DataKeyNames="address_id">
        <EditItemTemplate>
            // code here
        </EditItemTemplate>
        <EmptyDataTemplate>

There are currently no addresses found, please click the button above to add a new address.

        </EmptyDataTemplate>
        <ItemTemplate>
            //code here
        </ItemTemplate>
        <LayoutTemplate>
            //code here
        </LayoutTemplate>
    </asp:ListView>

    <asp:Button CommandName="NextView" ID="Button1" Enabled="false" runat="server" Text="Next" />
</asp:View>

I have the following C# on PageLoad
protected void Page_Load(object sender, EventArgs e)
    {
        Button1.Enabled = address_list.Items.Any();
    }

However, the button still appears even if there is no data in the ListView.
My question is, how can I prevent a user from continuing onto the next view when they click Button1 if their is no data in the ListView?
I'm fairly new to C# so any help would be much appreciated.

A: Try something like:
if(address_list.Items.Count() = 0)
{
Button1.enabled = false
}else
 {
 Button1.enabled = true
 }

But have in mind that if you call this before you bind the data it wont work so be sure to not use this code as the first line in the Page load event

The lv.items.Count() will return 0 if it has no rows after binded


text:
Q: hide custom button based on user profile? I have one custom detail button in the Account page ,i want to hide that button based on the user profile ?
Is there any way we can do this?

A: Create a new Page layout and remove that button from it. Assign that page layout to the Profile to which you don't want to show the button.

A: To do what you're asking about you'd need to create a Dynamic Visualforce Component based on the $User.Profile:
Modified from an example in the documentation:
Component.Apex.OutputText renderButton = new Component.Apex.OutputText();
renderButton.expressions.value =
    '{!IF($User.Profile == "NameofUserRequiredProfile", "True", "False")}';

In the above, you'd want to use this type of thing to use to determine whether or not to render the button based on the value of the Profile matching a specific profile where it can be displayed with it not being visible to any other profile. You could modify it accordingly to do the inverse, render the button for everyone except for that specific Profile too, which I believe is closer to what you're asking to do.

A: It is possible now in lightning. While on the account detail page, click the Setup gear icon and click 'edit' page. Then click the top bar containing the buttons and, at the right Click upgrade to dynamic actions. After upgrading you can set filters for the visibility of the buttons: Press the button on the right side, press 'add filter', press 'Advanced' en then 'Select' Field, go to user to filter on user or to user>Profile to filter on profile.


text:
Q: Invalid JSON format I'm building JSON object and passing it to server with JQuery ajax.
data: "{'authorID' : '" + authorID +
      "', 'title' : '" + encodeURIComponent(blogTitle) +
      "', 'msg' : '" + encodeURIComponent(blogBody) +
      "', 'preview' : '" + encodeURIComponent(mediaContent) +
      "', 'layoutID' : '" + previewLayoutId +
      "', 'threadID' : '" + threadID + "'}"

But when my blogBody variable contains ' the code fails with the error message:
{"Message":"Invalid object passed in, \u0027:\u0027 or \u0027}\u0027 expected. (107): {\u0027authorID\u0027 : \u0027148385\u0027, \u0027title\u0027 : \u0027123213\u0027, \u0027msg\u0027 : \u0027%3Cp%3Eqqq%3C%2Fp%3E%3Cp%3E%3Cbr%3E%3C%2Fp%3E%3Cp%3E\u0027\u0027\u0027\u0027%3C%2Fp%3E\u0027, \u0027preview\u0027 : \u0027\u0027, \u0027layoutID\u0027 : \u00271\u0027, \u0027threadID\u0027 : \u00270\u0027}","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

Could someone say where is the error and how to fix it?

A: In JSON, the keys must be quoted with double quotes ("), not single quotes ('). Similarly, string values must be in double, not single, quotes. You're using single quotes. For example, around authorId and around the text of the title.
So at a minimum, you need to swap those quotes around, e.g.:
data: '{"authorID" : "' + authorID +
      '", "title" : "' + encodeURIComponent(blogTitle) +
      '", "msg" : "' + encodeURIComponent(blogBody) +
      '", "preview" : "' + encodeURIComponent(mediaContent) +
      '", "layoutID" : "' + previewLayoutId +
      '", "threadID" : "' + threadID + '"}'

A: Use this instead:
JSON.stringify(object)

A: I had the same issue when using Microsoft's JavaScriptSerializer() function for turning objects into JSON.
It would convert apostrophes to \u0027, but jqGrid would happily continue to display them as \u0027:

My solution was simply to stop using Microsoft's JavaScriptSerializer() function..
string JSON = new JavaScriptSerializer().Serialize(myListOfObjects).ToString();

..and switch to JSON.Net..
string JSON = JsonConvert.SerializeObject(myListOfObjects);

JSON.Net also avoids the issues with converting DateTimes to JSON.  Microsoft's version uses it's own nasty formatting for dates, eg:
/Date(1355496152000)/

Errr, yeah.  Time to get Googling again.  Or use JSON.Net !

A: As T.J. Crowder said, your elements should have double quotes, and to make sure your format is correct, you can always validate your json array here (I always do):
Also you better use this to generate the json arrays
http://jsonlint.com/

A: JSON field names should be in double quotes also string values should be double quotes too. See JSON syntax rules here.
Also you can validate JSON output by using an online JSON validation websites like DebugJSON.


text:
Q: Not able to give alternate color to listview using Arrayadapter Not able to give alternate color to listview using Arrayadapter
Here is my Logcat...
10-29 17:56:24.449  18093-18093/com.ambilobes.santom D/AbsListView﹕ Get MotionRecognitionManager
10-29 17:56:24.549  18093-18093/com.ambilobes.santom D/AndroidRuntime﹕ Shutting down VM
10-29 17:56:24.549  18093-18093/com.ambilobes.santom W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40ff0ac8)
10-29 17:56:24.569  18093-18093/com.ambilobes.santom E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NullPointerException
            at com.ambilobes.santom.UserAdapter.getView(UserAdapter.java:54)
            at android.widget.AbsListView.obtainView(AbsListView.java:2619)
            at android.widget.ListView.measureHeightOfChildren(ListView.java:1253)
            at android.widget.ListView.onMeasure(ListView.java:1165)
            at android.view.View.measure(View.java:16142)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4927)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
            at android.view.View.measure(View.java:16142)
            at
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
            at android.os.Handler.handleCallback(Handler.java:725)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5306)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
            at dalvik.system.NativeStart.main(Native Method)

and my code is
    public class UserAdapter extends BaseAdapter{

        Context context;
        ArrayList<Users> userlist;
        List<Users> userlistnew = null;
        public UserAdapter(Context context,  List<Users> userlistnew){
            this.context= context;
            this.userlist = new ArrayList<Users>();
            this.userlistnew= userlistnew;
            this.userlist.addAll(userlistnew);
        }

        @Override
        public int getCount() {
            return userlistnew.size();
        }

        @Override
        public Object getItem(int position) {
            return userlistnew.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }
        class ViewHolder {
            private TextView textViewUserName;
            private TextView textViewUserId;
        }
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {

            ViewHolder viewHolder = null;

                LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = inflater.inflate(R.layout.user_item,null);
                viewHolder = new ViewHolder();
                viewHolder.textViewUserName = (TextView) convertView.findViewById(R.id.txtViewUserName);
                viewHolder.textViewUserId = (TextView) convertView.findViewById(R.id.txtViewUserid);
                convertView.setTag(viewHolder);
if(position % 2 == 0){
                    convertView.setBackgroundColor(Color.GRAY);
                }
            Users user = userlistnew.get(position);
            String userName = user.getName();
            String userId = user.getId();
            viewHolder.textViewUserName.setText(userName);
            viewHolder.textViewUserId.setText(userId);
            return convertView;
        }
    }

not able to find the error. Wasted one day... Can any one help. I am just new to android.I want to give alternate color to my listview.

A: Just move your code
if(position % 2 == 0){
  convertView.setBackgroundColor(Color.GRAY);
}

after
convertView = inflater.inflate(R.layout.user_item,null);

A: you set background color  to null variable of convertView. thus it not working. just change the position of your code . please do it like below.
 if(convertView == null){

        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.user_item,null);
        viewHolder = new ViewHolder();
        viewHolder.textViewUserName = (TextView) convertView.findViewById(R.id.txtViewUserName);
        viewHolder.textViewUserId = (TextView) convertView.findViewById(R.id.txtViewUserid);
        if(position % 2 == 0){
            convertView.setBackgroundColor(Color.GRAY);
        }
        convertView.setTag(viewHolder);

A: You can try below code :
if (position % 2 == 1) {

    view.setBackgroundColor(Color.RED);
} else {
    view.setBackgroundColor(Color.GREEN);
}

You can see this example for overriding arrayadapter.
Hope it will help you


text:
Q: Get full process path from pid in kernel linux I'm building custom kernel linux for my device (like embeded device). I want to log all information of kill system call. So I modify code in kill system call and get pid to kill. But I can't get full process path for it, I have just get full path of current process.
This is my code to get process path from pid.
long GetProcessPathFromPid(const pid_t p_id, char* pszProcessPath, int iSize)
{
    struct task_struct *task = NULL;
    struct pid *pid_struct = NULL;
    struct mm_struct *mm = NULL;
    //struct file *exe_file = NULL;
    //char buf[256] = {0};
    //char *result = ERR_PTR(-ENOENT);
    //int iResultLength = 0;

    pid_struct = find_get_pid(p_id);
    if (pid_struct == NULL)
    {
        printk("Fail to find_get_pid.\n");
    }
    task = pid_task(pid_struct, PIDTYPE_PID);                               // Get task_struct
    if (task == NULL)
    {
        printk("Fail to pid_task.\n");
    }
    mm = get_task_mm(task);                                                // Get mm of task_struct
    mmput(mm);

    printk("Finish hook kill process\n.");
    return 0;                                              // Get mm of task_struct
}

And this is error when I update firmware:
Call Trace:
[<8042971c>] printk+0x24/0x30
[<800c37c8>] GetProcessPathFromPid+0x38/0x88
[<800c3b60>] LogKillProcess+0x64/0xf4
[<800443d4>] sys_kill+0x30/0x1d8
[<800354b0>] do_wait+0x11c/0x220
[<8042e234>] wait_for_completion_killable+0x18/0x30
[<80043a3c>] set_current_blocked+0x30/0x48
[<80533210>] repair_env_string+0x0/0x94
[<8003664c>] sys_wait4+0x80/0xfc
[<800344d8>] child_wait_callback+0x0/0x8c
[<80533210>] repair_env_string+0x0/0x94
[<8001b59c>] stack_done+0x20/0x40
[<800b07a8>] sys_close+0x0/0x158
[<80533210>] repair_env_string+0x0/0x94

Call Trace:
[<8042fe88>] _raw_spin_lock+0x10/0x3c
[<8002ef68>] get_task_mm+0x20/0x7c
[<800c37c8>] GetProcessPathFromPid+0x38/0x88
[<800c3b60>] LogKillProcess+0x64/0xf4
[<800443d4>] sys_kill+0x30/0x1d8
[<8001b59c>] stack_done+0x20/0x40

Code: 24630001  af830014  3c020001 <c0830000> 00622821  e0850000  10a0fffc  00032c02  3063ffff
pe=GPON

---[ end trace aee100dae37dfc66 ]---
note: init[1] exited with preempt_count 1
FinWLmngr Daeish hook kill process
.mon is running
 !!!!   PLL locked !!!!!!     !!!!   RX CDR locked !!!!!!     !!!!   TX CDR locked !!!!!!    GPON BEN Calibration Done
GPON SerDes Initialization Sequence Done
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Can you help me? Thanks!

A: I found way to get full path process from pid.
Full path process is symlink of /proc//exe, so I must find symlink of it.
Here is code:
long GetSymLinkOfFile(const char *pzsFilePath, char *pszRealPath, int iSize)
{
    struct path path_struct;
    char pszBuffer[256];
    char *result = ERR_PTR(-ENOENT);
    int err = 0;
    int iLengthOfResult = 0;

    if (pzsFilePath == NULL || pszRealPath == NULL)
    {
        printk("Buffer is NULL.\n");
        return -EINVAL;
    }

    err = kern_path(pzsFilePath, LOOKUP_FOLLOW, &path_struct);

    if (err < 0)
    {
        printk("kern_path error, error code: %d", err);
        return iLengthOfResult;
    }

    result = d_path(&path_struct, pszBuffer, 256);

    if (IS_ERR(result) == true)
    {
        printk("d_path GetSymlink error: %s", result);
        return iLengthOfResult;
    }

    iLengthOfResult = strlen(result);

    if (iLengthOfResult <= iSize)
        strcpy(pszRealPath, result);

    return iLengthOfResult;
}


text:
Q: How do you cast a block? I made an array of blocks. I want to execute an individual block from the array and I am having trouble finding what the syntax is to cast and call the block.
 void (^hiBlock)() = ^void() {
        NSLog(@"Hi");
    };

    void (^byeBlock)() = ^void() {
        NSLog(@"Bye");
    };

    NSArray *blocks = @[hiBlock, byeBlock];
    (void (^)(void))blocks[0]();

A: Consider using a typedef to make your life easier.  The following works:
typedef void (^HiBlockType)();

HiBlockType hiBlock = ^{ NSLog(@"Hi"); };
HiBlockType byeBlock = ^{ NSLog(@"Bye"); };

NSArray *blocks = @[ hiBlock, byeBlock ];
((HiBlockType)blocks[0])();

Also note that this is essentially dispatch_block_t, so you could just use that instead of HiBlockType.


text:
Q: Simplifying an Expression in Python I feel there must be a simpler/cleaner/faster (choose one or more) way to write this expression...
take a BigString = "This is a long sentence about a red cat named dude."
and LittleStringList = [ "red dog", "red cat", "red mouse" ]
I effectively want a function/expression that returns true when one of LittleStringList is in BigString. I wrote it like this:
def listcontains(list, big):
    contains = False
    for string in list:
        if string in big:
            contains = True
        else:
            pass
    return contains

Any help is appreciated! Thanks.
edit: Fixed a small error!

A: use any():
>>> BigString = "This is a long sentence about a red cat named dude."
>>> LittleStringList = [ "red dog", "red cat", "red mouse" ]
>>> any([str in BigString for str in LittleStringList])
True

>>> BigString = "This is a long sentence about a red bear named dude."
>>> any([str in BigString for str in LittleStringList])
False

A: any([s in BigString for s in LittleStringList])
or even better using a generator expression - as pointed out by @GWW:
any(s in BigString for s in LittleStringList)

A: I assume you mean if string in big?
Maybe then try:
def listcontains(list, big):
    return any([string in big for string in list])

Or a version with a generator:
def listcontains(list, big):
    def gen():
        for s in list:
            yield s in big
    return any(gen())

A: *

*You don't need to go thru whole list, return on first match

*Do not use string as variable name, it is a module, str is a type, better word would be word.

*Do not use list as variable name

*You are looping on list and checking again in list, instead of big

so
def listcontains(words, big):
    for word in words:
        if word in big:
            return True
    return False

A: To shorten it a little you could instead write:
def listcontains(list, big):
    for s in list:
        if s in big:
            return True
    return False

A: any(filter(lambda x: x in BigString, LittleStringList))
filter will return a list with LittleStringList words inside BigString and any will return true if filter returns a list with some occurence


text:
Q: Can't get the Airconsole quickstart instructions to work I've created a new game/ directory on my webhost, and created and copy/pasted to the controller and screen html files as instructed at http://developers.airconsole.com/#/getting_started, but the game just comes up as a blank screen when I test it at http://www.airconsole.com/simulator/#(myurl)/game/ (tried both with and without "simulator")
Any suggestions as to what might be causing the issue?
I can access both files in my web browser, and I've verified that the javascript is visible in the source of both, so it doesn't seem to be a permissions issue or problem with the content of the file.
Thanks very much in advance!

A: The getting started guide has been updated (including the examples) since you've posted this question.
Feel free to reply to this message if it still doesn't work for you.


text:
Q: Comparing the NSString dates keys in an NSArray I was wondering how would I express the non-matching dates values in Xcode, for example I have this two buttons one to present today's events and the other to present future events, I managed to code the first button which is loading today's events, But i don't know how to do it for future events like how to say "if the date of the event does not match the date on the calendar, then load these events"??
Below, is some of my code for my todaysEvents button,
 @property (strong, nonatomic) NSArray *dateEvents;
 @end

 @implementation HomeViewController {
      NSArray *_events;
      NSArray *_dateEvents;
      NSMutableArray *displayedEvents;
 }

- (IBAction)todaysEvents:(id)sender {

     [_pendingOperations.downloadQueue cancelAllOperations];

     [displayedEvents removeAllObjects];

     NSDate *currDate = [NSDate date];
     NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
     [dateFormatter setDateFormat:@"dd-MM-YYYY"];
     NSString *dateString = [dateFormatter stringFromDate:currDate];

     [displayedEvents addObjectsFromArray:[_events filteredArrayUsingPredicate:[NSPredicate
                       predicateWithBlock:^BOOL(Events * event, NSDictionary *bindings)
                       {
                            NSLog(@"%@ ?= %@", event.date , dateString);
                           return [event.date isEqualToString:dateString];
                       }]]];

     NSLog(@"%@", displayedEvents);

     [self.myTableView reloadData];
}

A: If you are trying to simply compare strings, then use the following code:
if([string1 isEqualToString:string2])
{
     //The strings are equal, do something here
}

UPDATE: Since you are trying to check for 2 strings that are not equal, simply add the not operator(!). Like so:
 if(![string1 isEqualToString:string2])
{
     //The strings are equal, do something here
}

A: You've created a predicate that matches today's date. You're using a date formatter to generate a date string with month day and year, and then matching the date string of toaday's date to a date string from your _events array, which isn't a very flexible way of doing it, but it works.
If now you only want to select dates other than today, simply change your predate to read:
[displayedEvents addObjectsFromArray:[_events filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(Events * event, NSDictionary *bindings)
{
  NSLog(@"%@ ?= %@", event.date , dateString);
  return ![event.date isEqualToString:dateString];
}

(I just added a "!" to the return statement to match all dates EXCEPT today.)
If instead you want to match all dates AFTER today (future dates, as you suggest in your text) then you'll need to change your method of matching dates. You'll want to use NSCalendar and probably the method components:fromDate:toDate:options: with a components value of NSDayCalendarUnit, and options of 0 (do not wrap). That will let you calculate the number of days difference between the current date and a date from your array. You could use that to create a predicate that only selects dates that are at least 1 day greater than the current date.
That should be enough for you to solve your problem.


text:
Q: Why my below code giving java.lang.StackOverflowError exception? I cant understand, why is my code giving java.lang.StackOverflowError exception? And can someone give a brief idea about why java.lang.StackOverflowError exception came?
public class BasicProg {

    BasicProg b = new BasicProg();

    int show() {

        return (true ? null : 0);
    }

    public static void main(String[] args) {
        BasicProg b = new BasicProg();
        System.out.println(b.show());
    }

}

A: You are getting recursion because the constructor for the basicProg class is being called an infinite number of times.
public class basicProg {
   // everytime a new basicProg object is created, another one will
   // be created here, and so on...
   basicProg b = new basicProg();

    int show() {
        return (true ? null : 0);
    }

    public static void main(String[] args) {
        basicProg b = new basicProg();
        System.out.println(b.show());
   }
}

I don't know why your basicProg class even has that reference.  If you remove it, and make a few changes, your code should behave as expected:
public class BasicProg {
    public Integer show() {
        return (true ? null : 0);
    }

    public static void main(String[] args) {
        BasicProg b = new BasicProg();
        Integer result = b.show();
        System.out.println(result == null ? "null" : result.toString());
   }
}

A: You have a class member b which is instanciated when you create a new instance of basicProg.
And that will call new basicProg() which created a new Instance and instantiate b and so on. Thats why you get the StackOverflowError.
BTW. Java naming convention says, that classnames should start with an uppercase character

A: Because in your BasicProg Class object is created recursive. here doc
A stack is the part of the memory. The local automatic variable is created on this stack and method arguments are passed. When a process starts, it get a default stack size which is fixed for each process.  In today's operating system, generally, the default stack size is 1 Mb, which is enough for most of the process. Under abnormal condition, the stack limit exceeds. This is known as stack overflow.
The two most common reason :

*

*Infinite recursion
 int f(){
            g();
            }
            int g() {
            f();
            }

*Allocating size greater than stack's limit

public int test(){

int x[10000000]; // array is too large

int y =0; //y's address exceeds the stack's limits, error

}


text:
Q: iphone uitabbar menu option rather than view I have a tab bar controller with 6 tabs. The 6th tab I want to simply do an action (like rate this app) and not move to a new view.
The tab bar elements need to have a view object, so is there any way I can work around this to directly call a selector which will perform an action.
EDIT:
Here is the selector I would like to call from my 6th tab and continue remain on the current view.
-(void)action_rateThisApp:(id)sender {

NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str];
str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];

// Here is the app id from itunesconnect
// http://itunes.apple.com/us/app/cricbuzz-cricket-scores-news/id360466413?mt=8
str = [NSString stringWithFormat:@"%@360466413", str];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

A: You can implement the delegate function
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

To intercept the tab bar item touch. From there you can do whatever you want. You can generate the interface view you want for rating your app and add it to your main window (so that it is superimposed on the current view, whichever tab you are currently on).


text:
Q: VLOOKUP with a dynamic range in Excel I'm trying to use VLookup in excel on a range that's changing according to a reference number.
I've attached an image as it's far easier to understand.
http://tinypic.com/r/20h53ls/8
What I am attempting is to get the values of item no 1, 2, 3 etc and place them horizontally. However the range (which is defined by the ref) changes.
So in the image I am try to get the value of 1 (which is 21) and place it into E3. I want the value of 1 to be placed all the way down column E until we reach the new ref no. Then the value of 1 is 11. And so on with 2, 3, 4...
I've tried different combinations of MATCH and INDIRECT to try and define the range but without any success.
If anyone has any ideas I would love your thoughts.
Many thanks.


text:
Q: Systematic brute-force searches for counterexamples This is getting nowhere on math.stackexchange.com, so I'm putting it here.
Gödel's completeness theorem says that for every statement in first-order predicate calculus with equality, there is either a proof that it holds in all structures, or a counterexample --- a structure in which it does not hold.  What seems often insufficiently emphasized is the connection with computability: there is an efficient proof-checking algorithm.  Without that, the conclusion would be of far less interest than it is!  (Especially since one could just declare every universally valid formula to be a proof of itself.  Then one would have absolutely no way of knowing what's a valid proof and what's not, but the conclusion of the theorem would still be true.)
Another theorem discovered in the '30s is that although there's a proof-checking algorithm for this situation, there's only half of a proof-finding algorithm:

*

*One can search systematically for a proof in such a manner that if one exists, then one will find it.

*But after a trillion years of searching without success, there's no way to know that it won't show up ten minutes later, nor that it will.

Both of the bulleted points were proved in the '30s.  (Is "Church's theorem" the conventional name for the conjunction of the two bulleted items, or only the second one, or what?  Right now I'm not sure.)
I think there's a vast literature on the computational efficiency (or lack of efficiency?) of these searches for proofs.  Is there a literature on systematic brute-force searches for counterexamples?  Such counterexamples would be structures in which a proposed first-order sentence is false.

A: Alg enumerates finite models of single-sorted first-order theories. It can find counter-examples, obviously, as we can just add the negation of the statement we wish to violate. My experience with this sort of thing is that it basically amounts to solving a satisfiability problem, so all the theory about SAT solvers might be relevant here.
For the general problem of finding a (possibly infinite) counter-model I have nothing intelligent to say. Well, I do. In order to talk about computability, we need to first specify what it means for a computer to "find" an infinite model. This leads to the question on how to represent infinite models, and at that point you're doing effective model theory.

A: Proofs are finite objects, so you can search for proofs systematically.
Counterexamples may be infinite models, so you can't search for them in the same way.
Thus a complete positive result seems unlikely.
Example 1:  Are the axioms of Peano arithmetic consistent with the infinite set of sentences $\exists x. n=Sx, \exists x. n=SSx, \exists x. n=SSSx, \ldots$?  You can't derive a contradiction from them, but you also won't find a counterexample by search because non-standard models of Peano arithmetic are non-recursive.
Example 2:  Lerman and Schmerl came up with a sentence $\phi$ in the theory of trees with no recursive models.  So counterexamples to $\phi\rightarrow\psi$ also won't show up in any ordinary type of search.

A: This is somewhat tangential to your specific query, but perhaps not entirely irrelevant.
There has been considerable progress in the subdomain of geometry theorems,
some of whose provers proceed by searching for and eliminating possible counterexamples.
I am no expert, but permit me to cite three references, separated by about a decade
each, to indicate the continued progress in this subarea:

1988: Chou, Shang-Ching. Mechanical geometry theorem proving. Vol. 41. Springer, 1988.
  (Springer link)

     p.109: Five Gauss lines are concurrent: A "possibly new theorem" [in 1988].
2001: Jacques Fleuriot. "Geometry Theorem Proving."
  2001, pp 11-30. A survey.
  (Springer link)
2011: Stojanović, Sana, Vesna Pavlović, and Predrag Janičić. "A coherent logic based geometry theorem prover capable of producing formal and readable proofs." Automated Deduction in Geometry. Springer Berlin Heidelberg, 2011. 201-220. (Springer link)

      Ulrik Buchholtz talk slides PDF download, 2010.


text:
Q: PageLines theme: how to change the background color of the main content vs. entire page? I use PageLines free version, with WordPress 3.3.1, for this website: http://new.teleosis.org/?page_id=76
I want the background color of the whole page to be light green, and the background color of my content area to be white.

*

*I configure the Page Background Color in the PageLines settings, which affects the whole page. Whereas Body Background Color affects what they call the "Page content areas" like the footer.

*But I don't find the setting to change the background of a page body, is it even available in PageLines?
I hope I don't have to go into the CSS files for such a simple thing, but if I do, I appreciate any suggestions regarding which CSS file to modify and which properties to change/add. Thank you!

A: Looking at your code, this is a very very VERY bloated theme.  Seriously, there's no reason a page that simple should take over 4 seconds to fully load.
In addition to the "way too many nested DIV's" issue, areas above and below the header menu span the entire page, so you can't actually change just that section of the header to white background.
From the looks of things, this theme creates its CSS dynamically on page load, so chances are it's going to be a hassle to fix.  I would really recommend you find a different theme that's easier to CSS edit, because any time you want to change something that's not in the "Theme Options" you're going to run into issues.
I know this isn't the answer you were hoping for, but you've kinda backed yourself into a corner with your theme choice.

A: The easy CSS fix is this:
#pagelines_content{background:#0000ff;}

You can plug this into the custom code in your WP Dashboard at PageLines > Settings > Custom Code > CSS Rules.
This is NOT their recommended way, but a very straightforward way to do it.


text:
Q: Flex formatting byte to MB, GB, TB, etc. in AdvancedDataGrid column that uses Summaries Before anyone answers the question I already have the code that converts from bytes to MB, GB, TB, etc., it is below:
private var _levels:Array = [ 'bytes','Kb','MB','GB','TB','PB','EB','ZB','YB'];

private function convertSize(bytes:Number):String
{
    var index:uint = Math.floor(Math.log(bytes) / Math.log(1024));
    return (bytes / Math.pow(1024, index)).toFixed(2)+" "+this._levels[index];
}

I have the following AdvancedDataGrid:
<mx:AdvancedDataGrid id="albumTree" width="100%" height="100%" sortExpertMode="true" useHandCursor="true" buttonMode="true">
    <mx:dataProvider>
        <mx:GroupingCollection id="gcQuote" source="{albums}">
            <mx:grouping>
                <mx:Grouping>
                    <mx:GroupingField name="foldername" compareFunction="positionCompareFunction">
                        <mx:summaries>
                            <mx:SummaryRow summaryPlacement="group">
                                <mx:fields>
                                    <mx:SummaryField dataField="totalunpublished" operation="SUM" />
                                </mx:fields>
                            </mx:SummaryRow>
                        </mx:summaries>
                    </mx:GroupingField>
                </mx:Grouping>
            </mx:grouping>
        </mx:GroupingCollection>
    </mx:dataProvider>
    <mx:columns>
        <mx:AdvancedDataGridColumn dataField="name" sortCompareFunction="positionCompareFunction" headerText="Folder/Album" />
        <mx:AdvancedDataGridColumn width="80" dataField="totalunpublished" headerText="Photo Usage" />
    </mx:columns>
</mx:AdvancedDataGrid>

I am trying to format the totalunpublished column to be formatted using the convertSize function.  Right now I have something similar to these values:
2302869
24901163
1890295725
1120056357856
But would like them to look something like this:
17.57 MB
189.98 MB
1.76 GB
1.02 TB
Any help in getting this accomplished would be greatly appreciated.

A: I think labelFunction will be helpfull
<mx:AdvancedDataGridColumn width="80" dataField="totalunpublished" headerText="Photo Usage" labelFunction="convertSize"/>

and the function is(By this)
private var _levels:Array = [ 'bytes','Kb','MB','GB','TB','PB','EB','ZB','YB'];
private function convertSize(data:Object, column:AdvancedDataGridColumn):String
{
     var bytes:Number=data[column.dataField];
    var index:uint = Math.floor(Math.log(bytes) / Math.log(1024));
    return (bytes / Math.pow(1024, index)).toFixed(2)+" "+this._levels[index];
}