问:
How to convert a PowerPoint file to wiki markup?
In order to make PowerPoint presentations 1. readable, and 2. searchable, I'd like to somehow convert them to wiki markup (we're using ScrewTurn).

I'm expecting some manual steps.

One idea was to upload a slide as a PDF to Google Docs and make it use its native doc format, and then use Google's HTML in I love wiki, but Google Docs erred when trying to convert the PDF file.

答: Just an idea...Not very sure about the feasibility. Maybe you can export the contents of slides by using VBA to a plain text file and just add some simple wiki markup for titiles, sections... if you don't care much about the font, style, pictures in it. I guess VBA can provide easy way to traverse and judge the objects in PowerPoint slides easier.</p>


来源: stackexchange

问:
jQuery AutoComplete Fill Array
I'm attempting to use jQuery's autocomplete feature, and after reading several posts I still have two questions:

1)  I've gotten autocomplete to work with the code posted at the bottom, however I need the array titled "data" to be filled from our database.  I've been trying to use different methods to fill this via AJAX.  I tried using $.get and $.ajax.  What is the correct syntax to accomplish this?

2)  This array will be big, I will have 60,000 plus values if I just fill the array once.  I was wondering if it's possible to perform an AJAX request to fill the array every-time the user enters a new letter?  Is this better to do, or just fill the array with all values at once?  By better, which taxes the system less?

```<code>//This code works
<script type="text/javascript">
  $(document).ready(function(){
  var data = "Facebook Gowalla Foursquare".split(" ");
  $("#search_company").autocomplete(data);
  });
</script>

//display company live search
echo('<form id="form" method="post" action="competitor_unlink.php" onsubmit="return">');
echo('Company: <input id="search_company"/>');
echo('<br/>');
echo('<button type="submit" value="Submit">Submit</button>');
echo('</form>');
</code>```

答:
You're correct that sending the whole 60,000-record list to the client's machine doesn't sound like the best solution. You'll notice that Google only shows you a handful of the most popular matches in its autocomplete, as to many other websites.

You could shorten the list by waiting for the user to type two or three letters instead of searching on the first one.

You could do page chunking in the list (it goes by various names). That is, only return the top 10 or 15 matches. The user can get more of the list by scrolling or by clicking on a "Show More Results" link. You have to write (or search for) all the javascript code for this, of course.

ContentLicense: CC BY-SA 2.5

Title: jQuery AutoComplete Fill Array

Body:
I'm attempting to use jQuery's autocomplete feature, and after reading several posts I still have two questions:

1)  I've gotten autocomplete to work with the code posted at the bottom, however I need the array titled "data" to be filled from our database.  I've been trying to use different methods to fill this via AJAX.  I tried using $.get and $.ajax.  What is the correct syntax to accomplish this?

2)  This array will be big, I will have 60,000 plus values if I just fill the array once.  I was wondering if it's possible to perform an AJAX request to fill the array every-time the user enters a new letter?  Is this better to do, or just fill the array with all values at once?  By better, which taxes the system less?

//This code works

//display company live search
echo('<form id="form" method="post" action="competitor_unlink.php" onsubmit="return">');
echo('Company: <input id="search_company"/>');
echo('
');
echo('<button type="submit" value="Submit">Submit</button>');
echo('</form>');


问:
Date format issue between ssl & non-ssl site. IIS & asp.net
IIS 10 , Windows Server 2016

I have a strange issue & am finding it hard to diagnose..

I have a website which is on SSL.

I have the same website codebase which is on same server but on a different port but which is not on ssl.

Now :
1) From Normal Website When I am sending date as 23/06/2017. It is being saved properly in the format which i want.

2) However, From the ssl website, When I am sending date as 23/06/2017, I get this error.

Error converting data type nvarchar to datetime.

I need some help as to how do i diagnose this issue. Only difference is the presence of a ssl certificate.

The result of this code is being sent to a stored procedure as a parameter.

```<code>DateTime.ParseExact("23/06/2017", "d/M/yyyy", null).ToString("MM/dd/yyyy")
</code>```

答:
This should not actually be called an answer. it is just a patch.
As per comments I have removed the .ToString & now my code looks like.

```<code>DateTime.ParseExact("23/06/2017", "d/M/yyyy", null)
</code>```

The same code base pointing to the same database & same stored procedure in the same server making a difference in just ssl. this needs to be searched..

ContentLicense: CC BY-SA 3.0

Body:
IIS 10 , Windows Server 2016

I have a strange issue & am finding it hard to diagnose..

I have a website which is on SSL.

I have the same website codebase which is on same server but on a different port but which is not on ssl.

Now :
1) From Normal Website When I am sending date as 23/06/2017. It is being saved properly in the format which i want.

2) However, From the ssl website, When I am sending date as 23/06/2017, I get this error.

Error converting data type nvarchar to datetime.

I need some help as to how do i diagnose this issue. Only difference is the presence of a ssl certificate.

The result of this code is being sent to a stored procedure as a parameter.

DateTime.ParseExact("23/06/2017", "d/M/yyyy", null).ToString("MM/dd/yyyy")

Body:
This should not actually be called an answer. it is just a patch.
As per comments I have removed the .ToString & now my code looks like.

DateTime.ParseExact("23/06/2017", "d/M/yyyy", null)

The same code base pointing to the same database & same stored procedure in the same server making a difference in just ssl. this needs to be searched..


问:
How to create responsive div in image?
I am trying to create a responsive container which contains an image and a div with some text over the image. Something like this:

.tileimage {
  position: absolute;
  width: 100%;
  height:auto;
  color: white;
}

.tileseven {
  position: absolute;
  width: 100%;
  height:auto;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div className="container">
  <img className="col-lg-12 tileimage" src="./tile.jpg" alt=""/>
  <div className="col-lg-12 tileseven">
      <img className="" src="./logo.png" alt=""/>
      <p>this is some text</p>
  </div>
</div></code>```

How can I make the logo.png responsive? When I resize the browser the image is resized but not the logo? Also how can I keep the div.tileseven superimposed over the image at the bottom?

答:
Take a look at this!!!Try to test this.
//

<!DOCTYPE html>

Responsive Image Gallery

Resize the browser window to see the effect.

Add a description of the image here

Add a description of the image here

Add a description of the image here

Add a description of the image here

This example use media queries to re-arrange the images on different screen sizes: for screens larger than 700px wide, it will show four images side by side, for screens smaller than 700px, it will show two images side by side. For screens smaller than 500px, the images will stack vertically (100%).

```

Title: How to create responsive div in image?

Body:
I am trying to create a responsive container which contains an image and a div with some text over the image. Something like this:

.tileimage {
  position: absolute;
  width: 100%;
  height:auto;
  color: white;
}

.tileseven {
  position: absolute;
  width: 100%;
  height:auto;
}

this is some text

How can I make the logo.png responsive? When I resize the browser the image is resized but not the logo? Also how can I keep the div.tileseven superimposed over the image at the bottom?

Body:
Take a look at this!!!Try to test this.
//

<!DOCTYPE html>
<html>
<head>
<style>
  div.gallery {
      border: 1px solid #ccc;
  }

  div.gallery:hover {
      border: 1px solid #777;
  }

  div.gallery img {
      width: 100%;
      height: auto;
  }

  div.desc {
      padding: 15px;
      text-align: center;
  }

  * {
      box-sizing: border-box;
  }

  .responsive {
      padding: 0 6px;
      float: left;
      width: 24.99999%;
  }

  @media only screen and (max-width: 700px){
      .responsive {
          width: 49.99999%;
          margin: 6px 0;
      }
  }

  @media only screen and (max-width: 500px){
      .responsive {
          width: 100%;
      }
  }

  .clearfix:after {
      content: "";
      display: table;
      clear: both;
  }
</style>
</head>
<body>

  <h2>Responsive Image Gallery</h2>
  <h4>Resize the browser window to see the effect.</h4>

  <div class="responsive">
    <div class="gallery">
      <a target="_blank" href="img_fjords.jpg">
        <img src="img_fjords.jpg" alt="Trolltunga Norway" width="300" height="200">
      </a>
      <div class="desc">Add a description of the image here</div>
    </div>
  </div>

  <div class="responsive">
    <div class="gallery">
      <a target="_blank" href="img_forest.jpg">
        <img src="img_forest.jpg" alt="Forest" width="600" height="400">
      </a>
      <div class="desc">Add a description of the image here</div>
    </div>
  </div>

  <div class="responsive">
    <div class="gallery">
      <a target="_blank" href="img_lights.jpg">
        <img src="img_lights.jpg" alt="Northern Lights" width="600" height="400">
      </a>
      <div class="desc">Add a description of the image here</div>
    </div>
  </div>

  <div class="responsive">
    <div class="gallery">
      <a target="_blank" href="img_mountains.jpg">
        <img src="img_mountains.jpg" alt="Mountains" width="600" height="400">
      </a>
      <div class="desc">Add a description of the image here</div>
    </div>
  </div>

  <div class="clearfix"></div>

  <div style="padding:6px;">
    <p>This example use media queries to re-arrange the images on different screen sizes: for screens larger than 700px wide, it will show four images side by side, for screens smaller than 700px, it will show two images side by side. For screens smaller than 500px, the images will stack vertically (100%).</p>
  </div>
</body>
</html>


问:
Enable Clear Filter on Protected Sheet's Excel Ribbon
Even though Microsoft says that it's not possible: Can't clear auto filter in protected sheet, I am still thinking that somehow this should be possible. At least I hope.

I know that I can clear filters from columns one by one, but I want users to be able to click that Clear feature on the Ribbon/Sort&Filter section. (Currently it's disabled / greyed out)

There are many questions on the internet but none of them is useful honestly. Is there any possibility?

I tried defining Worksheet_Change event to Unprotect Sheet but that is not sensible at all because it slows down my worksheet and I wasn't able to find correct condition to define into Worksheet_Change. In this example it was running whenever $:$ rows are selected . So I need another smart suggestion.

答:
You do not need to unprotect the sheet to clear the filter. Simply paste this macro in a module

```<code>Sub ClearFilter()
    Dim ws As Worksheet
    Set ws = ActiveSheet

    ws.AutoFilter.ShowAllData
End Sub
</code>```

And then assign a shortcut key to it.

Now when you press CTRL+SHIFT+C, you will see Autofilter data is reset.

Body:
You do not need to unprotect the sheet to clear the filter. Simply paste this macro in a module

Sub ClearFilter()
    Dim ws As Worksheet
    Set ws = ActiveSheet

    ws.AutoFilter.ShowAllData
End Sub

And then assign a shortcut key to it.

Now when you press CTRL+SHIFT+C, you will see Autofilter data is reset.


问:
How to prevent Sql-Injection on User-Generated Sql Queries
I have a project (private, ASP.net website, password protected with https) where one of the requirements is that the user be able to enter Sql queries that will directly query the database. I need to be able to allow these queries, while preventing them from doing damage to the database itself, and from accessing or updating data that they shouldn't be able to access/update.

I have come up with the following rules for implementation:

Use a db user that only has permission for Select Table/View and Update Table (thus any other commands like drop/alter/truncate/insert/delete will just not run).

Verify that the statement begins with the words "Select" or "Update"

Verify (using Regex) that there are no instances of semi-colons in the statement that are not surrounded by single-quotes, white space and letters. (The thought here is that the only way that they could include a second query would be to end the first with a semi-colon that is not part of an input string).

Verify (using Regex) that the user has permission to access the tables being queried/updated, included in joins, etc. This includes any subqueries. (Part of the way that this will be accomplished is that the user will be using a set of table names that do not actually exist in the database, part of the query parsing will be to substitute in the correct corresponding table names into the query).

Am I missing anything?

The goal is that the users be able to query/update tables to which they have access in any way that they see fit, and to prevent any accidental or malicious attempts to damage the db. (And since a requirement is that the user generate the sql, I have no way to parametrize the query or sanitize it using any built-in tools that I know of).

答:
what about this stuff, just imagine the select is an EXEC</p>

```<code>select convert(varchar(50),0x64726F70207461626C652061)
</code>```

OwnerDisplayName: Yaakov Ellis

LastEditorDisplayName: Yaakov Ellis

Body:
what about this stuff, just imagine the select is an EXEC

select convert(varchar(50),0x64726F70207461626C652061)

OwnerDisplayName: SQLMenace


问:
Tortoise SVN auto lock
Is there a way to have tortoise svn automatically lockdown files when you check them out, with out having to check them out and then lock down the files you want?

Also, is there a way to not allow other people to checkout any files if they are locked down? Right now it lets them checkout the locked files, edit them, and then when they go to commit the files it gives them an error that they are locked.

Thanks!

答:
This is sort of a non-answer, but Subversion (SVN) isn't a Lock-Modify-Unlock system, it's a Copy-Modify-Merge system, although it does provide the locking feature for stuff that can't be readily merged (like images, certain types of datasets, Office documents, etc).

In general, you don't want to restrict developers from having the ability to modify chunks of source code as it leads to all sorts of versioning, semantic incompatibility, and work concurrency problems between developers. If you're trying to lock source code, I highly suggest you reread Subversion or TortoiseSVN's help documentation to better understand how and why this is the case. Tortoise's built in help is really superb (available from the TortoiseSVN context menu).

Title: Tortoise SVN auto lock


问:
Accordion in Javascript
I want to implement a simple accordion to my page, so I browsed w3schools and found the tutorial. But in it's javascript code there is a for loop that I can't understand what is does. can anyone explain it?
here is the code:

```<code>var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}
</code>```

and here is the link to actual w3schools page:
https://www.w3schools.com/howto/howto_js_accordion.asp

答:
This for loop is used to uniquely identify the onlick operation for each accordion element.

This is used to get all the elements from the page with class as accordion

```<code>var acc = document.getElementsByClassName("accordion");
</code>```

As there are multiple elements with the name accordion so now you start iterating over each element of the of the acc variable

```<code>var i;
for (i = 0; i < acc.length; i++) {
</code>```

Now for each element in the acc array you define a onclick operation and set the toggle element for it.
    acc[i].onclick = function(){

Change the toggle class to active for the selected accordion and toggle the panel to block/none on each click of the accordion.

```<code>        this.classList.toggle("active");
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}
</script>
</code>```

Hope this helps..:)

Title: Accordion in Javascript

Body:
I want to implement a simple accordion to my page, so I browsed w3schools and found the tutorial. But in it's javascript code there is a for loop that I can't understand what is does. can anyone explain it?
here is the code:

var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}

and here is the link to actual w3schools page:
https://www.w3schools.com/howto/howto_js_accordion.asp

Body:
This for loop is used to uniquely identify the onlick operation for each accordion element.

This is used to get all the elements from the page with class as accordion

var acc = document.getElementsByClassName("accordion");

As there are multiple elements with the name accordion so now you start iterating over each element of the of the acc variable

var i;
for (i = 0; i < acc.length; i++) {

Now for each element in the acc array you define a onclick operation and set the toggle element for it.
    acc[i].onclick = function(){

Change the toggle class to active for the selected accordion and toggle the panel to block/none on each click of the accordion.

        this.classList.toggle("active");
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}
</script>

Hope this helps..:)


问:
How to select a variable with an input and change its value in python(2.7)
How could I select a variable with an input and than change its value,
this is the best that I could come up with but it doesn't seem to work.

```<code>itm1 = 1
itm2 = 1
x = raw_input()
x += 1
print (itm1)
</code>```

I'm trying to get it so that anyone of the variables could be changed depending on the input.

答:
What do you want to do exactly?

If you want to add the input value to an existing variable you can just do this:

```<code>itm1 = 1
itm2 = 1
x = raw_input()
itm1 += x
print (itm1)
</code>```

Your question is unclear regarding the aim.
If you want to select one variable to change depending on the input, you can try this:

```<code>itm = [1, 1]
x = raw_input()
itm[x] += 1
print(itm[x])
</code>```

Of course this assumes you're entering a value in the bounds of the aray indices.

Or you can define a dictionary

```<code>y = {"itm1": 1, "itm2": 1}
x = raw_input()
y[x] += 1
print( y[x] )
</code>```

Body:
How could I select a variable with an input and than change its value,
this is the best that I could come up with but it doesn't seem to work.

itm1 = 1
itm2 = 1
x = raw_input()
x += 1
print (itm1)

I'm trying to get it so that anyone of the variables could be changed depending on the input.

Body:
What do you want to do exactly?

If you want to add the input value to an existing variable you can just do this:

itm1 = 1
itm2 = 1
x = raw_input()
itm1 += x
print (itm1)

Your question is unclear regarding the aim.
If you want to select one variable to change depending on the input, you can try this:

itm = [1, 1]
x = raw_input()
itm[x] += 1
print(itm[x])

Of course this assumes you're entering a value in the bounds of the aray indices.

Or you can define a dictionary

y = {"itm1": 1, "itm2": 1}
x = raw_input()
y[x] += 1
print( y[x] )


答:
For the resizing of the logo you will need to reference the image not just the containing div

```<code>.tileseven img {
     height: auto;
     width: 100%;
 }
</code>```

as for keeping it on top, you could always throw a z-index in there.

Title: How to create responsive div in image?

Body:
For the resizing of the logo you will need to reference the image not just the containing div

.tileseven img {
     height: auto;
     width: 100%;
 }

as for keeping it on top, you could always throw a z-index in there.


问:
Create an iterator from a single element
I would like to prepend an element to an iterator. Specifically, I would like to create an iterator that steps through the sequence [2, 3, 5, 7, 9, ...] up to some maximum. The best I've been able to come up with is

```<code>range_step_inclusive(2,2,1).chain(range_step_inclusive(3, max, 2))
</code>```

But the first iterator is kind of a hack to get the single element 2 as an iterator. Is there a more idiomatic way of creating a single-element iterator (or of prepending an element to an iterator)?

答:
This is the exact use case of std::iter::once.

Creates an iterator that yields an element exactly once.

This is commonly used to adapt a single value into a chain of other kinds of iteration. Maybe you have an iterator that covers almost everything, but you need an extra special case. Maybe you have a function which works on iterators, but you only need to process one value.

range_step_inclusive is long gone, so let's also use the inclusive range syntax (..=):

```<code>iter::once(2).chain((3..=max).step_by(2))
</code>```

Body:
I would like to prepend an element to an iterator. Specifically, I would like to create an iterator that steps through the sequence [2, 3, 5, 7, 9, ...] up to some maximum. The best I've been able to come up with is

range_step_inclusive(2,2,1).chain(range_step_inclusive(3, max, 2))

But the first iterator is kind of a hack to get the single element 2 as an iterator. Is there a more idiomatic way of creating a single-element iterator (or of prepending an element to an iterator)?

Body:
This is the exact use case of std::iter::once.

Creates an iterator that yields an element exactly once.

This is commonly used to adapt a single value into a chain of other kinds of iteration. Maybe you have an iterator that covers almost everything, but you need an extra special case. Maybe you have a function which works on iterators, but you only need to process one value.

range_step_inclusive is long gone, so let's also use the inclusive range syntax (..=):

iter::once(2).chain((3..=max).step_by(2))

ContentLicense: CC BY-SA 4.0


问:
Working with MultiLevel XML in C# and SQL Server
I have a client API which sends me an XML in the following format. I have to change few values and send the same XML to my client's another API. What is the best possible way to do it. We are currently using SQL Server 2014 and C#.

```<code><?xml version="1.0"?>
<JobPositionPostings>
    <JobPositionPosting>
        <JobAction>ADD</JobAction>
        <JobType>p</JobType>
        <JobPositionPostingID>27</JobPositionPostingID>
        <HiringOrg>
            <HiringOrgName>Company Name</HiringOrgName>
            <Industry>
                <SummaryText>Brief description of the hiring organization</SummaryText>
            </Industry>
            <Contact>
                <PersonName>
                    <FormattedName>Name of the Hiring Contact</FormattedName>
                </PersonName>
            </Contact>
        </HiringOrg>
        <JobDisplayOptions>
            <MicrositeName>Client Microsite Name</MicrositeName>
            <TemplateName>Client Template Name</TemplateName>
        </JobDisplayOptions>
        <JobPositionInformation>
            <JobPositionTitle>R and D manager #2 banglore</JobPositionTitle>
            <JobClassifications>
                <PrimaryJobCategory>
                    <JobIndustryCode>7</JobIndustryCode>
                    <JobFunctionCode>8</JobFunctionCode>
                    <JobRoleCode>8.31</JobRoleCode>
                </PrimaryJobCategory>
            </JobClassifications>
            <JobPositionDescription>
                <JobKeywords>Java</JobKeywords>
                <JobPositionLocation>
                    <InterNationalLoc></InterNationalLoc>
                    <InterNationalLocOther></InterNationalLocOther>
                    <IndianLoc>25.30.159</IndianLoc>
                    <IndianLocOther></IndianLocOther>
                </JobPositionLocation>
                <CompensationDescription>
                    <Pay>
                        <SalaryCurrency>Rupees</SalaryCurrency>
                        <MinimumSalary>250000</MinimumSalary>
                        <MaximumSalary>325000</MaximumSalary>
                        <DisplaySalary>Y</DisplaySalary>
                    </Pay>
                    <BenifitsDescription>Job Benefits Description</BenifitsDescription>
                </CompensationDescription>
                <SummaryText>Job Description(brief about JD)</SummaryText>
            </JobPositionDescription>
            <JobPositionRequirements>
                <SummaryText>Desired Candidate Profile Summary Text - Required Competencies/Skills/Leadership E-mail
         </SummaryText>
                <JobExperience>
                    <MinimumExperience>2</MinimumExperience>
                    <MaximumExperience>4</MaximumExperience>
                </JobExperience>
                <JobQualifications>
                    <UGQualifications />
                    <UGSpecializations />
                    <PGQualifications />
                    <PGSpecializations />
                </JobQualifications>
            </JobPositionRequirements>
            <AddJobsToRefSite>true</AddJobsToRefSite>
            <ReferenceCode>Your Unique Job Reference code</ReferenceCode>
        </JobPositionInformation>
        <HowToApply>
            <ApplicationMethods>
                <ByEmail>
                    <E-mail>Client E-mail for Response Management , in case not using ATS Integration
           </E-mail>
                </ByEmail>
                <ByWeb>
                    <URL></URL>
                    <ApplyIntegration>1</ApplyIntegration>
                </ByWeb>
                <QUESTIONNAIRE>Standard Questionnaire name if you know the same, else contact your Account manager</QUESTIONNAIRE>
            </ApplicationMethods>
        </HowToApply>
        <ReferralDetails>
            <Amount> 1000</Amount>
            <Benefit>  gift voucher</Benefit>
        </ReferralDetails>
    </JobPositionPosting>
    <JobFeedResponseEmail>Tech person's E-mail for receiving Feed Status</JobFeedResponseEmail>
</JobPositionPostings>
</code>```

I am following the below approach. I replaced all the value fields in my XML with some variables by separating them with pipe(|) symbols. Please find below the replaced one.

```<code><?xml version="1.0"?>
<JobPositionPostings>
   <JobPositionPosting>
                    <JobAction>|JAct_M|</JobAction>
                    <JobPositionPostingID>|JID_M|</JobPositionPostingID>
                    <JobType>|JType_M|</JobType>
   <HiringOrg>
                    <WebSite>|JWebSite_N|</WebSite>
                    <HiringOrgName>|JComp_M|</HiringOrgName>
        <Industry>
                    <SummaryText>|JCompDesc_M|</SummaryText>
        </Industry>
    <Contact>
            <PersonName>
                    <FormattedName>|JContactName_N|</FormattedName>
            </PersonName>
    </Contact>
   </HiringOrg>
   <JobDisplayOptions>
                    <MicrositeName>|JMSite_S|</MicrositeName>
                    <TemplateName>|JTempl_N|</TemplateName>
   </JobDisplayOptions>
   <JobPositionInformation>
                    <JobPositionTitle>|JTitle_M|</JobPositionTitle>
       <JobClassifications>
            <PrimaryJobCategory>
                    <JobIndustryCode>|JIndustryCode_M|</JobIndustryCode>
                    <JobFunctionCode>|JFunCode_M|</JobFunctionCode>
                    <JobRoleCode>|JRoleCode_M|</JobRoleCode>
            </PrimaryJobCategory>
       </JobClassifications>
       <JobPositionDescription>
                    <JobKeywords>|JSkills_M|</JobKeywords>
            <JobPositionLocation>
                    <InterNationalLoc>|JIntlCode_M|</InterNationalLoc>
                    <InterNationalLocOther>|JIntlCodeOther_N|</InterNationalLocOther>
                    <IndianLoc>|JLocCode_M|</IndianLoc>
                    <IndianLocOther>|JLocOther_N|</IndianLocOther>
            </JobPositionLocation>
            <CompensationDescription>
                <Pay>
                        <SalaryCurrency>|JCurr_M|</SalaryCurrency>
                        <MinimumSalary>|JMinSal_M|</MinimumSalary>
                        <MaximumSalary>|JMaxSal_M|</MaximumSalary>
                        <DisplaySalary>|JSalDisp_N|</DisplaySalary>
                </Pay>
                    <BenifitsDescription>|JBenefits_N|</BenifitsDescription>
            </CompensationDescription>
                    <SummaryText>|JJD_M|</SummaryText>
       </JobPositionDescription>
       <JobPositionRequirements>
                    <SummaryText>|JDesCand_N|</SummaryText>
            <JobExperience>
                    <MinimumExperience>|JMinExp_M|</MinimumExperience>
                    <MaximumExperience>|JMaxExp_M|</MaximumExperience>
            </JobExperience>
            <JobQualifications>
                    <UGQualifications>|JQual1_M|</UGQualifications>
                    <UGSpecializations>|JSpec1_M|</UGSpecializations>
                    <PGQualifications>|JQual2_M|</PGQualifications>
                    <PGSpecializations>|JSpec2_M|</PGSpecializations>
                    <DoctorateQualifications>|JQual3_M|</DoctorateQualifications>
                    <DoctorateSpecializations>|JSpec3_M|</DoctorateSpecializations>
            </JobQualifications>
       </JobPositionRequirements>
                <AddJobsToRefSite>|JRefSite_N|</AddJobsToRefSite>
                <ReferenceCode>|JRefCode_N|</ReferenceCode>
    </JobPositionInformation>
    <HowToApply>
            <ApplicationMethods>
                <ByEmail>
                    <E-mail>|JLntMail_M|</E-mail>
                </ByEmail>
            <ByEapps>
                <Eapps>|JeApps_M|</Eapps>
            </ByEapps>
                <ByWeb>
                    <URL>|JURL_M|</URL>
                    <ApplyIntegration>|JAppInt_M|</ApplyIntegration>
                </ByWeb>
                <QUESTIONNAIRE>|JQuest_N|</QUESTIONNAIRE>
            </ApplicationMethods>
     </HowToApply>
     <ReferralDetails>
                        <Benefit>|JBenefit_N|</Benefit>
                        <Amount>|JBAmt_N|</Amount>
     </ReferralDetails>
  </JobPositionPosting>
                <JobFeedResponseEmail>|JFeedRespEmail_N|</JobFeedResponseEmail>
</JobPositionPostings>
</code>```

After that in SQL server I am replacing them with desired values and forwarding that XML to my client.

```<code>set @Nxml = replace(@Nxml, '|JAct_M|','Add')
set @Nxml = replace(@Nxml, '|JID_M|',@reqmt_id)
set @Nxml = replace(@Nxml, '|JType_M|','P')
</code>```

Is this best method or is there any other easy approach.
Thanks in advance.

答:
The best approach (only in the case that you should get xml, modify it and then pass by modified xml) would be to use XPathNavigator (example to change your JobAction):</p>

```<code>public static string UpdateJobAction(string inputXml)
    {
        var xmlDocument = new XmlDocument();
        xmlDocument.LoadXml(inputXml);

        var xpnavigator = xmlDocument.CreateNavigator();
        foreach (XPathNavigator xpn in xpnavigator.Select("//JobPositionPostings/JobPositionPosting/JobAction"))
        {
            var value = xpn.Value; // to obtain the JobAction value
            xpn.SetValue("Add");
        }
        return xpnavigator.OuterXml;
    }
</code>```

Body:
I have a client API which sends me an XML in the following format. I have to change few values and send the same XML to my client's another API. What is the best possible way to do it. We are currently using SQL Server 2014 and C#.

<?xml version="1.0"?>
<JobPositionPostings>
    <JobPositionPosting>
        <JobAction>ADD</JobAction>
        <JobType>p</JobType>
        <JobPositionPostingID>27</JobPositionPostingID>
        <HiringOrg>
            <HiringOrgName>Company Name</HiringOrgName>
            <Industry>
                <SummaryText>Brief description of the hiring organization</SummaryText>
            </Industry>
            <Contact>
                <PersonName>
                    <FormattedName>Name of the Hiring Contact</FormattedName>
                </PersonName>
            </Contact>
        </HiringOrg>
        <JobDisplayOptions>
            <MicrositeName>Client Microsite Name</MicrositeName>
            <TemplateName>Client Template Name</TemplateName>
        </JobDisplayOptions>
        <JobPositionInformation>
            <JobPositionTitle>R and D manager #2 banglore</JobPositionTitle>
            <JobClassifications>
                <PrimaryJobCategory>
                    <JobIndustryCode>7</JobIndustryCode>
                    <JobFunctionCode>8</JobFunctionCode>
                    <JobRoleCode>8.31</JobRoleCode>
                </PrimaryJobCategory>
            </JobClassifications>
            <JobPositionDescription>
                <JobKeywords>Java</JobKeywords>
                <JobPositionLocation>
                    <InterNationalLoc></InterNationalLoc>
                    <InterNationalLocOther></InterNationalLocOther>
                    <IndianLoc>25.30.159</IndianLoc>
                    <IndianLocOther></IndianLocOther>
                </JobPositionLocation>
                <CompensationDescription>
                    <Pay>
                        <SalaryCurrency>Rupees</SalaryCurrency>
                        <MinimumSalary>250000</MinimumSalary>
                        <MaximumSalary>325000</MaximumSalary>
                        <DisplaySalary>Y</DisplaySalary>
                    </Pay>
                    <BenifitsDescription>Job Benefits Description</BenifitsDescription>
                </CompensationDescription>
                <SummaryText>Job Description(brief about JD)</SummaryText>
            </JobPositionDescription>
            <JobPositionRequirements>
                <SummaryText>Desired Candidate Profile Summary Text - Required Competencies/Skills/Leadership E-mail
         </SummaryText>
                <JobExperience>
                    <MinimumExperience>2</MinimumExperience>
                    <MaximumExperience>4</MaximumExperience>
                </JobExperience>
                <JobQualifications>
                    <UGQualifications />
                    <UGSpecializations />
                    <PGQualifications />
                    <PGSpecializations />
                </JobQualifications>
            </JobPositionRequirements>
            <AddJobsToRefSite>true</AddJobsToRefSite>
            <ReferenceCode>Your Unique Job Reference code</ReferenceCode>
        </JobPositionInformation>
        <HowToApply>
            <ApplicationMethods>
                <ByEmail>
                    <E-mail>Client E-mail for Response Management , in case not using ATS Integration
           </E-mail>
                </ByEmail>
                <ByWeb>
                    <URL></URL>
                    <ApplyIntegration>1</ApplyIntegration>
                </ByWeb>
                <QUESTIONNAIRE>Standard Questionnaire name if you know the same, else contact your Account manager</QUESTIONNAIRE>
            </ApplicationMethods>
        </HowToApply>
        <ReferralDetails>
            <Amount> 1000</Amount>
            <Benefit>  gift voucher</Benefit>
        </ReferralDetails>
    </JobPositionPosting>
    <JobFeedResponseEmail>Tech person's E-mail for receiving Feed Status</JobFeedResponseEmail>
</JobPositionPostings>

I am following the below approach. I replaced all the value fields in my XML with some variables by separating them with pipe(|) symbols. Please find below the replaced one.

<?xml version="1.0"?>
<JobPositionPostings>
   <JobPositionPosting>
                    <JobAction>|JAct_M|</JobAction>
                    <JobPositionPostingID>|JID_M|</JobPositionPostingID>
                    <JobType>|JType_M|</JobType>
   <HiringOrg>
                    <WebSite>|JWebSite_N|</WebSite>
                    <HiringOrgName>|JComp_M|</HiringOrgName>
        <Industry>
                    <SummaryText>|JCompDesc_M|</SummaryText>
        </Industry>
    <Contact>
            <PersonName>
                    <FormattedName>|JContactName_N|</FormattedName>
            </PersonName>
    </Contact>
   </HiringOrg>
   <JobDisplayOptions>
                    <MicrositeName>|JMSite_S|</MicrositeName>
                    <TemplateName>|JTempl_N|</TemplateName>
   </JobDisplayOptions>
   <JobPositionInformation>
                    <JobPositionTitle>|JTitle_M|</JobPositionTitle>
       <JobClassifications>
            <PrimaryJobCategory>
                    <JobIndustryCode>|JIndustryCode_M|</JobIndustryCode>
                    <JobFunctionCode>|JFunCode_M|</JobFunctionCode>
                    <JobRoleCode>|JRoleCode_M|</JobRoleCode>
            </PrimaryJobCategory>
       </JobClassifications>
       <JobPositionDescription>
                    <JobKeywords>|JSkills_M|</JobKeywords>
            <JobPositionLocation>
                    <InterNationalLoc>|JIntlCode_M|</InterNationalLoc>
                    <InterNationalLocOther>|JIntlCodeOther_N|</InterNationalLocOther>
                    <IndianLoc>|JLocCode_M|</IndianLoc>
                    <IndianLocOther>|JLocOther_N|</IndianLocOther>
            </JobPositionLocation>
            <CompensationDescription>
                <Pay>
                        <SalaryCurrency>|JCurr_M|</SalaryCurrency>
                        <MinimumSalary>|JMinSal_M|</MinimumSalary>
                        <MaximumSalary>|JMaxSal_M|</MaximumSalary>
                        <DisplaySalary>|JSalDisp_N|</DisplaySalary>
                </Pay>
                    <BenifitsDescription>|JBenefits_N|</BenifitsDescription>
            </CompensationDescription>
                    <SummaryText>|JJD_M|</SummaryText>
       </JobPositionDescription>
       <JobPositionRequirements>
                    <SummaryText>|JDesCand_N|</SummaryText>
            <JobExperience>
                    <MinimumExperience>|JMinExp_M|</MinimumExperience>
                    <MaximumExperience>|JMaxExp_M|</MaximumExperience>
            </JobExperience>
            <JobQualifications>
                    <UGQualifications>|JQual1_M|</UGQualifications>
                    <UGSpecializations>|JSpec1_M|</UGSpecializations>
                    <PGQualifications>|JQual2_M|</PGQualifications>
                    <PGSpecializations>|JSpec2_M|</PGSpecializations>
                    <DoctorateQualifications>|JQual3_M|</DoctorateQualifications>
                    <DoctorateSpecializations>|JSpec3_M|</DoctorateSpecializations>
            </JobQualifications>
       </JobPositionRequirements>
                <AddJobsToRefSite>|JRefSite_N|</AddJobsToRefSite>
                <ReferenceCode>|JRefCode_N|</ReferenceCode>
    </JobPositionInformation>
    <HowToApply>
            <ApplicationMethods>
                <ByEmail>
                    <E-mail>|JLntMail_M|</E-mail>
                </ByEmail>
            <ByEapps>
                <Eapps>|JeApps_M|</Eapps>
            </ByEapps>
                <ByWeb>
                    <URL>|JURL_M|</URL>
                    <ApplyIntegration>|JAppInt_M|</ApplyIntegration>
                </ByWeb>
                <QUESTIONNAIRE>|JQuest_N|</QUESTIONNAIRE>
            </ApplicationMethods>
     </HowToApply>
     <ReferralDetails>
                        <Benefit>|JBenefit_N|</Benefit>
                        <Amount>|JBAmt_N|</Amount>
     </ReferralDetails>
  </JobPositionPosting>
                <JobFeedResponseEmail>|JFeedRespEmail_N|</JobFeedResponseEmail>
</JobPositionPostings>

After that in SQL server I am replacing them with desired values and forwarding that XML to my client.

set @Nxml = replace(@Nxml, '|JAct_M|','Add')
set @Nxml = replace(@Nxml, '|JID_M|',@reqmt_id)
set @Nxml = replace(@Nxml, '|JType_M|','P')

Is this best method or is there any other easy approach.
Thanks in advance.

Body:
The best approach (only in the case that you should get xml, modify it and then pass by modified xml) would be to use XPathNavigator (example to change your JobAction):

public static string UpdateJobAction(string inputXml)
    {
        var xmlDocument = new XmlDocument();
        xmlDocument.LoadXml(inputXml);

        var xpnavigator = xmlDocument.CreateNavigator();
        foreach (XPathNavigator xpn in xpnavigator.Select("//JobPositionPostings/JobPositionPosting/JobAction"))
        {
            var value = xpn.Value; // to obtain the JobAction value
            xpn.SetValue("Add");
        }
        return xpnavigator.OuterXml;
    }


问:
luajit Compiling lua-lzma on windows mingw64
so I have a project where I need lzma decompression so I googled and found this project https://github.com/rainfiel/lua-lzma

After some poking around I managed to compile it to find that it was written for lua 5.2, so I changed some lines to fix that. In the llzma.c file I changed the luaL_newlib(L, l); line to luaL_register(L, "lzma", l);, commented out the luaL_checkversion(L);, and changed the size_t len = lua_rawlen(L, 1); to size_t len = lua_objlen(L, 1); etc.

My makefile looks something like this

```<code>all: lzma.dll

lzma.dll: LzFind.o LzAlloc.o LzmaDec.o LzmaEnc.o LzmaLib.o llzma.o
    gcc -O -shared -o lzma.dll llzma.o LzmaLib.o LzmaEnc.o LzmaDec.o
LzFind.o LzAlloc.o -L"..\bin" -llua51

LzFind.o: LzFind.c
    gcc -O2 -c LzFind.c
LzAlloc.o: LzAlloc.c
    gcc -O2 -c LzAlloc.c
LzmaDec.o: LzmaDec.c
        gcc -O2 -c LzmaDec.c
LzmaEnc.o: LzmaEnc.c
    gcc -O2 -c LzmaEnc.c
LzmaLib.o: LzmaLib.c
    gcc -O2 -c LzmaLib.c
llzma.o:   llzma.c
    gcc -I..\luajit\src\src -O2 -c -o llzma.o llzma.c
</code>```

I got it to compile but when I try and load it through require I get this message:

```<code>> require 'lzma'
error loading module 'lzma' from file '.\lzma.dll':
    The specified procedure could not be found.

stack traceback:
    [C]: at 0x66dd6c40
    [C]: in function 'require'
    stdin:1: in main chunk
    [C]: at 0x00401f80
</code>```

I did some more searching and came across this http://lua-users.org/lists/lua-l/2013-03/msg00363.html

However when I did the dumpbin the luaopen_lzma function was there so it seems it had been exported. I am thoroughly stumped here. I don't have much experience with binary libraries and the like so this is troubling me. I would like to be able to compile and use this library and not have to write my own. Does anyone know what I'm doing wrong?

答:
I solved my problem, initially I compiled and forgot to link llzma.c so it didn't have any lua api code, I put that next to the binary in it's folder but it didn't see the dll and didn't load it, so I put it in the working directory and it seemed to work. from then on i put it in the working directory and left the old one in the bin folder, and from then on it seems it found the dll in the bin folder and was loading from that one. So when I deleted it from the bin folder it worked...

So this was a total fail and oversight on my part, sorry for the time everyone used to help me with my problems, this just shows how unexperienced I am when it comes to this stuff.

Body:
so I have a project where I need lzma decompression so I googled and found this project https://github.com/rainfiel/lua-lzma

After some poking around I managed to compile it to find that it was written for lua 5.2, so I changed some lines to fix that. In the llzma.c file I changed the luaL_newlib(L, l); line to luaL_register(L, "lzma", l);, commented out the luaL_checkversion(L);, and changed the size_t len = lua_rawlen(L, 1); to size_t len = lua_objlen(L, 1); etc.

My makefile looks something like this

all: lzma.dll

lzma.dll: LzFind.o LzAlloc.o LzmaDec.o LzmaEnc.o LzmaLib.o llzma.o
    gcc -O -shared -o lzma.dll llzma.o LzmaLib.o LzmaEnc.o LzmaDec.o
LzFind.o LzAlloc.o -L"..\bin" -llua51

LzFind.o: LzFind.c
    gcc -O2 -c LzFind.c
LzAlloc.o: LzAlloc.c
    gcc -O2 -c LzAlloc.c
LzmaDec.o: LzmaDec.c
        gcc -O2 -c LzmaDec.c
LzmaEnc.o: LzmaEnc.c
    gcc -O2 -c LzmaEnc.c
LzmaLib.o: LzmaLib.c
    gcc -O2 -c LzmaLib.c
llzma.o:   llzma.c
    gcc -I..\luajit\src\src -O2 -c -o llzma.o llzma.c

I got it to compile but when I try and load it through require I get this message:

> require 'lzma'
error loading module 'lzma' from file '.\lzma.dll':
    The specified procedure could not be found.

stack traceback:
    [C]: at 0x66dd6c40
    [C]: in function 'require'
    stdin:1: in main chunk
    [C]: at 0x00401f80

I did some more searching and came across this http://lua-users.org/lists/lua-l/2013-03/msg00363.html

However when I did the dumpbin the luaopen_lzma function was there so it seems it had been exported. I am thoroughly stumped here. I don't have much experience with binary libraries and the like so this is troubling me. I would like to be able to compile and use this library and not have to write my own. Does anyone know what I'm doing wrong?


答:
You can make the logo responsive by defining it's width 100%. Below is the css:

```<code>.tileseven img {
   width: 100%;
}
</code>```

To make div.tileseven superimposed play with left, top and z-index in CSS.

Title: How to create responsive div in image?

Body:
You can make the logo responsive by defining it's width 100%. Below is the css:

.tileseven img {
   width: 100%;
}

To make div.tileseven superimposed play with left, top and z-index in CSS.


答:
Look at this demo - it's what you want to do (get data using ajax):

http://jqueryui.com/demos/autocomplete/#remote

You can pull data in from a local
  and/or a remote source: Local is good
  for small data sets (like an address
  book with 50 entries), remote is
  necessary for big data sets, like a
  database with hundreds or millions of
  entries to select from.

Autocomplete can be customized to work
  with various data sources, by just
  specifying the source option. A data
  source can be:

an Array with local data a String,
  specifying a URL a Callback The local
  data can be a simple Array of Strings,
  or it contains Objects for each item
  in the array, with either a label or
  value property or both. The label
  property is displayed in the
  suggestion menu. The value will be
  inserted into the input element after
  the user selected something from the
  menu. If just one property is
  specified, it will be used for both,
  eg. if you provide only
  value-properties, the value will also
  be used as the label.

When a String is used, the
  Autocomplete plugin expects that
  string to point to a URL resource that
  will return JSON data. It can be on
  the same host or on a different one
  (must provide JSONP). The request
  parameter "term" gets added to that
  URL. The data itself can be in the
  same format as the local data
  described above.

The third variation, the callback,
  provides the most flexibility, and can
  be used to connect any data source to
  Autocomplete. The callback gets two
  arguments:

1) A request object, with a single
  property called "term", which refers
  to the value currently in the text
  input. For example, when the user
  entered "new yo" in a city field, the
  Autocomplete term will equal "new yo".

2) A response callback, which expects
  a single argument to contain the data
  to suggest to the user. This data
  should be filtered based on the
  provided term, and can be in any of
  the formats described above for simple
  local data (String-Array or
  Object-Array with label/value/both
  properties). It's important when
  providing a custom source callback to
  handle errors during the request. You
  must always call the response callback
  even if you encounter an error. This
  ensures that the widget always has the
  correct state.

Title: jQuery AutoComplete Fill Array

Body:
I'm attempting to use jQuery's autocomplete feature, and after reading several posts I still have two questions:

1)  I've gotten autocomplete to work with the code posted at the bottom, however I need the array titled "data" to be filled from our database.  I've been trying to use different methods to fill this via AJAX.  I tried using $.get and $.ajax.  What is the correct syntax to accomplish this?

2)  This array will be big, I will have 60,000 plus values if I just fill the array once.  I was wondering if it's possible to perform an AJAX request to fill the array every-time the user enters a new letter?  Is this better to do, or just fill the array with all values at once?  By better, which taxes the system less?

//This code works

//display company live search
echo('<form id="form" method="post" action="competitor_unlink.php" onsubmit="return">');
echo('Company: <input id="search_company"/>');
echo('
');
echo('<button type="submit" value="Submit">Submit</button>');
echo('</form>');


问:
Unfortunately, MyApp has stopped - no error logs in logcat
Every once in a while I get:

Unfortunately, MyApp has stopped.

Problem is easy to solve if you have some logs, but in my case logcat has absolutely no message of error (it has normal messages published by my app and other exceptions are shown there but not this one which causes this app has stopped).

Is there any chance I can solve this problem?

The good thing is I can quite easily reproduce it, thus I'm trying to put as many information I can to logcat and then investigate what happened.

I have ACRA up and running (other exceptions are caught by it but not this app has stopped).

When it happens my app is not visible and there are some things happendnig in IntentService. My app is tracking geofences and the app has stopped happens only on HTC M8 when I switch on and off Location in phone Settings. I've tested on different phones and it does not happen on LG G3, Nexus 5, Moto G, LG Swift L9.

答:
In my case logcat was filtered. You can change filter in
Android Monitor -> logcat -> Bottom right corner, change filter to No Filters. It will show all errors.


问:
How to disable bolt port Neo4j EE 3.2.1
I'm trying to run Neo4j EE 3.2.1 on AWS EC2, I was able to access the UI via port 7474, but couldn't connect to DB because bolt://myip:7687 isn't opened.

I could open this port on security group but prefer that Neo4j connects with DB via localhost instead.

答:
On /etc/neo4j/neo4j.conf

update
dbms.connector.bolt.enabled=false

Title: How to disable bolt port Neo4j EE 3.2.1


问:
How to listen to all custom events in VueJS?
In my VueJS app I have a Vue instance which I'm using as an event bus for sending data between components.

It's just this:

```<code>import Vue from 'vue';
export const EventBus = new Vue();
</code>```

Then in my components I import EventBus and use EventBus.$emit() and EventBus.$on().

This approach is explained here: https://alligator.io/vuejs/global-event-bus/

What I'd like to be able to do is listen to any event that is sent through EventBus. If I could bind one listener to all events I could use this for logging or to feed data into some system for my development environment that would show me all data as it went into eventBus, which would be super useful.

Is there any type of vm.$listenToEverything() that I'm missing or some way to make this work?

答:
The author of VueJS provided a hacky solution for listening to all events:

```<code>var oldEmit = this.compiler.emitter.emit
this.compiler.emitter.emit = function () {
    console.log('got event: ' + arguments[0])
    oldEmit.apply(this, arguments)
}
</code>```

Another solution (which is said to also work on v1.0):

```<code>const old_on = this.$on;
this.$on = (...args) => {
  // custom logic here like pushing to a callback array or something
  old_on.apply(this, args);
};
</code>```

Body:
In my VueJS app I have a Vue instance which I'm using as an event bus for sending data between components.

It's just this:

import Vue from 'vue';
export const EventBus = new Vue();

Then in my components I import EventBus and use EventBus.$emit() and EventBus.$on().

This approach is explained here: https://alligator.io/vuejs/global-event-bus/

What I'd like to be able to do is listen to any event that is sent through EventBus. If I could bind one listener to all events I could use this for logging or to feed data into some system for my development environment that would show me all data as it went into eventBus, which would be super useful.

Is there any type of vm.$listenToEverything() that I'm missing or some way to make this work?

Body:
The author of VueJS provided a hacky solution for listening to all events:

var oldEmit = this.compiler.emitter.emit
this.compiler.emitter.emit = function () {
    console.log('got event: ' + arguments[0])
    oldEmit.apply(this, arguments)
}

Another solution (which is said to also work on v1.0):

const old_on = this.$on;
this.$on = (...args) => {
  // custom logic here like pushing to a callback array or something
  old_on.apply(this, args);
};


问:
Xcode project not showing list of simulators
I open my project in Xcode 6.1. When I try to run the project, the button is grayed out. When I try to go to Product > Clean, the option is grayed out. When I look at the list of simulators, all I get is My Mac instead of the usually iOS Device. How do I get my simulators to come back?

答:
If Your problem is due to multiple (versions of) xcode

Then follow following steps

1. Cleaning Derived Data
Go to Xcode preferences -> Select location tab -> select little gray arrow on /Users/apple/Library/Developer/Xcode/DerivedData. You will be redirect to folder From there select Derived Data folder and Delete.

2. Completely Quite The Xcode and reopen

This will solve your problem.
Happy coding :)


问:
Execute a python file c#
I have a python converter that works calling it with some parameters from cmd. I want to create an exe that automatically calls it with the needed parameters, which are the model I want to convert and the name of the model that it will be created.
The code is:</p>

```<code>blender -b -P dae-obj.py -- file.dae file.obj
</code>```

答:
Here is a sample code in order to launch a command prompt. Adjust it to your needs.</p>

```<code>System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; // Hides the cmd
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "blender -b -P dae-obj.py -- file.dae file.obj"; // Parameters
process.StartInfo = startInfo;
process.Start();
</code>```

Title: Execute a python file c#

Body:
I have a python converter that works calling it with some parameters from cmd. I want to create an exe that automatically calls it with the needed parameters, which are the model I want to convert and the name of the model that it will be created.
The code is:

blender -b -P dae-obj.py -- file.dae file.obj

Body:
Here is a sample code in order to launch a command prompt. Adjust it to your needs.

System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; // Hides the cmd
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "blender -b -P dae-obj.py -- file.dae file.obj"; // Parameters
process.StartInfo = startInfo;
process.Start();


问:
How to get single row CodeIgniter
How can I get single row when I call "conversationID",

Right now when I call "conversationID = 0" it show all "conversationID" by 0

message table,

```<code>|ID|conversationID|from|to|
|1|0|3|4
|2|0|4|3
|3|0|3|4
|4|1|2|4
|5|1|4|2
</code>```

Controller

```<code>public function index()
{
    $conversations_inbox = $this->conversation_model->get_conversation_inbox($this->user->info->ID);
    $this->template->loadContent("conversations/index.php", array("conversations_inbox" =>  $conversations_inbox,)
    );
}
</code>```

Model

```<code>public function get_conversation_inbox($userid) {
        $query = $this->db->where("conversations.from_user = ". $userid)->or_where("conversations.to_user = ". $userid)->select("*")->from("conversations")->join("conversation_message", "conversation_message.conversationID = conversations.conversationID")->order_by("conversation_message.date", "DESC")->get();
        return $query->row();
    }

<?php
foreach ($conversations_inbox as $c) { ?>
<li class="mail-starred">
    <div class="mail-from"><a href="<?php echo base_url("conversations/message/") . $c['conversationID'] ?>"><img src="<?php echo base_url() . $c['store_picture'] ?>" style="width: 40px;height: 40px;margin-right: 10px;">
    <?php echo $c['store_name'] ?></a></div>
    <div class="mail-subject">
    <a href="<?php echo base_url("conversations/message/") . $c['conversationID'] ?>">Test</a>
    </div>
</li>
<?php } ?>
</code>```

答:
You are using $query->result() which returns array of possible results, if you need only one record you should use $query->row().

You can read more about returning result from documentation here: https://www.codeigniter.com/user_guide/database/results.html#result-rows

Title: How to get single row CodeIgniter

Body:
How can I get single row when I call "conversationID",

Right now when I call "conversationID = 0" it show all "conversationID" by 0

message table,

|ID|conversationID|from|to|
|1|0|3|4
|2|0|4|3
|3|0|3|4
|4|1|2|4
|5|1|4|2

Controller

public function index()
{
    $conversations_inbox = $this->conversation_model->get_conversation_inbox($this->user->info->ID);
    $this->template->loadContent("conversations/index.php", array("conversations_inbox" =>  $conversations_inbox,)
    );
}

Model

public function get_conversation_inbox($userid) {
        $query = $this->db->where("conversations.from_user = ". $userid)->or_where("conversations.to_user = ". $userid)->select("*")->from("conversations")->join("conversation_message", "conversation_message.conversationID = conversations.conversationID")->order_by("conversation_message.date", "DESC")->get();
        return $query->row();
    }

<?php
foreach ($conversations_inbox as $c) { ?>

<a href="<?php echo base_url("conversations/message/") . $c['conversationID'] ?>"><img src="<?php echo base_url() . $c['store_picture'] ?>" style="width: 40px;height: 40px;margin-right: 10px;">
    <?php echo $c['store_name'] ?>

    <a href="<?php echo base_url("conversations/message/") . $c['conversationID'] ?>">Test

<?php } ?>


问:
How to setup my phone as a hotspot
My phone is connected to a wifi network which provide internet. But it is password protected and my phone is selected as a user with unique password. That password cannot be used to connect another device to the wifi connection. Is there any way to share the internet (from wifi router) to another phone or laptop using my phone as a hotspot? How to share?</p>

答: Wifi hotspot transfers your connection to other internet connection available on your phone, if you want to use your wifi from your phone to your laptop or pc while using wifi on phone there is one way, you can use usb tethering on your mobile device.</p>

Title: How to setup my phone as a hotspot


问:
POST Form action not working properly [Django]
I'm new to Django and I'm trying to fill the contentString of a Google Maps Marker with the following content:

```<code>for (i=0; i< Object.keys(j).length; i++){
  venue_name = j[i]['name']
  contentString = '<div id="content">'+
        '<div id="siteNotice">'+
        '</div>'+
        '<h1 id="firstHeading" class="firstHeading">'+j[i]['name']+'</h1>'+
        '<div id="bodyContent">'+
        '<p><b>'+j[i]['name']+'</b></p>'+
        '<p>Attribution: '+j[i]['name']+', <a href="https://www.google.es/#q='+j[i]['name']+" "+city+'">'+
        'Más información</a> '+
        '</p>'+
    '<button onclick="calculateAndDisplayRoute('+ j[i]['lat'] +','+ j[i]['long'] +')">Ir!</button>'+
    '<li><a href = "{% url 'detail' 'venue_name' %}">Ver comentarios</a>'+
        '</div>'+
        '</div>';
</code>```

The main idea is that the href link will send the venue_name variable to the detail view so it can retrieve the requested information from de data base. The problem is, venue_name is interpreted as a string, but if I remove the quotes then I get this error: Reverse for 'detail' with arguments '('',)' not found. 1 pattern(s) tried: ['venuesApp/(?P\w+)/$']

It should be the correct sintax if I'm not mistaken, so I'm assuming it has something to do with the fact that the whole HTML code is inside a JS string. I have another POST form outside the JS script code and it works just fine.

```<code>urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<venue_name>\w+)/$', views.detail, name='detail'),
</code>```

EDIT:

detail view:

```<code>def detail(request, venue_name):
if request.POST.has_key('text'):
    text=request.POST['text']
    user=request.user
    Review.objects.create(venue=venue_name,user=user,lat_long="",text=text)
try:
    p=Review.objects.filter(venue=venue_name)
    review_list = list(p.values())
except Review.DoesNotExist:
        raise Http404("No reviews available.")
context={ 'review_list':review_list, 'venue_name':venue_name}
return render(request,'venuesApp/detail.html',context)
</code>```

console.log

答:
Try to render the URL using a placeholder, and then replace it in javascript:

```<code>for (i=0; i< Object.keys(j).length; i++){
    var venue_url = "{% url 'detail' venue_name=XXXXX %}".replace('XXXXX', j[i]['name']);
    contentString = '...' +
    '<a href = "' + venue_url + '">Ver comentarios</a>' +
    '...'
</code>```

it's not that elegant, but works.

Hope this helps!

Body:
I'm new to Django and I'm trying to fill the contentString of a Google Maps Marker with the following content:

for (i=0; i< Object.keys(j).length; i++){
  venue_name = j[i]['name']
  contentString = '
'+
        '
'+
        '
'+
        '
'+j[i]['name']+'
'+
        '
'+
        '
'+j[i]['name']+'
'+
        '
Attribution: '+j[i]['name']+', '+
        'Más información '+
        '
'+
    '<button onclick="calculateAndDisplayRoute('+ j[i]['lat'] +','+ j[i]['long'] +')">Ir!</button>'+
    '
Ver comentarios'+
        '
'+
        '
';

The main idea is that the href link will send the venue_name variable to the detail view so it can retrieve the requested information from de data base. The problem is, venue_name is interpreted as a string, but if I remove the quotes then I get this error: Reverse for 'detail' with arguments '('',)' not found. 1 pattern(s) tried: ['venuesApp/(?P\w+)/$']

It should be the correct sintax if I'm not mistaken, so I'm assuming it has something to do with the fact that the whole HTML code is inside a JS string. I have another POST form outside the JS script code and it works just fine.

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<venue_name>\w+)/$', views.detail, name='detail'),

EDIT:

detail view:

def detail(request, venue_name):
if request.POST.has_key('text'):
    text=request.POST['text']
    user=request.user
    Review.objects.create(venue=venue_name,user=user,lat_long="",text=text)
try:
    p=Review.objects.filter(venue=venue_name)
    review_list = list(p.values())
except Review.DoesNotExist:
        raise Http404("No reviews available.")
context={ 'review_list':review_list, 'venue_name':venue_name}
return render(request,'venuesApp/detail.html',context)

console.log

Body:
Try to render the URL using a placeholder, and then replace it in javascript:

for (i=0; i< Object.keys(j).length; i++){
    var venue_url = "{% url 'detail' venue_name=XXXXX %}".replace('XXXXX', j[i]['name']);
    contentString = '...' +
    '<a href = "' + venue_url + '">Ver comentarios</a>' +
    '...'

it's not that elegant, but works.

Hope this helps!


问:
a4j command button not working under popup panel
I want to add a popup panel. In this panel there is a close button. On this button click a method should be invoked and popup should get hide. I have tried below code but not working kindly help me with this. Here settingPopUpClose is a method and okPopupStatus is a bean. It is displaying error: settingPopUpClose  is not a property.

```<code><rich:popupPanel id="okcontactpopup" width="450" height="50"
domElementAttachment="form">
<f:facet name="header">
</f:facet>
<f:facet name="controls">
    <h:panelGroup>

        <a4j:commandButton value="Close"
            actionListener="#{staffMsgingHccDiscoHandler.settingPopUpClose}"
            oncomplete="if(#{not empty staffMsgingHccDiscoHandler.hccDiscoBean.okPopupStatus}) #{rich:component('okcontactpopup')}.hide();" />
    </h:panelGroup>
</f:facet>
<h:panelGrid>
    <h:panelGrid columns="2">
        <h:panelGrid columns="2">
            <h:outputText
                value="#{staffMsgingHccDiscoHandler.hccDiscoBean.okPopup}"
                id="okpopup" />
        </h:panelGrid>
    </h:panelGrid>
</h:panelGrid>
</code>```

答:
Thanks @makhiel and @emil for your reply. But i solved the problem.

```<code><a4j:commandButton value="CLOSE" action="#{staffMsgingHccDiscoHandler.settingPopUpClose}" oncomplete=" #{rich:component('okcontactpopup')}.hide();" />
</code>```

I did not enclosed my richface popup inside form. This worked fine for me.

Body:
I want to add a popup panel. In this panel there is a close button. On this button click a method should be invoked and popup should get hide. I have tried below code but not working kindly help me with this. Here settingPopUpClose is a method and okPopupStatus is a bean. It is displaying error: settingPopUpClose  is not a property.

<rich:popupPanel id="okcontactpopup" width="450" height="50"
domElementAttachment="form">
<f:facet name="header">
</f:facet>
<f:facet name="controls">
    <h:panelGroup>

        <a4j:commandButton value="Close"
            actionListener="#{staffMsgingHccDiscoHandler.settingPopUpClose}"
            oncomplete="if(#{not empty staffMsgingHccDiscoHandler.hccDiscoBean.okPopupStatus}) #{rich:component('okcontactpopup')}.hide();" />
    </h:panelGroup>
</f:facet>
<h:panelGrid>
    <h:panelGrid columns="2">
        <h:panelGrid columns="2">
            <h:outputText
                value="#{staffMsgingHccDiscoHandler.hccDiscoBean.okPopup}"
                id="okpopup" />
        </h:panelGrid>
    </h:panelGrid>
</h:panelGrid>

Body:
Thanks @makhiel and @emil for your reply. But i solved the problem.

<a4j:commandButton value="CLOSE" action="#{staffMsgingHccDiscoHandler.settingPopUpClose}" oncomplete=" #{rich:component('okcontactpopup')}.hide();" />

I did not enclosed my richface popup inside form. This worked fine for me.


问:
How to display even number and a multiple of 3 from arraylist
Sorry, maybe I did not explain clearly. This is my pracitce

input a positive integer. If the input is not positive then then your algorithm should output an error message and re-prompt the user for the input. This process should continue to loop until the input is valid. Your algorithm should then output whether or not the input is an even number and a multiple of 3. Note your solution must make appropriate use of sub modules.

I have to create a method which gets a positive number from user input, And I need to display even numbers and multiple of 3 from this ArrayList. I have written code for that but I have struggled with how to use another submodule to display this ArrayList.

```<code>import java.util.ArrayList;
import java.util.*;

public class Array {

    public static void main(String[] args)
    {

        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list;
        list = new ArrayList<Integer>();
         int number = -1;
        printList(list, number );
        System.out.println("Enter number.  Enter 0 to end.");
        while (true)
        {
            System.out.print(" ");
            number = sc.nextInt();

        while( number < 0)
        {
        System.out.print("Enter your next positive integer, or 0 to end: ");
        number = sc.nextInt();
        }
         if (number == 0)
                break;
            list.add(number);
        }

    }
        public static void printList (ArrayList<Integer> list, int number)
        {
            for(int i = 0;i <= number.size(); i++)
            {
            if(i % 2 ==0 && i % 3 ==0)
            {
                 System.out.println(list(i));
            }
            }
        }
    }
</code>```

答:
The printList method can be invoked from inside the loop

Have to check size of list, not the number.

Please see the below code helps

```<code>public class Array {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list;
        list = new ArrayList<Integer>();
        int number = -1;
        System.out.println("Enter number.  Enter 0 to end.");
        while (true) {
            System.out.print(" ");
            number = sc.nextInt();

            while (number < 0) {
                System.out.print("Enter your next positive integer, or 0 to end: ");
                number = sc.nextInt();
            }
            if (number == 0) {
                sc.close();
                break;
            }
            list.add(number);
            printList(list, number); // Moved the print here.
        }

    }

    public static void printList(ArrayList<Integer> list, int number) {
        for (int i = 0; i <= list.size(); i++) { // You have to get size on
                                                 // list.
            if (i % 2 == 0 && i % 3 == 0) { // Are you planning to check the
                                            // index or the content in the list
                                            // ?
                System.out.println(list.get(i)); // Get the number from list
            }
        }
    }
}
</code>```

Body:
Sorry, maybe I did not explain clearly. This is my pracitce

input a positive integer. If the input is not positive then then your algorithm should output an error message and re-prompt the user for the input. This process should continue to loop until the input is valid. Your algorithm should then output whether or not the input is an even number and a multiple of 3. Note your solution must make appropriate use of sub modules.

I have to create a method which gets a positive number from user input, And I need to display even numbers and multiple of 3 from this ArrayList. I have written code for that but I have struggled with how to use another submodule to display this ArrayList.

import java.util.ArrayList;
import java.util.*;

public class Array {

    public static void main(String[] args)
    {

        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list;
        list = new ArrayList<Integer>();
         int number = -1;
        printList(list, number );
        System.out.println("Enter number.  Enter 0 to end.");
        while (true)
        {
            System.out.print(" ");
            number = sc.nextInt();

        while( number < 0)
        {
        System.out.print("Enter your next positive integer, or 0 to end: ");
        number = sc.nextInt();
        }
         if (number == 0)
                break;
            list.add(number);
        }

    }
        public static void printList (ArrayList<Integer> list, int number)
        {
            for(int i = 0;i <= number.size(); i++)
            {
            if(i % 2 ==0 && i % 3 ==0)
            {
                 System.out.println(list(i));
            }
            }
        }
    }

Body:
The printList method can be invoked from inside the loop

Have to check size of list, not the number.

Please see the below code helps

public class Array {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list;
        list = new ArrayList<Integer>();
        int number = -1;
        System.out.println("Enter number.  Enter 0 to end.");
        while (true) {
            System.out.print(" ");
            number = sc.nextInt();

            while (number < 0) {
                System.out.print("Enter your next positive integer, or 0 to end: ");
                number = sc.nextInt();
            }
            if (number == 0) {
                sc.close();
                break;
            }
            list.add(number);
            printList(list, number); // Moved the print here.
        }

    }

    public static void printList(ArrayList<Integer> list, int number) {
        for (int i = 0; i <= list.size(); i++) { // You have to get size on
                                                 // list.
            if (i % 2 == 0 && i % 3 == 0) { // Are you planning to check the
                                            // index or the content in the list
                                            // ?
                System.out.println(list.get(i)); // Get the number from list
            }
        }
    }
}


问:
Creating standalone app with Microsoft Access
Once I saw a DB made in MS Access that worked as a normal program, i.e with an executable file that opened a beautiful UI and allowed access to the forms and reports. I've trying to do the same, I even googled but didn't find how do it. Anyone knows how to build such standalone App with Access?</p>

答:
I believe the tool is called the Microsoft Access Runtime toolkit or something along those lines.  The latest version is free, a departure from the previous versions which I believe you had to pay for.  From the previous version I tinkered with, it comes with a tool to make a EXE file from the MDB or ACCB file, a handful of icons for the EXE to use if you are lacking one, and a program to help you generate Microsoft Help files for your application.

This is a link to the Developer Extensions - I believe the 2007 version of what I described above:
http://www.microsoft.com/downloads/en/details.aspx?FamilyId=D96A8358-ECE4-4BEE-A844-F81856DCEB67&displaylang=en

Here is a link for the runtime, which doesn't convert your Access database into an executable file, but would allow it to run on computers without Access installed:
http://www.microsoft.com/downloads/en/details.aspx?familyid=D9AE78D9-9DC6-4B38-9FA6-2C745A175AED&displaylang=en

NOTE:  Both of these are for Access 2007, the version I run.  Your version might require something different - but should be easily located on Microsoft's website.


问:
Razor and displaying a properties value?
I'll keep it simple, I have this application that sends back a status "code" to a page, as of right now, I have just the status code displaying on the page. What I want to do and what I have in place is for the system to read the status code, then pull an actual "value" from a database. As it sits, this code displays the status message on the page:

```<code><input type="textarea" data-bind="value: property('Message')" readonly />
</code>```

This is all fine and dandy, but there is a text box that I do NOT want to display, and it's only a single line, which means anything past the end would trail off into nothingness. How can I take this line of code, and make it so the value of the status message(HTML from a database) will be displayed?

Perhaps something with an @Html.Raw() so the HTML coming from the DB will be rendered?

答:
usually what i do is i convert the model values to json object and populate the required client side from that object ie</p>

```<code><script>
var jsonData= @Html.Raw(json.Encode(model));
$(function(){
RenderView();

})

function RenderView(){
$(jsonData).each(function(){    //if list
 $('inputID').val(this.modelPropertyname)
})

}

</script>
</code>```

Body:
I'll keep it simple, I have this application that sends back a status "code" to a page, as of right now, I have just the status code displaying on the page. What I want to do and what I have in place is for the system to read the status code, then pull an actual "value" from a database. As it sits, this code displays the status message on the page:

<input type="textarea" data-bind="value: property('Message')" readonly />

This is all fine and dandy, but there is a text box that I do NOT want to display, and it's only a single line, which means anything past the end would trail off into nothingness. How can I take this line of code, and make it so the value of the status message(HTML from a database) will be displayed?

Perhaps something with an @Html.Raw() so the HTML coming from the DB will be rendered?

Body:
usually what i do is i convert the model values to json object and populate the required client side from that object ie

<script>
var jsonData= @Html.Raw(json.Encode(model));
$(function(){
RenderView();

})

function RenderView(){
$(jsonData).each(function(){    //if list
 $('inputID').val(this.modelPropertyname)
})

}

</script>


问:
MySQL: Make a blog-style page with different data types at different points
I'm trying to develop something similar to this with PHP and MySQL: http://a-bittersweet-life.tumblr.com/

I'd like to make a page that is mostly made up of words, but can be interspersed with images or embedded videos or other data types. I'm not sure exactly how to do this, but I have an idea:

```<code>id | entry_date |  text | image_link | vid_embed | sound_embed
 0 |   June 1st |  data |    null    |   null    |  null
 1 |   June 1st |  null |    data    |   null    |  null
 2 |   June 1st |  null |    data    |   null    |  null
 3 |   June 1st |  data |    null    |   null    |  null
 4 |   June 2nd |  data |    null    |   null    |  null
 5 |   June 2nd |  null |    null    |   data    |  null
 6 |   June 2nd |  data |    null    |   null    |  null
 7 |   June 2nd |  null |    data    |   null    |  null
 8 |   June 2nd |  null |    data    |   null    |  null
 ....
 ....
 ....
</code>```

So, for each blog entry, the Date is displayed first, followed by the order in which data was put into the SQL table (ordered by id):

June 1st

Text

Image

Image

Text

June 2nd

Text

Video

Text

Image

Image

Is there another way to do this, or does this seem like a fairly practical way to do it?

答:
Or take a tip from HTML.

```<code>blah blah -- text
<img src=...> -- image
etc.
</code>```

Or have two columns; one saying the MIME type (or however you wish to categorize them), one with the data in question.

Another tip from HTML:  Don't put the image or video or sound in the table cell; put a 'link' to it.

Body:
I'm trying to develop something similar to this with PHP and MySQL: http://a-bittersweet-life.tumblr.com/

I'd like to make a page that is mostly made up of words, but can be interspersed with images or embedded videos or other data types. I'm not sure exactly how to do this, but I have an idea:

id | entry_date |  text | image_link | vid_embed | sound_embed
 0 |   June 1st |  data |    null    |   null    |  null
 1 |   June 1st |  null |    data    |   null    |  null
 2 |   June 1st |  null |    data    |   null    |  null
 3 |   June 1st |  data |    null    |   null    |  null
 4 |   June 2nd |  data |    null    |   null    |  null
 5 |   June 2nd |  null |    null    |   data    |  null
 6 |   June 2nd |  data |    null    |   null    |  null
 7 |   June 2nd |  null |    data    |   null    |  null
 8 |   June 2nd |  null |    data    |   null    |  null
 ....
 ....
 ....

So, for each blog entry, the Date is displayed first, followed by the order in which data was put into the SQL table (ordered by id):

June 1st

Text

Image

Image

Text

June 2nd

Text

Video

Text

Image

Image

Is there another way to do this, or does this seem like a fairly practical way to do it?

Body:
Or take a tip from HTML.

blah blah -- text
<img src=...> -- image
etc.

Or have two columns; one saying the MIME type (or however you wish to categorize them), one with the data in question.

Another tip from HTML:  Don't put the image or video or sound in the table cell; put a 'link' to it.


问:
What's the best way to search properties of a class in wpf?
I'm still new to WPF. Is there a website or document for property of certain class?

For example, I want to find a properties of trigger. When I search for "wpf trigger property" on google, I see few msdn sites like Trigger.Property Property. However, it does not tell me much, other than there are IsMouseOver, and IsPressed. Which is really annoying and not helpful. There are few classes that has list of their available properties like ButtonBase, but others do not.

Could anyone recommend me a better way to search?

答: MSDN is the best bet when you want to know the brief about things like properties, methods and how to use them. Here I got an MSDN link for Canvas Class of System.Windows.Controls namespace. You can change namespace from the drop down and traverse between different classes and their properties, Inheritance Hierarchy, Syntax etc. I always use MSDN to refer to such things and I hope this will be helpful to you as well.</p>


问:
Accordion in Javascript
I want to implement a simple accordion to my page, so I browsed w3schools and found the tutorial. But in it's javascript code there is a for loop that I can't understand what is does. can anyone explain it?
here is the code:

```<code>var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}
</code>```

and here is the link to actual w3schools page:
https://www.w3schools.com/howto/howto_js_accordion.asp

答:
Have added few more comments for ease of understanding</p>

```<code>// get all the elements which have same class name.
// it will return a html collection.
var acc = document.getElementsByClassName("accordion");
var i;

// now looping through the collection & adding event to each of the element.
// click is a event name
for (i = 0; i < acc.length; i++) {
    // adding onclick event to each of the element
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        // toggle will remove a class if it there & if not there it will add the class
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        // each of the element have a sibling p element.
        // depending on the scenario it is showing and hiding the p element
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            // will hide the p element
            panel.style.display = "none";
        } else {
            // will show p element
            panel.style.display = "block";
        }
    }
}
</code>```

Title: Accordion in Javascript

Body:
I want to implement a simple accordion to my page, so I browsed w3schools and found the tutorial. But in it's javascript code there is a for loop that I can't understand what is does. can anyone explain it?
here is the code:

var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}

and here is the link to actual w3schools page:
https://www.w3schools.com/howto/howto_js_accordion.asp

Body:
Have added few more comments for ease of understanding

// get all the elements which have same class name.
// it will return a html collection.
var acc = document.getElementsByClassName("accordion");
var i;

// now looping through the collection & adding event to each of the element.
// click is a event name
for (i = 0; i < acc.length; i++) {
    // adding onclick event to each of the element
    acc[i].onclick = function(){
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        // toggle will remove a class if it there & if not there it will add the class
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        // each of the element have a sibling p element.
        // depending on the scenario it is showing and hiding the p element
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            // will hide the p element
            panel.style.display = "none";
        } else {
            // will show p element
            panel.style.display = "block";
        }
    }
}


问:
php array_unique returns empty array depending on server
I have a line of code that has worked on my local develop machine but does not work (as expected) on another machine.

Here is my debugging of the call to array_unique:

```<code>debug("Parameter array size: ".sizeof($parameters));
debug("Sorted array size: ".sizeof(array_unique($parameters, SORT_REGULAR)));
debug_r($parameters);
debug_r(array_unique($parameters, SORT_REGULAR));
</code>```

(I've coded the debug and debug_r functions to output the input, but nicely formatted.)

The results are:

```<code>Parameter array size: 10
Sorted array size: 0
Array ( [0] => ~oli_Search_Term [1] => ~oli_Search_Term [2] => ~oli_Search_Term [3] => ~oli_Search_Term [4] => ~tim_Time_From [5] => ~tim_Time_To [6] => ~tim_Time_From [7] => ~tim_Time_To [8] => ~tim_Time_From [9] => ~tim_Time_To )
</code>```

Note - there is nothing output for that final debug call (intended to dump the contents of array_unique($parameters, SORT_REGULAR).

Why is the array empty (and only on one machine)?

The machine where the output is empty is running PHP Version 5.0.3.

Adding the following:

```<code>vardump($parameters);
</code>```

... yields:

array(10) { [0]=> string(16) "~oli_Search_Term" [1]=> string(16) "~oli_Search_Term" [2]=> string(16) "~oli_Search_Term" [3]=> string(16) "~oli_Search_Term" [4]=> string(14) "~tim_Time_From" [5]=> string(12) "~tim_Time_To" [6]=> string(14) "~tim_Time_From" [7]=> string(12) "~tim_Time_To" [8]=> string(14) "~tim_Time_From" [9]=> string(12) "~tim_Time_To" }

答:
After not finding a solution to the question above, I began seeing whether there was a workaround - to code this another way.

The workaround I found:

For all instances of:

```<code>array_unique($parameters, SORT_REGULAR)
</code>```

Replace with:

```<code>array_unique($parameters)
</code>```

I was unsure as to what this modified behaviour would be although at a glance it seemed to produce the result I wanted. In order to check explicitly what this change would do, I referred to the manual and found this:

"Added the optional sort_flags defaulting to SORT_REGULAR. Prior to 5.2.9, this function used to sort the array with SORT_STRING internally. "

So the root cause was that on the second server, running 5.0.3, the optional flag argument is not supported.

Body:
I have a line of code that has worked on my local develop machine but does not work (as expected) on another machine.

Here is my debugging of the call to array_unique:

debug("Parameter array size: ".sizeof($parameters));
debug("Sorted array size: ".sizeof(array_unique($parameters, SORT_REGULAR)));
debug_r($parameters);
debug_r(array_unique($parameters, SORT_REGULAR));

(I've coded the debug and debug_r functions to output the input, but nicely formatted.)

The results are:

Parameter array size: 10
Sorted array size: 0
Array ( [0] => ~oli_Search_Term [1] => ~oli_Search_Term [2] => ~oli_Search_Term [3] => ~oli_Search_Term [4] => ~tim_Time_From [5] => ~tim_Time_To [6] => ~tim_Time_From [7] => ~tim_Time_To [8] => ~tim_Time_From [9] => ~tim_Time_To )

Note - there is nothing output for that final debug call (intended to dump the contents of array_unique($parameters, SORT_REGULAR).

Why is the array empty (and only on one machine)?

The machine where the output is empty is running PHP Version 5.0.3.

Adding the following:

vardump($parameters);

... yields:

array(10) { [0]=> string(16) "~oli_Search_Term" [1]=> string(16) "~oli_Search_Term" [2]=> string(16) "~oli_Search_Term" [3]=> string(16) "~oli_Search_Term" [4]=> string(14) "~tim_Time_From" [5]=> string(12) "~tim_Time_To" [6]=> string(14) "~tim_Time_From" [7]=> string(12) "~tim_Time_To" [8]=> string(14) "~tim_Time_From" [9]=> string(12) "~tim_Time_To" }

Body:
After not finding a solution to the question above, I began seeing whether there was a workaround - to code this another way.

The workaround I found:

For all instances of:

array_unique($parameters, SORT_REGULAR)

Replace with:

array_unique($parameters)

I was unsure as to what this modified behaviour would be although at a glance it seemed to produce the result I wanted. In order to check explicitly what this change would do, I referred to the manual and found this:

"Added the optional sort_flags defaulting to SORT_REGULAR. Prior to 5.2.9, this function used to sort the array with SORT_STRING internally. "

So the root cause was that on the second server, running 5.0.3, the optional flag argument is not supported.


问:
jQuery click on appended elements
I have generated some html links with jQuery and appended it to some div
but it seams that i can't call click method now, when these elements are appended (it worked ok when they were hardcoded into html)
$('#something a').click(function() ...

Does anyone know a solution for this?

答:
Use .delegate() for these cases:

```<code>$('#something').delegate('a', 'click', function() {
</code>```

This attaches a click handler on #something, rather than direction to the  elements within...so it works on anchors appended later.  The alternative (worse for a few reasons) version is .live() like this:

```<code>$('#something a').live('click', function() {
</code>```

Title: jQuery click on appended elements

Body:
Use .delegate() for these cases:

$('#something').delegate('a', 'click', function() {

This attaches a click handler on #something, rather than direction to the <a> elements within...so it works on anchors appended later.  The alternative (worse for a few reasons) version is .live() like this:

$('#something a').live('click', function() {


问:
How we can auto remove standalone\tmp\vfs\temp from JBoss directory
Whenever i start the JBoss on windows machine, it auto creates temporary folders in standalone\tmp\vfs\temp directory of JBoss. Eventually the size of temporary data becomes huge. it's tedious to manual delete it.  So need help if anybody has resolved this problem by removing temporary folders on shutdown event of JBoss.

答:
I assume you are using JBoss 6.x as per the tags. Huge Logs generated under /vfs is most likely due to the -Xrs option of the JVM parameter.

There are no CLI commands available which prevent this or clear the logs during shut down. We can manually delete the files when the server is stopped or We can delete them during the startup as a temporary workaround.

Add  rm -rf ../standalone/tmp in the standalonde.sh/standalone.bat. This will clear the files while starting the server instance. But It is highly not recommended to clear the tmp dir when the server is running.

This issue was fixed in the version 6.4.0, It is good to upgrade it to the latest.