问:
Very simple Xamarin.Forms app won't Archive
I am working toward my first Android app and am having trouble. I am trying to Build and Archive the simplest possible Android app and can't get the Archive step to work.

Here is what I am doing...

Start VS2017 Preview with Xamarin Preview extension and Xamarin Updater (everything fully updated)

Run Android SDK Manager and install the following

```<code>Android SDK Tools 25.2.5
Android SDK Platform-tools 26
Android SDK Build-tools 26
Android SDK Build-tools 25.0.3
Android SDK Build-tools 25.0.2
Android SDK Build-tools 25.0.1
Android SDK Build-tools 25
SDK Platform 25.3
Android Support Repository 47
Google Play Services 42
Instant Apps Development SDK 1
Google Play Licensing Library 1
Google Play Billing Library 5
Google USB Driver 11
Google Web Driver 2
Emulator 26
</code>```

Create a new Cross Platform (App1) using defaults (Xamarin.Forms - Blank App - Shared Project), I make no changes to the code.

Open App1.Android Poperties

```<code>Compile using Android version: Android 7.1 (Nougat)
Package Name: App1
Version number: 1
Version name: 1.0
Minimum Android version: Android 7.1 (API Level 25 - Nougat)
Target Android version: Android 7.1 (API Level 25 - Nougat)
Linking: Sdk Assemblies Only
Everything else are default values
</code>```

Set for Release and Build:  Success

Archive: The "LinkAssemblies" task failed unexpectedly.

```<code> Mono.Linker.MarkException: Error processing method: 'TNativeView Xamarin.Forms.Platform.Android.ViewRenderer'2::get_Control()' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> System.ArgumentNullException: Value cannot be null.
Parameter name: instruction
   at Mono.Cecil.Cil.InstructionOffset..ctor(Instruction instruction)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection'1 scopes)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection'1 scopes)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadDebugInfo()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func'3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
</code>```

Where am I going wrong? How can I be messing up such a simple blank template app?

答:
If you go to the 'properties' tab for your android project and select 'Android Options' you will see a drop down list under the title 'Linking' Switch this so that it says 'None' and try again.

If this works, then try it again with 'SDK Assemblies Only'. Usually you get that error when it's found something that can't be linked natively.

Body:
I am working toward my first Android app and am having trouble. I am trying to Build and Archive the simplest possible Android app and can't get the Archive step to work.

Here is what I am doing...

Start VS2017 Preview with Xamarin Preview extension and Xamarin Updater (everything fully updated)

Run Android SDK Manager and install the following

Android SDK Tools 25.2.5
Android SDK Platform-tools 26
Android SDK Build-tools 26
Android SDK Build-tools 25.0.3
Android SDK Build-tools 25.0.2
Android SDK Build-tools 25.0.1
Android SDK Build-tools 25
SDK Platform 25.3
Android Support Repository 47
Google Play Services 42
Instant Apps Development SDK 1
Google Play Licensing Library 1
Google Play Billing Library 5
Google USB Driver 11
Google Web Driver 2
Emulator 26

Create a new Cross Platform (App1) using defaults (Xamarin.Forms - Blank App - Shared Project), I make no changes to the code.

Open App1.Android Poperties

Compile using Android version: Android 7.1 (Nougat)
Package Name: App1
Version number: 1
Version name: 1.0
Minimum Android version: Android 7.1 (API Level 25 - Nougat)
Target Android version: Android 7.1 (API Level 25 - Nougat)
Linking: Sdk Assemblies Only
Everything else are default values

Set for Release and Build:  Success

Archive: The "LinkAssemblies" task failed unexpectedly.

 Mono.Linker.MarkException: Error processing method: 'TNativeView Xamarin.Forms.Platform.Android.ViewRenderer'2::get_Control()' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> System.ArgumentNullException: Value cannot be null.
Parameter name: instruction
   at Mono.Cecil.Cil.InstructionOffset..ctor(Instruction instruction)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection'1 scopes)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection'1 scopes)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadDebugInfo()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func'3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Where am I going wrong? How can I be messing up such a simple blank template app?


来源: stackexchange

问:
ASP.Net Core doesn't recognize Request.MapPath in Razor segment
Working with ASP.Net Core is still a little new to me. I'm trying to follow a tutorial on PluralSight that details how Image Composition in .NET works.

That said, the code I'm trying to convert from ASP.Net MVC to ASP.Net Core is showing an error on Request in my Index.cshtml:

```<code><img src="@Url.Action("ImageFromPath", new { path = Request.MapPath("~/img/1.jpg") })" />
</code>```

The error is simply:

The name 'Request' does not exist in the current context.

My HomeController.cs:

```<code>public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }

    public ActionResult ImageFromPath(string path)
    {
        var ms = new MemoryStream();
        using (Bitmap bitmap = new Bitmap(path))
        {
            bitmap.Save(ms, ImageFormat.Jpeg);
        }

        ms.Position = 0;
        return File(ms, "image/jpg");
    }
}
</code>```

In MVC, I can look up definition of Request that goes all the way back to WebPageRenderingBase [from metadata], yet this does not exist in .NET Core, can anyone offer a way to get this to work?

EDIT - I later plan on using the backend ImageFromPath method to return an image from an API call, not the file system.

答:
You can inject IHostingEnvironment variable in view and rewrite code like below using Host variable:

```<code> @using Microsoft.AspNetCore.Hosting
 @inject IHostingEnvironment Host;

 <img src="@Url.Action("ImageFromPath", new { path = Host.WebRootPath + "/img/1.jpg" })"
</code>```

UPDATE:

Did not see Win's update message, his solution use the same approach, but more cleaner in terms of separation of concerns than my solution.

ContentLicense: CC BY-SA 3.0

Body:
Working with ASP.Net Core is still a little new to me. I'm trying to follow a tutorial on PluralSight that details how Image Composition in .NET works.

That said, the code I'm trying to convert from ASP.Net MVC to ASP.Net Core is showing an error on Request in my Index.cshtml:

The error is simply:

The name 'Request' does not exist in the current context.

My HomeController.cs:

public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }

    public ActionResult ImageFromPath(string path)
    {
        var ms = new MemoryStream();
        using (Bitmap bitmap = new Bitmap(path))
        {
            bitmap.Save(ms, ImageFormat.Jpeg);
        }

        ms.Position = 0;
        return File(ms, "image/jpg");
    }
}

In MVC, I can look up definition of Request that goes all the way back to WebPageRenderingBase [from metadata], yet this does not exist in .NET Core, can anyone offer a way to get this to work?

EDIT - I later plan on using the backend ImageFromPath method to return an image from an API call, not the file system.

Body:
You can inject IHostingEnvironment variable in view and rewrite code like below using Host variable:

 @using Microsoft.AspNetCore.Hosting
 @inject IHostingEnvironment Host;

 <img src="@Url.Action("ImageFromPath", new { path = Host.WebRootPath + "/img/1.jpg" })"

UPDATE:

Did not see Win's update message, his solution use the same approach, but more cleaner in terms of separation of concerns than my solution.


问:
Error: Cannot find module 'webpack'
I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build.  The webpack.config.js file in the example includes the line

```<code> var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
</code>```

which fails for me with the error

```<code>Error: Cannot find module '../../lib/optimize/CommonsChunkPlugin'
</code>```

Searching around, I found other examples of using the CommonsChunkPlugin with the expression

```<code>var commonsPlugin = new webpack.optimize.CommonsChunkPlugin("common.js");
</code>```

which fails with the error

```<code>ReferenceError: webpack is not defined
</code>```

Some more searching found a number of examples including

```<code>var webpack = require('webpack');
</code>```

and my build now fails with

```<code>Error: Cannot find module 'webpack'
</code>```

I'm at a loss as to how to proceed.

答:
On windows, I have observed that this issue shows up if you do not have administrative rights (i.e., you are not a local administrator) on the machine.

As someone else suggested, the solution seems to be to install locally by not using the -g hint.

Title: Error: Cannot find module 'webpack'

Body:
I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build.  The webpack.config.js file in the example includes the line

 var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");

which fails for me with the error

Error: Cannot find module '../../lib/optimize/CommonsChunkPlugin'

Searching around, I found other examples of using the CommonsChunkPlugin with the expression

var commonsPlugin = new webpack.optimize.CommonsChunkPlugin("common.js");

which fails with the error

ReferenceError: webpack is not defined

Some more searching found a number of examples including

var webpack = require('webpack');

and my build now fails with

Error: Cannot find module 'webpack'

I'm at a loss as to how to proceed.


问:
Modal window for several products
I have a problem. I need to make a modal window for each product, but in the modal window, all products only display the last product. I tried to assign id identifiers, but then only the modal window of the first product works.

window.onload = function() {
  $('.img-for-modal').click(function() {
    $('.modal').css('display', 'block');

  });

  $('.close').click(function() {
    $('.modal').css('display', 'none');
  });
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="products-wrap">
  <table class="product">
    <tr>
      <td class="img" rowspan="3">
        <img class="img-for-modal" src="media/products-image/1.jpg">
        <div class="modal">
          <span class="close">×</span>
          <img class="modal-img" src="media/products-image/1.jpg">
        </div>
      </td>
      <td class="product-info">
        <article>Lorem Ipsum is simply dummy text of the printing V1.0</article>
      </td>
    </tr>
    <tr>
      <td class="product-info">
        <b>Цена: </b>200 руб.
      </td>
    </tr>
    <tr>
      <td class="product-delete">
        Добавить в корзину
      </td>
    </tr>
  </table></code>```

答:
I suggest you change to this which will show the nearest modal and close the nearest modal. Your current code selects all items with class modal

Note I use jQuery $(function() { ... }); instead of window.onload = function() { ... }

$(function() {
  $('.img-for-modal').click(function() {
    $(this).next(".modal").show();
  });

  $('.close').click(function() {
    $(this).closest(".modal").hide();
  });
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.modal { display:none}</code>```

          ×

Lorem Ipsum is simply dummy text of the printing V1.0

        Цена: 200 руб.

        Добавить в корзину

```

Title: Modal window for several products

Body:
I have a problem. I need to make a modal window for each product, but in the modal window, all products only display the last product. I tried to assign id identifiers, but then only the modal window of the first product works.

window.onload = function() {
  $('.img-for-modal').click(function() {
    $('.modal').css('display', 'block');

  });

  $('.close').click(function() {
    $('.modal').css('display', 'none');
  });
}

          ×

Lorem Ipsum is simply dummy text of the printing V1.0

        Цена: 200 руб.

        Добавить в корзину

Body:
I suggest you change to this which will show the nearest modal and close the nearest modal. Your current code selects all items with class modal

Note I use jQuery $(function() { ... }); instead of window.onload = function() { ... }

$(function() {
  $('.img-for-modal').click(function() {
    $(this).next(".modal").show();
  });

  $('.close').click(function() {
    $(this).closest(".modal").hide();
  });
});

.modal { display:none}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="products-wrap">
  <table class="product">
    <tr>
      <td class="img" rowspan="3">
        <img class="img-for-modal" src="media/products-image/1.jpg">
        <div class="modal">
          <span class="close">&times;</span>
          <img class="modal-img" src="media/products-image/1.jpg">
        </div>
      </td>
      <td class="product-info">
        <article>Lorem Ipsum is simply dummy text of the printing V1.0</article>
      </td>
    </tr>
    <tr>
      <td class="product-info">
        <b>Цена: </b>200 руб.
      </td>
    </tr>
    <tr>
      <td class="product-delete">
        <a href="#">Добавить в корзину</a>
      </td>
    </tr>
  </table>


问:
System verilog Regular expressions
I understood that System verilog does not have very good regular expression support inbuilt.

How can I check in systemVerilog that a srting matches to the following regular expressions:
 "\d+(ns|ps|us)"

答:
You have a number of different options.

Some simulators already support a set of SystemVerilog string method extensions that handle regular expressions such as str.match() and str.search().

```<code>result = str.match(“pattern”); // returns true if the pattern is matched with the str.
</code>```

If you are using the UVM, there is a DPI routine that does the same thing

```<code>result = uvm_pkg::uvm_re_match(“pattern”,str);
</code>```

There are number of other packages out there such as SVunit that also provide the DPI routines for you.

Title: System verilog Regular expressions

Body:
You have a number of different options.

Some simulators already support a set of SystemVerilog string method extensions that handle regular expressions such as str.match() and str.search().

result = str.match(“pattern”); // returns true if the pattern is matched with the str.

If you are using the UVM, there is a DPI routine that does the same thing

result = uvm_pkg::uvm_re_match(“pattern”,str);

There are number of other packages out there such as SVunit that also provide the DPI routines for you.


问:
How can i update data in Cosmos Azure (NOSQL) , using Azure function with HTTP trigger POST
I'm a newbie Azure, and i'm trying to use Azure function for HTTP trigger NodeJS,
I already have an NoSQL database on Azure Cosmos.
Example:

{
   ...
   "shop":{
      "fruits":[
         "orange",
         "strawberry",
         "lemon"
      ],
      "clothes":[
         "man",
         "woman",
         "babies"
      ]
   }
   ...
}```

Then i want to ADD a new fruit named apple into fruits array, or REMOVE babies out of clothes. Also UPDATE man to men,
How can i do ?
I found the context.bindings. But i haven't known how to use it yet,
Does anyone can help me?

Many thanks.

答:
Here is a sample function which increments num field of the document.

function.json

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "route": "HttpTriggerJSUpdateDocument/{docid}"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "type": "documentDB",
      "name": "inputDocument",
      "databaseName": "MyDB",
      "collectionName": "MyCollection",
      "id": "{docid}",
      "connection": "mydocdb_DOCUMENTDB",
      "direction": "in"
    },
    {
      "type": "documentDB",
      "name": "outputDocument",
      "databaseName": "MyDB",
      "collectionName": "MyCollection",
      "createIfNotExists": false,
      "connection": "mydocdb_DOCUMENTDB",
      "direction": "out"
    }
  ],
  "disabled": false
}
```

<p><code>index.js</code>:</p>

<pre class="lang-js prettyprint-override"><code>module.exports = function (context, req) {
    let inputDocument = context.bindings.inputDocument;
    context.log('JavaScript HTTP trigger, current value: ' +
        (inputDocument && inputDocument.num));

    inputDocument.num = inputDocument.num + 1;

    context.bindings.outputDocument = inputDocument;

    context.res = {
        body: 'Result is ' + inputDocument.num
    };
    context.done();
};
</code>```

Body:
I'm a newbie Azure, and i'm trying to use Azure function for HTTP trigger NodeJS,
I already have an NoSQL database on Azure Cosmos.
Example:

{
   ...
   "shop":{
      "fruits":[
         "orange",
         "strawberry",
         "lemon"
      ],
      "clothes":[
         "man",
         "woman",
         "babies"
      ]
   }
   ...
}

Then i want to ADD a new fruit named apple into fruits array, or REMOVE babies out of clothes. Also UPDATE man to men,
How can i do ?
I found the context.bindings. But i haven't known how to use it yet,
Does anyone can help me?

Many thanks.

Body:
Here is a sample function which increments num field of the document.

function.json

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "route": "HttpTriggerJSUpdateDocument/{docid}"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "type": "documentDB",
      "name": "inputDocument",
      "databaseName": "MyDB",
      "collectionName": "MyCollection",
      "id": "{docid}",
      "connection": "mydocdb_DOCUMENTDB",
      "direction": "in"
    },
    {
      "type": "documentDB",
      "name": "outputDocument",
      "databaseName": "MyDB",
      "collectionName": "MyCollection",
      "createIfNotExists": false,
      "connection": "mydocdb_DOCUMENTDB",
      "direction": "out"
    }
  ],
  "disabled": false
}

index.js:

module.exports = function (context, req) {
    let inputDocument = context.bindings.inputDocument;
    context.log('JavaScript HTTP trigger, current value: ' +
        (inputDocument && inputDocument.num));

    inputDocument.num = inputDocument.num + 1;

    context.bindings.outputDocument = inputDocument;

    context.res = {
        body: 'Result is ' + inputDocument.num
    };
    context.done();
};


问:
excel, VBA, duplicate values
I have a large spreadsheet I was asked to edit. Basically wherever the data was pulled from, it created several duplicates of individuals names, country, start dates, and end dates. Would it be possible to get the start and stop dates in adjacent cells and remove the duplicate data?

I have provided a screen shot. Manually copying, pasting, and deleting would take a very long time since this spreadsheet has over 2300 rows with approximately 50% being duplicates that will need edited.

thanks

答:
VBA shouldn't be necessary here, just add a new column with the formula:

```<code>=CONCATENATE(C1,D1)
</code>```

Replace the column letters with your column letters for Start Date and End Date.

You can then use Excel's remove duplicates function on the new column (Data -> Remove Duplicates)

Title: excel, VBA, duplicate values

Body:
VBA shouldn't be necessary here, just add a new column with the formula:

=CONCATENATE(C1,D1)

Replace the column letters with your column letters for Start Date and End Date.

You can then use Excel's remove duplicates function on the new column (Data -> Remove Duplicates)


答:
If you are in need of your modals to display dynamic content, and you are not using a framework like Angular or React to update the components for you - then you will want to use a dedicated modal library. This will help you manage multiple modal instances, as well as all of your display bindings.

I have used Bootbox.js in the past for this purpose - if you are using Bootstrap, check it out. If you are not using Bootstrap, there are other plugins that will help you accomplish the same task.

The trouble with modals is that by design there can only be a single instance at any one time (think Singleton). So each time you call it, you are calling the same instance. So...if you try to populate multiple instances - it wont happen. Only or last data set will be applied.

The problem with using

http://bootboxjs.com/

Title: Modal window for several products


问:
AEM Form: Change access control of textfield
I'm using Adobe AEM Form, javascript for scripting.

In my form, I have a drop down which allow the user to pick one of the dropdown value item or to fill the textfield by typing. My script as follows:

```<code>Report.Page2.part2.body.subform.Dropdown::exit - (JavaScript, client)
if(this.selectedIndex == "0"){
    Textfield.access = "???????"
    Textfield.fillColor = "255,255,255"

}
else{
    Textfield.rawValue = this.rawValue;
    Textfield.access = "readOnly"
    Textfield.fillColor = "192,192,192"
}
</code>```

I am able to change the Textfield to read only, but not able to change it back to writtable. Can someone advice me how to? and other than "readOnly", what other access control can I assign to the textfield.

Thanks!

答:
There is already an accepted answer so just adding a few details on why it works the way it works as suggested in my comments.

```<code>TextField.access="literal";
</code>```

will generate a markup as below

```<code><input type="xxx" literal>
</input>
</code>```

There are some validations in the framework to check for the allowed values so the literal won't break the HTML over here. The key issues is that this literal is not an attribute so it cannot have a value. For example, the following markup is not possible:

```<code><input enabled="false"></input>
</code>```

In order to clear the attribute, the only way you can reset it is by using an empty string as below:

```<code>TextField.access="";
</code>```

Body:
I'm using Adobe AEM Form, javascript for scripting.

In my form, I have a drop down which allow the user to pick one of the dropdown value item or to fill the textfield by typing. My script as follows:

Report.Page2.part2.body.subform.Dropdown::exit - (JavaScript, client)
if(this.selectedIndex == "0"){
    Textfield.access = "???????"
    Textfield.fillColor = "255,255,255"

}
else{
    Textfield.rawValue = this.rawValue;
    Textfield.access = "readOnly"
    Textfield.fillColor = "192,192,192"
}

I am able to change the Textfield to read only, but not able to change it back to writtable. Can someone advice me how to? and other than "readOnly", what other access control can I assign to the textfield.

Thanks!

Body:
There is already an accepted answer so just adding a few details on why it works the way it works as suggested in my comments.

TextField.access="literal";

will generate a markup as below

<input type="xxx" literal>
</input>

There are some validations in the framework to check for the allowed values so the literal won't break the HTML over here. The key issues is that this literal is not an attribute so it cannot have a value. For example, the following markup is not possible:

<input enabled="false"></input>

In order to clear the attribute, the only way you can reset it is by using an empty string as below:

TextField.access="";


问:
Is it possible to get the string inside the enclosing '<' and '>' of a tag using jquery or plain javascript?
If  my question isn't clear,I don't want the outerhtml which returns all the contents inside a node.I don't want those.For example:

  Hello!

    How are you?Hope you are doing well!

```
</div>
</div>
</p>

<p>Now,outerHTML of 'foo' will give the whole string representation of its DOM structure.I just want </p>

```div id="foo" class="something" style="width:80%; display:inline-block"
```

Is it possible to get this without using regex/string matching?

答:
Another version using  Array#reduce

let el = document.getElementById('foo');

let res = [].slice.call(el.attributes).reduce((a, c) => {
  return a.concat(c.name + '="' + c.value + '"');
}, [el.tagName.toLowerCase()]).join(' ');

console.log(res)```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="foo" class="something" style="width:80%; display:inline-block"></div></code>```

Body:
If  my question isn't clear,I don't want the outerhtml which returns all the contents inside a node.I don't want those.For example:

  Hello!

    How are you?Hope you are doing well!

Now,outerHTML of 'foo' will give the whole string representation of its DOM structure.I just want

div id="foo" class="something" style="width:80%; display:inline-block"

Is it possible to get this without using regex/string matching?

Body:
Another version using  Array#reduce

let el = document.getElementById('foo');

let res = [].slice.call(el.attributes).reduce((a, c) => {
  return a.concat(c.name + '="' + c.value + '"');
}, [el.tagName.toLowerCase()]).join(' ');

console.log(res)

<div id="foo" class="something" style="width:80%; display:inline-block"></div>


问:
telegram bot inline keyboard in group
I am following this example to have the bot send an inline keyboard. When I interact with the bot directly it works fine, but I had no success to have the bot send the keyboard in a group. The bot is an admin member of the group. When I send <code>/start</code> in the group I get no response from the bot. Is this a restriction of groups? Or there is something I need to modify in the code? </p>

答:
there may be different reasons for your problem, try these:

turn off/on group privacy for you bot via botfather.

if you have more than 1bot in the group, try commands like this: /start@botnameBot

as the creator of the group, check if the bot has the required permissions(telegram has introduced different types of permissions for admins/members of channel/group in version 4.1 )

despite of peer to peer conversations, you should send your message to chatID instead of sender's id

Title: telegram bot inline keyboard in group

Body: I am following this example to have the bot send an inline keyboard. When I interact with the bot directly it works fine, but I had no success to have the bot send the keyboard in a group. The bot is an admin member of the group. When I send /start in the group I get no response from the bot. Is this a restriction of groups? Or there is something I need to modify in the code?


问:
Diagnostic Trace Logging Not Working when Deployed to IIS 7
I am working on migrating a site from IIS 6 to IIS 7 and I am not able to see all of my logs. My system.diagnostics configuration is as follows:

```<code><system.diagnostics>
  <trace autoflush="true"></trace>
  <sources>
    <source name="Assembly1" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.TextWriterTraceListener"
             traceOutputOptions="ProcessId, ThreadId, DateTime"
             initializeData="E:\Inetpub\logs\App\Assembly1.log" />
      </listeners>
    </source>
    <source name="Assembly2" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.TextWriterTraceListener"
             traceOutputOptions="ProcessId, ThreadId, DateTime"
             initializeData="E:\Inetpub\logs\App\Assembly2.log" />
      </listeners>
    </source>
    <source name="Assebly3" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.TextWriterTraceListener"
             traceOutputOptions="ProcessId, ThreadId, DateTime"
             initializeData="E:\Inetpub\logs\App\Assembly3.log" />
      </listeners>
    </source>
    <source name="System.ServiceModel" switchValue="All" propagateActivity="true">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="E:\Inetpub\logs\App\ServiceTrace.svclog" />
      </listeners>
    </source>
    <source name="System.ServiceModel.MessageLogging" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="E:\Inetpub\logs\App\ServiceMessages.svclog" />
      </listeners>
    </source>
  </sources>
  <switches>
    <add name="System.Net" value="Verbose" />
    <add name="System.Net.Sockets" value="Verbose" />
  </switches>
</system.diagnostics>
</code>```

If I run the application locally using the ASP.Net web server or local IIS I get all my log files. Once the application has been deployed to IIS 7 I only get the System.ServiceModel log. I have verified that the directory exists and I have given full control to everybody. I also have restarted the services and the site in an attempt to force the logs to flush. I have just been trying anything to get a log out of this thing so I also installed the Tracing and Logging Tools role services. I still don't get my application logs.

I also tried an implementation where I logged to the EventLog instead of trace log files. This also exhibited the same behavior. Worked locally and when deployed to local IIS but not when deployed to the actual server. I logged to the application log and on my IIS7 machine I gave full control permission to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application.

Seems like I must be missing something here. I can't get any information out of these 2 different logging implementations when deployed within IIS 7. I'm not even sure what is common here. Do EventLog.WriteEntry and Trace.TraceEvent both use WCF?

答:
You might have more joy moving your log files out of the Inetpub directory. I certainly did, even though I set the correct permission for the IIS pool user.

Try <initializeData="E:\logs\Apps\ServiceTrace.svclog" />

ContentLicense: CC BY-SA 2.5

Body:
I am working on migrating a site from IIS 6 to IIS 7 and I am not able to see all of my logs. My system.diagnostics configuration is as follows:

<system.diagnostics>
  <trace autoflush="true"></trace>
  <sources>
    <source name="Assembly1" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.TextWriterTraceListener"
             traceOutputOptions="ProcessId, ThreadId, DateTime"
             initializeData="E:\Inetpub\logs\App\Assembly1.log" />
      </listeners>
    </source>
    <source name="Assembly2" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.TextWriterTraceListener"
             traceOutputOptions="ProcessId, ThreadId, DateTime"
             initializeData="E:\Inetpub\logs\App\Assembly2.log" />
      </listeners>
    </source>
    <source name="Assebly3" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.TextWriterTraceListener"
             traceOutputOptions="ProcessId, ThreadId, DateTime"
             initializeData="E:\Inetpub\logs\App\Assembly3.log" />
      </listeners>
    </source>
    <source name="System.ServiceModel" switchValue="All" propagateActivity="true">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="E:\Inetpub\logs\App\ServiceTrace.svclog" />
      </listeners>
    </source>
    <source name="System.ServiceModel.MessageLogging" switchValue="All">
      <listeners>
        <add name="DiagnosticMessageTraceListener"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="E:\Inetpub\logs\App\ServiceMessages.svclog" />
      </listeners>
    </source>
  </sources>
  <switches>
    <add name="System.Net" value="Verbose" />
    <add name="System.Net.Sockets" value="Verbose" />
  </switches>
</system.diagnostics>

If I run the application locally using the ASP.Net web server or local IIS I get all my log files. Once the application has been deployed to IIS 7 I only get the System.ServiceModel log. I have verified that the directory exists and I have given full control to everybody. I also have restarted the services and the site in an attempt to force the logs to flush. I have just been trying anything to get a log out of this thing so I also installed the Tracing and Logging Tools role services. I still don't get my application logs.

I also tried an implementation where I logged to the EventLog instead of trace log files. This also exhibited the same behavior. Worked locally and when deployed to local IIS but not when deployed to the actual server. I logged to the application log and on my IIS7 machine I gave full control permission to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application.

Seems like I must be missing something here. I can't get any information out of these 2 different logging implementations when deployed within IIS 7. I'm not even sure what is common here. Do EventLog.WriteEntry and Trace.TraceEvent both use WCF?


问:
Laravel: Unknown column $parameter in 'on clause'
I have troubles with using a parameter in a DB query and parameter binding in Laravel.

I get this error:

Error: "Column not found: 1054 Unknown column '3' in 'on clause'"

This is the part of a query:

```<code>->join('foo AS f1', function($join) use ($bar)
      {
           $join->on('f1.foo', '=', 'f2.foo')
                ->on('f1.bar', '=', $bar);
      })
</code>```

If I do this instead, it works:

```<code>->on('f1.bar', '=', DB::raw($bar));
</code>```

What's the solution to this? I would like to use parameter binding for this as well of course. However, when I do:

```<code>->on('f1.bar', '=', ':bar', ['bar' => $bar]);
</code>```

I get this:

ErrorException in Grammar.php line 196:

Array to string conversion

答:
when you connecting two tables with join you must specify the column names ($bar must be equal to column name string). So if you want to send some parameters data you must use where instead on.

```<code>->join('foo AS f1', function($join) use ($bar)
      {
           $join->on('f1.foo', '=', 'f2.foo')
                ->where('f1.bar', '=', $bar);
      })
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have troubles with using a parameter in a DB query and parameter binding in Laravel.

I get this error:

Error: "Column not found: 1054 Unknown column '3' in 'on clause'"

This is the part of a query:

->join('foo AS f1', function($join) use ($bar)
      {
           $join->on('f1.foo', '=', 'f2.foo')
                ->on('f1.bar', '=', $bar);
      })

If I do this instead, it works:

->on('f1.bar', '=', DB::raw($bar));

What's the solution to this? I would like to use parameter binding for this as well of course. However, when I do:

->on('f1.bar', '=', ':bar', ['bar' => $bar]);

I get this:

ErrorException in Grammar.php line 196:

Array to string conversion

Body:
when you connecting two tables with join you must specify the column names ($bar must be equal to column name string). So if you want to send some parameters data you must use where instead on.

->join('foo AS f1', function($join) use ($bar)
      {
           $join->on('f1.foo', '=', 'f2.foo')
                ->where('f1.bar', '=', $bar);
      })


问:
Mysql query sum query in codeigniter
Split mysql column in codeigniter

the above link is one of my question. I got the answer for the above question. But now I have a sql query as follows,

```<code>SELECT SUM(IF(pay_type = 1, `pay_amount`, `0))` mess_pay, SUM(IF(pay_type=2, `pay_amount`, `0))` est_pay FROM (`mess_stock`);
</code>```

I want to use above code in codeigniter.

I have tried the following method

```<code>$this->db->select('SUM(IF(pay_type = 1, pay_amount, 0)) mess_pay, SUM(IF(pay_type=2, pay_amount, 0)) est_pay');
$this->db->from('mess_stock');
</code>```

But it throws the following output

```<code>A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mess_pay, SUM(IF(pay_type=2, `pay_amount`, `0))` est_pay FROM (`mess_stock`)' at line 1

SELECT SUM(IF(pay_type = 1, `pay_amount`, `0))` mess_pay, SUM(IF(pay_type=2, `pay_amount`, `0))` est_pay FROM (`mess_stock`)

Filename: /var/www/college/modules/mess_fees/models/mess_fees_model.php
Line Number: 25
</code>```

How can I execute the above query?

答:
USE THIS   </p>

```<code>$summ = $this->db->query("SELECT SUM(column) FROM
table WHERE columnid > '0' ")->result_array();
echo '<br>summ=>'.$summ[0]['SUM(answer)'];
</code>```

Title: Mysql query sum query in codeigniter

Body:
Split mysql column in codeigniter

the above link is one of my question. I got the answer for the above question. But now I have a sql query as follows,

SELECT SUM(IF(pay_type = 1, `pay_amount`, `0))` mess_pay, SUM(IF(pay_type=2, `pay_amount`, `0))` est_pay FROM (`mess_stock`);

I want to use above code in codeigniter.

I have tried the following method

$this->db->select('SUM(IF(pay_type = 1, pay_amount, 0)) mess_pay, SUM(IF(pay_type=2, pay_amount, 0)) est_pay');
$this->db->from('mess_stock');

But it throws the following output

A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mess_pay, SUM(IF(pay_type=2, `pay_amount`, `0))` est_pay FROM (`mess_stock`)' at line 1

SELECT SUM(IF(pay_type = 1, `pay_amount`, `0))` mess_pay, SUM(IF(pay_type=2, `pay_amount`, `0))` est_pay FROM (`mess_stock`)

Filename: /var/www/college/modules/mess_fees/models/mess_fees_model.php
Line Number: 25

How can I execute the above query?

Body:
USE THIS

$summ = $this->db->query("SELECT SUM(column) FROM
table WHERE columnid > '0' ")->result_array();
echo '<br>summ=>'.$summ[0]['SUM(answer)'];


问:
Centering text on video in CSS
I was trying to center the name of my blog in the video background I use but was unsuccesful even though I've tried positioning it absolute with 50% from the top. Can anyone help me center both horizontally and vertically the text on top of the video?

Here's the code: https://codepen.io/anon/pen/QgBZqd

HTML

```<code>    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <title>SINEMACERA</title>
        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Anton|Cabin" rel="stylesheet">
    </head>
    <body>

    <!--NAVBAR STARTS-->

    <nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">SINEMACERA</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav">

            <li class="active"><a href="#">Anasayfa</a></li>

          </ul>

          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">Hakkımda</a></li>
            <li><a href="#">İletişim</a></li>

          </ul>
        </div><!-- /.navbar-collapse -->
        </div>
    </nav>

    <!--NAVBAR ENDS-->

    <div id="COVERPHOTO">

        <div id="COVER">
          <h1 id="COVERTEXT">TEXT ON VIDEO</h1>
          <video autoplay loop id="video-background" muted plays-inline>
            <source src="http://thenewcode.com/assets/videos/polina.mp4" type="video/mp4">
          </video>
          </div>
      </div>

    <div class="container">
        <div class="row">
        <div id="MAJORCONTENT">

            <div class="col-lg-12">
    <h1>Lorem Ipsum Üzerine</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <span class="readmore">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </span>
    <button type="button" class="btn btn-primary wide-button">Devamını oku!</button>
    </div>

            <div class="col-lg-12">
    <h1>Lorem Ipsum Üzerine</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <span class="readmore">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </span>
    <button type="button" class="btn btn-primary wide-button">Devamını oku!</button>
    </div>

    <div class="col-lg-12">
    <h1>Lorem Ipsum Üzerine</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <span class="readmore">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </span>
    <button type="button" class="btn btn-primary wide-button">Devamını oku!</button>
    </div>

    </div>
        </div>
    </div>

    <script
      src="https://code.jquery.com/jquery-3.2.1.js"
      integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
      crossorigin="anonymous"></script>

    <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="sinemacera.js"></script>
    </body>
    </html>
</code>```

CSS

```<code> body {
        background: black;
        color:white;
        font-family: Cabin;
    }

    .wide-button {
        width:100%;
    }

    h1 {
        text-align: center;
        text-shadow: 0px 2px 10px rgba(255, 255, 255, 0.4)

    }

    .row {
        float:left;
    }

    .readmore {
        display:none;
    }

    #COVERPHOTO {
        margin-top: 50px;
    }

    #COVER {
        position: relative;
        font-size: 40px;
        text-align: center;
    }

    #COVERTEXT {
        margin:0;
        font-family: Anton;
        font-size: 10vw;
        text-shadow: 0px 4px 3px rgba(0, 0, 0, 0.7),
                 0px 8px 13px rgba(0, 0, 0, 0.3),
                 0px 18px 23px rgba(0, 0, 0,0.3);
                    }

    #MAJORCONTENT {
    text-align: justify;
    font-size: 1.5em;
    }

    video {
        width:100%;
        height: auto;
    }
</code>```

JS

```<code>$(".btn-primary").click(function() {

var thisBTN = $(this);
var RM = $(this).prev();

RM.slideToggle(1000, function() {
    thisBTN.toggleClass("btn-info")
    if(thisBTN.text()==="Küçült") {
        thisBTN.text("Devamını oku");
    }
    else {
        thisBTN.text("Küçült")
    }
});
});
</code>```

答:
update the css by this

#COVERTEXT {
    margin: 0;
    font-family: Anton;
    font-size: 10vw;
    text-shadow: 0px 4px 3px rgba(0, 0, 0, 0.7), 0px 8px 13px rgba(0, 0, 0, 0.3), 0px 18px 23px rgba(0, 0, 0,0.3);
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    margin: auto;
    transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    -o-transform: translateY(-50%);
    transform: -moz-translateY(-50%);
}```

Title: Centering text on video in CSS

Body:
I was trying to center the name of my blog in the video background I use but was unsuccesful even though I've tried positioning it absolute with 50% from the top. Can anyone help me center both horizontally and vertically the text on top of the video?

Here's the code: https://codepen.io/anon/pen/QgBZqd

HTML

    <!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <title>SINEMACERA</title>
        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Anton|Cabin" rel="stylesheet">

          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            Toggle navigation

          </button>
          SINEMACERA

Anasayfa

Hakkımda

İletişim

TEXT ON VIDEO

          <video autoplay loop id="video-background" muted plays-inline>
            <source src="http://thenewcode.com/assets/videos/polina.mp4" type="video/mp4">
          </video>

Lorem Ipsum Üzerine

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    <button type="button" class="btn btn-primary wide-button">Devamını oku!</button>

Lorem Ipsum Üzerine

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    <button type="button" class="btn btn-primary wide-button">Devamını oku!</button>

Lorem Ipsum Üzerine

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    <button type="button" class="btn btn-primary wide-button">Devamını oku!</button>

CSS

 body {
        background: black;
        color:white;
        font-family: Cabin;
    }

    .wide-button {
        width:100%;
    }

    h1 {
        text-align: center;
        text-shadow: 0px 2px 10px rgba(255, 255, 255, 0.4)

    }

    .row {
        float:left;
    }

    .readmore {
        display:none;
    }

    #COVERPHOTO {
        margin-top: 50px;
    }

    #COVER {
        position: relative;
        font-size: 40px;
        text-align: center;
    }

    #COVERTEXT {
        margin:0;
        font-family: Anton;
        font-size: 10vw;
        text-shadow: 0px 4px 3px rgba(0, 0, 0, 0.7),
                 0px 8px 13px rgba(0, 0, 0, 0.3),
                 0px 18px 23px rgba(0, 0, 0,0.3);
                    }

    #MAJORCONTENT {
    text-align: justify;
    font-size: 1.5em;
    }

    video {
        width:100%;
        height: auto;
    }

JS

$(".btn-primary").click(function() {

var thisBTN = $(this);
var RM = $(this).prev();

RM.slideToggle(1000, function() {
    thisBTN.toggleClass("btn-info")
    if(thisBTN.text()==="Küçült") {
        thisBTN.text("Devamını oku");
    }
    else {
        thisBTN.text("Küçült")
    }
});
});


问:
Safari hangs when uploading files
When uploading files to our PHP application through Safari, it starts uploading them and, after a bit, it hangs without proceeding. The request then goes in timeout and a 500 is reported.

Trying again and again, the uploads hangs always at the same percentage.

The script is very simple as you can see:

```<code><?php print_r($_FILES); ?>
<form action="?" enctype='multipart/form-data' method="post">
    <input type="file" name="file" id="file" multiple>
    <input type="submit" value="submit">
</form>
</code>```

The problem occurs always trying to upload a very large number of files (over 3500) in a multiple file input.

We already tried to close the connection as suggested by the Safari 5 on Mac hangs on uploading files post without success.

Maybe is a bug of Safari. I opened a bug report as you can see on OpenRadar, but different solutions or workarounds are welcomed.

Have you ever got the same problem? Thank you for your help!

UPDATE

Seems not a PHP issue: the upload hangs before sending the request to the server, so before processing the script.

The current php.ini has this configuration:

```<code>[PHP]
max_execution_time = 600
max_input_time = 600
max_input_vars = 100000
memory_limit = 2G
post_max_size = 512M
file_uploads = On
upload_max_filesize = 512M
max_file_uploads = 100000
</code>```

and Fcgi the following:

```<code>IPCCommTimeout 601
FcgidMaxRequestLen 1073741824
</code>```

答: this is bug which nobody knows how to resolve or how to fix</p>

Title: Safari hangs when uploading files

Body:
When uploading files to our PHP application through Safari, it starts uploading them and, after a bit, it hangs without proceeding. The request then goes in timeout and a 500 is reported.

Trying again and again, the uploads hangs always at the same percentage.

The script is very simple as you can see:

<?php print_r($_FILES); ?>
<form action="?" enctype='multipart/form-data' method="post">
    <input type="file" name="file" id="file" multiple>
    <input type="submit" value="submit">
</form>

The problem occurs always trying to upload a very large number of files (over 3500) in a multiple file input.

We already tried to close the connection as suggested by the Safari 5 on Mac hangs on uploading files post without success.

Maybe is a bug of Safari. I opened a bug report as you can see on OpenRadar, but different solutions or workarounds are welcomed.

Have you ever got the same problem? Thank you for your help!

UPDATE

Seems not a PHP issue: the upload hangs before sending the request to the server, so before processing the script.

The current php.ini has this configuration:

[PHP]
max_execution_time = 600
max_input_time = 600
max_input_vars = 100000
memory_limit = 2G
post_max_size = 512M
file_uploads = On
upload_max_filesize = 512M
max_file_uploads = 100000

and Fcgi the following:

IPCCommTimeout 601
FcgidMaxRequestLen 1073741824


答:
Because you are selecting all the modals on the page and showing them all.

```<code>$('.modal').css('display', 'block');
</code>```

You are not selecting the modal that corresponds with what you picked. In your case the modal is beside the image so grab the next element and display it.

```<code>$(this).next('.modal').css('display', 'block');
</code>```

Other option people tend to do is data attributes and ids. You add a data attribute that has the id of the item you want to show. So you read the attribute, and than show that item.

```<code><img class="img-for-modal" src="media/products-image/1.jpg" data-toggles="#modal1">
<div class="modal" id="modal1">
</code>```

and than the JavaScript would look at the attribute

```<code>var selector = $(this).data("toggles")
$(selector).css('display', 'block');
</code>```

Title: Modal window for several products

Body:
I have a problem. I need to make a modal window for each product, but in the modal window, all products only display the last product. I tried to assign id identifiers, but then only the modal window of the first product works.

window.onload = function() {
  $('.img-for-modal').click(function() {
    $('.modal').css('display', 'block');

  });

  $('.close').click(function() {
    $('.modal').css('display', 'none');
  });
}

          ×

Lorem Ipsum is simply dummy text of the printing V1.0

        Цена: 200 руб.

        Добавить в корзину

Body:
Because you are selecting all the modals on the page and showing them all.

$('.modal').css('display', 'block');

You are not selecting the modal that corresponds with what you picked. In your case the modal is beside the image so grab the next element and display it.

$(this).next('.modal').css('display', 'block');

Other option people tend to do is data attributes and ids. You add a data attribute that has the id of the item you want to show. So you read the attribute, and than show that item.

<img class="img-for-modal" src="media/products-image/1.jpg" data-toggles="#modal1">
<div class="modal" id="modal1">

and than the JavaScript would look at the attribute

var selector = $(this).data("toggles")
$(selector).css('display', 'block');


问:
Create custom XML map
I'm trying to create a custom XML map using Excel VBA. My XML file is BookData.xml:

```<code><?xml version='1.0'?>
<BookInfo>
   <Book>
      <ISBN>989-0-487-04641-2</ISBN>
      <Title>My World</Title>
      <Author>Nancy Davolio</Author>
      <Quantity>121</Quantity>
   </Book>
   <Book>
      <ISBN>981-0-776-05541-0</ISBN>
      <Title>Get Connected</Title>
      <Author>Janet Leverling</Author>
      <Quantity>435</Quantity>
   </Book>
   <Book>
      <ISBN>999-1-543-02345-2</ISBN>
      <Title>Honesty</Title>
      <Author>Robert Fuller</Author>
      <Quantity>315</Quantity>
   </Book>
</BookInfo>
</code>```

and my VBA code in Excel 2013 is:

```<code>Sub Create_XSD()
   Dim StrMyXml As String, MyMap As XmlMap
   Dim StrMySchema As String
   StrMyXml = "< BookInfo >"
   StrMyXml = StrMyXml & "<Book>"
   StrMyXml = StrMyXml & "<ISBN>Text</ISBN>"
   StrMyXml = StrMyXml & "<Title>Text</Title>"
   StrMyXml = StrMyXml & "<Author>Text</Author>"
   StrMyXml = StrMyXml & "<Quantity>999</Quantity>"
   StrMyXml = StrMyXml & "</Book>"
   StrMyXml = StrMyXml & "<Book></Book>"
   StrMyXml = StrMyXml & "</ BookInfo >"

   ' Turn off async loading.
   Application.DisplayAlerts = False
   ' Add the string to the XmlMaps collection.
   Set MyMap = ThisWorkbook.XmlMaps.Add(StrMyXml)
   Application.DisplayAlerts = True

   ' Create an empty file and output the schema.
   StrMySchema = ThisWorkbook.XmlMaps(1).Schemas(1).XML
   Open "C:\Documents\MySchema.xsd" For Output As #1
   Print #1, StrMySchema
   Close #1
End Sub
</code>```

which is returning the error:

On line:

```<code>   Set MyMap = ThisWorkbook.XmlMaps.Add(StrMyXml)
</code>```

I'm trying to understand the logic of how to build custom XML maps using VBA so I can use it on another (more complex) XML file. The code I'm following is here.

So, how to fix this error?

答:
I have encountered the same error and the response of BruceWayne is fast correct !

I have removed spaces in </ BookInfo > (line 12)
BUT ALSO in < BookInfo > (line 4)

Removing only in </ BookInfo > is not sufficient.

Title: Create custom XML map

Body:
I'm trying to create a custom XML map using Excel VBA. My XML file is BookData.xml:

<?xml version='1.0'?>
<BookInfo>
   <Book>
      <ISBN>989-0-487-04641-2</ISBN>
      <Title>My World</Title>
      <Author>Nancy Davolio</Author>
      <Quantity>121</Quantity>
   </Book>
   <Book>
      <ISBN>981-0-776-05541-0</ISBN>
      <Title>Get Connected</Title>
      <Author>Janet Leverling</Author>
      <Quantity>435</Quantity>
   </Book>
   <Book>
      <ISBN>999-1-543-02345-2</ISBN>
      <Title>Honesty</Title>
      <Author>Robert Fuller</Author>
      <Quantity>315</Quantity>
   </Book>
</BookInfo>

and my VBA code in Excel 2013 is:

Sub Create_XSD()
   Dim StrMyXml As String, MyMap As XmlMap
   Dim StrMySchema As String
   StrMyXml = "< BookInfo >"
   StrMyXml = StrMyXml & "<Book>"
   StrMyXml = StrMyXml & "<ISBN>Text</ISBN>"
   StrMyXml = StrMyXml & "<Title>Text</Title>"
   StrMyXml = StrMyXml & "<Author>Text</Author>"
   StrMyXml = StrMyXml & "<Quantity>999</Quantity>"
   StrMyXml = StrMyXml & "</Book>"
   StrMyXml = StrMyXml & "<Book></Book>"
   StrMyXml = StrMyXml & "</ BookInfo >"

   ' Turn off async loading.
   Application.DisplayAlerts = False
   ' Add the string to the XmlMaps collection.
   Set MyMap = ThisWorkbook.XmlMaps.Add(StrMyXml)
   Application.DisplayAlerts = True

   ' Create an empty file and output the schema.
   StrMySchema = ThisWorkbook.XmlMaps(1).Schemas(1).XML
   Open "C:\Documents\MySchema.xsd" For Output As #1
   Print #1, StrMySchema
   Close #1
End Sub

which is returning the error:

On line:

   Set MyMap = ThisWorkbook.XmlMaps.Add(StrMyXml)

I'm trying to understand the logic of how to build custom XML maps using VBA so I can use it on another (more complex) XML file. The code I'm following is here.

So, how to fix this error?


问:
python flask import error when I install the IDE and Run by Eclipse
When I Run by Esclipse

```<code># -*- coding: utf-8 -*-

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()
</code>```

This is error msg.

```<code>Traceback (most recent call last):

  File "C:\Users\Austyn\git\flask\ch02\hello.py", line 3, in <module>

    from flask import Flask

  File "C:\Python36\myprojects\venv\lib\site-packages\flask\__init__.py",
  line 19, in <module>

    from jinja2 import Markup, escape

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\__init__.py",
  line 33, in <module>

    from jinja2.environment import Environment, Template

 File"C:\Python36\myprojects\venv\lib\sitepackages\jinja2\environment.py",
 line 15, in <module>

    from jinja2 import nodes

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\nodes.py"line
  19, in <module>

    from jinja2.utils import Markup

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\utils.py"line
  624, in <module>

    from markupsafe import Markup, escape, soft_unicode

  File"C:\Python36\myprojects\venv\lib\sipackages\markupsafe\__init__.py",
  line 14, in <module>

    from markupsafe._compat import text_type, string_types, int_types, \

ModuleNotFoundError: No module named 'markupsafe._compat'
</code>```

When I have tried installing flask I'm in a trouble.
I have no idea why occur that error.
Am I wrong set up the PATH?
I think it doesn't work sideTools like werkzeug and jinja2 and Markupsafe...
But I have no idea what is this.

答:
Try to install markupsafe.</p>

```<code>pip install markupsafe
</code>```

Body:
When I Run by Esclipse

# -*- coding: utf-8 -*-

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

This is error msg.

Traceback (most recent call last):

  File "C:\Users\Austyn\git\flask\ch02\hello.py", line 3, in <module>

    from flask import Flask

  File "C:\Python36\myprojects\venv\lib\site-packages\flask\__init__.py",
  line 19, in <module>

    from jinja2 import Markup, escape

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\__init__.py",
  line 33, in <module>

    from jinja2.environment import Environment, Template

 File"C:\Python36\myprojects\venv\lib\sitepackages\jinja2\environment.py",
 line 15, in <module>

    from jinja2 import nodes

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\nodes.py"line
  19, in <module>

    from jinja2.utils import Markup

  File "C:\Python36\myprojects\venv\lib\site-packages\jinja2\utils.py"line
  624, in <module>

    from markupsafe import Markup, escape, soft_unicode

  File"C:\Python36\myprojects\venv\lib\sipackages\markupsafe\__init__.py",
  line 14, in <module>

    from markupsafe._compat import text_type, string_types, int_types, \

ModuleNotFoundError: No module named 'markupsafe._compat'

When I have tried installing flask I'm in a trouble.
I have no idea why occur that error.
Am I wrong set up the PATH?
I think it doesn't work sideTools like werkzeug and jinja2 and Markupsafe...
But I have no idea what is this.

Body:
Try to install markupsafe.

pip install markupsafe


问:
How to see full absolute path of a symlink
When I'm using ls -la symlinkName or stat symlinkName not all the path is displayed
(e.g ../../../one/two/file.txt)

What is the linux command that reveals the full path?

答:
You can use awk with a system call readlink to get the equivalent of an ls output with full symlink paths. For example:

```<code>ls | awk '{printf("%s ->", $1); system("readlink -f " $1)}'
</code>```

Will display e.g.

```<code>thin_repair ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_restore ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_rmap ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_trim ->/home/user/workspace/boot/usr/bin/pdata_tools
touch ->/home/user/workspace/boot/usr/bin/busybox
true ->/home/user/workspace/boot/usr/bin/busybox
</code>```

Body:
You can use awk with a system call readlink to get the equivalent of an ls output with full symlink paths. For example:

ls | awk '{printf("%s ->", $1); system("readlink -f " $1)}'

Will display e.g.

thin_repair ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_restore ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_rmap ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_trim ->/home/user/workspace/boot/usr/bin/pdata_tools
touch ->/home/user/workspace/boot/usr/bin/busybox
true ->/home/user/workspace/boot/usr/bin/busybox


问:
Edit button on GridView not updating with input box data
I know this is very basic, almost so basic it is difficult to find relevant examples.

I have a gridview table querying from database, and using VS17 I am trying to add an edit column. I have generated the following code using the designer layout but when I click the edit buttons, the row becomes editable but the update statement doesn't update the database. Once I click update, the page refreshes and the table disappears.

Where am I going wrong? Also, I am aware of the spelling errors my predecessor used in the column names.

Here's the cs file:

```<code><%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSWebParts_Custom_Intranet_Data_inventorycountsheetcategorydatagridedit" CodeFile="~/CMSWebParts/Custom/Intranet/Data/inventorycountsheetcategorydatagridedit.ascx.cs" %>
<br />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PartCatagoriesID" DataMember="DefaultView" DataSourceID="SqlDataSource1" EnableModelValidation="False">
    <Columns>
        <asp:CommandField ShowEditButton="True" />
        <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
        <asp:BoundField DataField="CategroyDescription" HeaderText="CategroyDescription" SortExpression="CategroyDescription" />
        <asp:BoundField DataField="PartCatagoriesID" HeaderText="PartCatagoriesID" InsertVisible="False" ReadOnly="True" SortExpression="PartCatagoriesID" />
    </Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Form_IntranetSharpTransit_PartCategories] WHERE [PartCatagoriesID] = ?" EnableViewState="False" InsertCommand="INSERT INTO [Form_IntranetSharpTransit_PartCategories] ([CategoryName], [CategroyDescription], [PartCatagoriesID]) VALUES (?, ?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [CategoryName], [CategroyDescription], [PartCatagoriesID] FROM [Form_IntranetSharpTransit_PartCategories]" UpdateCommand="UPDATE [Form_IntranetSharpTransit_PartCategories] SET [CategoryName] = ?, [CategroyDescription] = ? WHERE [PartCatagoriesID] = ?">
    <DeleteParameters>
        <asp:Parameter Name="PartCatagoriesID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="CategoryName" Type="String" />
        <asp:Parameter Name="CategroyDescription" Type="String" />
        <asp:Parameter Name="PartCatagoriesID" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="CategoryName" Type="String" />
        <asp:Parameter Name="CategroyDescription" Type="String" />
        <asp:Parameter Name="PartCatagoriesID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
</code>```

Here's the ascx file:

```<code>using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CMS.PortalControls;
using CMS.GlobalHelper;
using CMS.TreeEngine;
using CMS.CMSHelper;
using CMS.ExtendedControls;

public partial class CMSWebParts_Custom_Intranet_Data_inventorycountsheetcategorydatagridedit: CMSAbstractWebPart
{

    /// <summary>
    /// Enables or disables resolving of inline controls.
    /// </summary>
    public bool ResolveDynamicControls
    {
        get
        {
            return ValidationHelper.GetBoolean(this.GetValue("ResolveDynamicControls"), true);
        }
        set
        {
            this.SetValue("ResolveDynamicControls", value);
        }
    }

    /// <summary>
    /// Enables or disables HTML encoding of text.
    /// </summary>
    public bool EncodeText
    {
        get
        {
            return ValidationHelper.GetBoolean(this.GetValue("EncodeText"), false);
        }
        set
        {
            this.SetValue("EncodeText", value);
        }
    }

    /// <summary>
    /// Content loaded event handler.
    /// </summary>
    public override void OnContentLoaded()
    {
        base.OnContentLoaded();
        SetupControl();
    }

    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (this.StopProcessing)
        {
            // Do not process
        }
        else
        {

        }
    }

    /// <summary>
    /// Reloads the control data.
    /// </summary>
    public override void ReloadData()
    {
        base.ReloadData();

        SetupControl();
    }

}
</code>```

Very basic, I know, but this isn't my forte and I can't seem to find an applicable example or bit of documentation. Any help would be appreciated!

答: You may need to add the following attributes to your grid view and then implement them in your code behind. If you're using VS17 it'll help you do this tremendously. Inside your grid view start with typing OnRowEditing, OnRowUpdating. That should get you started. You'll probably want to implement the OnRowCancelingEdit method too.

Body:
I know this is very basic, almost so basic it is difficult to find relevant examples.

I have a gridview table querying from database, and using VS17 I am trying to add an edit column. I have generated the following code using the designer layout but when I click the edit buttons, the row becomes editable but the update statement doesn't update the database. Once I click update, the page refreshes and the table disappears.

Where am I going wrong? Also, I am aware of the spelling errors my predecessor used in the column names.

Here's the cs file:

<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSWebParts_Custom_Intranet_Data_inventorycountsheetcategorydatagridedit" CodeFile="~/CMSWebParts/Custom/Intranet/Data/inventorycountsheetcategorydatagridedit.ascx.cs" %>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PartCatagoriesID" DataMember="DefaultView" DataSourceID="SqlDataSource1" EnableModelValidation="False">
    <Columns>
        <asp:CommandField ShowEditButton="True" />
        <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
        <asp:BoundField DataField="CategroyDescription" HeaderText="CategroyDescription" SortExpression="CategroyDescription" />
        <asp:BoundField DataField="PartCatagoriesID" HeaderText="PartCatagoriesID" InsertVisible="False" ReadOnly="True" SortExpression="PartCatagoriesID" />
    </Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Form_IntranetSharpTransit_PartCategories] WHERE [PartCatagoriesID] = ?" EnableViewState="False" InsertCommand="INSERT INTO [Form_IntranetSharpTransit_PartCategories] ([CategoryName], [CategroyDescription], [PartCatagoriesID]) VALUES (?, ?, ?)" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [CategoryName], [CategroyDescription], [PartCatagoriesID] FROM [Form_IntranetSharpTransit_PartCategories]" UpdateCommand="UPDATE [Form_IntranetSharpTransit_PartCategories] SET [CategoryName] = ?, [CategroyDescription] = ? WHERE [PartCatagoriesID] = ?">
    <DeleteParameters>
        <asp:Parameter Name="PartCatagoriesID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="CategoryName" Type="String" />
        <asp:Parameter Name="CategroyDescription" Type="String" />
        <asp:Parameter Name="PartCatagoriesID" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="CategoryName" Type="String" />
        <asp:Parameter Name="CategroyDescription" Type="String" />
        <asp:Parameter Name="PartCatagoriesID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>

Here's the ascx file:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CMS.PortalControls;
using CMS.GlobalHelper;
using CMS.TreeEngine;
using CMS.CMSHelper;
using CMS.ExtendedControls;

public partial class CMSWebParts_Custom_Intranet_Data_inventorycountsheetcategorydatagridedit: CMSAbstractWebPart
{

    ///
    /// Enables or disables resolving of inline controls.
    ///
    public bool ResolveDynamicControls
    {
        get
        {
            return ValidationHelper.GetBoolean(this.GetValue("ResolveDynamicControls"), true);
        }
        set
        {
            this.SetValue("ResolveDynamicControls", value);
        }
    }

    ///
    /// Enables or disables HTML encoding of text.
    ///
    public bool EncodeText
    {
        get
        {
            return ValidationHelper.GetBoolean(this.GetValue("EncodeText"), false);
        }
        set
        {
            this.SetValue("EncodeText", value);
        }
    }

    ///
    /// Content loaded event handler.
    ///
    public override void OnContentLoaded()
    {
        base.OnContentLoaded();
        SetupControl();
    }

    ///
    /// Initializes the control properties.
    ///
    protected void SetupControl()
    {
        if (this.StopProcessing)
        {
            // Do not process
        }
        else
        {

        }
    }

    ///
    /// Reloads the control data.
    ///
    public override void ReloadData()
    {
        base.ReloadData();

        SetupControl();
    }

}

Very basic, I know, but this isn't my forte and I can't seem to find an applicable example or bit of documentation. Any help would be appreciated!


问:
Getting IP addresses for hostnames using nslookup in Powershell
I am new to Powershell scripting and I need to write one script. I have a list of server hostnames and I need to get IP addresses of those servers and write the results in a file.

The hostnames are one column in Excel spreadsheet but I can format them into anything (csv, simple txt file with one hostname per line etc.).

I would like to format the output the way there is a hostname of the server and its IP address per line (so there are multiple lines in case the server has more than one IP).

So far I have been using the simple text file with hostname per line, but from the output in PS I am unable to distinguish what server the IP address is for.

```<code>$servers = get-content "path_to_the_file"
foreach ($server in $servers) {
[System.Net.Dns]::GetHostAddresses($server)
}
</code>```

So I was wondering about loading the hostnames from csv file and printing the hostnames and related IP addresses to another csv again, but I am unsure how.

I am investigating the possibility to capture the required information (hostname and IP) by running nslookup $server in foreach.

Could someone give me a hand?

Thank you.

答:
You can also use nslookup in a Foreach-object loop with 'get-ADcomputer' cmdlet, assuming you have a consistent naming convention / computers are in AD.

The 'Select-Object -unique' does a nice job of stripping out all but one instance of the DC that was queried in the results.

```<code>get-adcomputer -Filter {name -like 'nameOfComputer*'} | ForEach-Object
{nslookup $_.name} | Select-Object -Unique
</code>```

Body:
I am new to Powershell scripting and I need to write one script. I have a list of server hostnames and I need to get IP addresses of those servers and write the results in a file.

The hostnames are one column in Excel spreadsheet but I can format them into anything (csv, simple txt file with one hostname per line etc.).

I would like to format the output the way there is a hostname of the server and its IP address per line (so there are multiple lines in case the server has more than one IP).

So far I have been using the simple text file with hostname per line, but from the output in PS I am unable to distinguish what server the IP address is for.

$servers = get-content "path_to_the_file"
foreach ($server in $servers) {
[System.Net.Dns]::GetHostAddresses($server)
}

So I was wondering about loading the hostnames from csv file and printing the hostnames and related IP addresses to another csv again, but I am unsure how.

I am investigating the possibility to capture the required information (hostname and IP) by running nslookup $server in foreach.

Could someone give me a hand?

Thank you.

Body:
You can also use nslookup in a Foreach-object loop with 'get-ADcomputer' cmdlet, assuming you have a consistent naming convention / computers are in AD.

The 'Select-Object -unique' does a nice job of stripping out all but one instance of the DC that was queried in the results.

get-adcomputer -Filter {name -like 'nameOfComputer*'} | ForEach-Object
{nslookup $_.name} | Select-Object -Unique


问:
PHP string replace the first and last occurance
I am trying to replace the occurrence of li tag with a tag but I also replace the other lis used in the string.

for example I have this:

```<code><li id="item" class="list-item" href="#">Item</li>
</code>```

but I want to replace the li tags without the list-item class name replaced.

if I do :

```<code>$f = array( '><a', 'li' );
$r = array( '', 'a' );
// output the menu
echo str_replace( $f, $r, $menu );
</code>```

then the class name list-item becomes ast-item where li is replaced with a.

How can I just replace the li tag and not all the instance of li?

答:
If you want to do exactly as the question states. First and last li

Then you can use strpos to find the first.

And use strrpos to find the last.

This is more a demonstration of the exact answer to the question rather than a good way.

As I linked to in the comments above str_replace is better.

```<code>$s = '<url id="item" class="list-item" href="#">Item</url>';
$find = "url";
$lenght = strlen($find);
$pos1 = strpos($s, $find);
$pos2 = strrpos($s, $find);

Echo substr($s,0,$pos1) . "a" . Substr($s,$pos1+$lenght,$pos2-$lenght-1) . "a" . Substr($s,$pos2+$lenght);
</code>```

Note that I add or subtract from position depending on if I want to keep or delete the words.

https://3v4l.org/J1Na0

Updated with a more universal solution.

Body:
I am trying to replace the occurrence of li tag with a tag but I also replace the other lis used in the string.

for example I have this:

Item

but I want to replace the li tags without the list-item class name replaced.

if I do :

$f = array( '><a', 'li' );
$r = array( '', 'a' );
// output the menu
echo str_replace( $f, $r, $menu );

then the class name list-item becomes ast-item where li is replaced with a.

How can I just replace the li tag and not all the instance of li?

Body:
If you want to do exactly as the question states. First and last li

Then you can use strpos to find the first.

And use strrpos to find the last.

This is more a demonstration of the exact answer to the question rather than a good way.

As I linked to in the comments above str_replace is better.

$s = '<url id="item" class="list-item" href="#">Item</url>';
$find = "url";
$lenght = strlen($find);
$pos1 = strpos($s, $find);
$pos2 = strrpos($s, $find);

Echo substr($s,0,$pos1) . "a" . Substr($s,$pos1+$lenght,$pos2-$lenght-1) . "a" . Substr($s,$pos2+$lenght);

Note that I add or subtract from position depending on if I want to keep or delete the words.

https://3v4l.org/J1Na0

Updated with a more universal solution.