qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
25,403,082
Got a table in SQL Server which contains a `varchar` column with date data. Unfortunately the dates are in a whole slew of different formats. ``` 2012-05-01 27/05/2012 07MAY2014 19/07/13 ``` There may be others, but that's all I've encountered so far. I need to squeeze these into a `datetime` column into anothe...
2014/08/20
[ "https://Stackoverflow.com/questions/25403082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/271907/" ]
In SQL Server 2012, you could use `try_convert()`. Otherwise, you could multiple updates: ``` UPDATE myTable SET myDateColumn = CONVERT(DATETIME, myDateColumn, 103) WHERE ISDATE(myDateColumn) = 0 AND MyDateColumn like '[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]'; UPDATE myTable SET myDateColumn = CONVER...
For this first you can convert all the data into another format such as `110` the `USA date fromat`, and then further again update the whole table with the desired format.
25,403,082
Got a table in SQL Server which contains a `varchar` column with date data. Unfortunately the dates are in a whole slew of different formats. ``` 2012-05-01 27/05/2012 07MAY2014 19/07/13 ``` There may be others, but that's all I've encountered so far. I need to squeeze these into a `datetime` column into anothe...
2014/08/20
[ "https://Stackoverflow.com/questions/25403082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/271907/" ]
This is totally horrid, but it works with your example: ``` DECLARE @DodgyDates TABLE ( DateString VARCHAR(50)); INSERT INTO @DodgyDates VALUES ('2012-05-01'); INSERT INTO @DodgyDates VALUES ('27/05/2012'); INSERT INTO @DodgyDates VALUES ('07MAY2014'); INSERT INTO @DodgyDates VALUES ('19/07/13'); SELECT * FROM @D...
For this first you can convert all the data into another format such as `110` the `USA date fromat`, and then further again update the whole table with the desired format.
25,403,082
Got a table in SQL Server which contains a `varchar` column with date data. Unfortunately the dates are in a whole slew of different formats. ``` 2012-05-01 27/05/2012 07MAY2014 19/07/13 ``` There may be others, but that's all I've encountered so far. I need to squeeze these into a `datetime` column into anothe...
2014/08/20
[ "https://Stackoverflow.com/questions/25403082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/271907/" ]
My guess is that you just have to try to differentiate between the different classes and handle each case in the appropriate way. Something like this: ``` declare @tab table (d varchar(20)) insert @tab values ('2012-05-01'),('27/05/2012'),('07MAY2014'),('19/07/13') select case when isnumeric(left(d,4)) ...
In SQL Server 2012, you could use `try_convert()`. Otherwise, you could multiple updates: ``` UPDATE myTable SET myDateColumn = CONVERT(DATETIME, myDateColumn, 103) WHERE ISDATE(myDateColumn) = 0 AND MyDateColumn like '[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]'; UPDATE myTable SET myDateColumn = CONVER...
25,403,082
Got a table in SQL Server which contains a `varchar` column with date data. Unfortunately the dates are in a whole slew of different formats. ``` 2012-05-01 27/05/2012 07MAY2014 19/07/13 ``` There may be others, but that's all I've encountered so far. I need to squeeze these into a `datetime` column into anothe...
2014/08/20
[ "https://Stackoverflow.com/questions/25403082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/271907/" ]
My guess is that you just have to try to differentiate between the different classes and handle each case in the appropriate way. Something like this: ``` declare @tab table (d varchar(20)) insert @tab values ('2012-05-01'),('27/05/2012'),('07MAY2014'),('19/07/13') select case when isnumeric(left(d,4)) ...
This is totally horrid, but it works with your example: ``` DECLARE @DodgyDates TABLE ( DateString VARCHAR(50)); INSERT INTO @DodgyDates VALUES ('2012-05-01'); INSERT INTO @DodgyDates VALUES ('27/05/2012'); INSERT INTO @DodgyDates VALUES ('07MAY2014'); INSERT INTO @DodgyDates VALUES ('19/07/13'); SELECT * FROM @D...
25,403,082
Got a table in SQL Server which contains a `varchar` column with date data. Unfortunately the dates are in a whole slew of different formats. ``` 2012-05-01 27/05/2012 07MAY2014 19/07/13 ``` There may be others, but that's all I've encountered so far. I need to squeeze these into a `datetime` column into anothe...
2014/08/20
[ "https://Stackoverflow.com/questions/25403082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/271907/" ]
This is totally horrid, but it works with your example: ``` DECLARE @DodgyDates TABLE ( DateString VARCHAR(50)); INSERT INTO @DodgyDates VALUES ('2012-05-01'); INSERT INTO @DodgyDates VALUES ('27/05/2012'); INSERT INTO @DodgyDates VALUES ('07MAY2014'); INSERT INTO @DodgyDates VALUES ('19/07/13'); SELECT * FROM @D...
In SQL Server 2012, you could use `try_convert()`. Otherwise, you could multiple updates: ``` UPDATE myTable SET myDateColumn = CONVERT(DATETIME, myDateColumn, 103) WHERE ISDATE(myDateColumn) = 0 AND MyDateColumn like '[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]'; UPDATE myTable SET myDateColumn = CONVER...
381,823
I designed a device on which there is a HUB, FT232 , two external USB port and some periphery. I wanted to check the noise on the power bus. And I saw only white noise. [![enter image description here](https://i.stack.imgur.com/tFYGt.png)](https://i.stack.imgur.com/tFYGt.png) But after I connect the USB cable, I see ...
2018/06/26
[ "https://electronics.stackexchange.com/questions/381823", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/113405/" ]
This doesn't work because the current thru the touch sensor is small and the gain of the transistor isn't large enough to amplify it to what the relay needs. You haven't provided any specs on the relay, so I'll just make up numbers for sake of example. Let's say the relay needs 30 mA at 9 V to operate. You haven't pro...
Another way to build this circuit is with a MOSFET. It can be used in these applications because it requires almost no current to switch on and off. The gate of a MOSFET is like a capacitor; when it charges it allows current to flow. When you place your finger across the contacts, the gate charges and allows current to...
381,823
I designed a device on which there is a HUB, FT232 , two external USB port and some periphery. I wanted to check the noise on the power bus. And I saw only white noise. [![enter image description here](https://i.stack.imgur.com/tFYGt.png)](https://i.stack.imgur.com/tFYGt.png) But after I connect the USB cable, I see ...
2018/06/26
[ "https://electronics.stackexchange.com/questions/381823", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/113405/" ]
This doesn't work because the current thru the touch sensor is small and the gain of the transistor isn't large enough to amplify it to what the relay needs. You haven't provided any specs on the relay, so I'll just make up numbers for sake of example. Let's say the relay needs 30 mA at 9 V to operate. You haven't pro...
Tray to use a darlington transistor and you got a good result [![enter image description here](https://i.stack.imgur.com/XWfnG.png)](https://i.stack.imgur.com/XWfnG.png) Because the B (amplification) is the product of the two transistor: B1 X B2 =B if B1=b2=100 you got B=10000 and tray to use a small relay of 6v (l...
381,823
I designed a device on which there is a HUB, FT232 , two external USB port and some periphery. I wanted to check the noise on the power bus. And I saw only white noise. [![enter image description here](https://i.stack.imgur.com/tFYGt.png)](https://i.stack.imgur.com/tFYGt.png) But after I connect the USB cable, I see ...
2018/06/26
[ "https://electronics.stackexchange.com/questions/381823", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/113405/" ]
Another way to build this circuit is with a MOSFET. It can be used in these applications because it requires almost no current to switch on and off. The gate of a MOSFET is like a capacitor; when it charges it allows current to flow. When you place your finger across the contacts, the gate charges and allows current to...
Tray to use a darlington transistor and you got a good result [![enter image description here](https://i.stack.imgur.com/XWfnG.png)](https://i.stack.imgur.com/XWfnG.png) Because the B (amplification) is the product of the two transistor: B1 X B2 =B if B1=b2=100 you got B=10000 and tray to use a small relay of 6v (l...
57,277,248
I have a function: ``` public static async Task DoSomthing(string str1, int num1, bool bool1) { //Do something.... (This function will not return any value) } ``` I want to overload this function so it can be called with other arguments, but this function will basically call the function above. ...
2019/07/30
[ "https://Stackoverflow.com/questions/57277248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760983/" ]
It will be executed almost in the same way but for the one with await it will add some overhead because the compiler will create a state machine. Compiler creates state machine for methods with async-await keywords so when the control flow reaches `await` it is returned to the calling method. The execution of async me...
You can do option 1 because you only want to return the task witch it's passing. Personally I prefer to read in the Taskname Async like DoSomthingAsync you you always know what's async and what's sync ``` public static Task DoSomethingAsync(CustomObject obj) // or set the ConfigureAwait to true when you need stu...
13,599,638
Probably a silly question, but in python is there a simple way to automatically pad a number with zeros to a fixed length? I wasn't able to find this in the python docs, but I may not have been looking hard enough? e.i. I want bin(4) to return 00100, rather than just 100. Is there a simple way to ensure the output will...
2012/11/28
[ "https://Stackoverflow.com/questions/13599638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1287834/" ]
Strings have a `.zfill()` method to pad it with zeros: ``` >>> '100'.zfill(5) '00100' ``` For binary numbers however, I'd use string formatting: ``` >>> '{0:05b}'.format(4) '00100' ``` The `:05b` formatting specification formats the number passed in as binary, with 5 digits, zero padded. See the [Python format st...
try this... ``` In [11]: x = 1 In [12]: print str(x).zfill(5) 00001 In [13]: bin(4) Out[13]: '0b100' In [14]: str(bin(4)[2:]).zfill(5) Out[14]: '00100' ```
13,599,638
Probably a silly question, but in python is there a simple way to automatically pad a number with zeros to a fixed length? I wasn't able to find this in the python docs, but I may not have been looking hard enough? e.i. I want bin(4) to return 00100, rather than just 100. Is there a simple way to ensure the output will...
2012/11/28
[ "https://Stackoverflow.com/questions/13599638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1287834/" ]
Strings have a `.zfill()` method to pad it with zeros: ``` >>> '100'.zfill(5) '00100' ``` For binary numbers however, I'd use string formatting: ``` >>> '{0:05b}'.format(4) '00100' ``` The `:05b` formatting specification formats the number passed in as binary, with 5 digits, zero padded. See the [Python format st...
This is a job for the [*format*](http://docs.python.org/2.7/library/functions.html#format) built-in function: ``` >>> format(4, '05b') '00100' ```
8,292,313
I'm trying to convert this C code to C#, is there a C# equivalent to the C union typedef? ``` struct sockaddr_in { short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; typedef struct in_addr { union { struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; ...
2011/11/28
[ "https://Stackoverflow.com/questions/8292313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1068804/" ]
You may check out the [following page](http://pinvoke.net/default.aspx/Structures/SOCKADDR.html). This being said, in .NET you have classes that allows you to work directly with sockets and TCP/IP such as Socket, TcpListener, TcpClient and you don't need to translate C code blindly.
Whilst the others definitely have a point - this is likely something you *really* don't need to do - there **is** a way to simulate unions in C# using [StructLayoutAttribute](http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.structlayoutattribute.aspx) (example of simulating a union [here](http://m...
56,662
I purchased my house (3 bedrooms, 2 full baths) in 1997 for $84,500. I have already made $166,500 of mortgage payments on a 9% interest rate loan. I have $53,000 left in payments. It recently appraised for approx. $71,000. I have made two unsuccessful attempts to refinance (but that’s a different story). I am looking...
2015/12/04
[ "https://money.stackexchange.com/questions/56662", "https://money.stackexchange.com", "https://money.stackexchange.com/users/35490/" ]
If it were me, I'd be debt free today, Monday, at latest. 100K-(53K+31.2K) = 15.8K would be my bank balance by this afternoon. I am not sure why you would count 6K of your daughter's money as yours to use. Either it is her money, or yours, not both. If you still want debt, which I think is silly, you might try to ref...
9% would be an absurdly high rate in the US by today's standards, so you should at the very least consider refinancing to fix that. Paying off completely is of course another way to fix that. Which approach makes more sense depends on what you plan to do with the money instead if you do refinance -- if you can put i...
56,662
I purchased my house (3 bedrooms, 2 full baths) in 1997 for $84,500. I have already made $166,500 of mortgage payments on a 9% interest rate loan. I have $53,000 left in payments. It recently appraised for approx. $71,000. I have made two unsuccessful attempts to refinance (but that’s a different story). I am looking...
2015/12/04
[ "https://money.stackexchange.com/questions/56662", "https://money.stackexchange.com", "https://money.stackexchange.com/users/35490/" ]
If it were me, I'd be debt free today, Monday, at latest. 100K-(53K+31.2K) = 15.8K would be my bank balance by this afternoon. I am not sure why you would count 6K of your daughter's money as yours to use. Either it is her money, or yours, not both. If you still want debt, which I think is silly, you might try to ref...
If you get a mortgage on the new property, you can almost surely get better than 9% today. I refinanced my house a year or so ago at 4%. You didn't say how much the new house will cost or how much of your cash you're willing to put to it, but just to make up a number say the house costs $200,000 and you'll pay $100,0...
56,662
I purchased my house (3 bedrooms, 2 full baths) in 1997 for $84,500. I have already made $166,500 of mortgage payments on a 9% interest rate loan. I have $53,000 left in payments. It recently appraised for approx. $71,000. I have made two unsuccessful attempts to refinance (but that’s a different story). I am looking...
2015/12/04
[ "https://money.stackexchange.com/questions/56662", "https://money.stackexchange.com", "https://money.stackexchange.com/users/35490/" ]
If it were me, I'd be debt free today, Monday, at latest. 100K-(53K+31.2K) = 15.8K would be my bank balance by this afternoon. I am not sure why you would count 6K of your daughter's money as yours to use. Either it is her money, or yours, not both. If you still want debt, which I think is silly, you might try to ref...
You owe only $38,860 to pay off your loan now, possibly less. From what you say about your loan, tell me if I got this right: `30 year loan $75,780 original loan amount 9% annual interest rate $609.74 monthly payment You have made 272 payments Payment number 273 is not due until late 2019, possibly early 2020` If I...
56,662
I purchased my house (3 bedrooms, 2 full baths) in 1997 for $84,500. I have already made $166,500 of mortgage payments on a 9% interest rate loan. I have $53,000 left in payments. It recently appraised for approx. $71,000. I have made two unsuccessful attempts to refinance (but that’s a different story). I am looking...
2015/12/04
[ "https://money.stackexchange.com/questions/56662", "https://money.stackexchange.com", "https://money.stackexchange.com/users/35490/" ]
9% would be an absurdly high rate in the US by today's standards, so you should at the very least consider refinancing to fix that. Paying off completely is of course another way to fix that. Which approach makes more sense depends on what you plan to do with the money instead if you do refinance -- if you can put i...
You owe only $38,860 to pay off your loan now, possibly less. From what you say about your loan, tell me if I got this right: `30 year loan $75,780 original loan amount 9% annual interest rate $609.74 monthly payment You have made 272 payments Payment number 273 is not due until late 2019, possibly early 2020` If I...
56,662
I purchased my house (3 bedrooms, 2 full baths) in 1997 for $84,500. I have already made $166,500 of mortgage payments on a 9% interest rate loan. I have $53,000 left in payments. It recently appraised for approx. $71,000. I have made two unsuccessful attempts to refinance (but that’s a different story). I am looking...
2015/12/04
[ "https://money.stackexchange.com/questions/56662", "https://money.stackexchange.com", "https://money.stackexchange.com/users/35490/" ]
If you get a mortgage on the new property, you can almost surely get better than 9% today. I refinanced my house a year or so ago at 4%. You didn't say how much the new house will cost or how much of your cash you're willing to put to it, but just to make up a number say the house costs $200,000 and you'll pay $100,0...
You owe only $38,860 to pay off your loan now, possibly less. From what you say about your loan, tell me if I got this right: `30 year loan $75,780 original loan amount 9% annual interest rate $609.74 monthly payment You have made 272 payments Payment number 273 is not due until late 2019, possibly early 2020` If I...
64,880,156
I have a situation where I have a paragraph, which needs to have a select box right in the middle of it. However, `v-select` is a bit too big and doesn't seem to allow you to control its width. This is currently what it looks like: ```js new Vue({ el: '#root', vuetify: new Vuetify(), template: ` <div style="{...
2020/11/17
[ "https://Stackoverflow.com/questions/64880156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1676032/" ]
You will have to override the Vuetify css with your own styles. A good way to do this is to create some kind of override class for your UI or for specific things you need to have higher in the cascade. Then you can call the Vuetify classes inside that class and most of the time it will make your styles fire last. If th...
You could apply an inline CSS style `style="width:64px;display:inline-flex"` ```js new Vue({ el: '#root', vuetify: new Vuetify(), template: ` <div style="{ margin: '20px' }"> <v-row> <v-col col="12"> <p>I would like to have the following select: <v-select style="width:64px" placeholder="0"/> ...
37,784,030
I want to get month value using week no. I have week numbers stored in a table with year value. [![enter image description here](https://i.stack.imgur.com/eMh1L.png)](https://i.stack.imgur.com/eMh1L.png) How to query database to get month value using that week value. I am using SQL
2016/06/13
[ "https://Stackoverflow.com/questions/37784030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2681855/" ]
You can try this: ``` SELECT DATEPART(m,DATEADD(wk, DATEDIFF(wk, 6, '1/1/' + CAST(t.year as VARCHAR(4))) + (t.week-1), 6)) ```
It depends on how you're classing your week numbers, For example, if we assume that week numbers start on a Monday then we'd have to say that week 1 in 2016 actually started on Monday 28th of December 2015 and finished on Sunday 3rd January 2016. If this is how your week numbers are set up then you can use the method b...
37,784,030
I want to get month value using week no. I have week numbers stored in a table with year value. [![enter image description here](https://i.stack.imgur.com/eMh1L.png)](https://i.stack.imgur.com/eMh1L.png) How to query database to get month value using that week value. I am using SQL
2016/06/13
[ "https://Stackoverflow.com/questions/37784030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2681855/" ]
You can try this: ``` SELECT DATEPART(m,DATEADD(wk, DATEDIFF(wk, 6, '1/1/' + CAST(t.year as VARCHAR(4))) + (t.week-1), 6)) ```
You can try the query below: ``` SELECT [Week], [Year], 'Output-Month' = MONTH(DATEADD(WEEK, [Week], DATEADD(WEEK, DATEDIFF(WEEK, '19050101', '01/01/' + CAST([Year] AS VARCHAR(4))), '19050101'))) FROM YourTable ``` 1st is to get the 1st day of the year using this: ``` DATEADD(WEEK, DATEDIFF(WEEK, '19...
37,784,030
I want to get month value using week no. I have week numbers stored in a table with year value. [![enter image description here](https://i.stack.imgur.com/eMh1L.png)](https://i.stack.imgur.com/eMh1L.png) How to query database to get month value using that week value. I am using SQL
2016/06/13
[ "https://Stackoverflow.com/questions/37784030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2681855/" ]
You can try this: ``` SELECT DATEPART(m,DATEADD(wk, DATEDIFF(wk, 6, '1/1/' + CAST(t.year as VARCHAR(4))) + (t.week-1), 6)) ```
You can't go from week number to month because weeks can occur in two different months. For example the 31st Jan 2016 and 1st Feb 2016 are both in week 6. ``` SELECT DATEPART(WEEK, '2016-01-31') SELECT DATEPART(WEEK, '2016-02-01') ```
37,784,030
I want to get month value using week no. I have week numbers stored in a table with year value. [![enter image description here](https://i.stack.imgur.com/eMh1L.png)](https://i.stack.imgur.com/eMh1L.png) How to query database to get month value using that week value. I am using SQL
2016/06/13
[ "https://Stackoverflow.com/questions/37784030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2681855/" ]
It depends on how you're classing your week numbers, For example, if we assume that week numbers start on a Monday then we'd have to say that week 1 in 2016 actually started on Monday 28th of December 2015 and finished on Sunday 3rd January 2016. If this is how your week numbers are set up then you can use the method b...
You can try the query below: ``` SELECT [Week], [Year], 'Output-Month' = MONTH(DATEADD(WEEK, [Week], DATEADD(WEEK, DATEDIFF(WEEK, '19050101', '01/01/' + CAST([Year] AS VARCHAR(4))), '19050101'))) FROM YourTable ``` 1st is to get the 1st day of the year using this: ``` DATEADD(WEEK, DATEDIFF(WEEK, '19...
37,784,030
I want to get month value using week no. I have week numbers stored in a table with year value. [![enter image description here](https://i.stack.imgur.com/eMh1L.png)](https://i.stack.imgur.com/eMh1L.png) How to query database to get month value using that week value. I am using SQL
2016/06/13
[ "https://Stackoverflow.com/questions/37784030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2681855/" ]
It depends on how you're classing your week numbers, For example, if we assume that week numbers start on a Monday then we'd have to say that week 1 in 2016 actually started on Monday 28th of December 2015 and finished on Sunday 3rd January 2016. If this is how your week numbers are set up then you can use the method b...
You can't go from week number to month because weeks can occur in two different months. For example the 31st Jan 2016 and 1st Feb 2016 are both in week 6. ``` SELECT DATEPART(WEEK, '2016-01-31') SELECT DATEPART(WEEK, '2016-02-01') ```
12,621,431
I wrote a small test page to grab `document.referrer` of users with javascript and send it to a simple log server (like `sendReferrer(document.referrer)`). The referrer Firefox sends is always url-encoded, (eg. 'http://www.google.com/search?q=%C3%9C' when referrer url is www.google.com/search?q=Ü) But some clients (l...
2012/09/27
[ "https://Stackoverflow.com/questions/12621431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326792/" ]
document.referrer isn't URL encoded I have recently tested it in all major browsers and it showed to be non encoded in every one of them.
My final answer for this question: `Referer` may/may not be encoded! With my tests some (only some!) IEs send unencoded referrers (I guess it depends on the locale of client system)
35,593,994
I have an array : ``` e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], [ 4, 5, 6, 7, 5, 3, 2, 5], [ 8, 9, 10, 11, 4, 5, 3, 5]]) ``` I want to extract array by its columns in RANGE, if I want to take column in range 1 until 5, It will return ``` e = np.array([[ 1, 2, 3, 5, ], ...
2016/02/24
[ "https://Stackoverflow.com/questions/35593994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4374970/" ]
You can just use e[:, 1:5] to retrive what you want. ``` In [1]: import numpy as np In [2]: e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], ...: [ 4, 5, 6, 7, 5, 3, 2, 5], ...: [ 8, 9, 10, 11, 4, 5, 3, 5]]) In [3]: e[:, 1:5] Out[3]: array([[ 1, 2, 3, 5], [ 5, 6, 7, 5], ...
Numpy row and column indices start counting at 0. The rows are specified first and then the column with a comma to separate the row from column. The ":" (colon) is used to shortcut all rows or all columns when it is used alone. When the row or column specifier has a range, then the ":" is paired with numbers that...
35,593,994
I have an array : ``` e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], [ 4, 5, 6, 7, 5, 3, 2, 5], [ 8, 9, 10, 11, 4, 5, 3, 5]]) ``` I want to extract array by its columns in RANGE, if I want to take column in range 1 until 5, It will return ``` e = np.array([[ 1, 2, 3, 5, ], ...
2016/02/24
[ "https://Stackoverflow.com/questions/35593994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4374970/" ]
You can just use e[:, 1:5] to retrive what you want. ``` In [1]: import numpy as np In [2]: e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], ...: [ 4, 5, 6, 7, 5, 3, 2, 5], ...: [ 8, 9, 10, 11, 4, 5, 3, 5]]) In [3]: e[:, 1:5] Out[3]: array([[ 1, 2, 3, 5], [ 5, 6, 7, 5], ...
You can use np.take with specifying axis=1 ``` import numpy as np e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], [ 4, 5, 6, 7, 5, 3, 2, 5], [ 8, 9, 10, 11, 4, 5, 3, 5]]) e = np.take(e, [1,2,3,4], axis=1) output: array([[ 1, 2, 3, 5], [ 5, 6, 7, 5], [ 9, 10, 11, 4]]) ...
35,593,994
I have an array : ``` e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], [ 4, 5, 6, 7, 5, 3, 2, 5], [ 8, 9, 10, 11, 4, 5, 3, 5]]) ``` I want to extract array by its columns in RANGE, if I want to take column in range 1 until 5, It will return ``` e = np.array([[ 1, 2, 3, 5, ], ...
2016/02/24
[ "https://Stackoverflow.com/questions/35593994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4374970/" ]
Numpy row and column indices start counting at 0. The rows are specified first and then the column with a comma to separate the row from column. The ":" (colon) is used to shortcut all rows or all columns when it is used alone. When the row or column specifier has a range, then the ":" is paired with numbers that...
You can use np.take with specifying axis=1 ``` import numpy as np e = np.array([[ 0, 1, 2, 3, 5, 6, 7, 8], [ 4, 5, 6, 7, 5, 3, 2, 5], [ 8, 9, 10, 11, 4, 5, 3, 5]]) e = np.take(e, [1,2,3,4], axis=1) output: array([[ 1, 2, 3, 5], [ 5, 6, 7, 5], [ 9, 10, 11, 4]]) ...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
PHP uses Content-Type `text/html` as default, which is pretty similar to `text/plain` and this explains why you don't see any differences. `text/plain` content-type is necessary if you want to output text as is (including `<` and `>` symbols). Examples: ``` header("Content-Type: text/plain"); echo "<b>hello world</b...
Say you want to answer a request with a 204: No Content HTTP status. Firefox will complain with "no element found" in the console of the browser. This is a bug in Firefox that has been reported, but never fixed, for several years. By sending a "Content-type: text/plain" header, you can prevent this error in Firefox.
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
Define "necessary". It is necessary if you want the browser to ***know*** what the type of the file is. PHP automatically sets the `Content-Type` header to `text/html` if you don't override it so your browser is treating it as an HTML file that doesn't contain any HTML. If your output contained any HTML you'd see very...
Setting the Content-Type header will affect how a web browser treats your content. When most mainstream web browsers encounter a Content-Type of text/plain, they'll render the raw text source in the browser window (as opposed to the source rendered at HTML). It's the difference between seeing ``` <b>foo</b> ``` or ...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
It is very important that you tell the browser what type of data you are sending it. The difference should be obvious. Try viewing the output of the following PHP file in your browser; ``` <?php header('Content-Type:text/html; charset=UTF-8'); ?> <p>Hello</p> ``` You will see: > > hello > > > (note that you wi...
no its not like that,here is Example for the support of my answer ---->the clear difference is visible ,when you go for HTTP Compression,which allows you to compress the data while travelling from Server to Client and the Type of this data automatically becomes as "gzip" which Tells browser that bowser got a **zipped d...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
Say you want to answer a request with a 204: No Content HTTP status. Firefox will complain with "no element found" in the console of the browser. This is a bug in Firefox that has been reported, but never fixed, for several years. By sending a "Content-type: text/plain" header, you can prevent this error in Firefox.
no its not like that,here is Example for the support of my answer ---->the clear difference is visible ,when you go for HTTP Compression,which allows you to compress the data while travelling from Server to Client and the Type of this data automatically becomes as "gzip" which Tells browser that bowser got a **zipped d...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
PHP uses Content-Type `text/html` as default, which is pretty similar to `text/plain` and this explains why you don't see any differences. `text/plain` content-type is necessary if you want to output text as is (including `<` and `>` symbols). Examples: ``` header("Content-Type: text/plain"); echo "<b>hello world</b...
It is very important that you tell the browser what type of data you are sending it. The difference should be obvious. Try viewing the output of the following PHP file in your browser; ``` <?php header('Content-Type:text/html; charset=UTF-8'); ?> <p>Hello</p> ``` You will see: > > hello > > > (note that you wi...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
Define "necessary". It is necessary if you want the browser to ***know*** what the type of the file is. PHP automatically sets the `Content-Type` header to `text/html` if you don't override it so your browser is treating it as an HTML file that doesn't contain any HTML. If your output contained any HTML you'd see very...
It is very important that you tell the browser what type of data you are sending it. The difference should be obvious. Try viewing the output of the following PHP file in your browser; ``` <?php header('Content-Type:text/html; charset=UTF-8'); ?> <p>Hello</p> ``` You will see: > > hello > > > (note that you wi...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
Setting the Content-Type header will affect how a web browser treats your content. When most mainstream web browsers encounter a Content-Type of text/plain, they'll render the raw text source in the browser window (as opposed to the source rendered at HTML). It's the difference between seeing ``` <b>foo</b> ``` or ...
no its not like that,here is Example for the support of my answer ---->the clear difference is visible ,when you go for HTTP Compression,which allows you to compress the data while travelling from Server to Client and the Type of this data automatically becomes as "gzip" which Tells browser that bowser got a **zipped d...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
PHP uses Content-Type `text/html` as default, which is pretty similar to `text/plain` and this explains why you don't see any differences. `text/plain` content-type is necessary if you want to output text as is (including `<` and `>` symbols). Examples: ``` header("Content-Type: text/plain"); echo "<b>hello world</b...
no its not like that,here is Example for the support of my answer ---->the clear difference is visible ,when you go for HTTP Compression,which allows you to compress the data while travelling from Server to Client and the Type of this data automatically becomes as "gzip" which Tells browser that bowser got a **zipped d...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
PHP uses Content-Type `text/html` as default, which is pretty similar to `text/plain` and this explains why you don't see any differences. `text/plain` content-type is necessary if you want to output text as is (including `<` and `>` symbols). Examples: ``` header("Content-Type: text/plain"); echo "<b>hello world</b...
Setting the Content-Type header will affect how a web browser treats your content. When most mainstream web browsers encounter a Content-Type of text/plain, they'll render the raw text source in the browser window (as opposed to the source rendered at HTML). It's the difference between seeing ``` <b>foo</b> ``` or ...
1,414,325
I didn't see any difference with or without this head information yet.
2009/09/12
[ "https://Stackoverflow.com/questions/1414325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104015/" ]
Setting the Content-Type header will affect how a web browser treats your content. When most mainstream web browsers encounter a Content-Type of text/plain, they'll render the raw text source in the browser window (as opposed to the source rendered at HTML). It's the difference between seeing ``` <b>foo</b> ``` or ...
Say you want to answer a request with a 204: No Content HTTP status. Firefox will complain with "no element found" in the console of the browser. This is a bug in Firefox that has been reported, but never fixed, for several years. By sending a "Content-type: text/plain" header, you can prevent this error in Firefox.
71,047,996
So I recently wrote an algorithm which I posted on stack exchange/code review and it was very well received and I got loads of improvements suggested. I'm new to C# and I don't really understand the IEnumerable interface. How do I print to the console my entire deck? The code below is a method, if I call the method t...
2022/02/09
[ "https://Stackoverflow.com/questions/71047996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12394124/" ]
Just use a simple `foreach` loop: ``` foreach (var card in CreateDeck()) Console.WriteLine(card); ``` This uses the `Console.WriteLine(object)` overload, that will internally call the `ToString()` method defined on `Card`. --- As an aside, you could reduce memory usage in your `CreateDeck` method by using `yield r...
Implement GetEnumerator method in CardDeck class or any class as ```cs class Program { static void Main(string[] args) { var cd = new CardDeck(); cd.cards = new List<Card>() { new Card(CardValue.Ace, CardSuit.Spades), ...
36,272,712
So I've been stuck for hours trying to figure out this problem. Given a randomly generated BST and using the method header: `public E higher(E elt)` Where `elt` is a randomly generated value within the tree's range, I need to find the least element in the set greater than `elt`. Nodes contain left links and right li...
2016/03/28
[ "https://Stackoverflow.com/questions/36272712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4938662/" ]
It's ``` UnityEngine.SceneManagement.SceneManager.LoadScene("Gameplay"); ``` and yes it does it "instantly" -- that is to say **s**ynchronously. In other words, it "stops" at that line of code, waits until it loads the whole scene (even if that takes some seconds) and then the new scene begins. Do not use the old...
Maybe it's changed. From the docs: > > When using SceneManager.LoadScene, the loading does not happen immediately, it completes in the next frame. > > > I had been doing the exact same thing as the poster and it was instantiating in the old scene. <https://docs.unity3d.com/ScriptReference/SceneManagement.SceneM...
21,776,458
i am using a Apache directory studio for as my database. how i can create there my own field. because there are object class and based upon object class we can add the filed. how can we manually add any filed.. Following is my LDIF file. ``` dn: cn = username ,ou=users,o=Agile-Infotech,ou=system objectClass: organiz...
2014/02/14
[ "https://Stackoverflow.com/questions/21776458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3184740/" ]
The LDAP object classes and their attributes are described in `schema` definition files. The classes and attributes can be inherited from and extended. If you want to add a new attribute to the class `organizationalPerson`, then you need to extend it. The schema files OpenLDAP ships with reside in a sub-directory `sch...
You need to create a schema project, add schema and then add attributetype. Refer to similar attribute type in the existing schema if you have or read the OpenLDAP documentation. Basically, your definition of custom attribute type have to mention mandatory fields like the OID, NAME, SYNTAX etc.
11,627,441
I know I can get the time since the last boot using `Environment.TickCount` But is it possible to get the last time a compute woke up from hibernation or sleep? (Without using WMI please)
2012/07/24
[ "https://Stackoverflow.com/questions/11627441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/766006/" ]
Try this command - use [Process](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx) to fire it off - you'll need to parse the result > > cmd /k wevtutil qe System > /q:"\*[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter']]]" > /rd:true /c:1 /f:text > > > Lifted from [here](ht...
According to [this page](http://msdn.microsoft.com/en-us/library/windows/desktop/aa373235%28v=vs.85%29.aspx) you'll have to listen for [PBT\_APMRESUMEAUTOMATIC](http://msdn.microsoft.com/en-us/library/windows/desktop/aa372718%28v=vs.85%29.aspx) (and [PBT\_APMRESUMESUSPEND](http://msdn.microsoft.com/en-us/library/window...
11,627,441
I know I can get the time since the last boot using `Environment.TickCount` But is it possible to get the last time a compute woke up from hibernation or sleep? (Without using WMI please)
2012/07/24
[ "https://Stackoverflow.com/questions/11627441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/766006/" ]
Try this command - use [Process](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx) to fire it off - you'll need to parse the result > > cmd /k wevtutil qe System > /q:"\*[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter']]]" > /rd:true /c:1 /f:text > > > Lifted from [here](ht...
Although there's an answer above that provides the core query, here's a more fleshed out solution for anyone who decides they want something more complete. ``` private string getLastWakeInfo() { String args = @"qe System /q:"" *[System[Provider[@Name = 'Microsoft-Windows-Power-Troubleshooter']]]"" /rd:true /c:1 /f...
49,638,082
I am using Observables in Angular 5, I am getting the data back from the API. Here's my code: ``` student: Student = null; // this is at a class level ngOnInit() { const id: number = Number(this.activatedRoute.snapshot.params['id']); if (id) { this.studentEditSubscription = this.studentService.getSt...
2018/04/03
[ "https://Stackoverflow.com/questions/49638082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5924007/" ]
You're missing here that observable code runs asynchronously. So second `console.log(...)` fires before the first one. That's why you get `null` output from it. You can confirm this by changing `student` initial value to something else. You will get this value.
I believe your issue here is that the callback of the subscription on the `studentService#getStudentById` event is asynchronous so the first `null` console.log runs in the first tick of the event loop in this scope then once the observable is resolved then the `.student` is set. A basic example of this is: ``` setTim...
19,043
Context ------- In this [Thread](http://www.mmo-champion.com/threads/2221878-Michael-Flynn-committed-Treason) the user titles it '*Michael Flynn committed Treason*'. He believes that Michael Flynn committed treason, Treason is defined in the [Article III Section 3](https://www.law.cornell.edu/constitution/articleiii...
2017/05/18
[ "https://law.stackexchange.com/questions/19043", "https://law.stackexchange.com", "https://law.stackexchange.com/users/18615/" ]
Since the treason statute is quite vague, you have to discover what the details of the law is by looking at precedent. Almost all federal treason convictions in the US have involved declared wars. There is the case of [John Fries](https://en.wikipedia.org/wiki/Fries%27s_Rebellion#Trials), an early tax rebellion case in...
It says in times of war, or in adhering to their enemies, giving comfort or aid. You do not need to be at war to commit treason. Selling top secret information to others is treason. Lying to our top governing body- sounds like treason to me. There is a line of guys waiting to be tried. coercion with a foreign gov...
19,043
Context ------- In this [Thread](http://www.mmo-champion.com/threads/2221878-Michael-Flynn-committed-Treason) the user titles it '*Michael Flynn committed Treason*'. He believes that Michael Flynn committed treason, Treason is defined in the [Article III Section 3](https://www.law.cornell.edu/constitution/articleiii...
2017/05/18
[ "https://law.stackexchange.com/questions/19043", "https://law.stackexchange.com", "https://law.stackexchange.com/users/18615/" ]
Since the treason statute is quite vague, you have to discover what the details of the law is by looking at precedent. Almost all federal treason convictions in the US have involved declared wars. There is the case of [John Fries](https://en.wikipedia.org/wiki/Fries%27s_Rebellion#Trials), an early tax rebellion case in...
Treason is defined in Article III, Section 3, Clause 1 of the United States Constitution (it is the only constitutionally defined crime): > > Treason against the United States, shall consist only in levying war > against them, or in adhering to their enemies, giving them aid and > comfort. > > > The legal meani...
19,043
Context ------- In this [Thread](http://www.mmo-champion.com/threads/2221878-Michael-Flynn-committed-Treason) the user titles it '*Michael Flynn committed Treason*'. He believes that Michael Flynn committed treason, Treason is defined in the [Article III Section 3](https://www.law.cornell.edu/constitution/articleiii...
2017/05/18
[ "https://law.stackexchange.com/questions/19043", "https://law.stackexchange.com", "https://law.stackexchange.com/users/18615/" ]
Treason is defined in Article III, Section 3, Clause 1 of the United States Constitution (it is the only constitutionally defined crime): > > Treason against the United States, shall consist only in levying war > against them, or in adhering to their enemies, giving them aid and > comfort. > > > The legal meani...
It says in times of war, or in adhering to their enemies, giving comfort or aid. You do not need to be at war to commit treason. Selling top secret information to others is treason. Lying to our top governing body- sounds like treason to me. There is a line of guys waiting to be tried. coercion with a foreign gov...
57,373,808
I am getting this error message when i wanna add a new line in my table: ``` ERROR TypeError: Cannot read property 'Nom' of undefined at Object.eval [as updateDirectives] (MedecinsComponent.html:43) at Object.debugUpdateDirectives [as updateDirectives] (core.js:36043) at checkAndUpdateView (core.js:35055) at c...
2019/08/06
[ "https://Stackoverflow.com/questions/57373808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11869110/" ]
You must initialize and get the value of "User" instance first. so before writing "this.col = ..." try getting the user instance & then pass-on the user properties to "col" array of objects.
Since it says "can't find property Nom in undefined", it looks like you have no object `User` to start with.
2,683,577
I have a bash script that runs on our shared web host. It does a dump of our mysql database and zips up the output file. Sometimes the mysqldump process gets killed, which leaves an incomplete sql file that still gets zipped. How do I get my script to 'notice' the killing and then delete the output file if the killing ...
2010/04/21
[ "https://Stackoverflow.com/questions/2683577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151841/" ]
If mysqldump gets killed it will have an exit code != 0: ``` if ! mysqldump ...;then rm ... fi ```
You could use `ps` or `pgrep` to see if the process is still running based on its name. Or you could use `lsof` on the SQL file to see if a process is accessing the file. However, if the process completes normally, that "open" connection will no longer be there.
40,931,089
Going to develop an `iOS VoIP` app as my final project, but not finding a proper `SDK` to be used for making app to work like `Skype/ Viber`, for Voice and Video Call. Or suggest me another FREE library. I working on this from the previous 2 months... Thanks. EDIT: [![](https://i.stack.imgur.com/6B1jL.png)](https...
2016/12/02
[ "https://Stackoverflow.com/questions/40931089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6940895/" ]
If you got errors in library means, Either you have not properly configure the PJSIP project in Your system (or) you missed any library that you want to add in your xcode project. If you want to run project in simulator or iphone? There is two different configuration for pjsip project. For iphone and simulator, config...
You missed architecture name **was:** ``` lipo -arch libpj-arm64-apple-darwin_ios.a -arch libpj-armv7-apple-darwin_ios.a ... ``` **Need:** ``` lipo -arch arm64 libpj-arm64-apple-darwin_ios.a -arch armv7 libpj-armv7-apple-darwin_ios.a ... ``` For each **-arch** you need set **name** and than lib name
31,208,949
I got a problem with SQL statment, I am trying to make START field unique. What I mean is to DELETE rest fields which has the same value in this field. My SQL query: ``` SELECT s.date AS START , s.machine_id, s.stop_id, o.date AS STOP FROM stops s LEFT JOIN performance_v2 o ON o.date > s.date AND o.machine_id = s....
2015/07/03
[ "https://Stackoverflow.com/questions/31208949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4287406/" ]
I believe typically that means that the character is not recognized by the font.
here are couple of thing i would check, 1. are you using a custom font, do that custom font support   ? 2. did you declear a charset in your meta? 3. instead of using `&nbsp;` why can't you use regular `space`? 4. are you using a data base, make sure you set the connection to utf-8 too.
26,013,209
I'm using `Joomla 2.5` and it is not giving duplicate email address for the user registration. But I want create accounts using same email address. I know I've to edit the core and It may be not an issue because I'm not going to update the Joomla in future. How can I do that core hack? Thanks
2014/09/24
[ "https://Stackoverflow.com/questions/26013209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/795446/" ]
I'm a little shocked that you said you will never update Joomla in the future. 2.5 as you may not know will reach EOL (end of life) in December this year, therefore a lot of extension developers will stop support and developing extensions for 2.5, therefore if you have any issues, you may run into problems. Secondly, ...
I agree with Lodder on his point of view that a "core hack" is bad, and that using an extension like "Users Same Email" (<http://extensions.joomla.org/extensions/clients-a-communities/user-management/24599>) is better. But however, if really you need so, you can have a look at the hack propose on the Joomla forum : <h...
34,652,499
I've just found a binary version [NSString to Print in in binary format](https://stackoverflow.com/questions/1286425/nsstring-to-print-in-in-binary-format), but I want to know if there is a flexible version. ``` let initialBits: UInt8 = 0b00001111 let invertedBits = ~initialBits // equals 11110000 let stringOfInverted...
2016/01/07
[ "https://Stackoverflow.com/questions/34652499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5756660/" ]
This is a modification of @Paul Griffiths answer, which is faster and more efficient as it avoids constant re-allocation of the `NSString`: ``` - (NSString *)formatStringFromInt:(int)value withRadix:(int)radix { if (value == 0) return @"0"; if (radix < 2 || radix > 36) radix = 10; const un...
Here's an easy modification: ``` #import <Foundation/Foundation.h> NSString * getBitStringForInt(const int value, const int radix) { static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if ( radix < 2 || radix > 36 ) { return NULL; } NSString *bits = @""; int absValue = a...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
Some things that have tipped me off in the past: * High load on a system that should be idle * Weird segfaults, eg. from standard utilities like `ls` (this can happen with broken root kits) * Hidden directories in `/` or `/var/` (most script kiddies are too stupid or lazy to cover their tracks) * `netstat` shows open ...
You should check out GuardRail. It can scan your server on a daily basis and tell you what's changed in a nice visual way. It doesn't require an agent and can connect over SSH so you don't need to junk up your machine and resources with an agent. Best of all, it's free for up to 5 servers. Check it out here: <https:...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
Some things that have tipped me off in the past: * High load on a system that should be idle * Weird segfaults, eg. from standard utilities like `ls` (this can happen with broken root kits) * Hidden directories in `/` or `/var/` (most script kiddies are too stupid or lazy to cover their tracks) * `netstat` shows open ...
I'll second the responses given here and add one of my own. ``` find /etc /var -mtime -2 ``` This will give you a quick indication if any of your main server files have changed in the last 2 days. This is from an article on hack detection [How to detect if your server has been hacked.](http://servermonitoringhq.c...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
There's a method of checking hacked servers via `kill` - Essentially, when you run "kill -0 $PID" you are sending a nop signal to process identifier $PID. If the process is running, the kill command will exit normally. (FWIW, since you're passing a nop kill signal, nothing will happen to the process). If a process isn...
After searching around a bit, there's this also, it does what I've listed above, amongst some other stuff: <http://www.chkrootkit.org/> and <http://www.rootkit.nl/projects/rootkit_hunter.html>
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
Some things that have tipped me off in the past: * High load on a system that should be idle * Weird segfaults, eg. from standard utilities like `ls` (this can happen with broken root kits) * Hidden directories in `/` or `/var/` (most script kiddies are too stupid or lazy to cover their tracks) * `netstat` shows open ...
There's a method of checking hacked servers via `kill` - Essentially, when you run "kill -0 $PID" you are sending a nop signal to process identifier $PID. If the process is running, the kill command will exit normally. (FWIW, since you're passing a nop kill signal, nothing will happen to the process). If a process isn...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
[Tripwire](http://sourceforge.net/projects/tripwire/) is a commonly used tool - it notifies you when system files have changed, although obviously you need to have it installed beforehand. Otherwise items such as new user accounts you don't know about, weird processes and files you don't recognize, or increased bandwid...
I'll second the responses given here and add one of my own. ``` find /etc /var -mtime -2 ``` This will give you a quick indication if any of your main server files have changed in the last 2 days. This is from an article on hack detection [How to detect if your server has been hacked.](http://servermonitoringhq.c...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
You don't. I know, I know - but it's the paranoid, sad truth, really ;) There are plenty of hints of course, but if the system was targeted specifically - it might be impossible to tell. It's good to understand that nothing is ever completely secure. But we need to work for more secure, so I will point at all the othe...
You should check out GuardRail. It can scan your server on a daily basis and tell you what's changed in a nice visual way. It doesn't require an agent and can connect over SSH so you don't need to junk up your machine and resources with an agent. Best of all, it's free for up to 5 servers. Check it out here: <https:...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
I'll second the responses given here and add one of my own. ``` find /etc /var -mtime -2 ``` This will give you a quick indication if any of your main server files have changed in the last 2 days. This is from an article on hack detection [How to detect if your server has been hacked.](http://servermonitoringhq.c...
After searching around a bit, there's this also, it does what I've listed above, amongst some other stuff: <http://www.chkrootkit.org/> and <http://www.rootkit.nl/projects/rootkit_hunter.html>
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
After searching around a bit, there's this also, it does what I've listed above, amongst some other stuff: <http://www.chkrootkit.org/> and <http://www.rootkit.nl/projects/rootkit_hunter.html>
You should check out GuardRail. It can scan your server on a daily basis and tell you what's changed in a nice visual way. It doesn't require an agent and can connect over SSH so you don't need to junk up your machine and resources with an agent. Best of all, it's free for up to 5 servers. Check it out here: <https:...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
From [How can I detect unwanted intrusions on my servers?](https://serverfault.com/questions/650/how-can-i-detect-unwanted-intrusions-on-my-servers/800#800) * Use an IDS > > SNORT® is an open source network intrusion prevention and detection system utilizing a rule-driven language, which combines the benefits of sig...
I'd just like to add to this: Check your bash history, if it's empty and you haven’t unset it or emptied it, there a good possibility someone has compromised your server. Check last. Either you will see unknown I.P's or it will look very empty. Then as the accepted answer stated, system files are often changed, chec...
2,783
What are the tell-tale signs that a Linux server has been hacked? Are there any tools that can generate and email an audit report on a scheduled basis?
2009/05/01
[ "https://serverfault.com/questions/2783", "https://serverfault.com", "https://serverfault.com/users/1532/" ]
From [How can I detect unwanted intrusions on my servers?](https://serverfault.com/questions/650/how-can-i-detect-unwanted-intrusions-on-my-servers/800#800) * Use an IDS > > SNORT® is an open source network intrusion prevention and detection system utilizing a rule-driven language, which combines the benefits of sig...
You should check out GuardRail. It can scan your server on a daily basis and tell you what's changed in a nice visual way. It doesn't require an agent and can connect over SSH so you don't need to junk up your machine and resources with an agent. Best of all, it's free for up to 5 servers. Check it out here: <https:...
3,334,716
I'm trying to execute the following query ``` SELECT * FROM person WHERE id IN ( SELECT user_id FROM participation WHERE activity_id = '1' AND application_id = '1' ) ``` The outer query returns about 4000 responses whilst the inner returns 29. When executed ...
2010/07/26
[ "https://Stackoverflow.com/questions/3334716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395082/" ]
why don't you use an inner join for this query? i think that would be faster (and easier to read) - and maybe it solves your problem (but i can't find a failure in your query). **EDIT:** the inner-join-solution would look like this: ``` SELECT person.* FROM person INNER JOIN participation ON person.id = parti...
How many rows are there in `participation` table and what indexes are there? A multi-column index on (user\_id, activity\_id, application\_id) could help here. Re comments: IN isn't slow. Subqueries within IN can be slow, if they're correlated to outer query.
53,816,896
I'm trying to do a custom radio button, I found some code on internet, and customed it. The probleme is, I need a padding 20px left/right in the label, and I need to keep the min-width at 110px and the li width is not wrapping content... He is my code if you want to see. ```css .ui-radio { margin:25px 0 0 0; ...
2018/12/17
[ "https://Stackoverflow.com/questions/53816896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6380158/" ]
Remove `position: absolute;` from `.ui-radio label, .ui-radio input`. Absolute positioning causes item's parent not to be aware of the content size, that why the content was overflowing.
default display of label is "inline". first you should change his display to "inline-block" , "block" or ... for example : html : ``` <!DOCTYPE html> <html> <head> <link class="menu-bar" rel="stylesheet" href="../css/index.css"> <link class="container" rel="stylesheet" href="../css/menu.css"> <meta charset="u...
50,952,648
I am pretty new to SQL. I have a 'Transactions' table with columns 'Model\_Id' and 'Tran\_date'. I have another 'Model' table with columns 'Model\_Id' and 'Model\_Name'. I want all the model names from 'Transactions' table which were sold in the year 2017 but not in the year 2018. How can I use the `Where` statement to...
2018/06/20
[ "https://Stackoverflow.com/questions/50952648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1644556/" ]
Welcome to Stack Overflow. Although I have supplied an answer here (in the form of pseudo-SQL) when posting a question like this you really need to supply Sample data and expected results as a bare minimum. Otherwise volunteers here have to guess your DDL and data, which is probably mean it'll be wrong (but possibly he...
Hope this helps! ``` SELECT m.Model_Name FROM Transactions t JOIN Model m on m.model_id=t.model_id and year(t.tran_date)=2017 LEFT JOIN Model mm on mm.model_id=t.model_id and year(t.tran_date)=2018 WHERE mm.model_id is null ```
5,733,373
I have the following problem: when there is a space in between html tags, my code does not give me the text I want outputted. Instead of outputting: ``` year|salary|bonus 2005|100,000|50,000 2006|120,000|80,000 ``` I get this instead: ``` |salary|bonus 2005|100,000|50,000 2006|120,000|80,000 ``` the text "year"...
2011/04/20
[ "https://Stackoverflow.com/questions/5733373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/714504/" ]
Instead of `row.append(''.join(td.find(text=True)))`, use : ``` row.append(''.join(td.text)) ``` Output: ``` year|salary|bonus 2005|100,000|50,000 2006|120,000|80,000 ```
As @Herman suggested, you should use `Tag.text` to find the relevant text for the tag you're currently parsing. A bit more detail on why `Tag.find()` didn't do what you want: BeautifulSoup's `Tag.find()` is very similar to to `Tag.findAll()`, in fact, its implementation of `Tag.find()` just invokes `Tag.findAll()` wit...
5,733,373
I have the following problem: when there is a space in between html tags, my code does not give me the text I want outputted. Instead of outputting: ``` year|salary|bonus 2005|100,000|50,000 2006|120,000|80,000 ``` I get this instead: ``` |salary|bonus 2005|100,000|50,000 2006|120,000|80,000 ``` the text "year"...
2011/04/20
[ "https://Stackoverflow.com/questions/5733373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/714504/" ]
Instead of `row.append(''.join(td.find(text=True)))`, use : ``` row.append(''.join(td.text)) ``` Output: ``` year|salary|bonus 2005|100,000|50,000 2006|120,000|80,000 ```
use ``` html = re.sub(r'\s\s+', '', html) ```
185,678
I see a point in the throttling system, however for regular chat users and room owners it can become quite a nuisance. The room owners already have no star limits for the rooms they own, would it make much sense to remove the message throttling for those users in their rooms as well? I know many other room owners, as...
2013/06/24
[ "https://meta.stackexchange.com/questions/185678", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/167434/" ]
This answer isn't really for nor against what you want; but I will definitely vote on at least the time limit being upped, because it bugs me all the time when I'm "power-typing". I am not spamming, just having a lot of suggestions coming into my head quickly when discussing something. It's always saying "You can do t...
-1, sorry. I dislike the throttling system as it stands today, but see no reason to disable it for room owners only. The principle of SO chat is that room owners are not masters, gods, or supreme beings, and are generally subject to the same rules as everybody else. *They do not "moderate" anything!* The unlimited sta...
186,229
I often come into the situation where I am not sure how big is my variable, for instance: integer, short, long? I know that I can find size of variable with sizeof(); function in C. But now I'm in situation where I'm trying to parse some data from file and I have that file structure, when I realize that all that is...
2015/08/18
[ "https://electronics.stackexchange.com/questions/186229", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81163/" ]
Even if your 8-bit processor only supports data handling at 8 bits, the compiler will handle all the necessary stuff for a 16-bit addition and passing on data, so the size in bits of int, short or others are purely based on your compilers settings. Normally you will find this information somewhere in the compiler manu...
You need to look at your C compiler documentation. It should spell out the answers you need. An 8-bit compiler may have "int" be 8-bits, 16-bits or something else. In some cases the number of bits in a default "int" may be selectable via a compiler command line switch or environment variable.
18,565,356
``` #!/bin/sh URL1=http://runescape.com/title.ws tot=`wget -qO- $URL1 | grep -i PlayerCount | cut -d\> -f4 | cut -d\< -f1 | sed -e's/,//'` URL2=http://oldschool.runescape.com b=`wget -qO- $URL2| grep "people playing" | awk '{print $4}'` a=`expr $tot - $b` export LC_ALL=en_US.UTF-8 a_with_comma=`echo $a | awk "{print...
2013/09/02
[ "https://Stackoverflow.com/questions/18565356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009123/" ]
Change this line: ``` ({_id:doc._id},$set:{scores:zz}); ``` To: ``` ({_id:doc._id}, { $set:{scores:zz}} ); ``` This should also probably be wrapped with a callback, to catch errors: ``` db.schools.update({_id:doc._id}, {$set:{scores:zz}}, function(err, result) { if (err) //do something. }); ```
I think you should do following code for solving issues ``` var lowScore = 9999.9; for ( var i=0; i<doc.scores.length; i++ ) { if ( doc.scores[i].type == "homework" && doc.scores[i].score < lowScore ) { lowScore = doc.scores[i].score; } } ...
18,565,356
``` #!/bin/sh URL1=http://runescape.com/title.ws tot=`wget -qO- $URL1 | grep -i PlayerCount | cut -d\> -f4 | cut -d\< -f1 | sed -e's/,//'` URL2=http://oldschool.runescape.com b=`wget -qO- $URL2| grep "people playing" | awk '{print $4}'` a=`expr $tot - $b` export LC_ALL=en_US.UTF-8 a_with_comma=`echo $a | awk "{print...
2013/09/02
[ "https://Stackoverflow.com/questions/18565356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009123/" ]
Change this line: ``` ({_id:doc._id},$set:{scores:zz}); ``` To: ``` ({_id:doc._id}, { $set:{scores:zz}} ); ``` This should also probably be wrapped with a callback, to catch errors: ``` db.schools.update({_id:doc._id}, {$set:{scores:zz}}, function(err, result) { if (err) //do something. }); ```
I know it's a bit late to help you now, but maybe others can benefit as new cohorts pass through MongoDB University! `db.schools.update` should read `db.students.update`. @tymeJV's answer gives the rest: * Wrap the `$set` inside braces: `{$set:{scores:zz}}` * Add a callback function to catch errors: ``` db.collecti...
18,565,356
``` #!/bin/sh URL1=http://runescape.com/title.ws tot=`wget -qO- $URL1 | grep -i PlayerCount | cut -d\> -f4 | cut -d\< -f1 | sed -e's/,//'` URL2=http://oldschool.runescape.com b=`wget -qO- $URL2| grep "people playing" | awk '{print $4}'` a=`expr $tot - $b` export LC_ALL=en_US.UTF-8 a_with_comma=`echo $a | awk "{print...
2013/09/02
[ "https://Stackoverflow.com/questions/18565356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009123/" ]
Change this line: ``` ({_id:doc._id},$set:{scores:zz}); ``` To: ``` ({_id:doc._id}, { $set:{scores:zz}} ); ``` This should also probably be wrapped with a callback, to catch errors: ``` db.schools.update({_id:doc._id}, {$set:{scores:zz}}, function(err, result) { if (err) //do something. }); ```
``` var dbName = 'school' var tableName = 'classA' MongoClient.connect(dbName, function(err, db) { if (err) { console.log(err); } else { var collection = db.collection(tableName) collection.update({_id:doc._id}, {$set:{scores:zz}}, function(err, result) { if (err) { console.log(...
18,565,356
``` #!/bin/sh URL1=http://runescape.com/title.ws tot=`wget -qO- $URL1 | grep -i PlayerCount | cut -d\> -f4 | cut -d\< -f1 | sed -e's/,//'` URL2=http://oldschool.runescape.com b=`wget -qO- $URL2| grep "people playing" | awk '{print $4}'` a=`expr $tot - $b` export LC_ALL=en_US.UTF-8 a_with_comma=`echo $a | awk "{print...
2013/09/02
[ "https://Stackoverflow.com/questions/18565356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009123/" ]
I know it's a bit late to help you now, but maybe others can benefit as new cohorts pass through MongoDB University! `db.schools.update` should read `db.students.update`. @tymeJV's answer gives the rest: * Wrap the `$set` inside braces: `{$set:{scores:zz}}` * Add a callback function to catch errors: ``` db.collecti...
I think you should do following code for solving issues ``` var lowScore = 9999.9; for ( var i=0; i<doc.scores.length; i++ ) { if ( doc.scores[i].type == "homework" && doc.scores[i].score < lowScore ) { lowScore = doc.scores[i].score; } } ...
18,565,356
``` #!/bin/sh URL1=http://runescape.com/title.ws tot=`wget -qO- $URL1 | grep -i PlayerCount | cut -d\> -f4 | cut -d\< -f1 | sed -e's/,//'` URL2=http://oldschool.runescape.com b=`wget -qO- $URL2| grep "people playing" | awk '{print $4}'` a=`expr $tot - $b` export LC_ALL=en_US.UTF-8 a_with_comma=`echo $a | awk "{print...
2013/09/02
[ "https://Stackoverflow.com/questions/18565356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009123/" ]
``` var dbName = 'school' var tableName = 'classA' MongoClient.connect(dbName, function(err, db) { if (err) { console.log(err); } else { var collection = db.collection(tableName) collection.update({_id:doc._id}, {$set:{scores:zz}}, function(err, result) { if (err) { console.log(...
I think you should do following code for solving issues ``` var lowScore = 9999.9; for ( var i=0; i<doc.scores.length; i++ ) { if ( doc.scores[i].type == "homework" && doc.scores[i].score < lowScore ) { lowScore = doc.scores[i].score; } } ...
18,565,356
``` #!/bin/sh URL1=http://runescape.com/title.ws tot=`wget -qO- $URL1 | grep -i PlayerCount | cut -d\> -f4 | cut -d\< -f1 | sed -e's/,//'` URL2=http://oldschool.runescape.com b=`wget -qO- $URL2| grep "people playing" | awk '{print $4}'` a=`expr $tot - $b` export LC_ALL=en_US.UTF-8 a_with_comma=`echo $a | awk "{print...
2013/09/02
[ "https://Stackoverflow.com/questions/18565356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1009123/" ]
I know it's a bit late to help you now, but maybe others can benefit as new cohorts pass through MongoDB University! `db.schools.update` should read `db.students.update`. @tymeJV's answer gives the rest: * Wrap the `$set` inside braces: `{$set:{scores:zz}}` * Add a callback function to catch errors: ``` db.collecti...
``` var dbName = 'school' var tableName = 'classA' MongoClient.connect(dbName, function(err, db) { if (err) { console.log(err); } else { var collection = db.collection(tableName) collection.update({_id:doc._id}, {$set:{scores:zz}}, function(err, result) { if (err) { console.log(...
16,859,808
Came a cross this fiddle in the Highcharts API doc: <http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/exporting/buttons-text/> ``` printButton: { text: 'Print', onclick: function () { this.print(); ...
2013/05/31
[ "https://Stackoverflow.com/questions/16859808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/289573/" ]
If you want to add custom tooltip text for a button, you must add a 'lang' object in the chart's options, and define a key with some text. Then use that key in the custom button's definition. ``` var chart = new Highcharts.Chart({ chart: { // your chart options }, lang: { yourKey: "Custom b...
Add directly `_titleKey`, see: <http://jsfiddle.net/x36qR/1/>
16,859,808
Came a cross this fiddle in the Highcharts API doc: <http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/exporting/buttons-text/> ``` printButton: { text: 'Print', onclick: function () { this.print(); ...
2013/05/31
[ "https://Stackoverflow.com/questions/16859808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/289573/" ]
Add directly `_titleKey`, see: <http://jsfiddle.net/x36qR/1/>
I'd like to add that the lang option works even if the button is not *custom*. For instance, ``` lang: { myKey: "Hello" }, exporting: { buttons: { exportButton: { _titleKey:"myKey", enabled: true }, printButton: { enabled: true } ...
16,859,808
Came a cross this fiddle in the Highcharts API doc: <http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/exporting/buttons-text/> ``` printButton: { text: 'Print', onclick: function () { this.print(); ...
2013/05/31
[ "https://Stackoverflow.com/questions/16859808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/289573/" ]
If you want to add custom tooltip text for a button, you must add a 'lang' object in the chart's options, and define a key with some text. Then use that key in the custom button's definition. ``` var chart = new Highcharts.Chart({ chart: { // your chart options }, lang: { yourKey: "Custom b...
I'd like to add that the lang option works even if the button is not *custom*. For instance, ``` lang: { myKey: "Hello" }, exporting: { buttons: { exportButton: { _titleKey:"myKey", enabled: true }, printButton: { enabled: true } ...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
**UPDATE:** i would strongly recommend to upgrade to pandas 0.18.1 (currently the latest version), as each new version of pandas introduces nice new features and fixes tons of old bugs. And the actual version (0.18.1) will process your empty files just out of the box (see demo below). If you can't upgrade to a newer ...
Looking through the [source code](https://github.com/python/cpython/blob/2.7/Lib/gzip.py) for the Python 2.7 version of the `gzip` module, it seems to immediately return EOF, not only in the case where the gzipped file is zero bytes, but also in the case that the gzip file is zero bytes, which is arguably a bug. Howev...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
**UPDATE:** i would strongly recommend to upgrade to pandas 0.18.1 (currently the latest version), as each new version of pandas introduces nice new features and fixes tons of old bugs. And the actual version (0.18.1) will process your empty files just out of the box (see demo below). If you can't upgrade to a newer ...
``` import gzip with gzip.open("pCSV.csv.gz", 'r') as f: f.seek(3) couterA = f.tell() f.seek(2,0) counterB = f.tell() if(couterA > counterB): print "NOT EMPTY" else: print "EMPTY" ``` This should do it without reading the file.
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
Unfortunately, the `gzip` module does not expose any functionality equivalent to the `-l` list option of the `gzip` program. But in Python 3 you can easily get the size of the uncompressed data by calling the `.seek` method with a `whence` argument of 2, which signifies positioning relative to the end of the (uncompres...
**UPDATE:** i would strongly recommend to upgrade to pandas 0.18.1 (currently the latest version), as each new version of pandas introduces nice new features and fixes tons of old bugs. And the actual version (0.18.1) will process your empty files just out of the box (see demo below). If you can't upgrade to a newer ...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
``` import gzip with gzip.open("pCSV.csv.gz", 'r') as f: f.seek(3) couterA = f.tell() f.seek(2,0) counterB = f.tell() if(couterA > counterB): print "NOT EMPTY" else: print "EMPTY" ``` This should do it without reading the file.
I had a few hundred thousand gzip files, only a few of which are zero-sized, mounted on a network share. I was forced to use the following optimization. It is brittle, but in the (very frequent) case in which you have a large number of files generated using the same method, the sum of all the bytes other than the name ...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
If you want to check whether a file is a valid Gzip file, you can open it and read one byte from it. If it succeeds, the file is quite probably a gzip file, with one caveat: an *empty* file also succeeds this test. Thus we get ``` def is_gz_file(name): with gzip.open(name, 'rb') as f: try: fil...
I had a few hundred thousand gzip files, only a few of which are zero-sized, mounted on a network share. I was forced to use the following optimization. It is brittle, but in the (very frequent) case in which you have a large number of files generated using the same method, the sum of all the bytes other than the name ...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
Try something like this: ``` def is_empty(gzfile): size = gzfile.read(). if len(size) > 0: gzfile.rewind() return False else: return True ```
I had a few hundred thousand gzip files, only a few of which are zero-sized, mounted on a network share. I was forced to use the following optimization. It is brittle, but in the (very frequent) case in which you have a large number of files generated using the same method, the sum of all the bytes other than the name ...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
If you want to check whether a file is a valid Gzip file, you can open it and read one byte from it. If it succeeds, the file is quite probably a gzip file, with one caveat: an *empty* file also succeeds this test. Thus we get ``` def is_gz_file(name): with gzip.open(name, 'rb') as f: try: fil...
Try something like this: ``` def is_empty(gzfile): size = gzfile.read(). if len(size) > 0: gzfile.rewind() return False else: return True ```
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
Unfortunately, any such attempt will likely have a fair bit of overhead, it would likely be cheaper to catch the exception, such as users commented above. A [gzip](http://www.zlib.org/rfc-gzip.html#member-format) file defines a few fixed size regions, as follows: **Fixed Regions** First, there are 2 bytes for the Gzi...
I had a few hundred thousand gzip files, only a few of which are zero-sized, mounted on a network share. I was forced to use the following optimization. It is brittle, but in the (very frequent) case in which you have a large number of files generated using the same method, the sum of all the bytes other than the name ...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
Unfortunately, the `gzip` module does not expose any functionality equivalent to the `-l` list option of the `gzip` program. But in Python 3 you can easily get the size of the uncompressed data by calling the `.seek` method with a `whence` argument of 2, which signifies positioning relative to the end of the (uncompres...
If you want to check whether a file is a valid Gzip file, you can open it and read one byte from it. If it succeeds, the file is quite probably a gzip file, with one caveat: an *empty* file also succeeds this test. Thus we get ``` def is_gz_file(name): with gzip.open(name, 'rb') as f: try: fil...
37,874,939
I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :[Error Message](http://i.stack.imgur.com/OvE2R.jpg) This is the model : ``` public partial class tblArtist { public tblArtist() { this.tblArtistCategoryMap...
2016/06/17
[ "https://Stackoverflow.com/questions/37874939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4757611/" ]
**UPDATE:** i would strongly recommend to upgrade to pandas 0.18.1 (currently the latest version), as each new version of pandas introduces nice new features and fixes tons of old bugs. And the actual version (0.18.1) will process your empty files just out of the box (see demo below). If you can't upgrade to a newer ...
I had a few hundred thousand gzip files, only a few of which are zero-sized, mounted on a network share. I was forced to use the following optimization. It is brittle, but in the (very frequent) case in which you have a large number of files generated using the same method, the sum of all the bytes other than the name ...
67,358,520
I have a long string in R with a series of values that have this pattern: ``` list <- '{s:K_01.01, y:01}="whatever" and {s:K_02.01, y:02}="whatever" and {s:K_03.01, y:03}="whatever" and {s:K_01.01, y:01}="whatever2" and {s:K_01.01, y:01}="whatever3"' ``` I would like to extract and store in a data frame one column w...
2021/05/02
[ "https://Stackoverflow.com/questions/67358520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7845823/" ]
You can extract all the matching using a pattern ``` {s:K_01\.01[^{}]*}="[^"]+" ``` * `{s:K_01\.01` Match a string that starts with `{s:K_01.01` * `[^{}]*}=` Match any char except `{` or `}` and match `}=` * `"[^"]+"` Match from `"` till `"` [See a regex demo](https://regex101.com/r/Gat1m3/1) | [R demo](https://ide...
A base R approach: ``` list <- '{s:K_01.01, y:01}="whatever" and {s:K_02.01, y:02}="whatever" and {s:K_03.01, y:03}="whatever" and {s:K_01.01, y:01}="whatever2" and {s:K_01.01, y:01}="whatever3"' regmatches(list, gregexpr("\\{s:K_01\\.01.*?\\}=\".*?\"", list))[[1]] [1] "{s:K_01.01, y:01}=\"whatever\"" "{s:K_01.01, y...
12,856,559
My new component (TComponent) uses DsgnIntf since I use custom property editors. The problem is when using the component in a custom VCL application - DSGNINTF.DCU not found! One solution is to add a command line switch to a compiler (dont remember any more what is it), but I don't like that solution. The second soluti...
2012/10/12
[ "https://Stackoverflow.com/questions/12856559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1659758/" ]
Usually you create a single unit to register your package in IDE, something like that: ``` unit RegPackage; interface uses Classes, MyUnit; procedure Register; implementation procedure Register; begin RegisterComponents('MyPage', [TMyComponent]); end; end. ``` and include this unit into design-only package...
You must separate your run-time code and design-time code into separate packages. Create a runtime-only package that contains just your component code. Create a designtime-only package that specifies your runtime-only package and the IDE's `DesignIDE` package in its `requires` list, and contains just your property edit...
57,004,193
I'm making a music app, and I'm trying to search my storage for songs and then display the cover art on the layout. I'm already able to display the song name and album. ``` private void loadSongs() { Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; //String selection = Cursor cursor = getContentReso...
2019/07/12
[ "https://Stackoverflow.com/questions/57004193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11774694/" ]
Yes, you can. You'd basically need to get the image from the URI and set it to an `ImageView`. I'd probably recommend you to use a image loading library like [Glide](https://github.com/bumptech/glide) or [Picasso](https://github.com/square/picasso) to reduce the boilerplate code and not have to worry about caching and ...
Yes you must get the Uri or the Url of the image location. I suggest you to use [Glide](https://github.com/bumptech/glide) to load the image into an ImageView. First import Glide in your `module:app` ``` dependencies { ... //Glide implementation 'com.github.bumptech.glide:glide:4.9.0' annotationPro...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
I don't think you're being unreasonable at all. There are many reasons why this arrangement is to your disadvantage, and there seems to be no benefit to yourself. Regarding the fact she sometimes makes you late: you mention that you are sometimes late yourself even without her. Well, almost everybody is sometimes, but...
Your arrangement is operating on the basis of **[social norms](https://whistlinginthewind.org/2013/01/15/predictably-irrational-chapter-4-the-cost-of-social-norms/)**, and it isn't working out because she's not taking care to be socially acceptable. I suggest you change your arrangement to operate on **market norms**....
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
I don't think you're being unreasonable at all. There are many reasons why this arrangement is to your disadvantage, and there seems to be no benefit to yourself. Regarding the fact she sometimes makes you late: you mention that you are sometimes late yourself even without her. Well, almost everybody is sometimes, but...
I have been in a similar situation with carpooling but we were always 3-4 people going together. The system that we used was quite simple. If you were not where you are supposed to be on time you got left behind as it is not fair for 3 other people to be late if you can't make it. At the end of the day you are the o...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
I have been in a similar situation with carpooling but we were always 3-4 people going together. The system that we used was quite simple. If you were not where you are supposed to be on time you got left behind as it is not fair for 3 other people to be late if you can't make it. At the end of the day you are the o...
**Train here**. You want to ride... I vow that I will never leave the station early. *That*, I can control. As for "late", you gotta understand. Stuff happens, paperwork, responsibil-- ok look, at the end of the day, it's because **I'm the train and that's how it is for trains**. That might seem unfair, that she ow...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
I don't think you're being unreasonable at all. There are many reasons why this arrangement is to your disadvantage, and there seems to be no benefit to yourself. Regarding the fact she sometimes makes you late: you mention that you are sometimes late yourself even without her. Well, almost everybody is sometimes, but...
Desperate times require desperate measures. Here I make assumption that your pooling buddy doesn't really react well to verbal pleads made in "good will". And also due to their personality/identity/character your buddy fails to realize that this behaviour is not acceptable. Basically your buddy is getting a "free r...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
Your arrangement is operating on the basis of **[social norms](https://whistlinginthewind.org/2013/01/15/predictably-irrational-chapter-4-the-cost-of-social-norms/)**, and it isn't working out because she's not taking care to be socially acceptable. I suggest you change your arrangement to operate on **market norms**....
Desperate times require desperate measures. Here I make assumption that your pooling buddy doesn't really react well to verbal pleads made in "good will". And also due to their personality/identity/character your buddy fails to realize that this behaviour is not acceptable. Basically your buddy is getting a "free r...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
**Train here**. You want to ride... I vow that I will never leave the station early. *That*, I can control. As for "late", you gotta understand. Stuff happens, paperwork, responsibil-- ok look, at the end of the day, it's because **I'm the train and that's how it is for trains**. That might seem unfair, that she ow...
If you want your colleague to be on time ---------------------------------------- First off, **try to always be on time yourself**. It's much easier to demand other people to be on time if you set an example. Second, stop calling it "carpooling". What you do is not really a case of car sharing, instead **you give her...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
If you want your colleague to be on time ---------------------------------------- First off, **try to always be on time yourself**. It's much easier to demand other people to be on time if you set an example. Second, stop calling it "carpooling". What you do is not really a case of car sharing, instead **you give her...
Desperate times require desperate measures. Here I make assumption that your pooling buddy doesn't really react well to verbal pleads made in "good will". And also due to their personality/identity/character your buddy fails to realize that this behaviour is not acceptable. Basically your buddy is getting a "free r...
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
**Train here**. You want to ride... I vow that I will never leave the station early. *That*, I can control. As for "late", you gotta understand. Stuff happens, paperwork, responsibil-- ok look, at the end of the day, it's because **I'm the train and that's how it is for trains**. That might seem unfair, that she ow...
Your arrangement is operating on the basis of **[social norms](https://whistlinginthewind.org/2013/01/15/predictably-irrational-chapter-4-the-cost-of-social-norms/)**, and it isn't working out because she's not taking care to be socially acceptable. I suggest you change your arrangement to operate on **market norms**....
18,265
**TL;DR:** I drive to work at my own expense. My friend gets a free ride from me, saving her money and time. I say "don't be late" sometimes, and she freaks out. --- So I live in a metropolitan area and have a vehicle. I have a friend/coworker who ditched her car when she moved here so she takes the metro by default....
2018/09/06
[ "https://interpersonal.stackexchange.com/questions/18265", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/21520/" ]
I don't think you're being unreasonable at all. There are many reasons why this arrangement is to your disadvantage, and there seems to be no benefit to yourself. Regarding the fact she sometimes makes you late: you mention that you are sometimes late yourself even without her. Well, almost everybody is sometimes, but...
If you want your colleague to be on time ---------------------------------------- First off, **try to always be on time yourself**. It's much easier to demand other people to be on time if you set an example. Second, stop calling it "carpooling". What you do is not really a case of car sharing, instead **you give her...