qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
`timeIntervalSinceReferenceDate` is perfectly fine. However, unless it's a long-running method, this won't bear much fruit. Execution times can vary wildly when you're talking about a few millisecond executions. If your thread/process gets preempted mid-way through, you'll have non-deterministic spikes. Essentially, y...
I will repost my answer from another post here. Note that my admittedly simple solution to this complex problem uses NSDate and NSTimeInterval as its foundation: --- I know this is an old one but even I found myself wandering past it again, so I thought I'd submit my own option here. Best bet is to check out my blog...
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
Actually, `+[NSDate timeIntervalSinceReferenceDate]` returns an `NSTimeInterval`, which is a typedef for a double. The docs say > > NSTimeInterval is always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years. > > > So it's safe to use for millisecond-precision timing. I do so ...
@bladnman I love your stopwatch thing.. I use it all the time.. Here's a little block I wrote that eliminates the need for the closing call, and makes it even EASIER (if that even seemed possible) to use, lol. ``` +(void)stopwatch:(NSString*)name timing:(void(^)())block { [MMStopwatch start:name]; block(); ...
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
I will repost my answer from another post here. Note that my admittedly simple solution to this complex problem uses NSDate and NSTimeInterval as its foundation: --- I know this is an old one but even I found myself wandering past it again, so I thought I'd submit my own option here. Best bet is to check out my blog...
@bladnman I love your stopwatch thing.. I use it all the time.. Here's a little block I wrote that eliminates the need for the closing call, and makes it even EASIER (if that even seemed possible) to use, lol. ``` +(void)stopwatch:(NSString*)name timing:(void(^)())block { [MMStopwatch start:name]; block(); ...
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
*Do not use `NSDate` for this.* You're loosing a lot of precision to call methods and instantiate objects, maybe even releasing something internal. You just don't have enough control. Use either `time.h` or as [Stephen Canon](https://stackoverflow.com/questions/1615998/rudimentary-ways-to-measure-execution-time-of-a-m...
If you're trying to tune your code's performance, you would do better to use Instruments or Shark to get an overall picture of where your app is spending its time.
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
For very fine-grained timings on OS X, I use `mach_absolute_time( )`, which is defined in `<mach/mach_time.h>`. You can use it as follows: ``` #include <mach/mach_time.h> #include <stdint.h> static double ticksToNanoseconds = 0.0; uint64_t startTime = mach_absolute_time( ); // Do some stuff you want to time here uin...
I will repost my answer from another post here. Note that my admittedly simple solution to this complex problem uses NSDate and NSTimeInterval as its foundation: --- I know this is an old one but even I found myself wandering past it again, so I thought I'd submit my own option here. Best bet is to check out my blog...
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
If you're trying to tune your code's performance, you would do better to use Instruments or Shark to get an overall picture of where your app is spending its time.
@bladnman I love your stopwatch thing.. I use it all the time.. Here's a little block I wrote that eliminates the need for the closing call, and makes it even EASIER (if that even seemed possible) to use, lol. ``` +(void)stopwatch:(NSString*)name timing:(void(^)())block { [MMStopwatch start:name]; block(); ...
1,615,998
What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis....
2009/10/23
[ "https://Stackoverflow.com/questions/1615998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119382/" ]
Actually, `+[NSDate timeIntervalSinceReferenceDate]` returns an `NSTimeInterval`, which is a typedef for a double. The docs say > > NSTimeInterval is always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years. > > > So it's safe to use for millisecond-precision timing. I do so ...
I will repost my answer from another post here. Note that my admittedly simple solution to this complex problem uses NSDate and NSTimeInterval as its foundation: --- I know this is an old one but even I found myself wandering past it again, so I thought I'd submit my own option here. Best bet is to check out my blog...
11,299,663
I know that this line of code will make the cell text-wrap: ``` $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setWrapText(true); ``` 'D1' being the chosen cell. Instead of using this code for every cell I need wrapped, is there a way to make the entire Excel Worksheet automatically wrap everything...
2012/07/02
[ "https://Stackoverflow.com/questions/11299663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1389807/" ]
Apply to a range: ``` $objPHPExcel->getActiveSheet()->getStyle('D1:E999') ->getAlignment()->setWrapText(true); ``` Apply to a column ``` $objPHPExcel->getActiveSheet()->getStyle('D1:D'.$objPHPExcel->getActiveSheet()->getHighestRow()) ->getAlignment()->setWrapText(true); ```
Apply to column ``` $highestRow = $$objPHPExcel->getActiveSheet()->getHighestRow(); for ($row = 1; $row <= $highestRow; $row++){ $sheet->getStyle("D$row")->getAlignment()->setWrapText(true); } ```
11,299,663
I know that this line of code will make the cell text-wrap: ``` $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setWrapText(true); ``` 'D1' being the chosen cell. Instead of using this code for every cell I need wrapped, is there a way to make the entire Excel Worksheet automatically wrap everything...
2012/07/02
[ "https://Stackoverflow.com/questions/11299663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1389807/" ]
Apply to a range: ``` $objPHPExcel->getActiveSheet()->getStyle('D1:E999') ->getAlignment()->setWrapText(true); ``` Apply to a column ``` $objPHPExcel->getActiveSheet()->getStyle('D1:D'.$objPHPExcel->getActiveSheet()->getHighestRow()) ->getAlignment()->setWrapText(true); ```
``` $objPHPExcel->getDefaultStyle()->getAlignment()->setWrapText(true); ```
11,299,663
I know that this line of code will make the cell text-wrap: ``` $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setWrapText(true); ``` 'D1' being the chosen cell. Instead of using this code for every cell I need wrapped, is there a way to make the entire Excel Worksheet automatically wrap everything...
2012/07/02
[ "https://Stackoverflow.com/questions/11299663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1389807/" ]
``` $objPHPExcel->getDefaultStyle()->getAlignment()->setWrapText(true); ```
Apply to column ``` $highestRow = $$objPHPExcel->getActiveSheet()->getHighestRow(); for ($row = 1; $row <= $highestRow; $row++){ $sheet->getStyle("D$row")->getAlignment()->setWrapText(true); } ```
10,779,130
``` enemyBlobArray = [[NSMutableArray alloc] init]; for(int i = 0; i < kEnemyCount; i++) { [enemyArray addObject:[SpriteHelpers setupAnimatedSprite:self.view numFrames:3 withFilePrefix:@"greenbox" withDuration:((CGFloat)(arc4random()%2)/3 + 0.5) ofType:@"png" withValue:0]]; } enemyView = [enemyArray objectAtIndex...
2012/05/28
[ "https://Stackoverflow.com/questions/10779130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1420896/" ]
The method `setupAnimatedSprite:numFrames:withFilePrefix:withDuration:ofType:withValue:` is returning nil. So the problem is somewhere inside that method. Since we don't have the code for that method, I couldn't tell you what it might be.
According to the provided code, you make no mention of the allocation and initialization of "enemyArray"; however, you created a mutable array called "enemyBlobArray" which is never utilized within the provided code. Perhaps this is a simple issue of misspelling of a variable name.
806,060
Is it possible to define host variables for all hosts using a dynamic inventory? Currently I can produce an inventory which allows me to assign variables to specific hosts, but what I want to achieve is something like this: ``` { "_meta": { "hostvars": { "all": { "my_global_ran...
2016/09/29
[ "https://serverfault.com/questions/806060", "https://serverfault.com", "https://serverfault.com/users/235801/" ]
I ended up using a lookup plugin instead of the inventory to retrieve my variables. More information on lookups: <https://docs.ansible.com/ansible/playbooks_lookups.html>
Variables set by `dynamic inventory` are `inventory variables`. When a variable is set in multiple places Ansible set the value following [variable precedence](http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable): > > > ``` > role defaults [1] > inventory ...
806,060
Is it possible to define host variables for all hosts using a dynamic inventory? Currently I can produce an inventory which allows me to assign variables to specific hosts, but what I want to achieve is something like this: ``` { "_meta": { "hostvars": { "all": { "my_global_ran...
2016/09/29
[ "https://serverfault.com/questions/806060", "https://serverfault.com", "https://serverfault.com/users/235801/" ]
Variables set by `dynamic inventory` are `inventory variables`. When a variable is set in multiple places Ansible set the value following [variable precedence](http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable): > > > ``` > role defaults [1] > inventory ...
I wanted to do this and seems to work with the following (adapted for your example): ``` { "all": { "vars": { "my_global_random_variable": "global_random_value" } }, "web_servers": { "children": [], "hosts": [ "web_server1", "web_server2" ...
806,060
Is it possible to define host variables for all hosts using a dynamic inventory? Currently I can produce an inventory which allows me to assign variables to specific hosts, but what I want to achieve is something like this: ``` { "_meta": { "hostvars": { "all": { "my_global_ran...
2016/09/29
[ "https://serverfault.com/questions/806060", "https://serverfault.com", "https://serverfault.com/users/235801/" ]
I ended up using a lookup plugin instead of the inventory to retrieve my variables. More information on lookups: <https://docs.ansible.com/ansible/playbooks_lookups.html>
I wanted to do this and seems to work with the following (adapted for your example): ``` { "all": { "vars": { "my_global_random_variable": "global_random_value" } }, "web_servers": { "children": [], "hosts": [ "web_server1", "web_server2" ...
48,345,049
According to most NVidia documentation CUDA cores are scalar processors and should only execute scalar operations, that will get vectorized to 32-component SIMT warps. But OpenCL has vector types like for example `uchar8`.It has the same size as `ulong` (64 bit), which can be processed by a single scalar core. If I do...
2018/01/19
[ "https://Stackoverflow.com/questions/48345049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4108376/" ]
CUDA has "built-in" (i.e. predefined) vector types up to a size of 4 for 4-byte quantities (e.g. `int4`) and up to a size of 2 for 8-byte quantities (e.g. `double2`). A CUDA thread has a maximum read/write transaction size of 16 bytes, so these particular size choices tend to line up with [that maximum](http://docs.nvi...
> > If I do operations on a uchar8 vector (for example component-wise addition), will this also map to an instruction on a single core? > > > AFAIK it'll always be on a single core (instructions from a single kernel / workitem don't cross cores, except special instructions like barriers), but it may be more than o...
686,737
I'm using StartSSL which , after you proove who you say you are, provides a certificate which I can install to authenticate myself. I have some SSL certificates associated with this account. I've bought a new server, and I need to move the certificates over, but I'm failing. On my 'old W28k server', I went into Firef...
2015/04/30
[ "https://serverfault.com/questions/686737", "https://serverfault.com", "https://serverfault.com/users/284558/" ]
You need to export the certificate as a whole - not just the certificate itself but also the private key, as pointed out by @EEAA in the comments below your question. As per [the MS documentation on TechNet](https://technet.microsoft.com/en-us/library/cc754329.aspx): > > 1. Open the Certificates snap-in for a user,...
If you could export full certificates with private keys from a browser that would make them pointless! You need to use the export feature ON the server, and then import on your new server. See these guides: <https://technet.microsoft.com/en-us/library/cc771103.aspx>
686,737
I'm using StartSSL which , after you proove who you say you are, provides a certificate which I can install to authenticate myself. I have some SSL certificates associated with this account. I've bought a new server, and I need to move the certificates over, but I'm failing. On my 'old W28k server', I went into Firef...
2015/04/30
[ "https://serverfault.com/questions/686737", "https://serverfault.com", "https://serverfault.com/users/284558/" ]
You need to export the certificate as a whole - not just the certificate itself but also the private key, as pointed out by @EEAA in the comments below your question. As per [the MS documentation on TechNet](https://technet.microsoft.com/en-us/library/cc754329.aspx): > > 1. Open the Certificates snap-in for a user,...
So, as far as I understand, you don't ask about importing/exporting SSL Certificates in gerneral (e.g. the ones you use for IIS) but the client authentication certificate from StartSSL? In that case, you have to re-import it into Firefox. To do this, got to Options --> Advanced --> Certificates --> View Certificates -...
686,737
I'm using StartSSL which , after you proove who you say you are, provides a certificate which I can install to authenticate myself. I have some SSL certificates associated with this account. I've bought a new server, and I need to move the certificates over, but I'm failing. On my 'old W28k server', I went into Firef...
2015/04/30
[ "https://serverfault.com/questions/686737", "https://serverfault.com", "https://serverfault.com/users/284558/" ]
You need to export the certificate as a whole - not just the certificate itself but also the private key, as pointed out by @EEAA in the comments below your question. As per [the MS documentation on TechNet](https://technet.microsoft.com/en-us/library/cc754329.aspx): > > 1. Open the Certificates snap-in for a user,...
You can export both the cert, and the key using this procedure: <https://technet.microsoft.com/en-us/library/cc754329.aspx> One thing to note however is "A private key is exportable only when it is specified in the certificate request" If the key is exportable the cert export wizard will give you the option. If its n...
686,737
I'm using StartSSL which , after you proove who you say you are, provides a certificate which I can install to authenticate myself. I have some SSL certificates associated with this account. I've bought a new server, and I need to move the certificates over, but I'm failing. On my 'old W28k server', I went into Firef...
2015/04/30
[ "https://serverfault.com/questions/686737", "https://serverfault.com", "https://serverfault.com/users/284558/" ]
If you could export full certificates with private keys from a browser that would make them pointless! You need to use the export feature ON the server, and then import on your new server. See these guides: <https://technet.microsoft.com/en-us/library/cc771103.aspx>
You can export both the cert, and the key using this procedure: <https://technet.microsoft.com/en-us/library/cc754329.aspx> One thing to note however is "A private key is exportable only when it is specified in the certificate request" If the key is exportable the cert export wizard will give you the option. If its n...
686,737
I'm using StartSSL which , after you proove who you say you are, provides a certificate which I can install to authenticate myself. I have some SSL certificates associated with this account. I've bought a new server, and I need to move the certificates over, but I'm failing. On my 'old W28k server', I went into Firef...
2015/04/30
[ "https://serverfault.com/questions/686737", "https://serverfault.com", "https://serverfault.com/users/284558/" ]
So, as far as I understand, you don't ask about importing/exporting SSL Certificates in gerneral (e.g. the ones you use for IIS) but the client authentication certificate from StartSSL? In that case, you have to re-import it into Firefox. To do this, got to Options --> Advanced --> Certificates --> View Certificates -...
You can export both the cert, and the key using this procedure: <https://technet.microsoft.com/en-us/library/cc754329.aspx> One thing to note however is "A private key is exportable only when it is specified in the certificate request" If the key is exportable the cert export wizard will give you the option. If its n...
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
``` Select distinct t1.Column1, case when t1.Column2 < t2.Column2 then t1.Column2 else t2.Column2 end as Column2, case when t1.Column3 > t2.Column3 then t1.Column3 else t2.Column3 end as Column3 from myTable t1 inner join myTable t2 on t1.Column1 = t2.Column1 and t1.column2 = t2.column3; ``` EDIT: A s...
All the answer till now, will loose data for single combination entry. It is suppose to be below code ``` Select distinct t1.Column1, case when t1.Column2 < t1.Column3 then t1.Column2 else t1.Column3 end as Column2, case when t1.Column2 < t1.Column3 then t1.Column3 else t1.Column2 end as Column3 from myTable...
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
``` Select distinct t1.Column1, case when t1.Column2 < t2.Column2 then t1.Column2 else t2.Column2 end as Column2, case when t1.Column3 > t2.Column3 then t1.Column3 else t2.Column3 end as Column3 from myTable t1 inner join myTable t2 on t1.Column1 = t2.Column1 and t1.column2 = t2.column3; ``` EDIT: A s...
You can use `exists` to find the duplicates and then `<` (or `>`) to get one of the rows; ``` select t.* from t where exists (select 1 from t t2 where t2.column1 = t1.column1 and t2.column2 = t1.column3 and t2.column3 = t1.column2 ) and ...
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
``` Select distinct t1.Column1, case when t1.Column2 < t2.Column2 then t1.Column2 else t2.Column2 end as Column2, case when t1.Column3 > t2.Column3 then t1.Column3 else t2.Column3 end as Column3 from myTable t1 inner join myTable t2 on t1.Column1 = t2.Column1 and t1.column2 = t2.column3; ``` EDIT: A s...
I your case you can use `distinct` with `outer apply`. in outer apply you can add `order by` that you need ``` select distinct t.column1, r.column2, r.column3 from myTable t outer apply ( select top 1 r.column2, r.column3 from myTable as r where r.column1 = t.column1 ) as r ```
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
If columns 2 and 3 contain "reverse duplicates" that you want to hide, you will have to decide what ordering you want to see: ``` SELECT column1, column2, column3 FROM aTable WHERE column2 <= column3 ```
From your data I assumed, that each entry has the same `column1` value, if they are duplicate. Try: ``` SELECT column1, column2, column3 FROM ( SELECT column1, column2, column3, ROW_NUMBER() OVER (PARTITION BY column1 ORDER BY column2, column3) rn FROM MyTable ) a WHERE rn = 1 ...
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
You can use `exists` to find the duplicates and then `<` (or `>`) to get one of the rows; ``` select t.* from t where exists (select 1 from t t2 where t2.column1 = t1.column1 and t2.column2 = t1.column3 and t2.column3 = t1.column2 ) and ...
I your case you can use `distinct` with `outer apply`. in outer apply you can add `order by` that you need ``` select distinct t.column1, r.column2, r.column3 from myTable t outer apply ( select top 1 r.column2, r.column3 from myTable as r where r.column1 = t.column1 ) as r ```
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
If columns 2 and 3 contain "reverse duplicates" that you want to hide, you will have to decide what ordering you want to see: ``` SELECT column1, column2, column3 FROM aTable WHERE column2 <= column3 ```
I your case you can use `distinct` with `outer apply`. in outer apply you can add `order by` that you need ``` select distinct t.column1, r.column2, r.column3 from myTable t outer apply ( select top 1 r.column2, r.column3 from myTable as r where r.column1 = t.column1 ) as r ```
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
From your data I assumed, that each entry has the same `column1` value, if they are duplicate. Try: ``` SELECT column1, column2, column3 FROM ( SELECT column1, column2, column3, ROW_NUMBER() OVER (PARTITION BY column1 ORDER BY column2, column3) rn FROM MyTable ) a WHERE rn = 1 ...
All the answer till now, will loose data for single combination entry. It is suppose to be below code ``` Select distinct t1.Column1, case when t1.Column2 < t1.Column3 then t1.Column2 else t1.Column3 end as Column2, case when t1.Column2 < t1.Column3 then t1.Column3 else t1.Column2 end as Column3 from myTable...
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
From your data I assumed, that each entry has the same `column1` value, if they are duplicate. Try: ``` SELECT column1, column2, column3 FROM ( SELECT column1, column2, column3, ROW_NUMBER() OVER (PARTITION BY column1 ORDER BY column2, column3) rn FROM MyTable ) a WHERE rn = 1 ...
I your case you can use `distinct` with `outer apply`. in outer apply you can add `order by` that you need ``` select distinct t.column1, r.column2, r.column3 from myTable t outer apply ( select top 1 r.column2, r.column3 from myTable as r where r.column1 = t.column1 ) as r ```
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
If columns 2 and 3 contain "reverse duplicates" that you want to hide, you will have to decide what ordering you want to see: ``` SELECT column1, column2, column3 FROM aTable WHERE column2 <= column3 ```
You can use `exists` to find the duplicates and then `<` (or `>`) to get one of the rows; ``` select t.* from t where exists (select 1 from t t2 where t2.column1 = t1.column1 and t2.column2 = t1.column3 and t2.column3 = t1.column2 ) and ...
51,518,362
Apologies if this is a duplicate question, I can't seem to find it anywhere else. I have a table like so: ``` column1 column2 column3 entry 1 A B ENTRY 2 A C ENTRY 3 B C ENTRY 1 B A ENTRY 2 C A ENTRY 3 C B ``` The table I'm using has more columns but the idea is the same. Is there an easy clean way to ...
2018/07/25
[ "https://Stackoverflow.com/questions/51518362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6067427/" ]
If columns 2 and 3 contain "reverse duplicates" that you want to hide, you will have to decide what ordering you want to see: ``` SELECT column1, column2, column3 FROM aTable WHERE column2 <= column3 ```
All the answer till now, will loose data for single combination entry. It is suppose to be below code ``` Select distinct t1.Column1, case when t1.Column2 < t1.Column3 then t1.Column2 else t1.Column3 end as Column2, case when t1.Column2 < t1.Column3 then t1.Column3 else t1.Column2 end as Column3 from myTable...
57,385,016
I'm trying to read a file that is formatted like this: ```none ruby 2.6.2 elixir 1.8.3 ``` And convert into a two-dimensional array like this pseudocode: ```none [ ["ruby", "2.6.2"] ["elixir", "1.8.3"] ] ``` The code I have to do this in Rust is: ```rust use std::fs::File; use std::io::prelude::*; use std::i...
2019/08/06
[ "https://Stackoverflow.com/questions/57385016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15245/" ]
Your code is generally idiomatic and good, I just have a few minor caveats. As far as the "overwork", I would argue modifying the string in-place is overwork, since at every removed whitespace character, you either need to do one of 3 things: 1. Shift every character past that element down 1 (most moves, no allocati...
I believe the `.to_string()` is necessary. But I would change it for clarity. The `.lines()` function returns an iterator with a `String`. But the function [split\_whitespace](https://doc.rust-lang.org/std/string/struct.String.html#method.split_whitespace) returns a `SplitWhiteSpace` struct. If you look in the source ...
9,136,527
I am creating a library in AS3. Inside the library I make use of a bunch of classes/packages that need not be exposed to the end user of my lib. I want to only expose one of these classes. I guess my questions are: 1) How are libraries commonly distributed in AS3? 2) Is there a .jar equivalent in AS3 that developers...
2012/02/03
[ "https://Stackoverflow.com/questions/9136527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396077/" ]
AS3 libraries are called SWCs. Like JARs they are just ZIP archives with some metadata included. You can build libraries either using Flash Builder library projects or mxmlc compiler in Flex SDK which is described for example [here](http://talsma.tv/post.cfm/ant-mxmlc-and-swc-files). Good practice is to distribute SWC...
> > Is it possible to create a SWC file without using the Flex framework? > I just want bare-bone AS3. > > > Yes we are not forced into using flex, in fact Adobe doesn't even support Flex as their product officially anymore as it is now an open-source apache project. <http://blogs.apache.org/flex/> The compiler...
37,576,880
How can I set `scrolling = "no"` at the iframe podio-webform-frame? Unfortunately it's possible in fully-conforming HTML5 with just HTML and CSS properties [view the automatic iframe generated by podio](http://i.stack.imgur.com/hvzV0.png)
2016/06/01
[ "https://Stackoverflow.com/questions/37576880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2624457/" ]
You can do this pretty easily using WPF: 1. Find a nice World Map in SVG format. I used [this one](https://commons.wikimedia.org/wiki/File:World_map_-_low_resolution.svg) from Wikipedia: [![World Map Wikipedia](https://i.stack.imgur.com/lAaNI.png)](https://i.stack.imgur.com/lAaNI.png) 2. Download and install [Inksca...
My first thought: You could bind a command to the view that will be triggered by a click on a position. If you're using WPF you can bind command parameters to the command to get the x and y of your click... After that you have to handle the content of your messagebox and the highlighting of the borders depending on the...
37,576,880
How can I set `scrolling = "no"` at the iframe podio-webform-frame? Unfortunately it's possible in fully-conforming HTML5 with just HTML and CSS properties [view the automatic iframe generated by podio](http://i.stack.imgur.com/hvzV0.png)
2016/06/01
[ "https://Stackoverflow.com/questions/37576880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2624457/" ]
You can do this pretty easily using WPF: 1. Find a nice World Map in SVG format. I used [this one](https://commons.wikimedia.org/wiki/File:World_map_-_low_resolution.svg) from Wikipedia: [![World Map Wikipedia](https://i.stack.imgur.com/lAaNI.png)](https://i.stack.imgur.com/lAaNI.png) 2. Download and install [Inksca...
**Option 1** There is a project on Code Project that someone created that defines hotspots that are clickable with events. You could use that to overlay your map and define the hotspots where you need them. [C# Windows Forms ImageMap Control](http://www.codeproject.com/Articles/2820/C-Windows-Forms-ImageMap-Control) ...
22,947
i want a vf page that will render all the records through controller and the results will be render as html how please help me with some code and example for custom object. Class: ``` public with sharing class Active { public Active(ApexPages.StandardController controller) { } public List<Property__c> p...
2013/12/24
[ "https://salesforce.stackexchange.com/questions/22947", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/4955/" ]
While reading data from the `Property__c` object you don't need to reference this objects name if the WHERE clause: ``` po = [ SELECT Acceptance_Date__c, ... FROM Property__c WHERE Property_Status__c = 'Active' ]; ``` Then at the visualforce page you want to show all records from the `po` list? You ...
Replace the below line this ``` <apex:pageblockTable value="{!Property__c}" var="a"> ``` with this line ``` <apex:pageblockTable value="{!po}" var="a"> ``` remove this construtor from class ``` public Active(ApexPages.StandardController controller) { } ``` and standard controller attribute from visual force pa...
22,947
i want a vf page that will render all the records through controller and the results will be render as html how please help me with some code and example for custom object. Class: ``` public with sharing class Active { public Active(ApexPages.StandardController controller) { } public List<Property__c> p...
2013/12/24
[ "https://salesforce.stackexchange.com/questions/22947", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/4955/" ]
While reading data from the `Property__c` object you don't need to reference this objects name if the WHERE clause: ``` po = [ SELECT Acceptance_Date__c, ... FROM Property__c WHERE Property_Status__c = 'Active' ]; ``` Then at the visualforce page you want to show all records from the `po` list? You ...
My VF Page: ``` <apex:page standardController="Order__c" recordSetVar="display" cache="false" extensions="AllOrders" > <apex:form > <apex:pageBlock title="All Orders in Application"> <apex:outputPanel id="mypanel"> <apex:pageBlockTable value="{!display}" var="r"> <apex:colum...
22,947
i want a vf page that will render all the records through controller and the results will be render as html how please help me with some code and example for custom object. Class: ``` public with sharing class Active { public Active(ApexPages.StandardController controller) { } public List<Property__c> p...
2013/12/24
[ "https://salesforce.stackexchange.com/questions/22947", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/4955/" ]
Replace the below line this ``` <apex:pageblockTable value="{!Property__c}" var="a"> ``` with this line ``` <apex:pageblockTable value="{!po}" var="a"> ``` remove this construtor from class ``` public Active(ApexPages.StandardController controller) { } ``` and standard controller attribute from visual force pa...
My VF Page: ``` <apex:page standardController="Order__c" recordSetVar="display" cache="false" extensions="AllOrders" > <apex:form > <apex:pageBlock title="All Orders in Application"> <apex:outputPanel id="mypanel"> <apex:pageBlockTable value="{!display}" var="r"> <apex:colum...
51,701,662
Below is the function in `__init__.py` file which means this part of code always run when code is executed ``` import logging def log_setup(): logging.TRACE = 5 logging.addLevelName(5, 'TRACE') def trace(obj, message, *args, **kws): obj.log(logging.TRACE, message, *args, **kws) logging.Logger....
2018/08/06
[ "https://Stackoverflow.com/questions/51701662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1336962/" ]
The problem is you are adding same `editButton` in all the cell, you need to create new `UIButton` for all the cell. So change line ``` editButton.frame = CGRect(x:63, y:0, width:20,height:20) ``` With ``` //Create new button instance every time let editButton = UIButton(frame: CGRect(x:63, y:0, width:20,height:2...
I think you could move the line: ``` var editButton = UIButton() ``` To func *cellForItemAt* : ``` func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as!...
51,701,662
Below is the function in `__init__.py` file which means this part of code always run when code is executed ``` import logging def log_setup(): logging.TRACE = 5 logging.addLevelName(5, 'TRACE') def trace(obj, message, *args, **kws): obj.log(logging.TRACE, message, *args, **kws) logging.Logger....
2018/08/06
[ "https://Stackoverflow.com/questions/51701662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1336962/" ]
The problem is you are adding same `editButton` in all the cell, you need to create new `UIButton` for all the cell. So change line ``` editButton.frame = CGRect(x:63, y:0, width:20,height:20) ``` With ``` //Create new button instance every time let editButton = UIButton(frame: CGRect(x:63, y:0, width:20,height:2...
move your button logic outside of switch statement like this ``` func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! CollectionViewCellCard switch ColorSegme...
12,236,579
I need to write a prog in Python that accomplishes the following: Prompt for and accept the input of a number, either positive or negative. Using a single alternative "decision" structure print a message only if the number is positive. It's extremely simply, but I'm new to Python so I have trouble with even the most ...
2012/09/02
[ "https://Stackoverflow.com/questions/12236579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1618869/" ]
Try this: ``` def getNumFromUser(): num = input("Please enter a number: ") if num >= 0: print "The number you entered is " + str(num) else: getNumFromUser() getNumFromUser() ``` The reason you received an error is because you omitted a colon after the condition of your if-statement. To ...
Try this: ``` inputnum = raw_input ("Please enter a number.") num = int(inputnum) if num >= 0: print("The number you entered is " + str(num)) ``` you don't need the `else` part just because the code is not inside a method/function. I agree with the other comment - as a beginner you may want to change your IDE...
23,447,451
I would like to ask your kind help about showing just the selected markers in Google Maps API V3. I have a HTML select -> ``` <select onchange="appartments()" id="selectField"> <option value="appartment1">Choose one appartment...</option> <option value="appartment2">1052 Budapest, Galamb u. 3.</option> <option value=...
2014/05/03
[ "https://Stackoverflow.com/questions/23447451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3599604/" ]
Maybe use PayPal's buy now buttons (<https://www.paypal.com/cgi-bin/webscr?cmd=_singleitem-intro-outside>) or some other simple purchase system's button. Maybe Strip has some good options too. Once you get to needing a real cart. You should just use a real application first and simple content management second.
[EvilText](http://eviltext.com) (open source static site generator similar to Jekyll) have eCommerce plugin, see [sample shop](http://shop-example.eviltext.com).
23,447,451
I would like to ask your kind help about showing just the selected markers in Google Maps API V3. I have a HTML select -> ``` <select onchange="appartments()" id="selectField"> <option value="appartment1">Choose one appartment...</option> <option value="appartment2">1052 Budapest, Galamb u. 3.</option> <option value=...
2014/05/03
[ "https://Stackoverflow.com/questions/23447451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3599604/" ]
You could use [snipcart](http://www.snipcart.com). There is a [blog post](https://snipcart.com/blog/static-site-e-commerce-part-2-integrating-snipcart-with-jekyll) and a [demo site](http://snipcart.github.io/snipcart-jekyll-integration/) that will get you up an running. There is also [Jekyll-store](http://www.jekyll-...
[EvilText](http://eviltext.com) (open source static site generator similar to Jekyll) have eCommerce plugin, see [sample shop](http://shop-example.eviltext.com).
31,293,008
I am gathering an `NSNumber` from my plist and I want to print that in a `String`: ``` let tijd = String(self.sortedHighscores[indexPath.row]["Tijd"]!) cell.detailTextLabel?.text = "\(tijd) seconden" ``` But in Simulator I'm seeing printed: `Optional(120) seconden` for example. How do I solve this? I've tried unwrap...
2015/07/08
[ "https://Stackoverflow.com/questions/31293008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4444642/" ]
Try this: ``` var highscore : NSNumber = self.sortedHighscores[indexPath.row]["Tijd"] as! NSNumber var a : String = String(format:"%d",highscore.integerValue) cell.detailTextLabel.text = a ```
`tijd` being an optional, you need to unwrap it, but you should check whether it has a value, too. ``` if let foo = tijd { cell.detailTextLabel?.text = "\(foo) seconden" } ``` If you know it will always have a value, `"\(tijd!) seconden"` should work also.
22,084
Which one is more correct: > > My hobby is to play basketball. > > > or > > My hobby is playing basketball? > > >
2014/04/24
[ "https://ell.stackexchange.com/questions/22084", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/5369/" ]
I’d say **my hobby is playing basketball** because it’s taking place now in the present, has been for some time in the past and may be in future.
I agree with Lucian Sava that > > My hobby is playing basketball? > > > is the better choice, as a statement, or a question if someone asked you. As for > > My hobby is to play basketball. > > > This wording seems to indicate a future goal, but seems strange written here. You could similarly say: > > "The...
9,612,862
I'm trying to install Forever to use with Node.js. I'm installing it using 'npm install forever -g'. It seems to install fine, but when I run the command 'forever' it's not found. Maybe I'm not installing it in the right location? Where should it be installed to? Any help would be great! Thank you!
2012/03/08
[ "https://Stackoverflow.com/questions/9612862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/245076/" ]
That should work, but check 'npm bin -g' to make sure that directory is on your path.
You have to run forever install using sudo: ``` sudo npm install forever -g ```
20,379,509
I add some gem to my gemfile. Then i type : `$ bundle install` It will install the newly add gems in general , But it install the all gems, and it very slowly. This is my terminal output: ``` Fetching gem metadata from http://rubygems.org/......... Fetching gem metadata from http://rubygems.org/.. Resolving depend...
2013/12/04
[ "https://Stackoverflow.com/questions/20379509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3060257/" ]
If you see `Using gemname (version)`, it means the gem is already installed and Bundler doesn't reinstall it.
You need to bundle install all of your gems as there are dependency requirements between them. Bundler doesn't reinstall the gem's which state `Using rake (10.1.0)`, but just confirms it's version to ensure gem dependency and prevent your application from producing runtime errors. You can find out more information her...
4,057
I recently flagged an answer which I think wasn't an answer. To my surprise, the flag was somehow declined. The screenshots below show the question and the flag declination. When flagging, I added a comment indicating why I flagged it as NAA. [In the low-quality queue](https://politics.stackexchange.com/review/low-qu...
2019/10/02
[ "https://politics.meta.stackexchange.com/questions/4057", "https://politics.meta.stackexchange.com", "https://politics.meta.stackexchange.com/users/18862/" ]
To be fair, the question was relatively low quality in itself (-2 score as of now): > > Is there a general consensus that Britain should continue to be a permanent member of the UN security council ? Other countries such as Japan or India have larger economies and/or militaries. > > > The now-deleted answer harpe...
This debate tends to repeat itself every once in a while. The gist of the problem is that when you flag an answer which apparently misinterpreted the question, there is a chance that you misinterpreted the question yourself, while the answer did not. Or that the answer, while not answering the literal question, still p...
65,217
Since I'm British, I'm used to biscuits that are crisp, dry and crunchy all the way through, with no soft chewy centre. Most chocolate chip cookie recipes are trying to do the exact opposite. How can I bake chocolate chip cookies with a more British texture? Essentially, I want the exact opposite to the answers to [thi...
2016/01/09
[ "https://cooking.stackexchange.com/questions/65217", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/9607/" ]
The best way to achieve what you are looking for is to lower the temp and lengthen the baking time. Lowering the temp will slow the edges from getting burned while the center is allowed to continue to cook. Allow the top of the cookie to brown before removing from the oven. For soft cookies, the moment it starts to tu...
It shouldn't be too hard to find a crispy chocolate chip cookie recipe if you want one, but if you're interested in experimenting with an existing recipe, here are a few ideas for things to change: Mix in **melted butter** instead of creamed soft butter. That will greatly reduce the amount of air trapped in the dough....
65,217
Since I'm British, I'm used to biscuits that are crisp, dry and crunchy all the way through, with no soft chewy centre. Most chocolate chip cookie recipes are trying to do the exact opposite. How can I bake chocolate chip cookies with a more British texture? Essentially, I want the exact opposite to the answers to [thi...
2016/01/09
[ "https://cooking.stackexchange.com/questions/65217", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/9607/" ]
The best way to achieve what you are looking for is to lower the temp and lengthen the baking time. Lowering the temp will slow the edges from getting burned while the center is allowed to continue to cook. Allow the top of the cookie to brown before removing from the oven. For soft cookies, the moment it starts to tu...
If what you want is a classic crunchy cookie with some chocolate chips thrown in, use your favorite crunchy cookie recipe and throw a few chocolate chips in. As you said yourself, the American "chocolate chip cookie" is a totally different thing, characterized by a soft texture. It makes no sense to use a recipe for th...
65,217
Since I'm British, I'm used to biscuits that are crisp, dry and crunchy all the way through, with no soft chewy centre. Most chocolate chip cookie recipes are trying to do the exact opposite. How can I bake chocolate chip cookies with a more British texture? Essentially, I want the exact opposite to the answers to [thi...
2016/01/09
[ "https://cooking.stackexchange.com/questions/65217", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/9607/" ]
The best way to achieve what you are looking for is to lower the temp and lengthen the baking time. Lowering the temp will slow the edges from getting burned while the center is allowed to continue to cook. Allow the top of the cookie to brown before removing from the oven. For soft cookies, the moment it starts to tu...
**Melted butter** (or browned butter better yet!) will make a crispy cookie. Obviously, **omitting all leaveners** will help as well, but you can get an even flatter cookie by adding **extra leavener**, which will over expand and then collapse the dough.
19,140,772
I have a query that I used pull data from several different tables each night and this pull goes into an upsert table that is loaded to our cloud server. I am trying to set some type of unique identifer/primary key for each row, but I am having issues with it. `SELECT SUBSTRING(CAST(NEWID() AS varchar(38)), 1, 16)` W...
2013/10/02
[ "https://Stackoverflow.com/questions/19140772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2839262/" ]
`NEWID()` is by design returning unique (to your computer) GUID values. Whenever you run ``` SELECT NEWID() ``` You will see a different value. It sounds like your UPSERT code needs to combine data from the source tables into a primary key that you can reliably use in future to determine if the given row needs to ...
NEWID() returns a unique value everytime it is called. It isn't the best choice for a primary key and most data professionals perfer using an int identity for the clustered, primary key if possible. In your case neither solution will work perfectly since both identities and NEWID() return new values. What you need to ...
24,475,696
my image is not appearing on my site when my page loads, in any browser. My HTML code is ``` <HTML> <img class="header-img" src="images/headerbanner.png" alt="App Image" /> </HTML> ``` The size and width of the div holding this are set in a css file. The images folder is located in the same directory as the file ma...
2014/06/29
[ "https://Stackoverflow.com/questions/24475696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2622366/" ]
PayPal will send notifications every month to your IPN Listener that should be specified and enabled in `Profile > My Selling Tools > Instant payment notifications` Every recurring payment notification will contain `txn_type=subscr_payment`
In order to get IPN's for future transactions on recurring payments profile you'll need to make sure you have IPN configured in the PayPal account profile. It will **not** continually use the original NotifyURL value.
24,475,696
my image is not appearing on my site when my page loads, in any browser. My HTML code is ``` <HTML> <img class="header-img" src="images/headerbanner.png" alt="App Image" /> </HTML> ``` The size and width of the div holding this are set in a css file. The images folder is located in the same directory as the file ma...
2014/06/29
[ "https://Stackoverflow.com/questions/24475696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2622366/" ]
PayPal will send notifications every month to your IPN Listener that should be specified and enabled in `Profile > My Selling Tools > Instant payment notifications` Every recurring payment notification will contain `txn_type=subscr_payment`
In my current testing with PayPal I see the following txn\_types; txn\_type => recurring\_payment\_profile\_created For the first time ONLY its created plus and then each recurring time, this notification for each payment cycle; txn\_type => recurring\_payment Plus as others have stated it will use the IPN URL spec...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
Integer range is: –2,147,483,648 to 2,147,483,647 You are like way above it.
It is caused because you are using `int` for storing such big number. As a result, the i [wraps](http://en.wikipedia.org/wiki/Integer_overflow) around itself, and never reaches the termination condition of the for loop. When you exceed the limit for the data types in C/C++, funny things can happen. The compile...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
This happens because the maximum value of an `int` on your architecture can never reach 10000000000. It will overflow at some point before reaching that value. Thus, the condition `i < 10000000000` will always evaluate as true, meaning this is an infinite loop. The compiler is able to deduct this at compile time, whic...
It is caused because you are using `int` for storing such big number. As a result, the i [wraps](http://en.wikipedia.org/wiki/Integer_overflow) around itself, and never reaches the termination condition of the for loop. When you exceed the limit for the data types in C/C++, funny things can happen. The compile...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
This happens because the maximum value of an `int` on your architecture can never reach 10000000000. It will overflow at some point before reaching that value. Thus, the condition `i < 10000000000` will always evaluate as true, meaning this is an infinite loop. The compiler is able to deduct this at compile time, whic...
Integer range is: –2,147,483,648 to 2,147,483,647 You are like way above it.
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
Integer range is: –2,147,483,648 to 2,147,483,647 You are like way above it.
Problem is: You can't store such a large number in "i". Look <https://en.wikipedia.org/wiki/Integer_%28computer_science%29> for more information. "i" (the variable) can't reach 10000000000, thus the loop evaluates true always and runs infinite times. You can either use a smaller number or another container for i, s...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
Integer range is: –2,147,483,648 to 2,147,483,647 You are like way above it.
If 10000000000 is outside the range of int, but inside the range of long or long long, for your compiler, then i < 10000000000 casts i to long or long long before making the comparison. Realising it will always be false, the compiler then removes the redundant comparison. I should hope there'd been some sort of compi...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
Integer range is: –2,147,483,648 to 2,147,483,647 You are like way above it.
This happens because the compiler sees that you are using a condition that can never be false, so the condition is simply never evaluated. An `int` can never hold a value that is as large as `10000000000`, so the value will always be lower than that. When the variable reaches its maximum value and you try to increase ...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
This happens because the maximum value of an `int` on your architecture can never reach 10000000000. It will overflow at some point before reaching that value. Thus, the condition `i < 10000000000` will always evaluate as true, meaning this is an infinite loop. The compiler is able to deduct this at compile time, whic...
Problem is: You can't store such a large number in "i". Look <https://en.wikipedia.org/wiki/Integer_%28computer_science%29> for more information. "i" (the variable) can't reach 10000000000, thus the loop evaluates true always and runs infinite times. You can either use a smaller number or another container for i, s...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
This happens because the maximum value of an `int` on your architecture can never reach 10000000000. It will overflow at some point before reaching that value. Thus, the condition `i < 10000000000` will always evaluate as true, meaning this is an infinite loop. The compiler is able to deduct this at compile time, whic...
If 10000000000 is outside the range of int, but inside the range of long or long long, for your compiler, then i < 10000000000 casts i to long or long long before making the comparison. Realising it will always be false, the compiler then removes the redundant comparison. I should hope there'd been some sort of compi...
21,217,886
I was running some tests to see how ++i and i++ translated to asm. I wrote a simple for : ``` int main() { int i; for(i=0;i<1000000;++i); return 0; } ``` compiled it with **gcc test.c -O0 -o test**, and checked the asm with **objdump -d test**: ``` 4004ed: 48 89 e5 mov %rsp,%rbp 4004...
2014/01/19
[ "https://Stackoverflow.com/questions/21217886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2549281/" ]
This happens because the maximum value of an `int` on your architecture can never reach 10000000000. It will overflow at some point before reaching that value. Thus, the condition `i < 10000000000` will always evaluate as true, meaning this is an infinite loop. The compiler is able to deduct this at compile time, whic...
This happens because the compiler sees that you are using a condition that can never be false, so the condition is simply never evaluated. An `int` can never hold a value that is as large as `10000000000`, so the value will always be lower than that. When the variable reaches its maximum value and you try to increase ...
64,269,724
i need to format this date on the template because comes from the database on a dictionary. I got this date displayed on my template: ``` 1996-08-22 ``` And i want to be like this: ``` 22-08-1996 ``` here is my code for it : ``` {{date['Fundação'] }} ``` I try to use with strftime but i got an error: ``` {{d...
2020/10/08
[ "https://Stackoverflow.com/questions/64269724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14067494/" ]
Do you mean something like below? ``` aggregate( cbind(value, cluster) ~ ., do.call(rbind, lapply(list.files(pattern = "*.csv"), read.csv)), sum ) ```
An option with `tidyverse` would be to read the csv files with `read_csv` from `readr`, row bind (`_dfr`), grouped by 'x', 'y' columns, get the `sum` of the numeric columns ``` library(purrr) library(readr) library(dplyr) files <- list.files(pattern = "\\.csv$") map_dfr(files, read_csv) %>% group_by(x, y) %>% ...
13,640,099
I got this error for some reason: ``` { "error": { "message": "(#4) Application request limit reached", "type": "OAuthException", "code": 4 } } ``` From my investigation, daily request limit seem to be 100m requests. The Insights -> Developer -> Activity and Errors does not update in realtime (lagg...
2012/11/30
[ "https://Stackoverflow.com/questions/13640099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60893/" ]
I have same error. I think there is a facebook bug: <https://developers.facebook.com/bugs/442544732471951?browse=search_50bc5133cf13d5c74557627> Please subscribe to this error to solve it quickly...
Quote from here: [Facebook Application Request limit reached](https://stackoverflow.com/questions/9272391/facebook-application-request-limit-reached) > > There is a limit, but it's pretty high, it should be difficult to hit unless they're using the same access tokens for all calls and not caching results, etc. **It's...
3,080
I have a post written in Microsoft Word with images, text and some formating. Is there some easy way to import this document into WordPress? Either a plugin for Word og perhaps a plugin inside WordPress? I'm looking for something simple that also converts images.
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3080", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88/" ]
There are 3 ways you can import content from Word: Paste from Word --------------- There's a button in the editor that allows you to paste content directly from Word. This removes the special formatting Word uses to lay content out on the page and will make things work well on your site. (The button is in the "Kitche...
There is a "Paste from Word" button in the editor but in my experience, it has been buggy. If you want clean code, your best bet is to just re-create your content within the editor. On the flip side, if you paste from Word, you'll end up editing and fixing its code so much that you'll have wished you just rewrote it in...
3,080
I have a post written in Microsoft Word with images, text and some formating. Is there some easy way to import this document into WordPress? Either a plugin for Word og perhaps a plugin inside WordPress? I'm looking for something simple that also converts images.
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3080", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88/" ]
There are 3 ways you can import content from Word: Paste from Word --------------- There's a button in the editor that allows you to paste content directly from Word. This removes the special formatting Word uses to lay content out on the page and will make things work well on your site. (The button is in the "Kitche...
What about when we have images and formatted content? For advance importing of documents into WordPress Editor, there is a plugin called "Document Importer by Plugmatter" which allows you to import the entire content along with it images, bold & italic words, underlines, etc. It retains all your formatting and does its...
3,378,166
I have designed a Class for Parent Child relationship ``` class Category { public string CatName; public string CatId; public IList<Category> childCategory = new List<Category>(); public void addChildCat(Category childCat) { this.childCategory.Add(childCat); } public Category S...
2010/07/31
[ "https://Stackoverflow.com/questions/3378166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922388/" ]
You can use the [SortedList](http://msdn.microsoft.com/en-us/library/system.collections.sortedlist.aspx) to keep track of the child categories instead.
If I understand this, we have a tree structure right? And what is the result you are expecting, the sorted children of the topmost parent (root)?
3,378,166
I have designed a Class for Parent Child relationship ``` class Category { public string CatName; public string CatId; public IList<Category> childCategory = new List<Category>(); public void addChildCat(Category childCat) { this.childCategory.Add(childCat); } public Category S...
2010/07/31
[ "https://Stackoverflow.com/questions/3378166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922388/" ]
You can't because you have not a reference to the parent. You have to add a field: ``` public Category Parent { get; set; } ``` and modify the add method to set the parent: ``` public void addChildCat(Category childCat) { childCat.Parent = this; this.childCategory.Add(childCat); } ``` You need the parent to g...
You can use the [SortedList](http://msdn.microsoft.com/en-us/library/system.collections.sortedlist.aspx) to keep track of the child categories instead.
3,378,166
I have designed a Class for Parent Child relationship ``` class Category { public string CatName; public string CatId; public IList<Category> childCategory = new List<Category>(); public void addChildCat(Category childCat) { this.childCategory.Add(childCat); } public Category S...
2010/07/31
[ "https://Stackoverflow.com/questions/3378166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922388/" ]
You can use the [SortedList](http://msdn.microsoft.com/en-us/library/system.collections.sortedlist.aspx) to keep track of the child categories instead.
Instead of : ``` public string CatName; public string CatId; ``` I would do: ``` class Cat { public string Name { get; set; } public string Id { get; set; } } ``` And instead of: ``` public Category SortedCategory(Category cat) { // Should return the sorted cat i.e topmost parent ...
3,378,166
I have designed a Class for Parent Child relationship ``` class Category { public string CatName; public string CatId; public IList<Category> childCategory = new List<Category>(); public void addChildCat(Category childCat) { this.childCategory.Add(childCat); } public Category S...
2010/07/31
[ "https://Stackoverflow.com/questions/3378166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922388/" ]
You can't because you have not a reference to the parent. You have to add a field: ``` public Category Parent { get; set; } ``` and modify the add method to set the parent: ``` public void addChildCat(Category childCat) { childCat.Parent = this; this.childCategory.Add(childCat); } ``` You need the parent to g...
If I understand this, we have a tree structure right? And what is the result you are expecting, the sorted children of the topmost parent (root)?
3,378,166
I have designed a Class for Parent Child relationship ``` class Category { public string CatName; public string CatId; public IList<Category> childCategory = new List<Category>(); public void addChildCat(Category childCat) { this.childCategory.Add(childCat); } public Category S...
2010/07/31
[ "https://Stackoverflow.com/questions/3378166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922388/" ]
You can't because you have not a reference to the parent. You have to add a field: ``` public Category Parent { get; set; } ``` and modify the add method to set the parent: ``` public void addChildCat(Category childCat) { childCat.Parent = this; this.childCategory.Add(childCat); } ``` You need the parent to g...
Instead of : ``` public string CatName; public string CatId; ``` I would do: ``` class Cat { public string Name { get; set; } public string Id { get; set; } } ``` And instead of: ``` public Category SortedCategory(Category cat) { // Should return the sorted cat i.e topmost parent ...
64,522,740
I read a lot about switchmap and its purpose but I did not see a lot of examples when it comes to subscribing to the new data. So I use a nested subscription in my Angular project and I wanted to ask you how to use switchmap properly in my example to understand the concept better. Here my nested subscription: ``` thi...
2020/10/25
[ "https://Stackoverflow.com/questions/64522740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14306879/" ]
There are multiple things to notice here 1. Looks like the outer observable `this.sharedSrv.postDetail` and `this.userSrv.getUserAsObservable()` are unrelated. In that case you could also use RxJS `forkJoin` to trigger the observables in parallel. Since you've asked for `switchMap`, you could try the following ```js ...
Looks like what you want: ``` this.sharedSrv.postDetail.pipe( switchMap(post => { if (post) { this.hasPost = true; this.post = post; } console.log(post); this.viewedMainComment = null; this.viewedSubComments = []; return this.userSrv.getUserAsObservable(); }), swtichMap(user =...
64,522,740
I read a lot about switchmap and its purpose but I did not see a lot of examples when it comes to subscribing to the new data. So I use a nested subscription in my Angular project and I wanted to ask you how to use switchmap properly in my example to understand the concept better. Here my nested subscription: ``` thi...
2020/10/25
[ "https://Stackoverflow.com/questions/64522740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14306879/" ]
There are multiple things to notice here 1. Looks like the outer observable `this.sharedSrv.postDetail` and `this.userSrv.getUserAsObservable()` are unrelated. In that case you could also use RxJS `forkJoin` to trigger the observables in parallel. Since you've asked for `switchMap`, you could try the following ```js ...
To transform `Observables` you need to use `piping` i.e call the `pipe()` method on the observable and pass in the an `rxjs` transformation operator Example we can transform your code to ```typescript this.sharedSrv.postDetail.pipe( switchMap(post => { if(post) { this.hasPost = true; this.post = po...
17,614,720
I read an [interesting post](http://csswizardry.com/2013/05/hashed-classes-in-css/) on using a css classname instead of the id attribute for identifying modules or widgets. The css classname could be prefixed with a hash or underscore, to indicate that the classname is used as an id. The reason for this being, that ids...
2013/07/12
[ "https://Stackoverflow.com/questions/17614720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/315260/" ]
It doesn't get simpler than this: **does it uniquely identify an element within a document tree now and forever? Use an ID. If not, use a class name.** Remember that IDs and classes are properties pertaining to *each element*, not a group of elements collectively. Using "identifier" to mean "identifying a *group* of e...
Its mostly driven by your own, personal taste. there are a lot of opinions and articles on this topic, even complete books were written. I suggest the following: [SMACSS](http://smacss.com/) [OOCSS](http://oocss.org/) [MVCSS](http://mvcss.github.io/styleguide/naming/) All of them are mentioning a more-or-les...
17,614,720
I read an [interesting post](http://csswizardry.com/2013/05/hashed-classes-in-css/) on using a css classname instead of the id attribute for identifying modules or widgets. The css classname could be prefixed with a hash or underscore, to indicate that the classname is used as an id. The reason for this being, that ids...
2013/07/12
[ "https://Stackoverflow.com/questions/17614720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/315260/" ]
It doesn't get simpler than this: **does it uniquely identify an element within a document tree now and forever? Use an ID. If not, use a class name.** Remember that IDs and classes are properties pertaining to *each element*, not a group of elements collectively. Using "identifier" to mean "identifying a *group* of e...
Not sure what your modules or widgets are for (wordpress?) but the methodology I choose to use when coding is this: 1: If it is DOM element that has a specific function that I know will only appear once on the page, then I use an ID (things like #main\_navigation, #global\_header). 2: The DOM element is used for styl...
29,609,845
I am working on Jasper Report. I need to ask from a user where to save the generated report. For that, I need to open a "Save As" dialog box. I tried it using `JFileChooser` and `FileDialog`. But, during execution of my code, when execution reaches the point where the code for the Save As dialog box is written, the c...
2015/04/13
[ "https://Stackoverflow.com/questions/29609845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4783729/" ]
It works now. You just need delete playSound() from onCreate() and put it to onResume() since onResume() is always called before Activity get to the foreground. Reference: <http://developer.android.com/reference/android/app/Activity.html>
`04-13 14:55:29.934 32338 32338 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.PowerManager$WakeLock.isHeld()' on a null object reference` If you read carefully here you can see that the problem is on `isHeld()` Just add a check on your `wl` just like...
29,609,845
I am working on Jasper Report. I need to ask from a user where to save the generated report. For that, I need to open a "Save As" dialog box. I tried it using `JFileChooser` and `FileDialog`. But, during execution of my code, when execution reaches the point where the code for the Save As dialog box is written, the c...
2015/04/13
[ "https://Stackoverflow.com/questions/29609845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4783729/" ]
It works now. You just need delete playSound() from onCreate() and put it to onResume() since onResume() is always called before Activity get to the foreground. Reference: <http://developer.android.com/reference/android/app/Activity.html>
Quick answer: ``` if (mediaPlayer != null && mediaPlayer.isPlaying()) { //stop music mediaPlayer.stop(); mediaPlayer.reset(); } ```
55,749,867
I have two classes. I want to access `type` property of Parent from instance: ```js // Parent class function Animal() { this.type = 'animal' } // Child class function Rabbit(name) { this.name = name } // I inherit from Animal Rabbit.prototype = Object.create(Animal.prototype); Rabbit.prototype.constructor = Rabbit; ...
2019/04/18
[ "https://Stackoverflow.com/questions/55749867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114926/" ]
Try this: ``` your_find_command | tail -n 1 ```
There could be multiple ways to achieve this - **Using the 'tail' command** (as suggested by @Roadowl) find branches -name alex\* | tail -n1 **Using the 'awk' command** find branches -name alex\* | awk 'END{print}' **Using the 'sed' command** find branches -name alex\* | sed -e '$!d' Other possible options are ...
55,749,867
I have two classes. I want to access `type` property of Parent from instance: ```js // Parent class function Animal() { this.type = 'animal' } // Child class function Rabbit(name) { this.name = name } // I inherit from Animal Rabbit.prototype = Object.create(Animal.prototype); Rabbit.prototype.constructor = Rabbit; ...
2019/04/18
[ "https://Stackoverflow.com/questions/55749867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114926/" ]
Try this: ``` your_find_command | tail -n 1 ```
Since you want the file name sorted by the highest version, you can try as follows ``` $ ls alex20_0 alex20_1 alex20_2 alex20_3 $ find . -iname "*alex*" -print | sort | tail -n 1 ./alex20_3 ```
55,749,867
I have two classes. I want to access `type` property of Parent from instance: ```js // Parent class function Animal() { this.type = 'animal' } // Child class function Rabbit(name) { this.name = name } // I inherit from Animal Rabbit.prototype = Object.create(Animal.prototype); Rabbit.prototype.constructor = Rabbit; ...
2019/04/18
[ "https://Stackoverflow.com/questions/55749867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114926/" ]
Try this: ``` your_find_command | tail -n 1 ```
`find` can list your files in any order. To extract the latest version you have to sort the output of `find`. The safest way to do this is ``` find . -maxdepth 1 -name "string" -print0 | sort -zV | tail -zn1 ``` If your implementation of `sort` or `tail` does not support `-z` and you are sure that the filenames are ...
55,749,867
I have two classes. I want to access `type` property of Parent from instance: ```js // Parent class function Animal() { this.type = 'animal' } // Child class function Rabbit(name) { this.name = name } // I inherit from Animal Rabbit.prototype = Object.create(Animal.prototype); Rabbit.prototype.constructor = Rabbit; ...
2019/04/18
[ "https://Stackoverflow.com/questions/55749867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114926/" ]
`find` can list your files in any order. To extract the latest version you have to sort the output of `find`. The safest way to do this is ``` find . -maxdepth 1 -name "string" -print0 | sort -zV | tail -zn1 ``` If your implementation of `sort` or `tail` does not support `-z` and you are sure that the filenames are ...
There could be multiple ways to achieve this - **Using the 'tail' command** (as suggested by @Roadowl) find branches -name alex\* | tail -n1 **Using the 'awk' command** find branches -name alex\* | awk 'END{print}' **Using the 'sed' command** find branches -name alex\* | sed -e '$!d' Other possible options are ...
55,749,867
I have two classes. I want to access `type` property of Parent from instance: ```js // Parent class function Animal() { this.type = 'animal' } // Child class function Rabbit(name) { this.name = name } // I inherit from Animal Rabbit.prototype = Object.create(Animal.prototype); Rabbit.prototype.constructor = Rabbit; ...
2019/04/18
[ "https://Stackoverflow.com/questions/55749867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114926/" ]
`find` can list your files in any order. To extract the latest version you have to sort the output of `find`. The safest way to do this is ``` find . -maxdepth 1 -name "string" -print0 | sort -zV | tail -zn1 ``` If your implementation of `sort` or `tail` does not support `-z` and you are sure that the filenames are ...
Since you want the file name sorted by the highest version, you can try as follows ``` $ ls alex20_0 alex20_1 alex20_2 alex20_3 $ find . -iname "*alex*" -print | sort | tail -n 1 ./alex20_3 ```
33,468,687
I need to seperate the inputs of the address, zip and city. Now I would like to know how I can gelocate. At the Google Devleloper [documentation](https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple) there is only one input field. Does anybody know how I can geolocate with three input f...
2015/11/01
[ "https://Stackoverflow.com/questions/33468687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4944595/" ]
you just need to use the same function to change the colour back to the original(or a new colour) ``` $pdf->SetFont($pdfFont, 'B', 10); $pdf->SetFillColor(59,78,135); $pdf->SetTextColor(0,0,0); $pdf->Cell(50, 6, strtoupper(Lang::trans('supportticketsclient')), 0, 1, 'L', true); $pdf->SetTextColor(255,255,255);//change...
I have the same problem on changing the text in a cell to Upper-Case.. What I did was convert it on my query ``` $appName = $row['appFname']." ".$row['appMname']. " ".$row['appLname']; $appNameUPPER = strtoupper($appName); ``` then I used that variable on my cell ``` $pdf->Cell(179,26,''.$appNameUPPER.'', 'B','', ...
29,829,279
I have this error: > > The specified child already has a parent. You must call removeView() > on the child's parent first. > > > When I clicked `buildNot.setPosiviteButton`. Help me please, thanks guys! This is my Java source code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(...
2015/04/23
[ "https://Stackoverflow.com/questions/29829279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4784098/" ]
Use extended regex flag in grep. For example: ``` grep -E abc_source.?_201501.csv ``` would source out both lines in your example. You can think of other regex patterns that would suit your data more.
You can use Bash [globbing](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm) to grep in several files at once. For example, to grep for the string "hello" in all files with a filename that starts with abc\_source and ends with 201501.csv, issue this command: ``` grep hello abc_source*201501.csv ``` You ...
29,829,279
I have this error: > > The specified child already has a parent. You must call removeView() > on the child's parent first. > > > When I clicked `buildNot.setPosiviteButton`. Help me please, thanks guys! This is my Java source code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(...
2015/04/23
[ "https://Stackoverflow.com/questions/29829279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4784098/" ]
Use extended regex flag in grep. For example: ``` grep -E abc_source.?_201501.csv ``` would source out both lines in your example. You can think of other regex patterns that would suit your data more.
If you are asking about patterns for file name matching in the shell, the [extended globbing](http://mywiki.wooledge.org/glob#extglob) facility in Bash lets you say ``` shopt -s extglob grep stuff abc_source@(|2)_201501.csv ``` to search through both files with a single glob expression.
29,829,279
I have this error: > > The specified child already has a parent. You must call removeView() > on the child's parent first. > > > When I clicked `buildNot.setPosiviteButton`. Help me please, thanks guys! This is my Java source code: ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(...
2015/04/23
[ "https://Stackoverflow.com/questions/29829279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4784098/" ]
Use extended regex flag in grep. For example: ``` grep -E abc_source.?_201501.csv ``` would source out both lines in your example. You can think of other regex patterns that would suit your data more.
The simplest possibility is to use brace expansion: ``` grep pattern abc_{source,source2}_201501.csv ``` That's exactly the same as: ``` grep pattern abc_source{,2}_201501.csv ``` You can use several brace patterns in a single word: ``` grep pattern abc_source{,2}_2015{01..04}.csv ``` expands to ``` grep patt...
7,452,489
I love an Emacs feature to copy selection to clipboard automatically. Is it possible to do the same on Eclipse? Environment: Windows XP, Helios
2011/09/17
[ "https://Stackoverflow.com/questions/7452489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/949869/" ]
To copy a String from Eclipse to the clipboard, you can use ``` void copyToClipboard (String toClipboard, Display display){ String toClipboard = "my String"; Clipboard clipboard = new Clipboard(display); TextTransfer [] textTransfer = {TextTransfer.getInstance()}; clipboard.setContents(new Object [] {...
You can try this [plugin](https://github.com/chandrayya/chandrayya-eclipse-plugins). Along with auto copy points mentioned in [Eclipse show number of lines and/or file size](https://stackoverflow.com/questions/26390560/eclipse-show-number-of-lines-and-or-file-size) also addressed.
8,035,876
I am currently developing a game for iPad & iPhone using Cocos2d with Box2d. It would have been majorly cool to achieve a lighting effect like the one in this video: <http://www.youtube.com/watch?v=Elnpm-gNI04> and on this link: <http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows...
2011/11/07
[ "https://Stackoverflow.com/questions/8035876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/685523/" ]
<http://code.google.com/p/box2dlights/> I have succesfully made dynamic light library that use box2d geometry and rayCasting. My library work under gles1.0 and gles2.0 and use libgdx as framework. This is peformant enough for giving dynamic real time lights to 2d games for mobile devices. I can help with porting that t...
Try to look at this link. <http://www.cocos2d-iphone.org/forum/topic/27856> He successfully added simple dynamic light using cocos2d + chipmunk following the technique that Catalin Zima used. Please note if you download his project and try to compile iOS build, then remove "Run Script" build phase as you may experien...
36,573,269
I would like to add a div to my current website. The div i would like to add should show some json data using angularjs. My problem is that it does not look like angularjs is working like its supose to when adding html after the page is rendered. Here is my test: ``` <html > <head> <meta charset="utf-8"> ...
2016/04/12
[ "https://Stackoverflow.com/questions/36573269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6193253/" ]
You are missing two semicolons in ``` $scope.firstName = "John"; $scope.lastName = "Doe"; ``` If you load the Angular script it looks for ng-app and bootstraps itself. Since you add Angular specific code after the script is loaded, you need to bootstrap Angular manually with: ``` //after initAngularDataFeatureInfo(...
Try using Angular directives. you can create a customer directive which will then feed a template of your liking
2,125,105
I'm trying to make modal window for my website, I have a problem with overlay or modal div I'm not sure what is the problem. The thing is everything except modal window shouldn't be clickable, but for some reason my navigation `<ul><li>` tags are visible and clickable. Here is css of my modal window : ``` element.st...
2010/01/23
[ "https://Stackoverflow.com/questions/2125105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190623/" ]
Check the `z-index` property of your `li` tags (or the underlying `ul`) and either set it below 100, or set the z-index of your modal window and overlay so it's higher than that of the `li`s.
It appears you have the values of your z-index backwards. The higher the number, the closer it is. Your background is set to 105 but the elements on top are set to 100.
634,504
Note: I am not talking about a circuit breaker where a spring is used to counter the repulsive force generated by current passing through a small contact area. This question is about switches designed for high currents (kA to MA range). The current pulse is DC, rising from zero to peak in milliseconds upon closing the...
2022/09/12
[ "https://electronics.stackexchange.com/questions/634504", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/321749/" ]
I will give you a small introduction to the way of thinking for high current, I have small experience from high voltage applications. essentially a switch has to be able to completely stop the current and not be destroyed in the process or damage other components, so avoiding spikes and other phenomena as best you can...
The spring does two things: 1. reduces the risk of bouncing when closing - as that can cause arcs to damage the contacts, 2. the cam and spring combine to open the contacts quickly again due to the issue of arcing. So design of switches is very complicated and you can research further but this gives you an idea.
340,432
I'm stuck trying to do the remote SSH with WP-CLI. I have installed WP-CLI on my **Webfaction server** and tested it's working ``` # This is in server $ wp --info OS: Linux web561.webfaction.com 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 Shell: /bin/bash PHP binary: /usr/local/bi...
2019/06/13
[ "https://wordpress.stackexchange.com/questions/340432", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33361/" ]
Found a solution here <https://github.com/hrsetyono/wordpress/wiki/WP-CLI-on-Webfaction> . This seems to be Webfaction specific issue You simply need to open FTP and append this line in `/home/yourname/.bashrc` ``` export PATH=$PATH:$HOME/bin ```
I know this might be trivial, - but it was my solution. I simply hadn't installed WP-CLI on my machine. So I followed the install instructions here: [wp-cli](https://wp-cli.org/) - and then it worked for me.
23,426,305
I have a very strange behaviour of "not()" css selector. Here my simplified code: ``` <div id="mapDiv" class="mapDiv mapDiv1"> pippo <div class="gm-style">pluto</div> </div> <div id="mapDiv2" class="mapDiv mapDiv2"> pippo <div class="gm-style">pluto</div> </div> ``` and my css: ``` .mapDiv1,.mapDi...
2014/05/02
[ "https://Stackoverflow.com/questions/23426305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2384685/" ]
If you use MAMP, It's because of XCache. Please try to disable it in the MAMP preference.
It may be solved by updating yii2 framework. `yii.db.Query` uses `yii.db.QueryTrait` in which `indexBy` method is implemented. Please compare your `Query.php`, `QueryTrait.php` and `QueryInterface.php` with <https://github.com/yiisoft/yii2/blob/master/framework/db/Query.php> <https://github.com/yiisoft/yii2/blob/m...
11,740,788
I have created a custom `CursorAdapter` which binds some view items (a `TextView` and a `RatingBar`) in a `ListView` to some columns in a `SQL` `database` via `bindView()`, i.e: ``` public class MyCursorAdapter extends CursorAdapter { ... public void bindView(View view, Context context, final Cursor cursor) {...
2012/07/31
[ "https://Stackoverflow.com/questions/11740788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356869/" ]
The association between Booking and Personal can be map as a [unidirectional many-to-one association](http://docs.jboss.org/hibernate/core/3.3/reference/en/html/associations.html#assoc-intro). Use [property-ref](http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/mapping.html#mapping-declaration-manytoone) attri...
how about using HQL to get list of that table objects ? TO get mapped objects, there must be FKs defined isn't it, otherwise how hibernate will be able to map columns ?
62,784,643
hello community I have a problem putting a `bind-value` and an `onchange` shows me the following error: ``` The attribute 'onchange' is used two or more times for this element. Attributes must be unique (case-insensitive). The attribute 'onchange' is used by the '@bind' directive attribute. ``` this is my `input che...
2020/07/07
[ "https://Stackoverflow.com/questions/62784643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11406791/" ]
First off, you usually don't bind to the value attribute. It remains fixed, and when present, and within a form element, it is passed as form data to the server. What you want is the checked attribute, like the code snippet below demonstrates: ``` <input type="checkbox" checked="@selected" @onchange="@((args)...
You can't. But you can set `checked=ProveedorEstadoCarrito.Cotizacion.Aceptada` to update the state of the checkbox, and for the `@onchange` event do `@onchange=CheckChanged` and in that method you can set `ProveedorEstadoCarrito.Cotizacion.Aceptada = (bool) ev.Value;`
3,045,913
Just started playing with the new AIR functions NetworkInfo and NetworkInterface, but can't build ... This is the example I started from: [tourdeflex](http://tourdeflex.adobe.com/AIR2samples/NetworkInfo/networkinfo.html) But these lines cause errors: ``` var networkInfo:NetworkInfo = NetworkInfo.networkInfo; var net...
2010/06/15
[ "https://Stackoverflow.com/questions/3045913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/278949/" ]
Due to the [Same Origin Policy](http://en.wikipedia.org/wiki/Same_origin_policy), you will need to modify your AJAX to use JSONP instead of JSON. Check out the [jQuery Cross-Domain Ajax Guide](http://usejquery.com/posts/9/the-jquery-cross-domain-ajax-guide).
Pointy is correct, but to solve this you need to expose an endpoint that is callable from outside the application. I suggest you take a look at creating JSON web services using WCF.
173,686
I'm trying to solve nonlinear equations using Newton-type methods with very high accuracy using Mathematica. I found many research papers in which the numerical results are calculated with very high accuracy. e.g. To solve the equation $$e^{-x}+\sin(x)-2=0\text{ with initial guess }x\_0=-1.$$ Many authors evaluated it...
2018/05/19
[ "https://mathematica.stackexchange.com/questions/173686", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/43942/" ]
Try ``` FindRoot[Exp[-x] + Sin[x] - 2 == 0, {x, -1}, WorkingPrecision -> 500] ```
You could also use [`Solve`](http://reference.wolfram.com/language/ref/Solve) as long as you provide a domain restriction: ``` root = x /. First @ Solve[Exp[-x]+Sin[x]-2==0 && -2<x<0] ``` > > Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}] > > > The nice thing about the [`Root`](http://reference.wo...
28,873,161
I push in values from JSON into a several arrays using Underscore, but I want to eliminate any repeated values if there are any, either during push or after. How could I do this? **JSON** ``` looks = [{ "id": "look1", "products": ["hbeu50271385", "hbeu50274296", "hbeu50272359", "hbeu50272802"] }, ...
2015/03/05
[ "https://Stackoverflow.com/questions/28873161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1937021/" ]
There are couple ways 1.Use [\_.uniq](http://underscorejs.org/#uniq) ``` _.uniq(productArray); ``` 2.Use [\_.indexOf](http://underscorejs.org/#indexOf) before `push` to `productArray` [Example](http://jsbin.com/gezaza/1/edit?js,console)
For array's content be unique, how about using \_.uniq? Or just check existence of value before really push it. ``` function uniquePush(arr, valueToPush) { if(arr.indexOf(valueToPush) == -1) { arr.push(valueToPush) } } ```
5,667,802
How can I know the IP address of my iPhone simulator?
2011/04/14
[ "https://Stackoverflow.com/questions/5667802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/418029/" ]
It will have the same IP addresses as the computer you’re running it on.
Jep, like Todd said, the same as your machines IP. You can also simply visit <http://www.whatismyip.com> with mobile Safari or your Mac's web browser ;-)
5,667,802
How can I know the IP address of my iPhone simulator?
2011/04/14
[ "https://Stackoverflow.com/questions/5667802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/418029/" ]
It will have the same IP addresses as the computer you’re running it on.
I think the by visiting the website <http://www.test-ipv6.com/> is also a good choice. As the site tells you both the ipv4 and ipv6 global-unicast address