qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
Using [JQuery DateFormat](https://github.com/phstc/jquery-dateFormat): ``` $.format.date(dateObj.toString(), "dd/MM/yyyy"); ```
var mydate=new Date(); alert(mydate.toString('dd/MM/yyyy'));
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
If you want to avoid using a library, and don't mind an extra line in your JavaScript: ``` var day = dateObj.getUTCDate(), dd = parseInt(day, 10) < 10 ? '0' + day : day; ```
``` function padWithZeroes(number, width) { while (number.length < width) number = '0' + number; return number; } ``` Now call `day = padWithZeroes(day, 2)` (and likewise for the month) before you use it.
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
If you want to avoid using a library, and don't mind an extra line in your JavaScript: ``` var day = dateObj.getUTCDate(), dd = parseInt(day, 10) < 10 ? '0' + day : day; ```
Using [JQuery DateFormat](https://github.com/phstc/jquery-dateFormat): ``` $.format.date(dateObj.toString(), "dd/MM/yyyy"); ```
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
Using [JQuery DateFormat](https://github.com/phstc/jquery-dateFormat): ``` $.format.date(dateObj.toString(), "dd/MM/yyyy"); ```
You can split it and create your own format: ``` var splitTime = newDate.split("/"); var day = splitTime[0]; var month = splitTime[1]; var year = splitTime[2]; if (day < 10){ day = "0" + day; } var myDate = day + '/' + month + '/' + year; ``` Living demo: <http://jsfiddle.net/rtqpp/>
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
If you want to avoid using a library, and don't mind an extra line in your JavaScript: ``` var day = dateObj.getUTCDate(), dd = parseInt(day, 10) < 10 ? '0' + day : day; ```
You can split it and create your own format: ``` var splitTime = newDate.split("/"); var day = splitTime[0]; var month = splitTime[1]; var year = splitTime[2]; if (day < 10){ day = "0" + day; } var myDate = day + '/' + month + '/' + year; ``` Living demo: <http://jsfiddle.net/rtqpp/>
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
With plain Javascript, only manually ``` if (day < 10) day = "0" + day; if (month < 10) month = "0" + month; ```
You can split it and create your own format: ``` var splitTime = newDate.split("/"); var day = splitTime[0]; var month = splitTime[1]; var year = splitTime[2]; if (day < 10){ day = "0" + day; } var myDate = day + '/' + month + '/' + year; ``` Living demo: <http://jsfiddle.net/rtqpp/>
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
Using [JQuery DateFormat](https://github.com/phstc/jquery-dateFormat): ``` $.format.date(dateObj.toString(), "dd/MM/yyyy"); ```
``` function padWithZeroes(number, width) { while (number.length < width) number = '0' + number; return number; } ``` Now call `day = padWithZeroes(day, 2)` (and likewise for the month) before you use it.
16,900,860
I am using the following to get the current date:- ``` var dateObj = new Date(); var month = dateObj.getUTCMonth() + 1; var day = dateObj.getUTCDate(); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ``` If I `alert(newdate);` it shows:- > > 3/06/2013 > > > Is there any way I...
2013/06/03
[ "https://Stackoverflow.com/questions/16900860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1128694/" ]
If you want to avoid using a library, and don't mind an extra line in your JavaScript: ``` var day = dateObj.getUTCDate(), dd = parseInt(day, 10) < 10 ? '0' + day : day; ```
Please use the following: ``` var dateObj = new Date(); var month = ('0' + (dateObj.getUTCMonth() + 1) ).slice( -2 );; var day = ('0' + (dateObj.getUTCDate() + 1) ).slice( -2 ); var year = dateObj.getUTCFullYear(); var newdate = day + "/" + month + "/" + year; ```
33,576,129
Sometimes i only want to select a single value from multiple rows. Lets imagine i have an account model which looks like this: **Account** * Id * Name * Age And i would only like to select the names. You would write something like this: ``` AccountModel.findAll({ where: { Age: { ...
2015/11/06
[ "https://Stackoverflow.com/questions/33576129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538813/" ]
Using Sequelize 3.13.0 it looks like it isn't possible to have `find` return a flat array of values rather than an array of objects. One solution to your problem is to map the results using underscore or lodash: ``` AccountModel.findAll({ where: { Age: { $gt : 18 } }, attribute...
[arr-pluck](https://github.com/jonschlinkert/arr-pluck) works well: ```js var pluck = require('arr-pluck'); AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true }) .then(function(accounts) { return pluck(accounts, 'Name'); }) `...
33,576,129
Sometimes i only want to select a single value from multiple rows. Lets imagine i have an account model which looks like this: **Account** * Id * Name * Age And i would only like to select the names. You would write something like this: ``` AccountModel.findAll({ where: { Age: { ...
2015/11/06
[ "https://Stackoverflow.com/questions/33576129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538813/" ]
Using Sequelize 3.13.0 it looks like it isn't possible to have `find` return a flat array of values rather than an array of objects. One solution to your problem is to map the results using underscore or lodash: ``` AccountModel.findAll({ where: { Age: { $gt : 18 } }, attribute...
Here is a nice ES6 version of cfogelberg's answer using lambda expressions (`Array.prototype.map()` only works in IE9+ and lambda (arrow) functions have no IE support): ``` AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true }) .then(account...
33,576,129
Sometimes i only want to select a single value from multiple rows. Lets imagine i have an account model which looks like this: **Account** * Id * Name * Age And i would only like to select the names. You would write something like this: ``` AccountModel.findAll({ where: { Age: { ...
2015/11/06
[ "https://Stackoverflow.com/questions/33576129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538813/" ]
Using Sequelize 3.13.0 it looks like it isn't possible to have `find` return a flat array of values rather than an array of objects. One solution to your problem is to map the results using underscore or lodash: ``` AccountModel.findAll({ where: { Age: { $gt : 18 } }, attribute...
**2020 Solution** Hi folks, you can easily do your pure "pluck" method: ``` const someVariable = [ ... ( await AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true })), ].map(account => account.Name); ```
33,576,129
Sometimes i only want to select a single value from multiple rows. Lets imagine i have an account model which looks like this: **Account** * Id * Name * Age And i would only like to select the names. You would write something like this: ``` AccountModel.findAll({ where: { Age: { ...
2015/11/06
[ "https://Stackoverflow.com/questions/33576129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538813/" ]
Here is a nice ES6 version of cfogelberg's answer using lambda expressions (`Array.prototype.map()` only works in IE9+ and lambda (arrow) functions have no IE support): ``` AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true }) .then(account...
[arr-pluck](https://github.com/jonschlinkert/arr-pluck) works well: ```js var pluck = require('arr-pluck'); AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true }) .then(function(accounts) { return pluck(accounts, 'Name'); }) `...
33,576,129
Sometimes i only want to select a single value from multiple rows. Lets imagine i have an account model which looks like this: **Account** * Id * Name * Age And i would only like to select the names. You would write something like this: ``` AccountModel.findAll({ where: { Age: { ...
2015/11/06
[ "https://Stackoverflow.com/questions/33576129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538813/" ]
**2020 Solution** Hi folks, you can easily do your pure "pluck" method: ``` const someVariable = [ ... ( await AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true })), ].map(account => account.Name); ```
[arr-pluck](https://github.com/jonschlinkert/arr-pluck) works well: ```js var pluck = require('arr-pluck'); AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true }) .then(function(accounts) { return pluck(accounts, 'Name'); }) `...
33,576,129
Sometimes i only want to select a single value from multiple rows. Lets imagine i have an account model which looks like this: **Account** * Id * Name * Age And i would only like to select the names. You would write something like this: ``` AccountModel.findAll({ where: { Age: { ...
2015/11/06
[ "https://Stackoverflow.com/questions/33576129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538813/" ]
Here is a nice ES6 version of cfogelberg's answer using lambda expressions (`Array.prototype.map()` only works in IE9+ and lambda (arrow) functions have no IE support): ``` AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true }) .then(account...
**2020 Solution** Hi folks, you can easily do your pure "pluck" method: ``` const someVariable = [ ... ( await AccountModel.findAll({ where: { Age: { $gt : 18 } }, attributes: ['Name'], raw : true })), ].map(account => account.Name); ```
7,149
I am looking for a application to install in my server having the following features:' 1. A global dashboard 2. Wiki 3. Article 4. Forum 5. Quiz 6. Newsleter (Optional) 7. Q/A (Optional) I already found a application: [TWiki](http://twiki.org/), but looking for a better alternative.
2010/12/28
[ "https://webmasters.stackexchange.com/questions/7149", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1171/" ]
Maybe [LifeRay](http://bitnami.org/stack/liferay) could do. Not sure on the quiz part, though.
It sounds like you're looking for something like the [Atlassian](http://www.atlassian.com/) package of applications.
7,149
I am looking for a application to install in my server having the following features:' 1. A global dashboard 2. Wiki 3. Article 4. Forum 5. Quiz 6. Newsleter (Optional) 7. Q/A (Optional) I already found a application: [TWiki](http://twiki.org/), but looking for a better alternative.
2010/12/28
[ "https://webmasters.stackexchange.com/questions/7149", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1171/" ]
[OpenAtrium](http://openatrium.com/) covers the wiki and article publishing part by default. You'll need to manually enable the forum part—it comes with the forum components that Drupal comes with, but there seems to be some minor incompatibility with OA (mainly just that each group can't be given its own default forum...
It sounds like you're looking for something like the [Atlassian](http://www.atlassian.com/) package of applications.
51,007,600
I have element sidebar and div with class `sticky-top`: ``` <div class="row"> <div class="col-lg-4"> <div class="sticky-top"> .... </div> </div> </div> ``` I need pass a margin, when sidebar is sticky, because class sticky-top doesn't have a margin-top. How I can write margin when sideb...
2018/06/24
[ "https://Stackoverflow.com/questions/51007600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9792447/" ]
Try: ``` .sticky-top { top: 0.5em; } ```
Try to use: ``` .sticky-top{ margin-top:10px; } ``` if it gives you trouble, you can force it with `!important`, like this: ``` .sticky-top{ margin-top:10px !important; } ``` Please note that !important should be used only when other solutions are not working. Hope it help!
51,007,600
I have element sidebar and div with class `sticky-top`: ``` <div class="row"> <div class="col-lg-4"> <div class="sticky-top"> .... </div> </div> </div> ``` I need pass a margin, when sidebar is sticky, because class sticky-top doesn't have a margin-top. How I can write margin when sideb...
2018/06/24
[ "https://Stackoverflow.com/questions/51007600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9792447/" ]
You need to use `top` instead of `margin-top` ``` <div class="row"> <div class="col-lg-4"> <div class="sticky-top" style="top: 30px"> .... </div> </div> </div> ```
Try to use: ``` .sticky-top{ margin-top:10px; } ``` if it gives you trouble, you can force it with `!important`, like this: ``` .sticky-top{ margin-top:10px !important; } ``` Please note that !important should be used only when other solutions are not working. Hope it help!
51,007,600
I have element sidebar and div with class `sticky-top`: ``` <div class="row"> <div class="col-lg-4"> <div class="sticky-top"> .... </div> </div> </div> ``` I need pass a margin, when sidebar is sticky, because class sticky-top doesn't have a margin-top. How I can write margin when sideb...
2018/06/24
[ "https://Stackoverflow.com/questions/51007600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9792447/" ]
Try: ``` .sticky-top { top: 0.5em; } ```
You need to use `top` instead of `margin-top` ``` <div class="row"> <div class="col-lg-4"> <div class="sticky-top" style="top: 30px"> .... </div> </div> </div> ```
15,483,496
This has been driving me nuts all evening. Basically, I need to set a specific value in a multidimensional array after sanitizing the value and then again (maybe, depends on validation; if validation failed then the value needs to be set to an empty string) after validating the value. Let's say I have this post array: ...
2013/03/18
[ "https://Stackoverflow.com/questions/15483496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1327700/" ]
You can try ``` $data = array(); $keys = array( 0 => 'should', 1 => 'be', 2 => 'int' ); $value = 'yjd'; echo "<pre>"; setValue($data,$keys,$value); print_r($data); ``` Output ``` Array ( [should] => Array ( [be] => Array ( [int]...
You can do it with [ouzo goodies](https://github.com/letsdrink/ouzo-goodies): ``` Arrays::setNestedValue($array, array('should', 'be', 'int'), 'value'); ``` See <http://ouzo.readthedocs.org/en/latest/utils/arrays.html#setnestedvalue>
33,803,377
I have strange problem and I need help. When I'm printing loop variable i, It is printing i = 3. However it must be 0, 1 or 2. This is my code: ``` IEnumerator Start() { itemCount = 3; for (int i = 0; i < itemCount; i++) { StartCoroutine(TextureFromURL(textureURLString[i], (Sprite callback) => { print...
2015/11/19
[ "https://Stackoverflow.com/questions/33803377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The problem is the anonmyous method. They are refering to the same loop variable i. You can solve it by making a copy of "i". I stripped down your code to make a simple working Example. ``` void Start() { var itemCount = 3; for (int i = 0; i < itemCount; i++) { var x = i; // Important Line ...
It happens of reason how mechanics of captured variables works. In two words - for the first your code makes variable 'i' to be 3 and only after your code starts corutine. Decision for this issue - just add variable that stores value of 'i' inside callback :) ``` var local_i = i; print("local_i = " + local_i); ``` Y...
26,486,975
I currently have a custom ValidationAttribute that ensures that a property is unique. It looks like this: ``` public class UniqueLoginAttribute : ValidationAttribute { protected override ValidationResult IsValid(object value, ValidationContext validationContext) { Context db = new Context(); ...
2014/10/21
[ "https://Stackoverflow.com/questions/26486975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116837/" ]
This will work. You need to build the expression tree manually. Usage ``` Expression<Func<User, string>> userExp = x => x.Login; UniqueAttribute u = new UniqueAttribute(userExp);` ``` EDIT: Removed generics to work w/ `Attribute`. You need to use reflection w/ the runtime types to get the appropriate `SingleOrDefau...
This may work for you, but has the downside of needing to retrieve the full list of entities and loop through them to look for a match. You can specify the entity and property as arguments to the attribute. ``` public class UniqueAttribute : ValidationAttribute { public UniqueAttribute(Type entityType, string prop...
1,367,479
In [this StackOverflow question](https://stackoverflow.com/questions/31505424/iteration-n-fn-1n-1-fn-2), I found an interesting recurrence relation: $$f(n) = \begin{cases} 1 & n \leq 2 \\ nf(n-1) + (n-1)f(n-2) & \text{otherwise.}\end{cases}$$ I [plugged it into Wolfram Alpha](http://www.wolframalpha.com/input/?i=f%28...
2015/07/20
[ "https://math.stackexchange.com/questions/1367479", "https://math.stackexchange.com", "https://math.stackexchange.com/users/141424/" ]
This is slightly reverse-engineered; I don't know whether I would have come up with it without knowing the answer – but it's certainly something that someone with much experience with such things could come up with. First, note that both values of $f$ are being multiplied by one more than their argument, so the right-...
Note that $\Gamma(n+3)=(n+2)!$. $$f(n) = \frac{2\Gamma(n+3) - 5!(n+2)}{n+1}=\frac{2(n+2)! - 5 \cdot !(n+2)}{n+1}$$ Once one has this form, it is not hard using induction: \begin{align\*} f(n+1)&=(n+1)f(n)+nf(n-1) \\ &=\frac{2(n+2)! - 5 \cdot !(n+2)}{n+1}(n-2)+\frac{2(n+1)! - 5 \cdot !(n+1)}{n}n \\ &= 2(n+2)! - 5 \cd...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
The basic `<appSettings>` is easier to deal with - just slap in a `<add key="...." value="..." />` entry and you're done. The downside is: there's no type-checking, e.g. you cannot safely assume your number that you wanted to configure there really is a number - someone could put a string into that setting..... you ju...
Application settings can be controlled from a designer (there is usually a Settings.settings file by default) so its easier to modify and you can access them programmatically through the Settings class where they appear like a strongly typed property. You can also have application and user level settings, as well as de...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
To understand the **pros** and **cons** of settings in the `app.config`, I suggest that you look into the technical details of both. I have included links where you can find source code for handling, describing more technical details below. Let me briefly summarize what I recognized when I worked with them (**note:** ...
I like working with the simpler version for storing and accessing single values. ``` <appSettings> <add key="MyConfigKey" value="true"/> </appSettings> ``` I wrote a utility class to access values in a typesafe way that allows for default values. If defaults are not provided, then helpful exception messages are ...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
The basic `<appSettings>` is easier to deal with - just slap in a `<add key="...." value="..." />` entry and you're done. The downside is: there's no type-checking, e.g. you cannot safely assume your number that you wanted to configure there really is a number - someone could put a string into that setting..... you ju...
One big benefit of using ApplicationSettings is when the application is deployed through ClickOnce as explained in detailed on [this page](https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-and-application-settings?view=vs-2019). Basically, if a setting is of type User and has been modified from its d...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
The basic `<appSettings>` is easier to deal with - just slap in a `<add key="...." value="..." />` entry and you're done. The downside is: there's no type-checking, e.g. you cannot safely assume your number that you wanted to configure there really is a number - someone could put a string into that setting..... you ju...
To understand the **pros** and **cons** of settings in the `app.config`, I suggest that you look into the technical details of both. I have included links where you can find source code for handling, describing more technical details below. Let me briefly summarize what I recognized when I worked with them (**note:** ...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
I've been using a pattern I found a while back where you use basic xml tags but wrap the settings in a static config class. So - a DIY App.Settings. [DotNetPearls Static Config Pattern](http://www.dotnetperls.com/appsettings-cache) If you do it this way you can: * use different sets of config values for different e...
I like working with the simpler version for storing and accessing single values. ``` <appSettings> <add key="MyConfigKey" value="true"/> </appSettings> ``` I wrote a utility class to access values in a typesafe way that allows for default values. If defaults are not provided, then helpful exception messages are ...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
Application settings can be controlled from a designer (there is usually a Settings.settings file by default) so its easier to modify and you can access them programmatically through the Settings class where they appear like a strongly typed property. You can also have application and user level settings, as well as de...
One big benefit of using ApplicationSettings is when the application is deployed through ClickOnce as explained in detailed on [this page](https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-and-application-settings?view=vs-2019). Basically, if a setting is of type User and has been modified from its d...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
I've been using a pattern I found a while back where you use basic xml tags but wrap the settings in a static config class. So - a DIY App.Settings. [DotNetPearls Static Config Pattern](http://www.dotnetperls.com/appsettings-cache) If you do it this way you can: * use different sets of config values for different e...
One big benefit of using ApplicationSettings is when the application is deployed through ClickOnce as explained in detailed on [this page](https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-and-application-settings?view=vs-2019). Basically, if a setting is of type User and has been modified from its d...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
Application settings can be controlled from a designer (there is usually a Settings.settings file by default) so its easier to modify and you can access them programmatically through the Settings class where they appear like a strongly typed property. You can also have application and user level settings, as well as de...
I like working with the simpler version for storing and accessing single values. ``` <appSettings> <add key="MyConfigKey" value="true"/> </appSettings> ``` I wrote a utility class to access values in a typesafe way that allows for default values. If defaults are not provided, then helpful exception messages are ...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
I like working with the simpler version for storing and accessing single values. ``` <appSettings> <add key="MyConfigKey" value="true"/> </appSettings> ``` I wrote a utility class to access values in a typesafe way that allows for default values. If defaults are not provided, then helpful exception messages are ...
One big benefit of using ApplicationSettings is when the application is deployed through ClickOnce as explained in detailed on [this page](https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-and-application-settings?view=vs-2019). Basically, if a setting is of type User and has been modified from its d...
460,935
When developing a .NET Windows Forms Application we have the choice between those `App.config` tags to store our configuration values. Which one is better? ``` <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <confi...
2009/01/20
[ "https://Stackoverflow.com/questions/460935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
The basic `<appSettings>` is easier to deal with - just slap in a `<add key="...." value="..." />` entry and you're done. The downside is: there's no type-checking, e.g. you cannot safely assume your number that you wanted to configure there really is a number - someone could put a string into that setting..... you ju...
I like working with the simpler version for storing and accessing single values. ``` <appSettings> <add key="MyConfigKey" value="true"/> </appSettings> ``` I wrote a utility class to access values in a typesafe way that allows for default values. If defaults are not provided, then helpful exception messages are ...
2,030,771
in java you can have same type of classes and interfaces in same package. i wonder how you could organize code in this way in php. have them in different folders? or use extend on them so you at least can organize them by superclass? (which you could do in java also).
2010/01/08
[ "https://Stackoverflow.com/questions/2030771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
'#{...}' expression does not work inside SSJS libraries, only in source of XPage or Custom Control. Workaround: use #{} clause anywhere else (text field, for example) and refer to it in your client side script.
**I apologize!** I thought this was a dojo question; instead it was a Lotus Notes XPages question! I'm still not sure why this is happening, but someone has [corroborated the that problem is larger than my script](http://mattwhite.me/11tmr.nsf/D6Plinks/MWHE-7K9BC3) and how to resolve it. My workaround is, rather than ...
2,030,771
in java you can have same type of classes and interfaces in same package. i wonder how you could organize code in this way in php. have them in different folders? or use extend on them so you at least can organize them by superclass? (which you could do in java also).
2010/01/08
[ "https://Stackoverflow.com/questions/2030771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
If you put code in a property or event on an XPage, it gets passed as a String and through an evaluator. If you look at the Java classes created for your XPages in the Package Explorer view, you'll see what I mean. The code is a String that is then passed to a Java function that evaluates it on page load or at runtime....
**I apologize!** I thought this was a dojo question; instead it was a Lotus Notes XPages question! I'm still not sure why this is happening, but someone has [corroborated the that problem is larger than my script](http://mattwhite.me/11tmr.nsf/D6Plinks/MWHE-7K9BC3) and how to resolve it. My workaround is, rather than ...
2,030,771
in java you can have same type of classes and interfaces in same package. i wonder how you could organize code in this way in php. have them in different folders? or use extend on them so you at least can organize them by superclass? (which you could do in java also).
2010/01/08
[ "https://Stackoverflow.com/questions/2030771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
'#{...}' expression does not work inside SSJS libraries, only in source of XPage or Custom Control. Workaround: use #{} clause anywhere else (text field, for example) and refer to it in your client side script.
Although script libraries are not compiled in XPages; they also don't run inline. The best practice in XPages is using black-box approach in script libraries. Use parametrization for all functions defined in script libraries (valid for both server-side and client-side). In SSJS, alternatively, you may get the compone...
2,030,771
in java you can have same type of classes and interfaces in same package. i wonder how you could organize code in this way in php. have them in different folders? or use extend on them so you at least can organize them by superclass? (which you could do in java also).
2010/01/08
[ "https://Stackoverflow.com/questions/2030771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
'#{...}' expression does not work inside SSJS libraries, only in source of XPage or Custom Control. Workaround: use #{} clause anywhere else (text field, for example) and refer to it in your client side script.
If you put code in a property or event on an XPage, it gets passed as a String and through an evaluator. If you look at the Java classes created for your XPages in the Package Explorer view, you'll see what I mean. The code is a String that is then passed to a Java function that evaluates it on page load or at runtime....
2,030,771
in java you can have same type of classes and interfaces in same package. i wonder how you could organize code in this way in php. have them in different folders? or use extend on them so you at least can organize them by superclass? (which you could do in java also).
2010/01/08
[ "https://Stackoverflow.com/questions/2030771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
If you put code in a property or event on an XPage, it gets passed as a String and through an evaluator. If you look at the Java classes created for your XPages in the Package Explorer view, you'll see what I mean. The code is a String that is then passed to a Java function that evaluates it on page load or at runtime....
Although script libraries are not compiled in XPages; they also don't run inline. The best practice in XPages is using black-box approach in script libraries. Use parametrization for all functions defined in script libraries (valid for both server-side and client-side). In SSJS, alternatively, you may get the compone...
15,903,669
I have a class which uses generic objects. Generic object needs to implement IDisposable interface. Class also needs to implement IDisposable. ``` public class MyGenericClass<T> where T : IDisposable ``` Now in this Generic object implements interface, but class doesn't. Is it possible that both implement interface?...
2013/04/09
[ "https://Stackoverflow.com/questions/15903669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077385/" ]
``` public class MyGenericClass<T> : IDisposable where T : IDisposable { public void Dispose() { throw new NotImplementedException(); } } ```
Yes it's possible: > > public class MyGenericClass: IDisposable where T : IDisposable > > >
9,005,454
I’m testing EMDK .Net SDK 2.5 on a ES400 device and have managed to get basic barcode scanning to work. When I try to scan QRCode’s, I allways get E\_SCN\_BUFFERTOOSMALL. The ScanData.Buffersize is 112 which probably is to small, but **where can I increase the buffersize**? The QRCode decoder is enabled. If I try the...
2012/01/25
[ "https://Stackoverflow.com/questions/9005454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1169524/" ]
I found a workaround!! By using **Symbol.Barcode2** assembly, instead of the **Symbol.Barcode2.DesingCF35** assembly, I am able to control the buffersize with the statement ``` MyScanner.Config.ScanDataSize = 256; ``` If you need more control, it looks as if you are better off looking at the “CS\_Barcode2Sample”...
You can set the buffer length on the ReaderData object via its constructor. Then you pass that instance to the Reader: ``` MyReader.Actions.Read(MyReaderData) ``` That's all there is to it!
9,005,454
I’m testing EMDK .Net SDK 2.5 on a ES400 device and have managed to get basic barcode scanning to work. When I try to scan QRCode’s, I allways get E\_SCN\_BUFFERTOOSMALL. The ScanData.Buffersize is 112 which probably is to small, but **where can I increase the buffersize**? The QRCode decoder is enabled. If I try the...
2012/01/25
[ "https://Stackoverflow.com/questions/9005454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1169524/" ]
I found a workaround!! By using **Symbol.Barcode2** assembly, instead of the **Symbol.Barcode2.DesingCF35** assembly, I am able to control the buffersize with the statement ``` MyScanner.Config.ScanDataSize = 256; ``` If you need more control, it looks as if you are better off looking at the “CS\_Barcode2Sample”...
You can use `Symbol.Barcode.ReaderDataLengths.MaximumLabel` to initialize the `ReaderData` buffer length to the maximum size. ``` Symbol.Barcode.ReaderData MyReaderData = new Symbol.Barcode.ReaderData ( Symbol.Barcode.ReaderDataTypes.Text, Symbol.Barcode.ReaderDataLengths.MaximumLabel); ```
13,735,410
Here is my site: <http://mytestsite.nfshost.com/>. If you make your browser window thinner, you'll notice that the content in the page's 'body' tag overtakes the 'footer' element. Instead, I'd like it to merely push the 'footer' content down without engulfing it. How do I do that? Below are the relevant sections f...
2012/12/06
[ "https://Stackoverflow.com/questions/13735410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1626730/" ]
footer must be inside body tag.
use css padding ``` footer { padding-top: 25px; } ```
13,735,410
Here is my site: <http://mytestsite.nfshost.com/>. If you make your browser window thinner, you'll notice that the content in the page's 'body' tag overtakes the 'footer' element. Instead, I'd like it to merely push the 'footer' content down without engulfing it. How do I do that? Below are the relevant sections f...
2012/12/06
[ "https://Stackoverflow.com/questions/13735410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1626730/" ]
footer must be inside body tag.
Create a division with `class = "clear"` css ``` div.clear { clear:both } ``` Use this above any division that you want to push down as page content grows. Also footer must be in body tag as Alex stated.
13,735,410
Here is my site: <http://mytestsite.nfshost.com/>. If you make your browser window thinner, you'll notice that the content in the page's 'body' tag overtakes the 'footer' element. Instead, I'd like it to merely push the 'footer' content down without engulfing it. How do I do that? Below are the relevant sections f...
2012/12/06
[ "https://Stackoverflow.com/questions/13735410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1626730/" ]
use css padding ``` footer { padding-top: 25px; } ```
Create a division with `class = "clear"` css ``` div.clear { clear:both } ``` Use this above any division that you want to push down as page content grows. Also footer must be in body tag as Alex stated.
5,073,611
I have discovered that there are still a fair number of drivers out there that don't support NPOT textures so I'm trying to retro-fit my 2D engine (based on OpenTK, which is in turn based on OpenGL) with Texture2D support instead of relying on GL\_ARB\_texture\_rectangle. As part of this I am forcing all NPOTS texture ...
2011/02/22
[ "https://Stackoverflow.com/questions/5073611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78162/" ]
Use `glTexImage2D` with empty data to initialize the texture and `glTexSubImage2D` to fill a portion of it with data. Technically OpenGL allows the data parameter given to `glTexImage{1,2,3}D` to be a null pointer, indicating that the texture object is just to be initializd. It depends on the language binding, if that ...
datenwolf is right on how to initialize the texture with just a partial image, but there are 2 issues with this you need to be aware of: * you need to remap the texture coordinates of your mesh, as the [0-1] texture range of the full texture now also contains uninitialized data, as opposed to your full texture. The us...
25,356
I've done several flash projects working as the ActionScripter with a designer doing all the pretty things and animation. When starting out I found quite a lot of information about ActionScript coding and flash design. Most of the information available seems to focus on one or the other. I didn't find any information ...
2008/08/24
[ "https://Stackoverflow.com/questions/25356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2178/" ]
The way I currently work is that I (the developer) build the functionality using a dummy FLA file, using only external class files. When the designer(s) finish up the layout, they send me a FLA with all the imported assets, and linked buttons and MovieClips. I then attach my document class to the new FLA, and make sure...
On our team everyone uses TortoiseSVN and a Trac instance per project. Designers are using the standard Flash designer to edit .FLAs and developers are using [FlashDevelop](http://www.flashdevelop.org/community/) to manage ActionScript files and debug the project. The tool-chain works like this: 1. Developers program...
25,356
I've done several flash projects working as the ActionScripter with a designer doing all the pretty things and animation. When starting out I found quite a lot of information about ActionScript coding and flash design. Most of the information available seems to focus on one or the other. I didn't find any information ...
2008/08/24
[ "https://Stackoverflow.com/questions/25356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2178/" ]
I've been doing Flash for 9 years and I still find this a difficult thing to get right. There is a balance of power between designers and developers, which will inevitably tip one way or the other. If you work for a developer led studio, then you are lucky, as the designers will be instructed to make a design that ...
On our team everyone uses TortoiseSVN and a Trac instance per project. Designers are using the standard Flash designer to edit .FLAs and developers are using [FlashDevelop](http://www.flashdevelop.org/community/) to manage ActionScript files and debug the project. The tool-chain works like this: 1. Developers program...
25,356
I've done several flash projects working as the ActionScripter with a designer doing all the pretty things and animation. When starting out I found quite a lot of information about ActionScript coding and flash design. Most of the information available seems to focus on one or the other. I didn't find any information ...
2008/08/24
[ "https://Stackoverflow.com/questions/25356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2178/" ]
separating the design from the code is the important thing to do - since I try to do projects as a series of modular components (stitched together a little, of course, since nothing ever fits exactly) I first make a sort of interactive wireframe. It's got placeholders for all UI elements, appropriately named and nested...
On our team everyone uses TortoiseSVN and a Trac instance per project. Designers are using the standard Flash designer to edit .FLAs and developers are using [FlashDevelop](http://www.flashdevelop.org/community/) to manage ActionScript files and debug the project. The tool-chain works like this: 1. Developers program...
25,356
I've done several flash projects working as the ActionScripter with a designer doing all the pretty things and animation. When starting out I found quite a lot of information about ActionScript coding and flash design. Most of the information available seems to focus on one or the other. I didn't find any information ...
2008/08/24
[ "https://Stackoverflow.com/questions/25356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2178/" ]
I've been doing Flash for 9 years and I still find this a difficult thing to get right. There is a balance of power between designers and developers, which will inevitably tip one way or the other. If you work for a developer led studio, then you are lucky, as the designers will be instructed to make a design that ...
The way I currently work is that I (the developer) build the functionality using a dummy FLA file, using only external class files. When the designer(s) finish up the layout, they send me a FLA with all the imported assets, and linked buttons and MovieClips. I then attach my document class to the new FLA, and make sure...
25,356
I've done several flash projects working as the ActionScripter with a designer doing all the pretty things and animation. When starting out I found quite a lot of information about ActionScript coding and flash design. Most of the information available seems to focus on one or the other. I didn't find any information ...
2008/08/24
[ "https://Stackoverflow.com/questions/25356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2178/" ]
I've been doing Flash for 9 years and I still find this a difficult thing to get right. There is a balance of power between designers and developers, which will inevitably tip one way or the other. If you work for a developer led studio, then you are lucky, as the designers will be instructed to make a design that ...
separating the design from the code is the important thing to do - since I try to do projects as a series of modular components (stitched together a little, of course, since nothing ever fits exactly) I first make a sort of interactive wireframe. It's got placeholders for all UI elements, appropriately named and nested...
23,595,420
I have a variable my\_variable with value as a dynamic URL like -- ``` http://stackoverflow.com/questions/ask ``` I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask" How can I use MEL to do that?
2014/05/11
[ "https://Stackoverflow.com/questions/23595420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1493140/" ]
You can use JDK classes in MEL, in fact these packages are auto imported (<http://www.mulesoft.org/documentation/display/current/Mule+Expression+Language+Reference>): * java.lang.\* * java.io.\* * java.net.\* * java.util.\* * java.math.BigDecimal * java.math.BigInteger * javax.activation.DataHandler * javax.activation...
You can use basic Java `String` methods such as `substring()` and `lastIndexOf()` on the variable.
23,595,420
I have a variable my\_variable with value as a dynamic URL like -- ``` http://stackoverflow.com/questions/ask ``` I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask" How can I use MEL to do that?
2014/05/11
[ "https://Stackoverflow.com/questions/23595420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1493140/" ]
You can use the string functions which are availalbe from the java.lang package. ``` #[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))] ``` Hope this helps.
You can use basic Java `String` methods such as `substring()` and `lastIndexOf()` on the variable.
23,595,420
I have a variable my\_variable with value as a dynamic URL like -- ``` http://stackoverflow.com/questions/ask ``` I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask" How can I use MEL to do that?
2014/05/11
[ "https://Stackoverflow.com/questions/23595420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1493140/" ]
You can use basic Java `String` methods such as `substring()` and `lastIndexOf()` on the variable.
``` #[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))] ``` which is simpler one
23,595,420
I have a variable my\_variable with value as a dynamic URL like -- ``` http://stackoverflow.com/questions/ask ``` I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask" How can I use MEL to do that?
2014/05/11
[ "https://Stackoverflow.com/questions/23595420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1493140/" ]
You can use the string functions which are availalbe from the java.lang package. ``` #[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))] ``` Hope this helps.
You can use JDK classes in MEL, in fact these packages are auto imported (<http://www.mulesoft.org/documentation/display/current/Mule+Expression+Language+Reference>): * java.lang.\* * java.io.\* * java.net.\* * java.util.\* * java.math.BigDecimal * java.math.BigInteger * javax.activation.DataHandler * javax.activation...
23,595,420
I have a variable my\_variable with value as a dynamic URL like -- ``` http://stackoverflow.com/questions/ask ``` I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask" How can I use MEL to do that?
2014/05/11
[ "https://Stackoverflow.com/questions/23595420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1493140/" ]
You can use JDK classes in MEL, in fact these packages are auto imported (<http://www.mulesoft.org/documentation/display/current/Mule+Expression+Language+Reference>): * java.lang.\* * java.io.\* * java.net.\* * java.util.\* * java.math.BigDecimal * java.math.BigInteger * javax.activation.DataHandler * javax.activation...
``` #[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))] ``` which is simpler one
23,595,420
I have a variable my\_variable with value as a dynamic URL like -- ``` http://stackoverflow.com/questions/ask ``` I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask" How can I use MEL to do that?
2014/05/11
[ "https://Stackoverflow.com/questions/23595420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1493140/" ]
You can use the string functions which are availalbe from the java.lang package. ``` #[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))] ``` Hope this helps.
``` #[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))] ``` which is simpler one
26,818,471
first off, I'm positive this is a really easy answer, and I apologize. I'm trying to figure out if I can chain a returned value through methods in the same class, using overloaded methods. In the code below, the computeBill(double bookPrice, int quantity) portion is what I'm currently stuck on. What I want it to do,...
2014/11/08
[ "https://Stackoverflow.com/questions/26818471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4221094/" ]
`bookPriceDisp` is a *local* variable of `moneyConversion()`. A local variable, as its name indicates, is local, and thus not visible/usable outside of the block (i.e. the `moneyConversion()` method) where it's defined. What you want is to return the same value of what the `moneyConversion()` method returns, so: ``` ...
I think the problem is in your method `computeBill(double bookPrice, int quantity)`. You just need to say `return moneyConversion(bookPrice, quantity);`
26,818,471
first off, I'm positive this is a really easy answer, and I apologize. I'm trying to figure out if I can chain a returned value through methods in the same class, using overloaded methods. In the code below, the computeBill(double bookPrice, int quantity) portion is what I'm currently stuck on. What I want it to do,...
2014/11/08
[ "https://Stackoverflow.com/questions/26818471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4221094/" ]
`bookPriceDisp` is a *local* variable of `moneyConversion()`. A local variable, as its name indicates, is local, and thus not visible/usable outside of the block (i.e. the `moneyConversion()` method) where it's defined. What you want is to return the same value of what the `moneyConversion()` method returns, so: ``` ...
There's several problems if I try to compile this issue. As already mentioned, you're trying to reference values that are out of scope. Rather than using those variables, you need to be using the values the methods are returning directly or using a variable to hold them and then using that variable in your calculations...
55,206,642
I want to assign the username field of Passengers model to the username of the current logged in user. I cant seem to do it. Below is the code. Models.py ``` class UserProfileInfo(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) profile_pic = models.ImageField(upload_to='pro...
2019/03/17
[ "https://Stackoverflow.com/questions/55206642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11206655/" ]
You need to log the changes in the router-view. So, in the component that has your `<router-view><router-view/>` tag, simply watch for router change: ``` watch: { '$route' (to, from) { console.log('Route changed from ' + from.path + ' to ' + to.path); } } ``` Let me know if this isn't you're looking ...
You can suscribe to all router navigation. The keyword here is [navigation guard](https://v3.router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards). The right one for you would be `beforeEach`. You could do something like this in Vue Router 4 (in Vue Router 3 you would also have to call next): ```...
51,866,058
I am using Azure Managed Service Identity (MSI) to create a static (singleton) AdlsClient. I, then, use the AdlsClient in a Functions app to write to a Data Lake store. The app works fine for about a day but then it stops working and I see this error. ``` The access token in the 'Authorization' header is expired.” ...
2018/08/15
[ "https://Stackoverflow.com/questions/51866058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407246/" ]
The access token that GetAccessTokenAsync returns is guaranteed to not expire within the next 5 minutes. By default, Azure AD access tokens expire in an hour [1]. So, if you use the same token (with default expiration time) for more than an hour, you will get an "expired token" error message. Please initialize the Ad...
If anyone else is hit with this issue, I was able to get this to work the following way. We know from Varun's answer that "GetAccessTokenAsync caches the access token in memory, and will automatically get a new token if it is within 5 minutes of expiry" So, we could just check whether the current access token isn't ...
51,866,058
I am using Azure Managed Service Identity (MSI) to create a static (singleton) AdlsClient. I, then, use the AdlsClient in a Functions app to write to a Data Lake store. The app works fine for about a day but then it stops working and I see this error. ``` The access token in the 'Authorization' header is expired.” ...
2018/08/15
[ "https://Stackoverflow.com/questions/51866058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407246/" ]
The access token that GetAccessTokenAsync returns is guaranteed to not expire within the next 5 minutes. By default, Azure AD access tokens expire in an hour [1]. So, if you use the same token (with default expiration time) for more than an hour, you will get an "expired token" error message. Please initialize the Ad...
**Prerequisites** We need to know the following information to come up with an efficient solution: 1. Your assembly in an Azure Function app is loaded upon Function startup. However, for each invocation, the same loaded assembly is used for invoking your function app's method. This implies that any singletons will be...
51,866,058
I am using Azure Managed Service Identity (MSI) to create a static (singleton) AdlsClient. I, then, use the AdlsClient in a Functions app to write to a Data Lake store. The app works fine for about a day but then it stops working and I see this error. ``` The access token in the 'Authorization' header is expired.” ...
2018/08/15
[ "https://Stackoverflow.com/questions/51866058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407246/" ]
A recent update appeared in the link below to automatically refresh tokens for Storage Accounts: <https://learn.microsoft.com/en-us/azure/storage/common/storage-auth-aad-msi> I've modified the code above and tested it with Azure Data Lake Store Gen1 successfully to auto refresh MSI tokens. To implement the code for A...
If anyone else is hit with this issue, I was able to get this to work the following way. We know from Varun's answer that "GetAccessTokenAsync caches the access token in memory, and will automatically get a new token if it is within 5 minutes of expiry" So, we could just check whether the current access token isn't ...
51,866,058
I am using Azure Managed Service Identity (MSI) to create a static (singleton) AdlsClient. I, then, use the AdlsClient in a Functions app to write to a Data Lake store. The app works fine for about a day but then it stops working and I see this error. ``` The access token in the 'Authorization' header is expired.” ...
2018/08/15
[ "https://Stackoverflow.com/questions/51866058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407246/" ]
If anyone else is hit with this issue, I was able to get this to work the following way. We know from Varun's answer that "GetAccessTokenAsync caches the access token in memory, and will automatically get a new token if it is within 5 minutes of expiry" So, we could just check whether the current access token isn't ...
**Prerequisites** We need to know the following information to come up with an efficient solution: 1. Your assembly in an Azure Function app is loaded upon Function startup. However, for each invocation, the same loaded assembly is used for invoking your function app's method. This implies that any singletons will be...
51,866,058
I am using Azure Managed Service Identity (MSI) to create a static (singleton) AdlsClient. I, then, use the AdlsClient in a Functions app to write to a Data Lake store. The app works fine for about a day but then it stops working and I see this error. ``` The access token in the 'Authorization' header is expired.” ...
2018/08/15
[ "https://Stackoverflow.com/questions/51866058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407246/" ]
A recent update appeared in the link below to automatically refresh tokens for Storage Accounts: <https://learn.microsoft.com/en-us/azure/storage/common/storage-auth-aad-msi> I've modified the code above and tested it with Azure Data Lake Store Gen1 successfully to auto refresh MSI tokens. To implement the code for A...
**Prerequisites** We need to know the following information to come up with an efficient solution: 1. Your assembly in an Azure Function app is loaded upon Function startup. However, for each invocation, the same loaded assembly is used for invoking your function app's method. This implies that any singletons will be...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
Old question I know, but for anyone that comes along looking for how to do this...it's pretty easy to connect `ZXing` to `JFreeSVG` (<http://www.jfree.org/jfreesvg>), for example: ``` package org.jfree.demo; import com.google.zxing.BarcodeFormat; import com.google.zxing.WriterException; import com.google.zxing.common...
The easiest way I found was to create a PDF with iText and then convert the resulting PDF to EPS or SVG. Here is the code to create the PDF: ``` @Test public void testQRtoPDF() throws WriterException, FileNotFoundException, DocumentException, UnsupportedEncodingException { final int s = 600; int r = ...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
The easiest way I found was to create a PDF with iText and then convert the resulting PDF to EPS or SVG. Here is the code to create the PDF: ``` @Test public void testQRtoPDF() throws WriterException, FileNotFoundException, DocumentException, UnsupportedEncodingException { final int s = 600; int r = ...
You can use `Apache Batik` instead of `JFreeSVG` if you want a more liberate license. That makes especially sense when you use `Apache FOP` that includes `Apache Batik` as a transient dependency. Here a tweaked version. Credits for the idea and the original code goes to David Gilbert. ``` import com.google.zxing.Barc...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
You can even do it only with zxing withou additional libraries: ``` QRCodeWriter qrCodeWriter = new QRCodeWriter(); Map<EncodeHintType, Object> hints = new HashMap<>(); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); hints.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name()); BitMatrix...
The easiest way I found was to create a PDF with iText and then convert the resulting PDF to EPS or SVG. Here is the code to create the PDF: ``` @Test public void testQRtoPDF() throws WriterException, FileNotFoundException, DocumentException, UnsupportedEncodingException { final int s = 600; int r = ...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
The easiest way I found was to create a PDF with iText and then convert the resulting PDF to EPS or SVG. Here is the code to create the PDF: ``` @Test public void testQRtoPDF() throws WriterException, FileNotFoundException, DocumentException, UnsupportedEncodingException { final int s = 600; int r = ...
Svg format is meant to be set of rectangles which constructs BitMatrix. The idea behind the format is the resolution of the image not to be affected by any increase in the size. For instance, @siom's solution creates 1x1 rectangles for all pixels(That's why it creates a huge file). I classify that solution as brute for...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
Old question I know, but for anyone that comes along looking for how to do this...it's pretty easy to connect `ZXing` to `JFreeSVG` (<http://www.jfree.org/jfreesvg>), for example: ``` package org.jfree.demo; import com.google.zxing.BarcodeFormat; import com.google.zxing.WriterException; import com.google.zxing.common...
You can use `Apache Batik` instead of `JFreeSVG` if you want a more liberate license. That makes especially sense when you use `Apache FOP` that includes `Apache Batik` as a transient dependency. Here a tweaked version. Credits for the idea and the original code goes to David Gilbert. ``` import com.google.zxing.Barc...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
Old question I know, but for anyone that comes along looking for how to do this...it's pretty easy to connect `ZXing` to `JFreeSVG` (<http://www.jfree.org/jfreesvg>), for example: ``` package org.jfree.demo; import com.google.zxing.BarcodeFormat; import com.google.zxing.WriterException; import com.google.zxing.common...
You can even do it only with zxing withou additional libraries: ``` QRCodeWriter qrCodeWriter = new QRCodeWriter(); Map<EncodeHintType, Object> hints = new HashMap<>(); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); hints.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name()); BitMatrix...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
Old question I know, but for anyone that comes along looking for how to do this...it's pretty easy to connect `ZXing` to `JFreeSVG` (<http://www.jfree.org/jfreesvg>), for example: ``` package org.jfree.demo; import com.google.zxing.BarcodeFormat; import com.google.zxing.WriterException; import com.google.zxing.common...
Svg format is meant to be set of rectangles which constructs BitMatrix. The idea behind the format is the resolution of the image not to be affected by any increase in the size. For instance, @siom's solution creates 1x1 rectangles for all pixels(That's why it creates a huge file). I classify that solution as brute for...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
You can even do it only with zxing withou additional libraries: ``` QRCodeWriter qrCodeWriter = new QRCodeWriter(); Map<EncodeHintType, Object> hints = new HashMap<>(); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); hints.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name()); BitMatrix...
You can use `Apache Batik` instead of `JFreeSVG` if you want a more liberate license. That makes especially sense when you use `Apache FOP` that includes `Apache Batik` as a transient dependency. Here a tweaked version. Credits for the idea and the original code goes to David Gilbert. ``` import com.google.zxing.Barc...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
You can use `Apache Batik` instead of `JFreeSVG` if you want a more liberate license. That makes especially sense when you use `Apache FOP` that includes `Apache Batik` as a transient dependency. Here a tweaked version. Credits for the idea and the original code goes to David Gilbert. ``` import com.google.zxing.Barc...
Svg format is meant to be set of rectangles which constructs BitMatrix. The idea behind the format is the resolution of the image not to be affected by any increase in the size. For instance, @siom's solution creates 1x1 rectangles for all pixels(That's why it creates a huge file). I classify that solution as brute for...
10,789,059
I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?
2012/05/28
[ "https://Stackoverflow.com/questions/10789059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763962/" ]
You can even do it only with zxing withou additional libraries: ``` QRCodeWriter qrCodeWriter = new QRCodeWriter(); Map<EncodeHintType, Object> hints = new HashMap<>(); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); hints.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name()); BitMatrix...
Svg format is meant to be set of rectangles which constructs BitMatrix. The idea behind the format is the resolution of the image not to be affected by any increase in the size. For instance, @siom's solution creates 1x1 rectangles for all pixels(That's why it creates a huge file). I classify that solution as brute for...
33,397,534
I am currently writing a test against an e-commerce website. When a user runs a search for a particular product a list of items are being returned. What I am hoping to do is pass a particular value (e.g. the number 2) into my test scenario, at which point can be passed into my XPath expression (nth-child), enabling the...
2015/10/28
[ "https://Stackoverflow.com/questions/33397534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3864487/" ]
Your Query would be something Similar to this ``` Products.find({},{ fields: { privateData: 0 } } ``` `privateData:0` will make sure that the field is omitted. please Refer <https://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/> for more info
if you can use the aggregation framework you can use the `$project` operator: ``` db.<colletion_name>.aggregate( { $project: { publicData: 1} } ); ``` And you will get back all of your documents with only the `publicData` field
36,999,061
Recently, I have read about Shortest Path Faster Algorithm. I am wondering how to construct a test case for which standard implementation of SPFA wolud be very, very slow. Do you know any? By standard implementation, I mean this one from Wikipedia: ``` procedure Shortest-Path-Faster-Algorithm(G, s) 1 for each ver...
2016/05/03
[ "https://Stackoverflow.com/questions/36999061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6284774/" ]
For example. There are N vertices. 1st vertex is the start and Nth vertex is the End. For ith vertex, there is 2 edges: (i, i+1, 1) and (1, i, 2\*N) where (a,b,c) means there is an edge from a to b with weight c. It is easy to see that the shortest path at this graph is 1->2->3->4->...->N. Assume that for the 7th lin...
Based on Ke Yang's answer, the worst case for a graph with 5 Vertices would be: [![Graph with 5 vertices](https://i.stack.imgur.com/NugE9.png)](https://i.stack.imgur.com/NugE9.png) In each iteration the queue would have the following elements (the head of the queue is the left most element): ``` [1] [5, 4, 3, 2] [4, ...
36,999,061
Recently, I have read about Shortest Path Faster Algorithm. I am wondering how to construct a test case for which standard implementation of SPFA wolud be very, very slow. Do you know any? By standard implementation, I mean this one from Wikipedia: ``` procedure Shortest-Path-Faster-Algorithm(G, s) 1 for each ver...
2016/05/03
[ "https://Stackoverflow.com/questions/36999061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6284774/" ]
For example. There are N vertices. 1st vertex is the start and Nth vertex is the End. For ith vertex, there is 2 edges: (i, i+1, 1) and (1, i, 2\*N) where (a,b,c) means there is an edge from a to b with weight c. It is easy to see that the shortest path at this graph is 1->2->3->4->...->N. Assume that for the 7th lin...
Ke Yang's tests can be easy broken by random shuffle of edges. Small modification brakes this trick: edges must be (i, i+1, 1) and (1, i, N\*3-i\*2).
36,999,061
Recently, I have read about Shortest Path Faster Algorithm. I am wondering how to construct a test case for which standard implementation of SPFA wolud be very, very slow. Do you know any? By standard implementation, I mean this one from Wikipedia: ``` procedure Shortest-Path-Faster-Algorithm(G, s) 1 for each ver...
2016/05/03
[ "https://Stackoverflow.com/questions/36999061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6284774/" ]
Based on Ke Yang's answer, the worst case for a graph with 5 Vertices would be: [![Graph with 5 vertices](https://i.stack.imgur.com/NugE9.png)](https://i.stack.imgur.com/NugE9.png) In each iteration the queue would have the following elements (the head of the queue is the left most element): ``` [1] [5, 4, 3, 2] [4, ...
Ke Yang's tests can be easy broken by random shuffle of edges. Small modification brakes this trick: edges must be (i, i+1, 1) and (1, i, N\*3-i\*2).
7,541,376
How could you read this dataset in `R`, the problem is that the numbers are *floats* and are like `4,000000059604644E+16` and they are separated by a `,` ``` 4,000000059604644E-16 , 7,999997138977056E-16, 9,000002145767216E-16 4,999999403953552E-16 , 6,99999988079071E-16 , 0,099999904632568E-16 9,9999976158142...
2011/09/24
[ "https://Stackoverflow.com/questions/7541376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265519/" ]
It might be best to transform that input data to use decimal points, rather than commas, in the floating point numbers. One way you could do this is to use sed (it looks like you are using Windows, so you would likely need to sed to use this approach): ``` sed 's/\([0-9]\),\([0-9]\)/\1.\2/g' data.txt > data2.txt ```...
It's not pretty, but it should work: ``` x <- matrix(scan("c:/data.txt", what=character(), sep=","), byrow=TRUE, ncol=6) y <- t(apply(x, 1, function(a) { left <- seq(1, length(a), by=2) as.numeric(paste(a[left], a[left+1], sep=".")) } )) ```
7,541,376
How could you read this dataset in `R`, the problem is that the numbers are *floats* and are like `4,000000059604644E+16` and they are separated by a `,` ``` 4,000000059604644E-16 , 7,999997138977056E-16, 9,000002145767216E-16 4,999999403953552E-16 , 6,99999988079071E-16 , 0,099999904632568E-16 9,9999976158142...
2011/09/24
[ "https://Stackoverflow.com/questions/7541376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265519/" ]
Here is an all R solution that uses three `read.table` calls. The first `read.table` statement reads each data row as 6 fields; the second `read.table` statement puts the fields back together properly and reads them and the third grabs the names from the header. ``` fn <- "data.txt" # create a test file Lines <- "A ...
It's not pretty, but it should work: ``` x <- matrix(scan("c:/data.txt", what=character(), sep=","), byrow=TRUE, ncol=6) y <- t(apply(x, 1, function(a) { left <- seq(1, length(a), by=2) as.numeric(paste(a[left], a[left+1], sep=".")) } )) ```
7,541,376
How could you read this dataset in `R`, the problem is that the numbers are *floats* and are like `4,000000059604644E+16` and they are separated by a `,` ``` 4,000000059604644E-16 , 7,999997138977056E-16, 9,000002145767216E-16 4,999999403953552E-16 , 6,99999988079071E-16 , 0,099999904632568E-16 9,9999976158142...
2011/09/24
[ "https://Stackoverflow.com/questions/7541376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265519/" ]
It might be best to transform that input data to use decimal points, rather than commas, in the floating point numbers. One way you could do this is to use sed (it looks like you are using Windows, so you would likely need to sed to use this approach): ``` sed 's/\([0-9]\),\([0-9]\)/\1.\2/g' data.txt > data2.txt ```...
Here is an all R solution that uses three `read.table` calls. The first `read.table` statement reads each data row as 6 fields; the second `read.table` statement puts the fields back together properly and reads them and the third grabs the names from the header. ``` fn <- "data.txt" # create a test file Lines <- "A ...
24,941,991
I'm using TIdFTP (Indy 10.2) in Delphi XE2; the method 'connect' (to create a connection...) is very slow; it takes 7 - 8 seconds to accomplish task. I have tried with different configurations: Passive true or false, AutoLogin true or false, but more or less the same situation. Is there any particular configuration to ...
2014/07/24
[ "https://Stackoverflow.com/questions/24941991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/998030/" ]
First, 10.2 is a VERY OLD and OUTDATED version. The current version is 10.6. You should seriously consider upgrading. Second, `Connect()` does a lot of work. It always sends a `SYST` command at a minimum, but depending on the values of the following properties, it may send a lot of additional commands as well: * UseH...
Firstly I'd verify if the issue is with Indy, have you tried connecting using a different ftp client (ftp at a command prompt, Filezilla, etc.), as it could be the server that is slow. I remember an issue I had where the FTP server was attempting to do a reverse DNS lookup and stalling the connection.
15,449,595
i have got an html table like that ``` <table> <tr> <td> 1 </td> <td> 2 </td> <td> 3 </td> <td> 4 </td> </tr> </table> ``` the result will be 1 2 3 4 i want the result to be 1 2 3 4 but in run time using jqu...
2013/03/16
[ "https://Stackoverflow.com/questions/15449595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2126633/" ]
**Using jQuery** *HTML* ``` <table id="table1"> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> </table> ``` *jQuery* ``` $("#table1 td:first-child").css("float", "left"); $("#table1 td:nth-child(2)").css("display", "block"); $("#table1 td:nth-child(3)").css("float", ...
``` <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> </table> ``` It works but it's not quite right )) ``` $(document).ready(function(){ $("td:even").css({"display":"block","float":"left", "clear":"left"}); $("td:odd").css({"display":"block", "float":"left"}); }); ```
15,449,595
i have got an html table like that ``` <table> <tr> <td> 1 </td> <td> 2 </td> <td> 3 </td> <td> 4 </td> </tr> </table> ``` the result will be 1 2 3 4 i want the result to be 1 2 3 4 but in run time using jqu...
2013/03/16
[ "https://Stackoverflow.com/questions/15449595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2126633/" ]
Can restructure table by putting last 2 cells in new row: ``` $('tr').each(function(){ $(this).after( $('<tr>').append( $(this).find('td:gt(1)'))) }); ``` DEMO: <http://jsfiddle.net/Fyvwd/>
``` <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> </table> ``` It works but it's not quite right )) ``` $(document).ready(function(){ $("td:even").css({"display":"block","float":"left", "clear":"left"}); $("td:odd").css({"display":"block", "float":"left"}); }); ```
15,637,228
The library I am working on need to be used on both 32 and 64 bit machines; I have lots of compiler warnings because on 64bit machines `unsigned int != size_t`. Is there any downside in replacing all `unsigned int`s and `size_t`s by 'unsigned long'? I appreciate it does not look very elegant, but, in out case, the me...
2013/03/26
[ "https://Stackoverflow.com/questions/15637228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396516/" ]
The standard makes little guarantees about the sizes of types like `int` and `long`. `size_t` is guaranteed to be large enough to hold any object, and all `std` containers operate on `size_t`. It's perfectly possible for a platform to define `long` as smaller than `size_t`, or have the size of `long` subject to compil...
If you are using `size_t` in places where you *should* get a `size_t` and replace it with `unsigned long`, you will introduce new warnings. example: ``` size_t count = some_vector.size(); ``` Replace `size_t` with `unsigned long`, and (to the degree they are different) you will have introduced a new warning (becaus...
15,637,228
The library I am working on need to be used on both 32 and 64 bit machines; I have lots of compiler warnings because on 64bit machines `unsigned int != size_t`. Is there any downside in replacing all `unsigned int`s and `size_t`s by 'unsigned long'? I appreciate it does not look very elegant, but, in out case, the me...
2013/03/26
[ "https://Stackoverflow.com/questions/15637228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396516/" ]
What warnings? The most obvious one I can think of is for a "narrowing conversion", that is to say you're assigning `size_t` to `unsigned int`, and getting a warning that information might be lost. The main downside of replacing `size_t` with `unsigned long` is that `unsigned long` is not guaranteed to be large enough...
If you are using `size_t` in places where you *should* get a `size_t` and replace it with `unsigned long`, you will introduce new warnings. example: ``` size_t count = some_vector.size(); ``` Replace `size_t` with `unsigned long`, and (to the degree they are different) you will have introduced a new warning (becaus...
15,637,228
The library I am working on need to be used on both 32 and 64 bit machines; I have lots of compiler warnings because on 64bit machines `unsigned int != size_t`. Is there any downside in replacing all `unsigned int`s and `size_t`s by 'unsigned long'? I appreciate it does not look very elegant, but, in out case, the me...
2013/03/26
[ "https://Stackoverflow.com/questions/15637228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396516/" ]
If you are using `size_t` in places where you *should* get a `size_t` and replace it with `unsigned long`, you will introduce new warnings. example: ``` size_t count = some_vector.size(); ``` Replace `size_t` with `unsigned long`, and (to the degree they are different) you will have introduced a new warning (becaus...
It may be a problem of assuming it's unsigned long when long is 8 bytes. then (unsigned int) -1 != (unsigned long) -1, the following code may have assertion failure. ``` unsigned int i = string::npos; assert(i == string::npos); ```
15,637,228
The library I am working on need to be used on both 32 and 64 bit machines; I have lots of compiler warnings because on 64bit machines `unsigned int != size_t`. Is there any downside in replacing all `unsigned int`s and `size_t`s by 'unsigned long'? I appreciate it does not look very elegant, but, in out case, the me...
2013/03/26
[ "https://Stackoverflow.com/questions/15637228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396516/" ]
What warnings? The most obvious one I can think of is for a "narrowing conversion", that is to say you're assigning `size_t` to `unsigned int`, and getting a warning that information might be lost. The main downside of replacing `size_t` with `unsigned long` is that `unsigned long` is not guaranteed to be large enough...
The standard makes little guarantees about the sizes of types like `int` and `long`. `size_t` is guaranteed to be large enough to hold any object, and all `std` containers operate on `size_t`. It's perfectly possible for a platform to define `long` as smaller than `size_t`, or have the size of `long` subject to compil...
15,637,228
The library I am working on need to be used on both 32 and 64 bit machines; I have lots of compiler warnings because on 64bit machines `unsigned int != size_t`. Is there any downside in replacing all `unsigned int`s and `size_t`s by 'unsigned long'? I appreciate it does not look very elegant, but, in out case, the me...
2013/03/26
[ "https://Stackoverflow.com/questions/15637228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396516/" ]
The standard makes little guarantees about the sizes of types like `int` and `long`. `size_t` is guaranteed to be large enough to hold any object, and all `std` containers operate on `size_t`. It's perfectly possible for a platform to define `long` as smaller than `size_t`, or have the size of `long` subject to compil...
It may be a problem of assuming it's unsigned long when long is 8 bytes. then (unsigned int) -1 != (unsigned long) -1, the following code may have assertion failure. ``` unsigned int i = string::npos; assert(i == string::npos); ```
15,637,228
The library I am working on need to be used on both 32 and 64 bit machines; I have lots of compiler warnings because on 64bit machines `unsigned int != size_t`. Is there any downside in replacing all `unsigned int`s and `size_t`s by 'unsigned long'? I appreciate it does not look very elegant, but, in out case, the me...
2013/03/26
[ "https://Stackoverflow.com/questions/15637228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396516/" ]
What warnings? The most obvious one I can think of is for a "narrowing conversion", that is to say you're assigning `size_t` to `unsigned int`, and getting a warning that information might be lost. The main downside of replacing `size_t` with `unsigned long` is that `unsigned long` is not guaranteed to be large enough...
It may be a problem of assuming it's unsigned long when long is 8 bytes. then (unsigned int) -1 != (unsigned long) -1, the following code may have assertion failure. ``` unsigned int i = string::npos; assert(i == string::npos); ```
1,458,518
Is there any differentiable function defined on $(0,1]$ whose range is $(0,1)$?
2015/09/30
[ "https://math.stackexchange.com/questions/1458518", "https://math.stackexchange.com", "https://math.stackexchange.com/users/201049/" ]
Consider $$ f(x)=\frac{1+\left(1-\frac x2\right)\,\sin\frac1x}2. $$ If $x>\delta$, then $|f(x)|=f(x)\leq(1+(1-\delta/2))/2=1=\delta/4$. But near zero, the function approaches both 1 and 0. So its range is $(0,1)$.
This does the job $$f(x) = \frac{1}{2} \left( (1-x) \sin \left( \frac{1}{x}\right) + 1 \right)$$
20,218,118
In PHP to convert a string to DateTime() its very very easy: ``` $dateTime = new DateTime("2013-12-11 10:109:08"); echo $dateTime->format("d/m/Y"); // output 11/12/2013 ``` What is the equivalent in Java? I've seen a lot of questions in stackoverflow. I cant find a way to solve this problem. My last try is: ``` Si...
2013/11/26
[ "https://Stackoverflow.com/questions/20218118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1420625/" ]
``` // First convert the String to a Date String dateTime = "2013-11-12 13:14:15"; SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ITALIAN); Date date = dateParser.parse(dateTime); // Then convert the Date to a String, formatted as you dd/MM/yyyy SimpleDateFormat dateFormatter = new Simp...
try this ``` String time1=""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS",Locale.US); GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("US/Central")); calendar.setTimeInMillis(yourmilliseconds); ...
20,218,118
In PHP to convert a string to DateTime() its very very easy: ``` $dateTime = new DateTime("2013-12-11 10:109:08"); echo $dateTime->format("d/m/Y"); // output 11/12/2013 ``` What is the equivalent in Java? I've seen a lot of questions in stackoverflow. I cant find a way to solve this problem. My last try is: ``` Si...
2013/11/26
[ "https://Stackoverflow.com/questions/20218118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1420625/" ]
``` // First convert the String to a Date String dateTime = "2013-11-12 13:14:15"; SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ITALIAN); Date date = dateParser.parse(dateTime); // Then convert the Date to a String, formatted as you dd/MM/yyyy SimpleDateFormat dateFormatter = new Simp...
Yes As of JDK version 1.1, `Date(java.lang.String)` is deprecated and replaced by `DateFormat.parse(String s)`.
20,218,118
In PHP to convert a string to DateTime() its very very easy: ``` $dateTime = new DateTime("2013-12-11 10:109:08"); echo $dateTime->format("d/m/Y"); // output 11/12/2013 ``` What is the equivalent in Java? I've seen a lot of questions in stackoverflow. I cant find a way to solve this problem. My last try is: ``` Si...
2013/11/26
[ "https://Stackoverflow.com/questions/20218118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1420625/" ]
``` // First convert the String to a Date String dateTime = "2013-11-12 13:14:15"; SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ITALIAN); Date date = dateParser.parse(dateTime); // Then convert the Date to a String, formatted as you dd/MM/yyyy SimpleDateFormat dateFormatter = new Simp...
Parse it like that: ``` SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMANY); Calendar date = Calendar.getInstance(); try { date.setTime(formatter.parse("12.12.2010")); } catch (ParseException e) { e.printStackTrace(); } ...
31,965,742
I have many json schemas in separate `*.json` files. How can I easily check that they are both valid JSON and valid [JSON schema](http://json-schema.org/latest/json-schema-core.html)? I prefer solutions in Javascript, because I'd like to add this step in my `npm test` procedure, but actually any CLI tool would do. I...
2015/08/12
[ "https://Stackoverflow.com/questions/31965742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115493/" ]
I found the Meta-schema here: <http://json-schema.org/documentation.html> With it, my question boils down to validating a JSON using a JSON schema, which is easy (see validators [here](http://json-schema.org/implementations.html)).
Using npm: ``` npm install jshint -g cd my_json_folder/ jshint . ``` Also check out <https://github.com/zaach/jsonlint>
31,965,742
I have many json schemas in separate `*.json` files. How can I easily check that they are both valid JSON and valid [JSON schema](http://json-schema.org/latest/json-schema-core.html)? I prefer solutions in Javascript, because I'd like to add this step in my `npm test` procedure, but actually any CLI tool would do. I...
2015/08/12
[ "https://Stackoverflow.com/questions/31965742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115493/" ]
I found the Meta-schema here: <http://json-schema.org/documentation.html> With it, my question boils down to validating a JSON using a JSON schema, which is easy (see validators [here](http://json-schema.org/implementations.html)).
There are many sites available... I use [jsonlint.com](http://jsonlint.com/) site frequently for json format. VoteUp if it helps
35,942,766
``` 03-11 08:50:46.911 8208-8233/? E/AndroidRuntime: FATAL EXCEPTION: MX Notifier Process: com.example.gec1ply.situationalautonomy, PID: 8208 java.lang.RuntimeException: Can't create handler inside thread that has not called Loope...
2016/03/11
[ "https://Stackoverflow.com/questions/35942766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4794502/" ]
The problem is that the FrameLayout is behind the toolbar, the main way of adding a view within the coordinator layout that has a toolbar is to either set a `margin` or add `app:layout_behavior="@string/appbar_scrolling_view_behavior"` to the Framelayout ``` <?xml version="1.0" encoding="utf-8"?> <android.support.desi...
Take this attribute ``` app:layout_behavior="@string/appbar_scrolling_view_behavior" ``` and put it on the FrameLayout fragment\_container.
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
Because it generates a conflict of interest that the Watch would rather not have present. > > **Maester Aemon:** Did you ever wonder why the men of the Night's Watch take no wives and father no children? So they will not love. Love is the death of duty." > > *Game of Thrones - S01E09: Baelor* > > > You may thi...
**Case 1: After Night King's death** Two kinds of people to join the night's watch or take the castle black. The first are the found guilty of crimes and join the night's watch for their life. Second, are who join castle black on their own. If you remember in the episode "The Iron Throne" (S08E06) Tyrion told Jon "The ...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
Because *love is the death of duty*. ------------------------------------ If they have families, they will lose the focus on the defense of the human realms against the Others. And when the time comes when they must choose, they will always choose their families rather than the realm. That is why they give up everythi...
They weren't. They were required to "take no wives and father no children". Even before contraceptives, there are ways of having sex which have no possibility of pregnancy, and that doesn't even count homosexual encounters. While celibacy is a way to *ensure* that, it isn't necessary. It was shown in the novels and bo...
213,431
If the Night's Watch was supposed to last thousands of years, and was given land, why not have them raise families in the Gift and send all adult males to guard the wall on a rotation?
2019/05/28
[ "https://scifi.stackexchange.com/questions/213431", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/99370/" ]
They weren't. They were required to "take no wives and father no children". Even before contraceptives, there are ways of having sex which have no possibility of pregnancy, and that doesn't even count homosexual encounters. While celibacy is a way to *ensure* that, it isn't necessary. It was shown in the novels and bo...
**Case 1: After Night King's death** Two kinds of people to join the night's watch or take the castle black. The first are the found guilty of crimes and join the night's watch for their life. Second, are who join castle black on their own. If you remember in the episode "The Iron Throne" (S08E06) Tyrion told Jon "The ...