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
34,899,129
I have now run out of ideas and Google is not helping either. I believe the issue is rather simple to solve, but currently I am not seeing why it happens. Everything works fine on my testing environment with dev mode. But doesn't work on production where the dev mode is off and proxy files need to be generated manual...
2016/01/20
[ "https://Stackoverflow.com/questions/34899129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5585305/" ]
Try adjusting the line height property using CSS. I would recommend giving it an id though if you only want it to affect this p tag in particular ``` p { line-height: 0px; } ``` There is also the possibility of negative margins (which isn't considered best practice, but will work in your case): ``` p { marg...
Simple use following css will remove default all padding and margin. Because here h2 use default spacing. ``` *{ margin:0; padding:0; } ``` Previous result: ```html <td style="width:427px;"> <h2 style="color:#156CA4">Quotation</h2> <p style="color:#00A651">abc Technologies Pvt Ltd</p> </td> ``` New wor...
34,899,129
I have now run out of ideas and Google is not helping either. I believe the issue is rather simple to solve, but currently I am not seeing why it happens. Everything works fine on my testing environment with dev mode. But doesn't work on production where the dev mode is off and proxy files need to be generated manual...
2016/01/20
[ "https://Stackoverflow.com/questions/34899129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5585305/" ]
Try adjusting the line height property using CSS. I would recommend giving it an id though if you only want it to affect this p tag in particular ``` p { line-height: 0px; } ``` There is also the possibility of negative margins (which isn't considered best practice, but will work in your case): ``` p { marg...
Use margin-bottom style inside h2 ``` margin-bottom:-10px; ``` To decrease space we should use values in negative.
34,899,129
I have now run out of ideas and Google is not helping either. I believe the issue is rather simple to solve, but currently I am not seeing why it happens. Everything works fine on my testing environment with dev mode. But doesn't work on production where the dev mode is off and proxy files need to be generated manual...
2016/01/20
[ "https://Stackoverflow.com/questions/34899129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5585305/" ]
You have to remove the margin from both h2 and p. ``` h2{ margin-bottom: 0; } p{ margin-top: 0; } ``` [here](https://jsfiddle.net/539qdkrg/) is a jsfiddle to see the results
Use margin-bottom style inside h2 ``` margin-bottom:-10px; ``` To decrease space we should use values in negative.
34,899,129
I have now run out of ideas and Google is not helping either. I believe the issue is rather simple to solve, but currently I am not seeing why it happens. Everything works fine on my testing environment with dev mode. But doesn't work on production where the dev mode is off and proxy files need to be generated manual...
2016/01/20
[ "https://Stackoverflow.com/questions/34899129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5585305/" ]
Try adjusting the line height property using CSS. I would recommend giving it an id though if you only want it to affect this p tag in particular ``` p { line-height: 0px; } ``` There is also the possibility of negative margins (which isn't considered best practice, but will work in your case): ``` p { marg...
You have to remove the margin from both h2 and p. ``` h2{ margin-bottom: 0; } p{ margin-top: 0; } ``` [here](https://jsfiddle.net/539qdkrg/) is a jsfiddle to see the results
34,899,129
I have now run out of ideas and Google is not helping either. I believe the issue is rather simple to solve, but currently I am not seeing why it happens. Everything works fine on my testing environment with dev mode. But doesn't work on production where the dev mode is off and proxy files need to be generated manual...
2016/01/20
[ "https://Stackoverflow.com/questions/34899129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5585305/" ]
Try adjusting the line height property using CSS. I would recommend giving it an id though if you only want it to affect this p tag in particular ``` p { line-height: 0px; } ``` There is also the possibility of negative margins (which isn't considered best practice, but will work in your case): ``` p { marg...
I faced the same issue. Setting Line height on the p and all heading tag works for me. ``` h1,h2,h3,h4,h5,h6,p{ margin: 0; // if there is margin padding:0; // if there is padding line-height: 0px !important; // you should set line height according to your requirement. } ``` This will affect all children's ...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
With `<gcAllowVeryLargeObjects>`, you can have arrays that are much larger. Why not convert those ASCII representations of 256-bit hash codes to a custom struct that implements `IComparable<T>`? It would look like this: ``` struct MyHashCode: IComparable<MyHashCode> { // make these readonly and provide a construct...
A plain vanilla binary search tree will give excellent lookup performance on large lists. However, if you don't really need to store the strings and simple membership is what you want to know, a Bloom Filter may be a terric solution. Bloom filters are a compact data structure that you train with all the strings. Once t...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
If the set is constant then just make a big sorted hash list (in raw format, 32 bytes each). Store all hashes so that they fit to disk sectors (4KB), and that the beginning of each sector is also the beginning of a hash. Save the first hash in every Nth sector in a special index list, which will easily fit into memory....
1. Store your hashes as UInt32[8] 2a. Use sorted list. To compare two hashes, first compare their first elements; if they are equals, then compare second ones and so on. 2b. Use prefix tree
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
Firstly, you say the strings are really SHA256 hashes. Observe that `100 million * 256 bits = 3.2 gigabytes`, so it is possible to fit the entire list in memory, assuming you use a memory-efficient data structure. If you forgive occasional false positives, you can actually use less memory than that. See bloom filters ...
A plain vanilla binary search tree will give excellent lookup performance on large lists. However, if you don't really need to store the strings and simple membership is what you want to know, a Bloom Filter may be a terric solution. Bloom filters are a compact data structure that you train with all the strings. Once t...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
You need to be careful in this sort of situation as most collections in most languages are not really designed or optimized for that sort of scale. As you have already identified memory usage will be a problem too. The clear winner here is to use some form of database. Either a SQL database or there are a number of No...
First of all I would really recommend that you use data compression in order to minimize resource consumption. Cache and memory bandwidth are usually the most limited resource in a modern computer. No matter how you implement this the biggest bottleneck will be waiting for data. Also I would recommend using an existin...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
``` using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Security.Cryptography; namespace HashsetTest { abstract class HashLookupBase { protected const int BucketCount = 16; private readonly HashAlgorithm _hasher; protected HashLook...
A hashset splits your data into buckets (arrays). On a 64-bit system, [the size limit for an array is 2 GB](http://msdn.microsoft.com/en-us/library/ms241064%28VS.80%29.aspx), which is *roughly* 2,000,000,000 bytes. Since a string is a reference type, and since a reference takes eight bytes (assuming a 64-bit system), ...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
A hashset splits your data into buckets (arrays). On a 64-bit system, [the size limit for an array is 2 GB](http://msdn.microsoft.com/en-us/library/ms241064%28VS.80%29.aspx), which is *roughly* 2,000,000,000 bytes. Since a string is a reference type, and since a reference takes eight bytes (assuming a 64-bit system), ...
If you want really fast, and the elements are more or less immutable and require exact matches, you can build something that operates like a virus scanner: set the scope to collect the minimum number of potential elements using whatever algorithms are relevant to your entries and search criteria, then iterate through t...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
First of all I would really recommend that you use data compression in order to minimize resource consumption. Cache and memory bandwidth are usually the most limited resource in a modern computer. No matter how you implement this the biggest bottleneck will be waiting for data. Also I would recommend using an existin...
A plain vanilla binary search tree will give excellent lookup performance on large lists. However, if you don't really need to store the strings and simple membership is what you want to know, a Bloom Filter may be a terric solution. Bloom filters are a compact data structure that you train with all the strings. Once t...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
It might take a while (1) to dump all the records in a (clustered indexed) table (preferably use their values, not their string representation (2)) and let SQL do the searching. It will handle binary searching for you, it will handle caching for you and it's probably the easiest thing to work with if you need to make c...
If you want really fast, and the elements are more or less immutable and require exact matches, you can build something that operates like a virus scanner: set the scope to collect the minimum number of potential elements using whatever algorithms are relevant to your entries and search criteria, then iterate through t...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
If the set is constant then just make a big sorted hash list (in raw format, 32 bytes each). Store all hashes so that they fit to disk sectors (4KB), and that the beginning of each sector is also the beginning of a hash. Save the first hash in every Nth sector in a special index list, which will easily fit into memory....
If you want really fast, and the elements are more or less immutable and require exact matches, you can build something that operates like a virus scanner: set the scope to collect the minimum number of potential elements using whatever algorithms are relevant to your entries and search criteria, then iterate through t...
22,389,931
This is not a terribly uncommon question, but I still couldn't seem to find an answer that really explained the choice. I have a very large list of strings (ASCII representations of [SHA-256](http://en.wikipedia.org/wiki/SHA-2) hashes, to be exact), and I need to query for the presence of a string within that list. T...
2014/03/13
[ "https://Stackoverflow.com/questions/22389931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1070412/" ]
These answers don't factor the string memory into the application. **Strings are not 1 char == 1 byte in .NET.** Each string object requires a constant 20 bytes for the object data. And the buffer requires 2 bytes per character. Therefore: **the memory usage estimate for a string instance is 20 + (2 \* Length) bytes.**...
1. Store your hashes as UInt32[8] 2a. Use sorted list. To compare two hashes, first compare their first elements; if they are equals, then compare second ones and so on. 2b. Use prefix tree
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
Generation.Version.Revision.Build (9.99.999.9999) Generation rarely changes. Only a big turn on product: DOS -> Windows, complete reengineering. Version is for big incompatible changes, new functionality, changes on some specific paradigms on software, etc. Revision is often done (minor features and bug fix). Build...
I prefer version numbers that assign some semantic meaning. As long as you can use the version number to track bugs reported with a particular version to changes that occurred in the source code (and in your activity management system) then you're probably using the right method. I use .NET so I'm stuck with the .NET ...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
For every major version you release, it's not uncommon to have a working version you call it internally. For instance, at my last job, we referred to a major version with the following Ubuntu-inspired naming convention: **[sickly condition] [alliterative animal name]** Which gave such names as "**Limp Lamprey**", "**...
Major.Minor.Public (build) [alpha/beta/trial], such as "4.08c (1290)" * With Major being the major version number (1, 2, 3...) * Minor being a 2 digit minor version (01, 02, 03...). Typically the tens digit is incremented when significant new functionality is added, the ones for bug fixes only. * Public being the publ...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
[Semantic Versioning](http://semver.org/) deserves a mention here. It is a public specification for a versioning scheme, in the form of `[Major].[Minor].[Patch]`. The motivation for this scheme is to communicate meaning with the version number.
I prefer version numbers that assign some semantic meaning. As long as you can use the version number to track bugs reported with a particular version to changes that occurred in the source code (and in your activity management system) then you're probably using the right method. I use .NET so I'm stuck with the .NET ...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
Here is very fine-grained approach to version numbering: * **`N.x.K`**, where `N` and `K` are integers. Examples: `1.x.0`, `5.x.1`, `10.x.33`. Used for *intermediate builds*. * **`N.M.K`**, where `N`, `M` and `K` are integers. Examples: `1.0.0`, `5.3.1`, `10.22.33`. Used for *releases*. * **`N.x.x`**, where `N` is int...
`git describe` provides a nice extension to whatever numbering convention you've chosen. It's easy enough to embed this in your build/packaging/deployment process. Suppose you name your tagged release versions A.B.C (major.minor.maintenance). `git describe` on a given commit will find the most recent tagged ancestor o...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
I tend to follow [Jeff Atwood's opinion of the .NET convention of version numbering](http://www.codinghorror.com/blog/2007/02/whats-in-a-version-number-anyway.html). > > **(Major version).(Minor version).(Revision number).(Build number)** > > > More often than not, for personal projects, I find this to be overkil...
For every major version you release, it's not uncommon to have a working version you call it internally. For instance, at my last job, we referred to a major version with the following Ubuntu-inspired naming convention: **[sickly condition] [alliterative animal name]** Which gave such names as "**Limp Lamprey**", "**...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
I try to use the [RubyGems Rational Versioning policy](http://docs.rubygems.org/read/chapter/7) in which: * The Major version number is incremented when binary compatibility is broken * The minor version number is incremented when new functionality is added * The build number changes for bug fixes.
`git describe` provides a nice extension to whatever numbering convention you've chosen. It's easy enough to embed this in your build/packaging/deployment process. Suppose you name your tagged release versions A.B.C (major.minor.maintenance). `git describe` on a given commit will find the most recent tagged ancestor o...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
Version numbers should have enough information that you avoid conflicts and fixing a bug in the wrong release type problems, but shouldn't convey additional information that isn't relevant. For instance if you use the date customers can tell that they have an older version, and patches against old versions can have co...
We use **Major.Minor.Build#.YYMMDD**[suffix], as we usually only do one production build on any particular day (but use a b/c/d suffix if there's more than one) and the YYMMDD gives users/customers/management an indication of the age of the build, where 6.3.1389 does not. Major numbers increase with significant produc...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
`git describe` provides a nice extension to whatever numbering convention you've chosen. It's easy enough to embed this in your build/packaging/deployment process. Suppose you name your tagged release versions A.B.C (major.minor.maintenance). `git describe` on a given commit will find the most recent tagged ancestor o...
Major.Minor.Public (build) [alpha/beta/trial], such as "4.08c (1290)" * With Major being the major version number (1, 2, 3...) * Minor being a 2 digit minor version (01, 02, 03...). Typically the tens digit is incremented when significant new functionality is added, the ones for bug fixes only. * Public being the publ...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
[Semantic Versioning](http://semver.org/) deserves a mention here. It is a public specification for a versioning scheme, in the form of `[Major].[Minor].[Patch]`. The motivation for this scheme is to communicate meaning with the version number.
Major.Minor.Public (build) [alpha/beta/trial], such as "4.08c (1290)" * With Major being the major version number (1, 2, 3...) * Minor being a 2 digit minor version (01, 02, 03...). Typically the tens digit is incremented when significant new functionality is added, the ones for bug fixes only. * Public being the publ...
3,199
Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. ``` 1.2.3 (11BCF) <- Build number, should corre...
2010/09/13
[ "https://softwareengineering.stackexchange.com/questions/3199", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/96/" ]
Here is very fine-grained approach to version numbering: * **`N.x.K`**, where `N` and `K` are integers. Examples: `1.x.0`, `5.x.1`, `10.x.33`. Used for *intermediate builds*. * **`N.M.K`**, where `N`, `M` and `K` are integers. Examples: `1.0.0`, `5.3.1`, `10.22.33`. Used for *releases*. * **`N.x.x`**, where `N` is int...
Generation.Version.Revision.Build (9.99.999.9999) Generation rarely changes. Only a big turn on product: DOS -> Windows, complete reengineering. Version is for big incompatible changes, new functionality, changes on some specific paradigms on software, etc. Revision is often done (minor features and bug fix). Build...
219
***Assumption:*** I have painted a bird with water colours. Now I want to colour the background green. I will start painting from the edges of the bird's body and take my strokes outwards. My problem with this approach is that the brush stroke directions will be visible. Also, if I get too close to the bird's body, I...
2016/04/29
[ "https://crafts.stackexchange.com/questions/219", "https://crafts.stackexchange.com", "https://crafts.stackexchange.com/users/96/" ]
The paint does make a difference in whether or not you can easily paint over the background. Watercolor, for example, does not easily cover other art and you would need to use a different technique for the background if you used this medium. Most other paints (like acrylics or oil) are thick enough that you can easily...
You could try applying a [frisket](https://en.wikipedia.org/wiki/Frisket#Frisket) to the bird and flowers first (to isolate and protect your lighter more detailed areas) before beginning painting your background. Once your background color/colors have dried you can remove the frisket from the next area you want to pain...
219
***Assumption:*** I have painted a bird with water colours. Now I want to colour the background green. I will start painting from the edges of the bird's body and take my strokes outwards. My problem with this approach is that the brush stroke directions will be visible. Also, if I get too close to the bird's body, I...
2016/04/29
[ "https://crafts.stackexchange.com/questions/219", "https://crafts.stackexchange.com", "https://crafts.stackexchange.com/users/96/" ]
The paint does make a difference in whether or not you can easily paint over the background. Watercolor, for example, does not easily cover other art and you would need to use a different technique for the background if you used this medium. Most other paints (like acrylics or oil) are thick enough that you can easily...
If I were planning to paint the above Blue Bird on an blossomed Apple branch, I'd lightly, but exactly draw the outline of the bird and branch then apply rubber cement to the body of the bird and branch, going right to the pencil lines. Then I'd take an air brush or similar tool to apply the back ground color. When the...
219
***Assumption:*** I have painted a bird with water colours. Now I want to colour the background green. I will start painting from the edges of the bird's body and take my strokes outwards. My problem with this approach is that the brush stroke directions will be visible. Also, if I get too close to the bird's body, I...
2016/04/29
[ "https://crafts.stackexchange.com/questions/219", "https://crafts.stackexchange.com", "https://crafts.stackexchange.com/users/96/" ]
You could try applying a [frisket](https://en.wikipedia.org/wiki/Frisket#Frisket) to the bird and flowers first (to isolate and protect your lighter more detailed areas) before beginning painting your background. Once your background color/colors have dried you can remove the frisket from the next area you want to pain...
If I were planning to paint the above Blue Bird on an blossomed Apple branch, I'd lightly, but exactly draw the outline of the bird and branch then apply rubber cement to the body of the bird and branch, going right to the pencil lines. Then I'd take an air brush or similar tool to apply the back ground color. When the...
2,220,458
I have some query regarding `tableViewCell`. There are many values added in an array for the table cells / rows. Now, each cell has info button as static. Each element of an array has dictionary and it has these two values, `cellvalue` and `detail` value. Now, when user clicks on info button, the cell itself flip and...
2010/02/08
[ "https://Stackoverflow.com/questions/2220458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/140765/" ]
Firstly, and it's probably just a personal taste, but your code is a bit untidy - there's nothing wrong with a few linebreaks you know ;) About your problem, I would suggest you use two views within the cell - one will be the cell's default contentView, and the other a custom view that you create yourself. Then you c...
I have added a view controller's view to cell view. Means ``` [cell addSubView:aVCtr.view]; ``` Now, each of view controllers have two view with in it. View controller has button & on button tap event I am flipping the view. See, the following code - is of a view controller & that view controller's view is added to...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
I just created a SP out of [Ben's](https://stackoverflow.com/users/424594/ben-b) great [answer](https://stackoverflow.com/a/14611173/3187389): ``` /* --------------------------------------------------------------------------------- PURPOSE : Print a string without the limitation of 4000 or 8000 characters. https://s...
Or simply: ``` PRINT SUBSTRING(@SQL_InsertQuery, 1, 8000) PRINT SUBSTRING(@SQL_InsertQuery, 8001, 16000) ```
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
You could do a `WHILE` loop based on the count on your script length divided by 8000. EG: ``` DECLARE @Counter INT SET @Counter = 0 DECLARE @TotalPrints INT SET @TotalPrints = (LEN(@script) / 8000) + 1 WHILE @Counter < @TotalPrints BEGIN -- Do your printing... SET @Counter = @Counter + 1 END ```
If the source code will not have issues with LF to be replaced by CRLF, No debugging is required by following simple codes outputs. ``` --http://stackoverflow.com/questions/7850477/how-to-print-varcharmax-using-print-statement --Bill Bai SET @SQL=replace(@SQL,char(10),char(13)+char(10)) SET @SQL=replace(@SQL,char(13)+...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
The following workaround does not use the `PRINT` statement. It works well in combination with the SQL Server Management Studio. ``` SELECT CAST('<root><![CDATA[' + @MyLongString + ']]></root>' AS XML) ``` You can click on the returned XML to expand it in the built-in XML viewer. There is a pretty generous client s...
I was looking to use the print statement to debug some dynamic sql as I imagin most of you are using print for simliar reasons. I tried a few of the solutions listed and found that Kelsey's solution works with minor tweeks (@sql is my @script) n.b. LENGTH isn't a valid function: ``` --http://stackoverflow.com/questio...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
Here is how this should be done: ``` DECLARE @String NVARCHAR(MAX); DECLARE @CurrentEnd BIGINT; /* track the length of the next substring */ DECLARE @offset tinyint; /*tracks the amount of offset needed */ set @string = replace( replace(@string, char(13) + char(10), char(10)) , char(13), char(10)) WHILE LEN(@Strin...
You can use this ``` declare @i int = 1 while Exists(Select(Substring(@Script,@i,4000))) and (@i < LEN(@Script)) begin print Substring(@Script,@i,4000) set @i = @i+4000 end ```
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
This proc correctly prints out `VARCHAR(MAX)` parameter considering wrapping: ``` CREATE PROCEDURE [dbo].[Print] @sql varchar(max) AS BEGIN declare @n int, @i int = 0, @s int = 0, -- substring start posotion @l int; -- substring length set @n = ceiling(len(@sql) / 8000....
``` create procedure dbo.PrintMax @text nvarchar(max) as begin declare @i int, @newline nchar(2), @print varchar(max); set @newline = nchar(13) + nchar(10); select @i = charindex(@newline, @text); while (@i > 0) begin select @print = substring(@text,0,@i); while (len(@print) > 8000...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
I was looking to use the print statement to debug some dynamic sql as I imagin most of you are using print for simliar reasons. I tried a few of the solutions listed and found that Kelsey's solution works with minor tweeks (@sql is my @script) n.b. LENGTH isn't a valid function: ``` --http://stackoverflow.com/questio...
If someone interested I've ended up as generating a text file with powershell, executing scalar code: ``` $dbconn = "Data Source=sqlserver;" + "Initial Catalog=DatabaseName;" + "User Id=sa;Password=pass;" $conn = New-Object System.Data.SqlClient.SqlConnection($dbconn) $conn.Open() $cmd = New-Object System.Data.SqlCli...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
You could do a `WHILE` loop based on the count on your script length divided by 8000. EG: ``` DECLARE @Counter INT SET @Counter = 0 DECLARE @TotalPrints INT SET @TotalPrints = (LEN(@script) / 8000) + 1 WHILE @Counter < @TotalPrints BEGIN -- Do your printing... SET @Counter = @Counter + 1 END ```
You can use this ``` declare @i int = 1 while Exists(Select(Substring(@Script,@i,4000))) and (@i < LEN(@Script)) begin print Substring(@Script,@i,4000) set @i = @i+4000 end ```
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
Came across this question and wanted something more simple... Try the following: ``` SELECT [processing-instruction(x)]=@Script FOR XML PATH(''),TYPE ```
Uses Line Feeds and spaces as a good break point: ``` declare @sqlAll as nvarchar(max) set @sqlAll = '-- Insert all your sql here' print '@sqlAll - truncated over 4000' print @sqlAll print ' ' print ' ' print ' ' print '@sqlAll - split into chunks' declare @i int = 1, @nextspace int = 0, @newline nchar(2) set ...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
There is great function called **[PrintMax written by Bennett Dill](https://weblogs.asp.net/bdill/sql-server-print-max)**. Here is slightly modified version that uses temp stored procedure to avoid "schema polution"(idea from <https://github.com/Toolien/sp_GenMerge/blob/master/sp_GenMerge.sql>) ``` EXEC (N'IF EXISTS ...
If someone interested I've ended up as generating a text file with powershell, executing scalar code: ``` $dbconn = "Data Source=sqlserver;" + "Initial Catalog=DatabaseName;" + "User Id=sa;Password=pass;" $conn = New-Object System.Data.SqlClient.SqlConnection($dbconn) $conn.Open() $cmd = New-Object System.Data.SqlCli...
7,850,477
I have a code which is: ``` DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos int SELECT @pos=CHARINDEX(CHAR(13)+CHAR(10),@script,7500) PRINT SUBSTRIN...
2011/10/21
[ "https://Stackoverflow.com/questions/7850477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979278/" ]
I know it's an old question, but what I did is not mentioned here. For me the following worked (for up to 16k chars) ``` DECLARE @info NVARCHAR(MAX) --SET @info to something big PRINT CAST(@info AS NTEXT) ``` If you have more than 16k chars you can combine with @Yovav's answer like this (64k should be enough for ...
If the source code will not have issues with LF to be replaced by CRLF, No debugging is required by following simple codes outputs. ``` --http://stackoverflow.com/questions/7850477/how-to-print-varcharmax-using-print-statement --Bill Bai SET @SQL=replace(@SQL,char(10),char(13)+char(10)) SET @SQL=replace(@SQL,char(13)+...
2,858,450
Why in the [following code](http://jsfiddle.net/pHr4z/) .height() returns 95 rather than 100, while .width() returns 200 as expected ? I work with Firefox 3.6.3. HTML: ``` <table><tr> <td id="my"></td> </tr></table> <div id="log"></div> ``` CSS: ``` #my { border: 5px solid red; } ``` JS: ``` $("#my").widt...
2010/05/18
[ "https://Stackoverflow.com/questions/2858450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247243/" ]
There are a few jQuery methods for calculating height and width. Try using `outerHeight()` Excerpt from jQuery Docs: <http://api.jquery.com/outerHeight/> > > `.outerHeight( [ includeMargin ] )` > > > includeMargin - A Boolean indicating > whether to include the element's > margin in the calculation. > > > <h...
I am not sure about this.. I also find it rather strange.. This is my guess. **The border eats up into the actual height and is neglected by jquery while calculating height**
2,858,450
Why in the [following code](http://jsfiddle.net/pHr4z/) .height() returns 95 rather than 100, while .width() returns 200 as expected ? I work with Firefox 3.6.3. HTML: ``` <table><tr> <td id="my"></td> </tr></table> <div id="log"></div> ``` CSS: ``` #my { border: 5px solid red; } ``` JS: ``` $("#my").widt...
2010/05/18
[ "https://Stackoverflow.com/questions/2858450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247243/" ]
I can't really explain this behaviour better than John, but since this browser inconsistency is still around (at least for those who can't upgrade jQuery version) I thought I would share a workaround for this problem. Using the HTML DOM properties *clientHeight* and *clientWidth* seems to be consistent over most brows...
I am not sure about this.. I also find it rather strange.. This is my guess. **The border eats up into the actual height and is neglected by jquery while calculating height**
2,858,450
Why in the [following code](http://jsfiddle.net/pHr4z/) .height() returns 95 rather than 100, while .width() returns 200 as expected ? I work with Firefox 3.6.3. HTML: ``` <table><tr> <td id="my"></td> </tr></table> <div id="log"></div> ``` CSS: ``` #my { border: 5px solid red; } ``` JS: ``` $("#my").widt...
2010/05/18
[ "https://Stackoverflow.com/questions/2858450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247243/" ]
There are a few jQuery methods for calculating height and width. Try using `outerHeight()` Excerpt from jQuery Docs: <http://api.jquery.com/outerHeight/> > > `.outerHeight( [ includeMargin ] )` > > > includeMargin - A Boolean indicating > whether to include the element's > margin in the calculation. > > > <h...
I can't really explain this behaviour better than John, but since this browser inconsistency is still around (at least for those who can't upgrade jQuery version) I thought I would share a workaround for this problem. Using the HTML DOM properties *clientHeight* and *clientWidth* seems to be consistent over most brows...
45,378,022
I have a code , it works, i saved it with download.php , but i don't know, how to download the image file named simpletext.jpg present on the same root of the above mentioned file, I will be very thankful to you if you write the actual path, how to do that, the code is below.... ``` $file_name = "a.txt"; // extractin...
2017/07/28
[ "https://Stackoverflow.com/questions/45378022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5433778/" ]
``` <a href="localhost:8888/files/download.jpg" download>Click here to download the file</a> ``` substitute the href with your file path.. hope this helps
``` <a href="/path/file_name.jpg" download="download_file_name">download</a> ``` download\_file\_name will replace file\_name
45,378,022
I have a code , it works, i saved it with download.php , but i don't know, how to download the image file named simpletext.jpg present on the same root of the above mentioned file, I will be very thankful to you if you write the actual path, how to do that, the code is below.... ``` $file_name = "a.txt"; // extractin...
2017/07/28
[ "https://Stackoverflow.com/questions/45378022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5433778/" ]
``` <a href="localhost:8888/files/download.jpg" download>Click here to download the file</a> ``` substitute the href with your file path.. hope this helps
You can use the htaccess file to force downloads for image files. See this similar question: Using Htaccess to force downloads [[Forcing a download using <filesMatch> in htaccess at WWW root](https://stackoverflow.com/q/14388994/8031331])
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
Try this: ``` this.addProjectForm.get('title').setValidators([]); // or clearValidators() this.addProjectForm.get('title').updateValueAndValidity(); ``` If you want to add a validator then append array of validators: ``` this.addProjectForm.get('title').setValidators([Validators.required]); this.addProjectForm.get(...
I have tried all of above, But for me following code has worked. ``` let formControl : FormControl = this.formGroup.get("mouldVendor") as FormControl; formControl.clearValidators(); formControl.setValidators(null); formControl.updateValueAndValidity(); ```
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
Try this: ``` this.addProjectForm.get('title').setValidators([]); // or clearValidators() this.addProjectForm.get('title').updateValueAndValidity(); ``` If you want to add a validator then append array of validators: ``` this.addProjectForm.get('title').setValidators([Validators.required]); this.addProjectForm.get(...
You can try following as another solution if you want to remove validator from your field: ``` public saveDraft(): void { this.addProjectForm.get('title').clearValidators(); this.addProjectForm.get('title').updateValueAndValidity(); } ```
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
I have implemented quite a lot of forms with this Save As Draft functionality. What I generally do is, just keep the Submit Button as disabled unless the form is `valid`. But keep the Save as a Draft button as always enabled. What this allows me to do is, save the contents of the form without applying any validation ...
This may help someone. I ended up adding validation as a result of another fields '.valuechanges' subscription, and when I went to clear them It would do, well, nothing. The solution was to use the method **.clearAsyncValidators()** on the formcontrol, instead of the typical clearValidators(). You still have to updat...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
You can use: AbstractControl.removeValidators(ValidatorFn) Not sure if it is possible in angular 6, but definately in Angular 12 and higher. It needs however, a reference to the [exact same function](https://angular.io/api/forms/AbstractControl#removevalidators). Just giving it Validators.required does not work. You n...
I found that the best solution is not to have any validation on the input fields (form controls) and then add this code to allow the submit button to be pressed: ``` ngAfterViewInit() { this.addProjectForm.valueChanges.subscribe(data => { //console.log(data) if(data.title.length != 0 && data.description.lengt...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
You can try following as another solution if you want to remove validator from your field: ``` public saveDraft(): void { this.addProjectForm.get('title').clearValidators(); this.addProjectForm.get('title').updateValueAndValidity(); } ```
I have implemented quite a lot of forms with this Save As Draft functionality. What I generally do is, just keep the Submit Button as disabled unless the form is `valid`. But keep the Save as a Draft button as always enabled. What this allows me to do is, save the contents of the form without applying any validation ...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
You can try following as another solution if you want to remove validator from your field: ``` public saveDraft(): void { this.addProjectForm.get('title').clearValidators(); this.addProjectForm.get('title').updateValueAndValidity(); } ```
This may help someone. I ended up adding validation as a result of another fields '.valuechanges' subscription, and when I went to clear them It would do, well, nothing. The solution was to use the method **.clearAsyncValidators()** on the formcontrol, instead of the typical clearValidators(). You still have to updat...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
I have implemented quite a lot of forms with this Save As Draft functionality. What I generally do is, just keep the Submit Button as disabled unless the form is `valid`. But keep the Save as a Draft button as always enabled. What this allows me to do is, save the contents of the form without applying any validation ...
You can use: AbstractControl.removeValidators(ValidatorFn) Not sure if it is possible in angular 6, but definately in Angular 12 and higher. It needs however, a reference to the [exact same function](https://angular.io/api/forms/AbstractControl#removevalidators). Just giving it Validators.required does not work. You n...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
Try this: ``` this.addProjectForm.get('title').setValidators([]); // or clearValidators() this.addProjectForm.get('title').updateValueAndValidity(); ``` If you want to add a validator then append array of validators: ``` this.addProjectForm.get('title').setValidators([Validators.required]); this.addProjectForm.get(...
I found that the best solution is not to have any validation on the input fields (form controls) and then add this code to allow the submit button to be pressed: ``` ngAfterViewInit() { this.addProjectForm.valueChanges.subscribe(data => { //console.log(data) if(data.title.length != 0 && data.description.lengt...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
You can try following as another solution if you want to remove validator from your field: ``` public saveDraft(): void { this.addProjectForm.get('title').clearValidators(); this.addProjectForm.get('title').updateValueAndValidity(); } ```
I found that the best solution is not to have any validation on the input fields (form controls) and then add this code to allow the submit button to be pressed: ``` ngAfterViewInit() { this.addProjectForm.valueChanges.subscribe(data => { //console.log(data) if(data.title.length != 0 && data.description.lengt...
53,507,355
I have a form with a lot of form controls and Validators for some of the controls, like: ``` title = new FormControl("", Validators.compose([ Validators.required ])); description = new FormControl("", [ Validators.required, Validators.minLength(1), Validators.maxLength(2000) ]); ``` How do I add a sa...
2018/11/27
[ "https://Stackoverflow.com/questions/53507355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590743/" ]
You can try following as another solution if you want to remove validator from your field: ``` public saveDraft(): void { this.addProjectForm.get('title').clearValidators(); this.addProjectForm.get('title').updateValueAndValidity(); } ```
You can use: AbstractControl.removeValidators(ValidatorFn) Not sure if it is possible in angular 6, but definately in Angular 12 and higher. It needs however, a reference to the [exact same function](https://angular.io/api/forms/AbstractControl#removevalidators). Just giving it Validators.required does not work. You n...
27,940,553
More specifically, can the block of code ``` ob_start(); echo $astring; $astring = ob_get_clean(); ``` change the value of $astring ? In other words, I want to know how reliable is the combination of echo, output-buffering and getting the buffer. Of course, I have tested it. With simple strings, in my tests, the s...
2015/01/14
[ "https://Stackoverflow.com/questions/27940553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You're using a generic list, meaning that you didn't define which type of objects is stored inside the list, so Java assumes all of your items are `Object`s (the lowest common denominator of all objects). Change your list instantiation to this line: ``` private List<Shopping> items = new ArrayList<Shopping>(); ``` ...
Your list contains `Object` instances and your `getItem(int position)` method is expected to return `products` instance. Add cast to `products` instance like this: ``` public products getItem(int position) { return (products) items.get(position); } ``` `Object` class is the superclass object in Java that handles...
27,940,553
More specifically, can the block of code ``` ob_start(); echo $astring; $astring = ob_get_clean(); ``` change the value of $astring ? In other words, I want to know how reliable is the combination of echo, output-buffering and getting the buffer. Of course, I have tested it. With simple strings, in my tests, the s...
2015/01/14
[ "https://Stackoverflow.com/questions/27940553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
define your list as: ``` private List<products> items = new ArrayList<products>(); ```
Your list contains `Object` instances and your `getItem(int position)` method is expected to return `products` instance. Add cast to `products` instance like this: ``` public products getItem(int position) { return (products) items.get(position); } ``` `Object` class is the superclass object in Java that handles...
27,940,553
More specifically, can the block of code ``` ob_start(); echo $astring; $astring = ob_get_clean(); ``` change the value of $astring ? In other words, I want to know how reliable is the combination of echo, output-buffering and getting the buffer. Of course, I have tested it. With simple strings, in my tests, the s...
2015/01/14
[ "https://Stackoverflow.com/questions/27940553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
define your list as: ``` private List<products> items = new ArrayList<products>(); ```
You're using a generic list, meaning that you didn't define which type of objects is stored inside the list, so Java assumes all of your items are `Object`s (the lowest common denominator of all objects). Change your list instantiation to this line: ``` private List<Shopping> items = new ArrayList<Shopping>(); ``` ...
66,639
If the libor rate stays the same -which implies that also the eurodollar future quoted price remains the same- (ie: jun '22 prices is trading at 99.8, and it expires at 99.8), does the investor that purchased this contract make money for buying this contract?
2021/08/27
[ "https://quant.stackexchange.com/questions/66639", "https://quant.stackexchange.com", "https://quant.stackexchange.com/users/57168/" ]
No, an investor that buys or sells the contract at 99.80 will make zero money if the contract expires at that price. (Not sure what you mean by lending. )Also note that investors may make or lose money prior to maturity if the price is moving , but in the end they will end up flat.
If we assume that this investor does not care for the possibly different exchange rates prevailing at the expiration day in comparison with the day he entered the futures contract then no. EDIT:: I am talking about exchange rates because maybe he had to convert euros to dollars to make this transaction and after expir...
45,717,811
How to change file type of open file without binding file extension to new file type? I'd like to use that to view python scripts that don't have any extension. So there is no extension to associate file type with.
2017/08/16
[ "https://Stackoverflow.com/questions/45717811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/639687/" ]
Good news : IDEA now allow to temporarily set a file type : open "Actions" menu (Ctrl+Shift+A), and look for "override file type" item.
You should be able to just try opening the file in IntelliJ, and you will automatically be prompted to associate it with a language type. In the case of files without an extension the association is made on the entire file name, rather than a set of extensions (no 'wildcard' character). Take a look at how the assoc...
70,227,643
I want to define a new call operator() function with the parameters and type defined for the first operator() function. The reason for doing this is that the operations I want to perform with the new operator() function needs the same parameters as the first one, but maybe named differently but the type I need should r...
2021/12/04
[ "https://Stackoverflow.com/questions/70227643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16829653/" ]
You can do this using `Webhook by Zapier` as an action (and Schedule by Zapier as a trigger): ![](https://cdn.zappy.app/1a4ba409a73d2c283c0f655f933f496b.png)
You can create a custom Zapier UI app to implement custom URLS. <https://platform.zapier.com/> Also, I recently learnt you can do this by making a custom request with the zapier webhook App. <https://zapier.com/apps/webhook/integrations/webhook/60510/send-custom-webhook-requests-with-new-recieved-webhooks> [![[1]: ht...
63,082,972
Having a situation where my java code is symbolic to query - ``` SELECT CUSTOMER_ID, CUSTOMER_NAME, CASE WHEN COUNT (DISTINCT CARD_ID) > 1 THEN 'MULTIPLE' ELSE MAX(CARD_NUM) END AS CARD_NUM FROM CUSTOMER LEFT JOIN CARD ON CARD.CUSTOMER_ID = CUSTOMER.CUSTOME...
2020/07/25
[ "https://Stackoverflow.com/questions/63082972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3499836/" ]
Using the Criteria API, you need to order by the `caseSelect` expression. I gave it a try and it works fine with Hibernate 5.4. Which version do you use?
It seems this is not possible with the JPA Criteria API and you will have to fallback to using JPQL/HQL instead.
63,082,972
Having a situation where my java code is symbolic to query - ``` SELECT CUSTOMER_ID, CUSTOMER_NAME, CASE WHEN COUNT (DISTINCT CARD_ID) > 1 THEN 'MULTIPLE' ELSE MAX(CARD_NUM) END AS CARD_NUM FROM CUSTOMER LEFT JOIN CARD ON CARD.CUSTOMER_ID = CUSTOMER.CUSTOME...
2020/07/25
[ "https://Stackoverflow.com/questions/63082972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3499836/" ]
I faced a similar situation... ``` query.multiselect(root, computedColumn); query.orderBy(new Order[]{filterDTO.getSortAsc() ? cb.asc(cb.literal(2)) : cb.desc(cb.literal(2))}); ``` I my case computedColumn is Subquery...I did not manage to make it work by column alias but it seems to work by column index returned in...
It seems this is not possible with the JPA Criteria API and you will have to fallback to using JPQL/HQL instead.
63,082,972
Having a situation where my java code is symbolic to query - ``` SELECT CUSTOMER_ID, CUSTOMER_NAME, CASE WHEN COUNT (DISTINCT CARD_ID) > 1 THEN 'MULTIPLE' ELSE MAX(CARD_NUM) END AS CARD_NUM FROM CUSTOMER LEFT JOIN CARD ON CARD.CUSTOMER_ID = CUSTOMER.CUSTOME...
2020/07/25
[ "https://Stackoverflow.com/questions/63082972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3499836/" ]
Using the Criteria API, you need to order by the `caseSelect` expression. I gave it a try and it works fine with Hibernate 5.4. Which version do you use?
This is fairly not possible and just feels like a case missed by JPA. Though if using hibernate API it is possible. But, my workaround was - 1. Created a view which would contain the case expression. 2. Join the view with my entity (you cannot do a join, but one more query.from(View.class)). 3. In the where add the id...
63,082,972
Having a situation where my java code is symbolic to query - ``` SELECT CUSTOMER_ID, CUSTOMER_NAME, CASE WHEN COUNT (DISTINCT CARD_ID) > 1 THEN 'MULTIPLE' ELSE MAX(CARD_NUM) END AS CARD_NUM FROM CUSTOMER LEFT JOIN CARD ON CARD.CUSTOMER_ID = CUSTOMER.CUSTOME...
2020/07/25
[ "https://Stackoverflow.com/questions/63082972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3499836/" ]
I faced a similar situation... ``` query.multiselect(root, computedColumn); query.orderBy(new Order[]{filterDTO.getSortAsc() ? cb.asc(cb.literal(2)) : cb.desc(cb.literal(2))}); ``` I my case computedColumn is Subquery...I did not manage to make it work by column alias but it seems to work by column index returned in...
This is fairly not possible and just feels like a case missed by JPA. Though if using hibernate API it is possible. But, my workaround was - 1. Created a view which would contain the case expression. 2. Join the view with my entity (you cannot do a join, but one more query.from(View.class)). 3. In the where add the id...
48,368,224
In some third party library, array prototype is extended: ``` Array.prototype.repeat = function(value, length) { while (length) this[--length] = value; return this; }; ``` code: ``` var model = { features:[1,2,3] }; for (var p in model.features) { console.log(p); } ``` Expect: ``` 1 2 3 ``` Result...
2018/01/21
[ "https://Stackoverflow.com/questions/48368224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130204/" ]
All i had to do was connect to cookies changed signal. ``` def cookies_change(self): print("Updating Cookies") self.cookies.connect("changed", cookies_change) ```
Use the `session_start` function. Then, you can check if someone is logged in.
3,978,123
I'm just curious how the integrating factor m(x,y) = $\frac{1}{x\,y}$ of $\frac{\mathrm{d}}{\mathrm{d}x}f(x,y) = x+y-\frac{x^2}{y}\,y'(x)$ was determined. It was just given. When I was introduced to this topic this week, my fist impression was that integrating factor just can depend on x or y. Because determinations li...
2021/01/08
[ "https://math.stackexchange.com/questions/3978123", "https://math.stackexchange.com", "https://math.stackexchange.com/users/855524/" ]
You may have to guess, but in this case you can make it an *educated* guess. If you multiply by $dx$ and thus rewrite the differential as $M dx + N dy=(x+y)dx - (x^2/y)dy$ you see that if $x$ and $y$ were multiplied by a constant $\lambda$, you would get just the same differential multiplied by a constant: $(\lambd...
To add to what Oscar said, you don't necessarily have to guess the form of your integrating factor, but if you guess it right it will expedite your process. I'll lay out what I do when I'm trying to find an integrating factor. To find the integrating factor for the expression \begin{align} f(x,y)+g(x,y)\frac{\mathrm{d}...
23,934,048
I am new in Windows Azure, previously I have used Amazon Web Services. In AWS you can set a SSL certificate for a Load Balancer and use it in listeners, so you don't need to worry about that in the web server. Is it possible to set a SSL certificate for an Azure VM endpoint?
2014/05/29
[ "https://Stackoverflow.com/questions/23934048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647256/" ]
Azure Load Balancer is a layer 4 device, so it can't do SSL termination. You can use Azure Application Gateway which is a Layer 7 Load Balancer, and it can do SSL termination. see here: <https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-ssl-portal> EDIT: I am trying to understand if yo...
Yes you can Please check the documentation here: <http://azure.microsoft.com/en-us/documentation/articles/cloud-services-configure-ssl-certificate/>
23,934,048
I am new in Windows Azure, previously I have used Amazon Web Services. In AWS you can set a SSL certificate for a Load Balancer and use it in listeners, so you don't need to worry about that in the web server. Is it possible to set a SSL certificate for an Azure VM endpoint?
2014/05/29
[ "https://Stackoverflow.com/questions/23934048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647256/" ]
Loadbalancer comparation AWS ``` Application Load Balancer - Layer 7 - HTTP, HTTPS Network Load Balancer - layer 4 - TCP, UDP, TLS Classic - Layer 4/7 - HTTP/HTTPS(layer 7), TCP, SSL/TLS(layer 4) ``` Azure ``` Load Balancer - Layer 4 - TCP and UDP Application Gateway - Layer 7 - HTTP, HTTPS(support SSL) ```
Yes you can Please check the documentation here: <http://azure.microsoft.com/en-us/documentation/articles/cloud-services-configure-ssl-certificate/>
23,934,048
I am new in Windows Azure, previously I have used Amazon Web Services. In AWS you can set a SSL certificate for a Load Balancer and use it in listeners, so you don't need to worry about that in the web server. Is it possible to set a SSL certificate for an Azure VM endpoint?
2014/05/29
[ "https://Stackoverflow.com/questions/23934048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647256/" ]
Azure Load Balancer is a layer 4 device, so it can't do SSL termination. You can use Azure Application Gateway which is a Layer 7 Load Balancer, and it can do SSL termination. see here: <https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-ssl-portal> EDIT: I am trying to understand if yo...
The Azure terminology is a little different from that of AWS. You can use the Azure Traffic Manager to offload TLS/SSL: <http://www.hanselman.com/blog/CloudPowerHowToScaleAzureWebsitesGloballyWithTrafficManager.aspx> (The Azure Load-Balanced Sets use round-robin DNS balancing, with VMs directly visible, whereas the T...
23,934,048
I am new in Windows Azure, previously I have used Amazon Web Services. In AWS you can set a SSL certificate for a Load Balancer and use it in listeners, so you don't need to worry about that in the web server. Is it possible to set a SSL certificate for an Azure VM endpoint?
2014/05/29
[ "https://Stackoverflow.com/questions/23934048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647256/" ]
Loadbalancer comparation AWS ``` Application Load Balancer - Layer 7 - HTTP, HTTPS Network Load Balancer - layer 4 - TCP, UDP, TLS Classic - Layer 4/7 - HTTP/HTTPS(layer 7), TCP, SSL/TLS(layer 4) ``` Azure ``` Load Balancer - Layer 4 - TCP and UDP Application Gateway - Layer 7 - HTTP, HTTPS(support SSL) ```
The Azure terminology is a little different from that of AWS. You can use the Azure Traffic Manager to offload TLS/SSL: <http://www.hanselman.com/blog/CloudPowerHowToScaleAzureWebsitesGloballyWithTrafficManager.aspx> (The Azure Load-Balanced Sets use round-robin DNS balancing, with VMs directly visible, whereas the T...
23,934,048
I am new in Windows Azure, previously I have used Amazon Web Services. In AWS you can set a SSL certificate for a Load Balancer and use it in listeners, so you don't need to worry about that in the web server. Is it possible to set a SSL certificate for an Azure VM endpoint?
2014/05/29
[ "https://Stackoverflow.com/questions/23934048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647256/" ]
Azure Load Balancer is a layer 4 device, so it can't do SSL termination. You can use Azure Application Gateway which is a Layer 7 Load Balancer, and it can do SSL termination. see here: <https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-ssl-portal> EDIT: I am trying to understand if yo...
Loadbalancer comparation AWS ``` Application Load Balancer - Layer 7 - HTTP, HTTPS Network Load Balancer - layer 4 - TCP, UDP, TLS Classic - Layer 4/7 - HTTP/HTTPS(layer 7), TCP, SSL/TLS(layer 4) ``` Azure ``` Load Balancer - Layer 4 - TCP and UDP Application Gateway - Layer 7 - HTTP, HTTPS(support SSL) ```
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
> > <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart> > > > ``` String(number).padStart(2, '0') ```
``` function padLeft(a, b) { var l = (a + '').length; if (l >= b) { return a + ''; } else { var arr = []; for (var i = 0; i < b - l ;i++) { arr.push('0'); } arr.push(a); return arr.join(''); } } ```
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
Just use the following short function to get the result you need: ``` function pad2(number) { return (number < 10 ? '0' : '') + number } ```
I use regex to format my time such as ------------------------------------- const str = '12:5' const final = str.replace(/\d+/g, (match, offset, string) => match < 10 ? '0' + match : match) ---------------------------------------------------------------------------------------------- output: 12:05
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
A direct way to pad a number to the left in Javascript is to calculate the number of digits by log base 10. For example: ``` function padLeft(positiveInteger, totalDigits) { var padding = "00000000000000"; var rounding = 1.000000000001; var currentDigits = positiveInteger > 0 ? 1 + Math.floor(rounding * (Math.lo...
```js const threeDigit = num => num.toString().padStart(3 , '0'); ``` The function converts a number to a string and then returns a three-digit version of the number
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
A direct way to pad a number to the left in Javascript is to calculate the number of digits by log base 10. For example: ``` function padLeft(positiveInteger, totalDigits) { var padding = "00000000000000"; var rounding = 1.000000000001; var currentDigits = positiveInteger > 0 ? 1 + Math.floor(rounding * (Math.lo...
lodash has padStart, <https://lodash.com/docs/4.17.15#padStart> padStart(1, 2, '0') it will pad 1 => 01, it wont take care of negative numbers, as - will be considered as padding
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
``` String("0" + x).slice(-2); ``` where `x` is your number.
Improved version of previous answer: ```js var result = [...Array(12)].map((_, i) => zeroFill(i + 1, 2)); function zeroFill(num, size) { let s = num + ''; while (s.length < size) s = `0${s}`; return s; } console.log(result) ```
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
``` function padLeft(a, b) { var l = (a + '').length; if (l >= b) { return a + ''; } else { var arr = []; for (var i = 0; i < b - l ;i++) { arr.push('0'); } arr.push(a); return arr.join(''); } } ```
lodash has padStart, <https://lodash.com/docs/4.17.15#padStart> padStart(1, 2, '0') it will pad 1 => 01, it wont take care of negative numbers, as - will be considered as padding
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
``` String("0" + x).slice(-2); ``` where `x` is your number.
```js const threeDigit = num => num.toString().padStart(3 , '0'); ``` The function converts a number to a string and then returns a three-digit version of the number
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
I usually use this function. ``` function pad(n, len) { let l = Math.floor(len) let sn = '' + n let snl = sn.length if(snl >= l) return sn return '0'.repeat(l - snl) + sn } ``` Usage Example ``` pad(1, 1) // ==> returns '1' (string type) pad(384, 5) // ==> returns '00384' pad(384, 4.5)// ==>...
Improved version of previous answer: ```js var result = [...Array(12)].map((_, i) => zeroFill(i + 1, 2)); function zeroFill(num, size) { let s = num + ''; while (s.length < size) s = `0${s}`; return s; } console.log(result) ```
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
Update ====== This answer was written in 2011. See [liubiantao's answer](https://stackoverflow.com/a/51276909/110164) for the 2021 version. Original -------- ``` function pad(d) { return (d < 10) ? '0' + d.toString() : d.toString(); } pad(1); // 01 pad(9); // 09 pad(10); // 10 ```
```js function leftFillNum(num, targetLength) { return num.toString().padStart(targetLength, '0'); } console.log(leftFillNum(3,2)); // ==> returns '03' console.log(leftFillNum(33,2)); // ==> returns '33' console.log(leftFillNum(3,4)); // ==> returns '0003' console.log(leftFillNum(33,5)); // ==> returns '00033' ```
5,774,042
I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 ... 09 10 11 12 ...
2011/04/24
[ "https://Stackoverflow.com/questions/5774042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647405/" ]
A direct way to pad a number to the left in Javascript is to calculate the number of digits by log base 10. For example: ``` function padLeft(positiveInteger, totalDigits) { var padding = "00000000000000"; var rounding = 1.000000000001; var currentDigits = positiveInteger > 0 ? 1 + Math.floor(rounding * (Math.lo...
I use regex to format my time such as ------------------------------------- const str = '12:5' const final = str.replace(/\d+/g, (match, offset, string) => match < 10 ? '0' + match : match) ---------------------------------------------------------------------------------------------- output: 12:05
39,300,319
I noticed that most of the books and tutorials on Django make it very clear that use Django development server as a normal webserver is not OK. But some state that other webservers are optional, that we can use Django server to put the website on the web for everybody to see. But why exactly? Why do I need (or not) to...
2016/09/02
[ "https://Stackoverflow.com/questions/39300319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6789127/" ]
It comes down to the goal of the Django project and the efficiency gains associated with re-use (as opposed to reinventing the wheel). The stated goal for Django is to offer a web application framework that enables quick development and minimal code. The original tagline was a "web application framework for perfection...
My understanding is that the folks at Django are not specialized in the server business and they never intended their server code to produce anything other than a way to develop and test on one's local machine without a lot of traffic. Per their [own documentation](https://docs.djangoproject.com/en/1.10/intro/tutorial0...
39,300,319
I noticed that most of the books and tutorials on Django make it very clear that use Django development server as a normal webserver is not OK. But some state that other webservers are optional, that we can use Django server to put the website on the web for everybody to see. But why exactly? Why do I need (or not) to...
2016/09/02
[ "https://Stackoverflow.com/questions/39300319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6789127/" ]
My understanding is that the folks at Django are not specialized in the server business and they never intended their server code to produce anything other than a way to develop and test on one's local machine without a lot of traffic. Per their [own documentation](https://docs.djangoproject.com/en/1.10/intro/tutorial0...
It is not something specific to Django, that is the case for all modern web frameworks that I know, they all have this very simple built-in web server that we use only for development purposes, and the reason is obvious, it does not make any sense to reinvent the wheel since we already have very powerful web servers. ...
39,300,319
I noticed that most of the books and tutorials on Django make it very clear that use Django development server as a normal webserver is not OK. But some state that other webservers are optional, that we can use Django server to put the website on the web for everybody to see. But why exactly? Why do I need (or not) to...
2016/09/02
[ "https://Stackoverflow.com/questions/39300319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6789127/" ]
It comes down to the goal of the Django project and the efficiency gains associated with re-use (as opposed to reinventing the wheel). The stated goal for Django is to offer a web application framework that enables quick development and minimal code. The original tagline was a "web application framework for perfection...
It is not something specific to Django, that is the case for all modern web frameworks that I know, they all have this very simple built-in web server that we use only for development purposes, and the reason is obvious, it does not make any sense to reinvent the wheel since we already have very powerful web servers. ...
58,587,529
I have the next layout: ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.CoordinatorLayout android:id="...
2019/10/28
[ "https://Stackoverflow.com/questions/58587529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064171/" ]
It was easier than I thought. After three hours of searching and trying out things, I just had to do this: ``` appBarLayout.setExpanded(true, true); ``` Well, that was an unnecessary waste of time on my part...
you have to use collapsing tool bar to achieve this. ``` <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="match_parent" app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <a...
4,480,137
Can [codemirror](http://www.codemirror.net) be used on more than one textarea? I use many textareas that are generated dynamically. ``` <script type="text/javascript"> var editor = CodeMirror.fromTextArea('code', { height: "dynamic", parserfile: "parsecss.js", stylesheet: "codemirror/css/csscolors.css", path: "codemi...
2010/12/18
[ "https://Stackoverflow.com/questions/4480137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148496/" ]
You can actually make multiple calls to `CodeMirror.fromTextArea` to 'Codemirror-ify' multiple textareas. If you want multiple textareas with the same options, wrap the `Codemirror.fromTextArea` call in a function, like: ``` function editor(id) { CodeMirror.fromTextArea(id, { height: "350px", pars...
**Try this code** ``` function getByClass(sClass){ var aResult=[]; var aEle=document.getElementsByTagName('*'); for(var i=0;i<aEle.length;i++){ /*foreach className*/ var arr=aEle[i].className.split(/\s+/); for(var j=0;j<arr.length;j++){ /*check class*/ if(arr...
4,480,137
Can [codemirror](http://www.codemirror.net) be used on more than one textarea? I use many textareas that are generated dynamically. ``` <script type="text/javascript"> var editor = CodeMirror.fromTextArea('code', { height: "dynamic", parserfile: "parsecss.js", stylesheet: "codemirror/css/csscolors.css", path: "codemi...
2010/12/18
[ "https://Stackoverflow.com/questions/4480137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148496/" ]
You can actually make multiple calls to `CodeMirror.fromTextArea` to 'Codemirror-ify' multiple textareas. If you want multiple textareas with the same options, wrap the `Codemirror.fromTextArea` call in a function, like: ``` function editor(id) { CodeMirror.fromTextArea(id, { height: "350px", pars...
Might be helpful to somebody, attach it to multiple textareas using html class: ``` <textarea class="code"></textarea> <textarea class="code"></textarea> <textarea class="code"></textarea> <script type="text/javascript"> function qsa(sel) { return Array.apply(null, document.querySelectorAll(sel)); } qsa(".code")....
4,480,137
Can [codemirror](http://www.codemirror.net) be used on more than one textarea? I use many textareas that are generated dynamically. ``` <script type="text/javascript"> var editor = CodeMirror.fromTextArea('code', { height: "dynamic", parserfile: "parsecss.js", stylesheet: "codemirror/css/csscolors.css", path: "codemi...
2010/12/18
[ "https://Stackoverflow.com/questions/4480137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148496/" ]
Might be helpful to somebody, attach it to multiple textareas using html class: ``` <textarea class="code"></textarea> <textarea class="code"></textarea> <textarea class="code"></textarea> <script type="text/javascript"> function qsa(sel) { return Array.apply(null, document.querySelectorAll(sel)); } qsa(".code")....
**Try this code** ``` function getByClass(sClass){ var aResult=[]; var aEle=document.getElementsByTagName('*'); for(var i=0;i<aEle.length;i++){ /*foreach className*/ var arr=aEle[i].className.split(/\s+/); for(var j=0;j<arr.length;j++){ /*check class*/ if(arr...
5,220,185
I want a class something like this: ``` public interface IDateRecognizer { DateTime[] Recognize(string s); } ``` The dates might exist anywhere in the string and might be any format. For now, I could limit to U.S. culture formats. The dates would not be delimited in any way. They might have arbitrary amounts of ...
2011/03/07
[ "https://Stackoverflow.com/questions/5220185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29493/" ]
I'd go for some hand rolled solution to chop the input string into manageable size to let some Regex'es do the work. This seems like a great test to start with unit testing.
Recognising dates seems to be a straight forward and easy task for Regex. I cannot understand why you are trying to avoid it. ANTLR for this case where you have a very limited set of semantics is just overkill. While performance could be a potential issue but I would really doubt if other options would give you bett...
5,220,185
I want a class something like this: ``` public interface IDateRecognizer { DateTime[] Recognize(string s); } ``` The dates might exist anywhere in the string and might be any format. For now, I could limit to U.S. culture formats. The dates would not be delimited in any way. They might have arbitrary amounts of ...
2011/03/07
[ "https://Stackoverflow.com/questions/5220185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29493/" ]
I'd go for some hand rolled solution to chop the input string into manageable size to let some Regex'es do the work. This seems like a great test to start with unit testing.
I'd suggest you to go with the regex. I'd put one regex (matching one date) into one string and multiple of them into an array. Then create the full regex in runtime. This makes the system more flexible. Depending what you need, you could consider putting the different date-regex into a (XML)file / db.
5,220,185
I want a class something like this: ``` public interface IDateRecognizer { DateTime[] Recognize(string s); } ``` The dates might exist anywhere in the string and might be any format. For now, I could limit to U.S. culture formats. The dates would not be delimited in any way. They might have arbitrary amounts of ...
2011/03/07
[ "https://Stackoverflow.com/questions/5220185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29493/" ]
I'd suggest you to go with the regex. I'd put one regex (matching one date) into one string and multiple of them into an array. Then create the full regex in runtime. This makes the system more flexible. Depending what you need, you could consider putting the different date-regex into a (XML)file / db.
Recognising dates seems to be a straight forward and easy task for Regex. I cannot understand why you are trying to avoid it. ANTLR for this case where you have a very limited set of semantics is just overkill. While performance could be a potential issue but I would really doubt if other options would give you bett...
34,246,812
I tried to find a solution but so much information which doesn't work. My last try was using the following: ``` UIApplication.sharedApplication().setStatusBarOrientation(UIInterfaceOrientation.LandscapeRight, animated: false) ``` This however, was deprecated from iOS 9 and couldn't find any way to force rotate with ...
2015/12/13
[ "https://Stackoverflow.com/questions/34246812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4697535/" ]
If this is something you really want to do, subclass `UINavigationController` then add this code: ``` override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { return .Landscape } ``` Trying to force an orientation imperatively is unwise; it's better to tell iOS what you want (as above) then...
We had to do this same thing in our app as well. Initially we worked with a hack. But eventually we switched the "Landscape" VC to a modal rather than part of navigation view controller stack. I would suggest you do that. But if you really want to, here is how you do it. Subclass Navigation VC. in `supportedInterface...
46,771,879
**GOAL:** Create a histogram that accepts user input for bin count, and overlay it with a curve to fit the distribution. Plotted data is the amount of time it takes a person to cut a cookie. **KEY FUNCTIONS:** *geom\_histogram(aes(y = ..count..), bins = input$binCount)* - This statement creates a frequency plot with...
2017/10/16
[ "https://Stackoverflow.com/questions/46771879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8784215/" ]
Consider the much simpler example ``` # works ggplot(iris, aes(Sepal.Width)) + geom_density(aes(y=..density.. * 5)) # doesn't work N <- 5 ggplot(iris, aes(Sepal.Width)) + geom_density(aes(y=..density.. * N)) ``` For the ggplot layers that do calculations for you, they need to create their own variables, and when the...
While the previous answer is good enough, `stat_density` allows us extract the the density values on which we can make arithmetic ops and build a layer, Just wanted to share this approach too. ``` if(interactive()){ # # Cookie Cutting Analytics # # Author: Cody # Date: 10/16/2017 # Descr: An application...
36,592,190
Video recording works fine on IOS, Android can't catch data. problem seems to be the ``` var curActivity = Ti.Android.currentActivity; curActivity.startActivityForResult(intent, function(e) { .... ``` there was some advise to use win.getActivity() instead, but i have no variable I can use. $.cameraWin this is no...
2016/04/13
[ "https://Stackoverflow.com/questions/36592190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6197411/" ]
**Alternative way:** I'm currently working on getting video recording to android in the normal SDK: <https://github.com/appcelerator/titanium_mobile/pull/7929> It is already working (Samsung Galaxy S6 has a problem a the moment I need to fix: you need to rotate the phone ones to have the proper preview size) but need...
I have a similar project, though mine is taking stills, not video, but for all intents and purposes they should behave the same. In my code I have: ``` var win = $.camera_view; ``` This allows me later to start my activity with: ``` win.activity.startActivityForResult(... ``` Per your example you would probably ...
28,776,205
I am looking for a tool (or chain of tools) that can parse a .class files to a Java object. Something like : ``` JavaClass parsed = myTool.parse("/some_folder/SomeClassFile.class"); ``` The parsed object would have methods like : ``` List<JavaMethod> methods = parsed.getMethods(); List<JavaInterface> interfaces = p...
2015/02/27
[ "https://Stackoverflow.com/questions/28776205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2520643/" ]
I'd recommend ASM. From what I've seen, it's by far the most popular Java bytecode library, and yes, it is still maintained. At time of writing, it looks like [the most recent change](http://websvn.ow2.org/log.php?repname=asm&path=%2Ftrunk%2F&isdir=1&) was 41 days ago. So it's not constantly churning but it's not like ...
I made some test for JBBP to parse java class, take a look at it, may be it will be useful for you <https://github.com/raydac/java-binary-block-parser/blob/master/src/test/java/com/igormaznitsa/jbbp/it/ClassParsingTest.java>
35,387,667
I installed Gitbash in my Windows and defined the Linux command lines (ls to list directory for example) but the command line is returning strange characters. ``` Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) $ php artisan ←[32mLaravel Framework←[39m version ←[33m5.1.29 (LTS)←[39m ←[33mUsage:←[39m c...
2016/02/14
[ "https://Stackoverflow.com/questions/35387667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5683175/" ]
You need to enable ansi control code processing. See [here](http://jasonkarns.com/blog/ansi-color-in-windows-shells/) for details. By Jason Karns in shell ----------------------- * [Link content included for reference in case link ever gets deleted.](http://jasonkarns.com/blog/ansi-color-in-windows-shells/) Having u...
For MingGW64 I found going into the Options > Terminal and switching from `xterm` (the default I presume) to `xterm-256color` fixed the issue. I also restarted the console. [![enter image description here](https://i.stack.imgur.com/tEth8.png)](https://i.stack.imgur.com/tEth8.png)
35,387,667
I installed Gitbash in my Windows and defined the Linux command lines (ls to list directory for example) but the command line is returning strange characters. ``` Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) $ php artisan ←[32mLaravel Framework←[39m version ←[33m5.1.29 (LTS)←[39m ←[33mUsage:←[39m c...
2016/02/14
[ "https://Stackoverflow.com/questions/35387667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5683175/" ]
You need to enable ansi control code processing. See [here](http://jasonkarns.com/blog/ansi-color-in-windows-shells/) for details. By Jason Karns in shell ----------------------- * [Link content included for reference in case link ever gets deleted.](http://jasonkarns.com/blog/ansi-color-in-windows-shells/) Having u...
I didn't remember the last version of GIT. I faced same problem after updating Git Bash to 2.11. Downgrading to 2.10 solved my problem. <https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1>
35,387,667
I installed Gitbash in my Windows and defined the Linux command lines (ls to list directory for example) but the command line is returning strange characters. ``` Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) $ php artisan ←[32mLaravel Framework←[39m version ←[33m5.1.29 (LTS)←[39m ←[33mUsage:←[39m c...
2016/02/14
[ "https://Stackoverflow.com/questions/35387667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5683175/" ]
You need to enable ansi control code processing. See [here](http://jasonkarns.com/blog/ansi-color-in-windows-shells/) for details. By Jason Karns in shell ----------------------- * [Link content included for reference in case link ever gets deleted.](http://jasonkarns.com/blog/ansi-color-in-windows-shells/) Having u...
[This answer](https://stackoverflow.com/a/64272135/1221537) helped me with my weird characters in gradle output from git bash in windows. Just add `export TERM=cygwin` to the last line of `git/etc/bash.bashrc`. If this helps you, be sure to send the upvotes to their answer—I'm only reposting it here since this is where...
35,387,667
I installed Gitbash in my Windows and defined the Linux command lines (ls to list directory for example) but the command line is returning strange characters. ``` Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) $ php artisan ←[32mLaravel Framework←[39m version ←[33m5.1.29 (LTS)←[39m ←[33mUsage:←[39m c...
2016/02/14
[ "https://Stackoverflow.com/questions/35387667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5683175/" ]
For MingGW64 I found going into the Options > Terminal and switching from `xterm` (the default I presume) to `xterm-256color` fixed the issue. I also restarted the console. [![enter image description here](https://i.stack.imgur.com/tEth8.png)](https://i.stack.imgur.com/tEth8.png)
I didn't remember the last version of GIT. I faced same problem after updating Git Bash to 2.11. Downgrading to 2.10 solved my problem. <https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1>
35,387,667
I installed Gitbash in my Windows and defined the Linux command lines (ls to list directory for example) but the command line is returning strange characters. ``` Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) $ php artisan ←[32mLaravel Framework←[39m version ←[33m5.1.29 (LTS)←[39m ←[33mUsage:←[39m c...
2016/02/14
[ "https://Stackoverflow.com/questions/35387667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5683175/" ]
[This answer](https://stackoverflow.com/a/64272135/1221537) helped me with my weird characters in gradle output from git bash in windows. Just add `export TERM=cygwin` to the last line of `git/etc/bash.bashrc`. If this helps you, be sure to send the upvotes to their answer—I'm only reposting it here since this is where...
I didn't remember the last version of GIT. I faced same problem after updating Git Bash to 2.11. Downgrading to 2.10 solved my problem. <https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1>