variables

How sort elements and store them in a variable, XSLT

喜你入骨 提交于 2019-12-31 02:15:10
问题 I was wondering whether it's possible to sort some elements first and store them (already sorted) in a variable. I would need to refer to them thought XSLT that's why I'd like to store them in a variable. I was trying to do the following, but it doesn't seem to work <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:variable name="deposits"> <xsl:for-each select="/BookingCostings/MultiDeposits"> <xsl:sort select="substring(@DepositDate, 1, 4)" /> <xsl:sort

jQuery - Is it okay to use $('#ElementId') everytime?

混江龙づ霸主 提交于 2019-12-31 02:01:05
问题 I just learned how to do the 'document.getElementById' counterpart in jQuery (and it's more powerful). My question is, is it okay to use it everytime or every line of code? Here's how I use it now: $('#MyParentElement').html('<tr id="' + $('#MyElement').val() + '"><td>' + $('#MyElement').val() + '</td></tr>'; Isn't better if I do something like using a variable to reference the object? var x = $('#MyElement'); $('#MyParentElement').html('<tr id="' + x.text() + '"><td>' + x.text() + '</td></tr

Check if variable is number: Applescript

别说谁变了你拦得住时间么 提交于 2019-12-31 01:54:11
问题 How can I check if a variable is a number? I'm trying this: set a to 5 if a is a number display dialog "Yes! It's a number!" end if I've also tried this code: set a to 5 if a is integer display dialog "Yes! It's a number!" end if But unfortunately it doesn't work as expected. 回答1: class of a is integer will fail if you use set a to "5" This will work if even if the variable is a number but was entered as text. set a to "5" try set a to a as number display dialog "Yes! It's a number!" end try

Can't understand the behavior of deleting vars in JavaScript

巧了我就是萌 提交于 2019-12-31 00:56:10
问题 Here is the issue: var x = 5; window.x === x // true. x, as it seems, is a property of window delete x; // false delete window.x; // false; BUT window.x = 5; delete window.x; // true AND window.x = 5; delete x; // true What is the explanation for such behavior? 回答1: Essentially the reason is that declared variables are created with an internal DontDelete attribute, while properties created via assignment are not. Here is great article explaining the inner details of delete : Understanding

Ant loadfile override property

岁酱吖の 提交于 2019-12-31 00:46:29
问题 I'm trying to use the Ant task <loadfile> in a loop to parse the contents of a file. I have something like <loadfile srcFile="@{some.input}" property="my.property"> Since Ant properties are immutable, this doesn't work for me. I need 'my.property' to update on every iteration. Is there a way to achieve this? I know Ant-contrib has a <var> task but I'm not sure how to use <loadfile> with it. Any recommendations? Thanks. 回答1: The Ant plugin Flaka provides a let task, allowing to overwrite

Weird PHP behavior if I put exclamation point into variable name

∥☆過路亽.° 提交于 2019-12-31 00:45:14
问题 I have weirdest problem with PHP itself, that I've ever seen. Setup: PHP 5.33, (tried PHP 5.2.14 as well) under IIS Problem: PHP deletes all session data as soon as I put exclamation point into a key in session array. Example: session1.php session_start(); $_SESSION["foo"] = 'test'; header('Location: session2.php'); session2.php session_start(); var_dump($_SESSION); die(); Works fine, I see variable data printed out. array(1) { ["foo"]=> &string(4) "test" } But if I change line in first file

Java: “error: cannot find symbol”

大兔子大兔子 提交于 2019-12-30 19:48:47
问题 (Rookie mistake, I'm sure.) I'm a first year computer science student, and attempting to write a program for an assignment, with the code; import java.util.Scanner; public class Lab10Ex1 { public static void main(String[] arg) { Scanner keyboard = new Scanner(System.in); System.out.println("Please type a number: "); int n = keyboard.nextInt(); calcNumFactors(); } public static void calcNumFactors(){ System.out.print(n + 1); } } But upon compiling, I get the error; Lab10Ex1.java:10: error:

Function becomes undefined when declaring local variable with same name

廉价感情. 提交于 2019-12-30 12:41:40
问题 I have declared a function in file so that it becomes global: function speakService() { var speakService = {}; var speak = function(word) { console.log(word); }; speakService.speak = speak; return speakService; } Using AngularJS, I want to add this service as dependency: angular .module('login', ['ngRoute']) .factory('speakService', [function() { var speakService = speakService(); return speakService; }]); But as soon as the interpreter hits the line: var speakService = speakService(); the

Function becomes undefined when declaring local variable with same name

一曲冷凌霜 提交于 2019-12-30 12:40:54
问题 I have declared a function in file so that it becomes global: function speakService() { var speakService = {}; var speak = function(word) { console.log(word); }; speakService.speak = speak; return speakService; } Using AngularJS, I want to add this service as dependency: angular .module('login', ['ngRoute']) .factory('speakService', [function() { var speakService = speakService(); return speakService; }]); But as soon as the interpreter hits the line: var speakService = speakService(); the

Unexpected behavior with a string stored in a variable in PowerShell

纵然是瞬间 提交于 2019-12-30 12:14:40
问题 I'm getting some odd behavior from Excel's Cells.Find() method: Variable I'm searching on: PS > $volumename vol_01 PS > $volumename.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object produces no results: PS > $sheet.Cells.Find($volumename).Row but if I manually copy and paste the value of that variable: PS > $volumename = "vol_01" PS > $volumename.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String