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
461,917
I rarely need to disable the wireless network on my laptop, so the `Fn` + `F12` key combination is usually just in the way. It's even more frustrating for some of my friends and family, who don't know the key combination to begin with and so can't get their wireless to work when they accidentally disable it. **Is ther...
2012/08/15
[ "https://superuser.com/questions/461917", "https://superuser.com", "https://superuser.com/users/9217/" ]
There is no way to do this using only the `net use` command (see [documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx)), but there is a way to do this using a vb script, as described by Guy Thomas at computerperformance.co.uk [here](http://computerperformance.co.uk...
``` @echo off echo --------------------------delete map drive all------------------------ net use * /delete /yes echo ------------------create drive -------------------------------- net use m: \\172.16.0.136\Source /user:aleg\masr masr2006* net use n: \\172.16.0.136\scanner_bat_test /user:alwq\4288044 masr2006* echo --...
461,917
I rarely need to disable the wireless network on my laptop, so the `Fn` + `F12` key combination is usually just in the way. It's even more frustrating for some of my friends and family, who don't know the key combination to begin with and so can't get their wireless to work when they accidentally disable it. **Is ther...
2012/08/15
[ "https://superuser.com/questions/461917", "https://superuser.com", "https://superuser.com/users/9217/" ]
There is way to do it from the command line without using VBScript. You can edit the registry using the `reg add` command. IMHO, doing it this way will be better than using VBScript to change the label because it will not associate the label with the drive letter, but rather it will associate the label with the share. ...
``` @echo off echo --------------------------delete map drive all------------------------ net use * /delete /yes echo ------------------create drive -------------------------------- net use m: \\172.16.0.136\Source /user:aleg\masr masr2006* net use n: \\172.16.0.136\scanner_bat_test /user:alwq\4288044 masr2006* echo --...
461,917
I rarely need to disable the wireless network on my laptop, so the `Fn` + `F12` key combination is usually just in the way. It's even more frustrating for some of my friends and family, who don't know the key combination to begin with and so can't get their wireless to work when they accidentally disable it. **Is ther...
2012/08/15
[ "https://superuser.com/questions/461917", "https://superuser.com", "https://superuser.com/users/9217/" ]
There is way to do it from the command line without using VBScript. You can edit the registry using the `reg add` command. IMHO, doing it this way will be better than using VBScript to change the label because it will not associate the label with the drive letter, but rather it will associate the label with the share. ...
There is no way to do this using only the `net use` command (see [documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx)), but there is a way to do this using a vb script, as described by Guy Thomas at computerperformance.co.uk [here](http://computerperformance.co.uk...
7,058,220
By default Windows Phone 7 (WP7) will render the applications **<Title />** over the *ApplicationIcon* when pinned to the start screen. In my case, my title needs two lines to fully render. Given the following WP7 App configuration as an example, is there any mechanism for inserting a line break in the application **<...
2011/08/14
[ "https://Stackoverflow.com/questions/7058220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/308665/" ]
I tried this too and don't think this is possible using the "traditional" technique of settting the title via the XML. I think you're best option is to use a custom background image that includes your multi-line title, formatting it's layout just the way you want it, then remove the tag from the XML configuration file ...
The Title tag for WP7 tile does not support a multi-line title. Your only choice is to insert the title in your tile design and give the title tag no content. Take this into account: - Background.png in your application root is the image used as a tile when pinning the application - Best practice is to give your logo a...
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
The [`ToList`](http://msdn.microsoft.com/en-us/library/bb342261.aspx) method you are looking for is an extension method. Try adding this `using` directive to the top of your file: ``` using System.Linq; ``` By adding this `using` directive you are indicating to the compiler that any extension methods in that namespa...
ToList() is an extension method. Maybe you're missing the ``` using System.Linq; ```
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
In case someone stumbles on this questions after googling... I had the exact same problem in *Razor views* and adding `using System.Linq` at the top didn't help. What did help is calling `.Cast()` before using Linq extension methods: ``` myArrayVariable.Cast<SomeClass>().ToList() //ok, NOW ToList works fine ```
You can also do this without .toList, saves including an entire library for no real reason. new List(array)
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
You can also do this without .toList, saves including an entire library for no real reason. new List(array)
This is simply because `ArrayList` does not expose a method named `ToList`. See [this MSDN page](http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx) for a table view of the members available to you. As explained by others, you may access this *extension* method by importing the Linq library: `...
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
In case someone stumbles on this questions after googling... I had the exact same problem in *Razor views* and adding `using System.Linq` at the top didn't help. What did help is calling `.Cast()` before using Linq extension methods: ``` myArrayVariable.Cast<SomeClass>().ToList() //ok, NOW ToList works fine ```
ToList() is an extension method. Maybe you're missing the ``` using System.Linq; ```
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
In case someone stumbles on this questions after googling... I had the exact same problem in *Razor views* and adding `using System.Linq` at the top didn't help. What did help is calling `.Cast()` before using Linq extension methods: ``` myArrayVariable.Cast<SomeClass>().ToList() //ok, NOW ToList works fine ```
This is simply because `ArrayList` does not expose a method named `ToList`. See [this MSDN page](http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx) for a table view of the members available to you. As explained by others, you may access this *extension* method by importing the Linq library: `...
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
You can also do this without .toList, saves including an entire library for no real reason. new List(array)
This worked for me: ``` var lst = ((IEnumerable<XElement>)doc.Element("cards").Elements("card")).ToList(); ``` My initial result was simply a dynamic. The .Cast() method gave me the same error as ToList() but this did the trick.
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
The [`ToList`](http://msdn.microsoft.com/en-us/library/bb342261.aspx) method you are looking for is an extension method. Try adding this `using` directive to the top of your file: ``` using System.Linq; ``` By adding this `using` directive you are indicating to the compiler that any extension methods in that namespa...
This is simply because `ArrayList` does not expose a method named `ToList`. See [this MSDN page](http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx) for a table view of the members available to you. As explained by others, you may access this *extension* method by importing the Linq library: `...
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
This is simply because `ArrayList` does not expose a method named `ToList`. See [this MSDN page](http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx) for a table view of the members available to you. As explained by others, you may access this *extension* method by importing the Linq library: `...
It's because the Enumerable extension methods aren't available. You need to add "using System.Linq"
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
It's because the Enumerable extension methods aren't available. You need to add "using System.Linq"
This worked for me: ``` var lst = ((IEnumerable<XElement>)doc.Element("cards").Elements("card")).ToList(); ``` My initial result was simply a dynamic. The .Cast() method gave me the same error as ToList() but this did the trick.
5,538,377
I'm getting the above error on the ToList() line of the code below ``` if (emailReplyTo != null) { System.Collections.Generic.List<String> replyto = emailReplyTo // Strip uneccessary spaces .Replace(", ", ",") .Split(',') .ToList(); request.WithReplyToAddresses(emailReplyTo); } ``` I have in...
2011/04/04
[ "https://Stackoverflow.com/questions/5538377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93702/" ]
The [`ToList`](http://msdn.microsoft.com/en-us/library/bb342261.aspx) method you are looking for is an extension method. Try adding this `using` directive to the top of your file: ``` using System.Linq; ``` By adding this `using` directive you are indicating to the compiler that any extension methods in that namespa...
It's because the Enumerable extension methods aren't available. You need to add "using System.Linq"
50,249,604
I have a result of "ImputacionData", and with a reduces it I group it with an attribute of the object: ``` this.imputacionesDatas = data; this.imputacionesAndAusencias = this.imputacionesDatas.reduce(function (r, a) { r[a.empleadoId] = r[a.empleadoId] || []; r[a.empleadoId].push(a); return r; ...
2018/05/09
[ "https://Stackoverflow.com/questions/50249604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5712607/" ]
You could take [`Object.entries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries) for getting keys and values in an array. ``` this.imputacionesAndAusencias = Object.entries(this.imputacionesDatas.reduce(function (r, a) { r[a.empleadoId] = r[a.empleadoId] || []; ...
You can set the accumulator's initial value to `new Map()` and then use the Map methods to set its values. ```js const input = [{ empleadoId: 5 }, { empleadoId: 5 }, { empleadoId: 6 }]; const output = input.reduce((map, item) => { const { empleadoId } = item; if (map.has(empleadoId)) map.get(emplead...
141,944
Many times mathematicians draw proofs about the impossibility of something. As an example, take the Abel–Ruffini theorem, which states no generic formula exists for quintic equations (I know the proof is more contrived that this). Some "proofs" might be wrong though: maybe a formalism was overlooked... maybe there was...
2012/05/06
[ "https://math.stackexchange.com/questions/141944", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1366/" ]
Perhaps one of the most famous is [Cantor's $1887$ "proof"](http://www.jstor.org/discover/10.2307/20117309?uid=3739696&uid=2129&uid=2&uid=70&uid=4&uid=3739256&sid=47698975614357) of the impossibility of infinitesimals. This was presented in a letter to Weierstrass. The "proof" was later elaborated by Peano $(1892)$ and...
Wikipedia has a list of proofs that were later shown to be false or incomplete: [List of incomplete proofs](http://en.wikipedia.org/wiki/List_of_incomplete_proofs)
63,674
We have had several situations when our production MySQL server suddenly became unavailable. The error log just shows "Normal shutdown" followed by the typical shutdown messages. How can I determine the Linux or MySQL user account and host name of the connection issuing the shutdown command?
2014/04/22
[ "https://dba.stackexchange.com/questions/63674", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/37403/" ]
Try and see if this yields the result you want: ``` SELECT some_description FROM something_about_courses A JOIN courses B ON (A.course_code = B.course_code AND A.course_session = B.course_session AND (A.course_type = B.course_type OR B.course_type IS NULL)) ```
As a quick solution, use the `<=>` operator, so ``` AND (A.course_type <=> B.course_type). ``` As a real solution, add a column `id` to course and let `something_about_courses` show to that id column. EDIT: If you want to get rid of the NULL, you don't need to do that manually. What about ``` UPDATE A set course...
47,418,734
I am very new to Javascript and am trying to ensure the date entered in a textbox (i haven't used number as im playing) is not less than todays date. I think I have over complicated this, please can you help me with the logic. I start by reading user date and split user input into dd/mm/yyyy ``` //date regex ensures ...
2017/11/21
[ "https://Stackoverflow.com/questions/47418734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8863141/" ]
Well, you have to process data from database manually and create new array, which would be formatted appropriately. May be something like this? ``` ... $result = []; $data = $sentencia->fetchAll(PDO::FETCH_ASSOC, "Cliente"); foreach ($data as $item) { // Create client if not exists $id = $item['CodCliente']; ...
When you return the data just encode it with json E.g echo json\_encode($data); which we genrally use for apis
47,418,734
I am very new to Javascript and am trying to ensure the date entered in a textbox (i haven't used number as im playing) is not less than todays date. I think I have over complicated this, please can you help me with the logic. I start by reading user date and split user input into dd/mm/yyyy ``` //date regex ensures ...
2017/11/21
[ "https://Stackoverflow.com/questions/47418734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8863141/" ]
Well, you have to process data from database manually and create new array, which would be formatted appropriately. May be something like this? ``` ... $result = []; $data = $sentencia->fetchAll(PDO::FETCH_ASSOC, "Cliente"); foreach ($data as $item) { // Create client if not exists $id = $item['CodCliente']; ...
``` $data = '[{ "CodCliente": "1", "NombreCliente": "Garcia", "Direccion": "Av Uriburu 2569", "Telefono": "4558899" }, { "CodCliente": "1", "NombreCliente": "Garcia", "Direccion": "Pte Roca 1527", "Telefono": "4887541" }, { "CodCliente": ...
47,418,734
I am very new to Javascript and am trying to ensure the date entered in a textbox (i haven't used number as im playing) is not less than todays date. I think I have over complicated this, please can you help me with the logic. I start by reading user date and split user input into dd/mm/yyyy ``` //date regex ensures ...
2017/11/21
[ "https://Stackoverflow.com/questions/47418734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8863141/" ]
Well, you have to process data from database manually and create new array, which would be formatted appropriately. May be something like this? ``` ... $result = []; $data = $sentencia->fetchAll(PDO::FETCH_ASSOC, "Cliente"); foreach ($data as $item) { // Create client if not exists $id = $item['CodCliente']; ...
SQL databases are relational meaning that the result set is per row and that practically means (especially as the number of joins rises) that you can have tenths, hundreds maybe sometimes thousands rows for something that in an object representation can be an object with some nested object/s. From the other hand an obj...
34,542,089
My JS looks something like this ``` $(document).ready(function(){ menuClickHandler(); }); ``` I have ajax based menu, `menuClickHandler` is used to make it work and resides in a separate JS file. `menuClickHandler` associates other functions that are associated to menu item. On click of menu item it calls a func...
2015/12/31
[ "https://Stackoverflow.com/questions/34542089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5625207/" ]
You can use [`.one()`](http://api.jquery.com/one/) instead of [`.on()`](http://api.jquery.com/on/) > > Attach a handler to an event for the elements. The handler is executed at most once per element per event type. > > > *Code* ``` $("div.tree").one("click", ".branch", function(event) { event.stopPropagation...
if for some reason you have to bind click event inside `functionA`, then you can try `off` ``` functionA() { $("div.tree").off("click", ".branch" ); $("div.tree").on("click", ".branch", function(event) { event.stopPropagation(); //some code }); } ``` or else you can do this binding outsi...
34,542,089
My JS looks something like this ``` $(document).ready(function(){ menuClickHandler(); }); ``` I have ajax based menu, `menuClickHandler` is used to make it work and resides in a separate JS file. `menuClickHandler` associates other functions that are associated to menu item. On click of menu item it calls a func...
2015/12/31
[ "https://Stackoverflow.com/questions/34542089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5625207/" ]
You can use [`.one()`](http://api.jquery.com/one/) instead of [`.on()`](http://api.jquery.com/on/) > > Attach a handler to an event for the elements. The handler is executed at most once per element per event type. > > > *Code* ``` $("div.tree").one("click", ".branch", function(event) { event.stopPropagation...
Because Once the function is called you have initialize a function in jquery which will execute without calling the function again. So before calling any function just turn off the jquery function example: ``` $("div.tree").off("click", ".branch" ); functionA(); $("div.tree").off("click", ".branch" ); functionB(); ...
56,038,863
I have the following code: ``` echo $diff . ' / '; echo gmdate("H:i:s", $diff); ``` This produces ``` 129600 / 12:00:00 ``` However 129600 is 36 hours and not 12, so how could I amend the code to be total hours (36) rather than being 1 day and 12 hours as I don't need to show the day So if it was 36 hours and 1 ...
2019/05/08
[ "https://Stackoverflow.com/questions/56038863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/544542/" ]
I don't know how whatsapp manages this but you can use silent notification to achieve the above feature.You need to turn on the background mode for silent notification. When Silent notification comes it doesn't show up on screen like regular notification it will open your application even if your app in terminated mod...
Try using VoIP Pushes, silent push notification wont work if app was intentionally terminated by user.
56,038,863
I have the following code: ``` echo $diff . ' / '; echo gmdate("H:i:s", $diff); ``` This produces ``` 129600 / 12:00:00 ``` However 129600 is 36 hours and not 12, so how could I amend the code to be total hours (36) rather than being 1 day and 12 hours as I don't need to show the day So if it was 36 hours and 1 ...
2019/05/08
[ "https://Stackoverflow.com/questions/56038863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/544542/" ]
What's app is a VoIP app and it's always (in a way) awake in the background. So one can perform api calls to check status of the application messages. If your app has a VoIP feature, you can benefit from it.
Try using VoIP Pushes, silent push notification wont work if app was intentionally terminated by user.
4,021,244
I'm reading the [MCS textbook from MIT](https://courses.csail.mit.edu/6.042/spring18/mcs.pdf) where they state the following: > > The valid formula of part (a) leads to sound proof method: to prove > that an implication is true, just prove that its converse is false. > > > For example, from elementary calculus we ...
2021/02/11
[ "https://math.stackexchange.com/questions/4021244", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
This is a pretty confusing question to ask early in one’s logical education! What’s going on is that, if we want to think about the statement “$p$ implies $q$” and we can prove that the converse “$q$ implies $p$” is false, then in fact we know that $q$ is true and $p$ is false, which means $p$ does imply $q$. That is, ...
If you translate $[A \implies B]~~$ to $~~[(\neg A) \vee B]~~$ then the assertion that (in general) $~~(P \implies Q)~~$ must hold when $~~\neg(Q \implies P)~~$ ::: is a **true assertion**, demonstrated as follows: The only way that the statement $(Q \implies P)$ can be false is if $$(\neg P) \wedge Q.\tag1$$ The ...
18,991,654
I am using an UIImagePickerController within an UIPopoverController which is working perfectly with iOS6. With iOS 7 the "preview" image which is shown to capture the image is rotated, but if I take a picture it is saved correctly. This is how I get my picker: ``` UIImagePickerController *imagePicker = [[UIImagePicke...
2013/09/24
[ "https://Stackoverflow.com/questions/18991654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702961/" ]
The UIImagePickerController has a property called cameraViewTransform. Applying a CGAffineTransform to this will transform the preview image but will not transform the captured image which will therefore be correctly captured. I have the same problem that you describe and I solved it (for iOS7) by creating my camera co...
I've found another solution which handles the case where a device is rotated while the UIIMagePickerView is presenting based on the answer Journeyman provided. It also handles the case where the view is rotated from UIOrientationLandscapeRight/UIOrientationLandscapeLeft back to UIOrientationPortrait. I created a subcl...
18,991,654
I am using an UIImagePickerController within an UIPopoverController which is working perfectly with iOS6. With iOS 7 the "preview" image which is shown to capture the image is rotated, but if I take a picture it is saved correctly. This is how I get my picker: ``` UIImagePickerController *imagePicker = [[UIImagePicke...
2013/09/24
[ "https://Stackoverflow.com/questions/18991654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702961/" ]
The UIImagePickerController has a property called cameraViewTransform. Applying a CGAffineTransform to this will transform the preview image but will not transform the captured image which will therefore be correctly captured. I have the same problem that you describe and I solved it (for iOS7) by creating my camera co...
iPad with Camera - don't display in a popover. Instead, present in a modal view controller, like you would on the iPhone. (at least starting with iOS 7)
18,991,654
I am using an UIImagePickerController within an UIPopoverController which is working perfectly with iOS6. With iOS 7 the "preview" image which is shown to capture the image is rotated, but if I take a picture it is saved correctly. This is how I get my picker: ``` UIImagePickerController *imagePicker = [[UIImagePicke...
2013/09/24
[ "https://Stackoverflow.com/questions/18991654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702961/" ]
The UIImagePickerController has a property called cameraViewTransform. Applying a CGAffineTransform to this will transform the preview image but will not transform the captured image which will therefore be correctly captured. I have the same problem that you describe and I solved it (for iOS7) by creating my camera co...
I had a similar situation in my app. However the preview was rotating correctly in iOS7 and not in iOS8. This code assumes you have more than one orientation. The first thing is to subclass `UIImagePickerController`. Starting from the top, add `#import <AVFoundation/AVFoundation.h>` to your .m file. Also add a prope...
18,991,654
I am using an UIImagePickerController within an UIPopoverController which is working perfectly with iOS6. With iOS 7 the "preview" image which is shown to capture the image is rotated, but if I take a picture it is saved correctly. This is how I get my picker: ``` UIImagePickerController *imagePicker = [[UIImagePicke...
2013/09/24
[ "https://Stackoverflow.com/questions/18991654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702961/" ]
I've found another solution which handles the case where a device is rotated while the UIIMagePickerView is presenting based on the answer Journeyman provided. It also handles the case where the view is rotated from UIOrientationLandscapeRight/UIOrientationLandscapeLeft back to UIOrientationPortrait. I created a subcl...
iPad with Camera - don't display in a popover. Instead, present in a modal view controller, like you would on the iPhone. (at least starting with iOS 7)
18,991,654
I am using an UIImagePickerController within an UIPopoverController which is working perfectly with iOS6. With iOS 7 the "preview" image which is shown to capture the image is rotated, but if I take a picture it is saved correctly. This is how I get my picker: ``` UIImagePickerController *imagePicker = [[UIImagePicke...
2013/09/24
[ "https://Stackoverflow.com/questions/18991654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702961/" ]
I had a similar situation in my app. However the preview was rotating correctly in iOS7 and not in iOS8. This code assumes you have more than one orientation. The first thing is to subclass `UIImagePickerController`. Starting from the top, add `#import <AVFoundation/AVFoundation.h>` to your .m file. Also add a prope...
iPad with Camera - don't display in a popover. Instead, present in a modal view controller, like you would on the iPhone. (at least starting with iOS 7)
30,825,062
I'm working on a program (a chat bot actually, you can see the code [here](https://github.com/RPiAwesomeness/BeamBot) if you want) that has an infinite loop running at all times. I use `asyncio` as part of the code, so I initially tried creating another subroutine that received input and checked for commands. However,...
2015/06/14
[ "https://Stackoverflow.com/questions/30825062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770044/" ]
You should be able to use asyncio since the StdIn is just another stream you can select...
``` from threading import Thread import shlex def endless_job(): while True: pass job = Thread(target=endless_job) job.start() while True: user_input = input('> ') print(shlex.split(user_input)) ``` shlex module helps you to parse the command line entered by the user :) If you need to pass arg...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
As a teacher, I tend to avoid this because even when I ask generic questions to the whole class the discomfort of the students is often patent. With mathematics, also, you are frequently trying to get the students to understand a new idea, and it usually takes time and practice to get it; which means that being partial...
I was routinely called on in high school and college. I think it is a fine practice. I would not obsess too much on how to do it perfectly or some big fear od doing it imperfectly. Still remember snapping awake at the Naval Academy when the Indian ODEs prof asked me some ODE needing an integrating factor to solve it. ...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
**1. Be aware of your goals for calling upon students.** As teachers, it is vitally important that we are goal oriented. As such, we should establish goals not only for learning outcomes but for classroom management and maintaining an atmosphere that is beneficial to learning. Whether or not the method for calling on...
I was routinely called on in high school and college. I think it is a fine practice. I would not obsess too much on how to do it perfectly or some big fear od doing it imperfectly. Still remember snapping awake at the Naval Academy when the Indian ODEs prof asked me some ODE needing an integrating factor to solve it. ...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
This isn't much of an answer, but I think it goes a long ways toward what to think about. > > Know your class really well. > > > Different questions will work for different students. Your third point is a good one, and so you need to know the class well enough to know what sort of question will work for each stud...
I was routinely called on in high school and college. I think it is a fine practice. I would not obsess too much on how to do it perfectly or some big fear od doing it imperfectly. Still remember snapping awake at the Naval Academy when the Indian ODEs prof asked me some ODE needing an integrating factor to solve it. ...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
**1. Be aware of your goals for calling upon students.** As teachers, it is vitally important that we are goal oriented. As such, we should establish goals not only for learning outcomes but for classroom management and maintaining an atmosphere that is beneficial to learning. Whether or not the method for calling on...
As a teacher, I tend to avoid this because even when I ask generic questions to the whole class the discomfort of the students is often patent. With mathematics, also, you are frequently trying to get the students to understand a new idea, and it usually takes time and practice to get it; which means that being partial...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
This isn't much of an answer, but I think it goes a long ways toward what to think about. > > Know your class really well. > > > Different questions will work for different students. Your third point is a good one, and so you need to know the class well enough to know what sort of question will work for each stud...
I emphasize from the beginning of the year that **mistake-making** is to be expected; the specific language that I use can be found in [**MESE 11794**](https://matheducators.stackexchange.com/a/11830). I believe that by ensuring this is a *norm* from the beginning of the academic school year, one is better positioned t...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
This isn't much of an answer, but I think it goes a long ways toward what to think about. > > Know your class really well. > > > Different questions will work for different students. Your third point is a good one, and so you need to know the class well enough to know what sort of question will work for each stud...
As a teacher, I tend to avoid this because even when I ask generic questions to the whole class the discomfort of the students is often patent. With mathematics, also, you are frequently trying to get the students to understand a new idea, and it usually takes time and practice to get it; which means that being partial...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
I emphasize from the beginning of the year that **mistake-making** is to be expected; the specific language that I use can be found in [**MESE 11794**](https://matheducators.stackexchange.com/a/11830). I believe that by ensuring this is a *norm* from the beginning of the academic school year, one is better positioned t...
As a teacher, I tend to avoid this because even when I ask generic questions to the whole class the discomfort of the students is often patent. With mathematics, also, you are frequently trying to get the students to understand a new idea, and it usually takes time and practice to get it; which means that being partial...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
This isn't much of an answer, but I think it goes a long ways toward what to think about. > > Know your class really well. > > > Different questions will work for different students. Your third point is a good one, and so you need to know the class well enough to know what sort of question will work for each stud...
If the question really is "how (best) to call on students?", then I'd say I don't know. If the question is "do I call on students?", then I'd say "no, I do not". I do not do so in undergrad or grad classes, required or elective. I *do* encourage questions, even if frivolous or humorous, and usually there are several st...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
This isn't much of an answer, but I think it goes a long ways toward what to think about. > > Know your class really well. > > > Different questions will work for different students. Your third point is a good one, and so you need to know the class well enough to know what sort of question will work for each stud...
**1. Be aware of your goals for calling upon students.** As teachers, it is vitally important that we are goal oriented. As such, we should establish goals not only for learning outcomes but for classroom management and maintaining an atmosphere that is beneficial to learning. Whether or not the method for calling on...
12,246
I was reading answers to [this question](https://matheducators.stackexchange.com/questions/1/encouraging-class-participation/5#5) today when I realized we never had this followup question: **How do you effectively call on students by name in a math class**? As a way to encourage class participation and class prepara...
2017/05/01
[ "https://matheducators.stackexchange.com/questions/12246", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/11/" ]
This isn't much of an answer, but I think it goes a long ways toward what to think about. > > Know your class really well. > > > Different questions will work for different students. Your third point is a good one, and so you need to know the class well enough to know what sort of question will work for each stud...
I have the opportunity to teach both high school students and undergraduate students in College Algebra and College Trigonometry. In my high school classes, I call on each student at least once per class. This has always been a practice of mine as it encourages participation and engagement. I strongly disagree with cal...
13,978,969
I need to integrate just over half a terabyte of data into MongoDB (about 525GB). They are visits to my website, each line of the file is a tab delimited string This is my main loop: ``` f = codecs.open(directoryLocation+fileWithData, encoding='utf-8') count = 0 #start the line counter for line in f: print line...
2012/12/20
[ "https://Stackoverflow.com/questions/13978969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849354/" ]
As Zagorulkin says, it's important not to be doing a bunch of indexing while inserting, so make sure there are no operative indexed. Beyond that, you probably want to limit the feedback to every 1000 lines (or some useful number based on how many lines you have to input, or how much feedback you want). Instead of doin...
1. `Delete all indexes` which exists in collection 2. If you have a replication than set `w=0, j=0` 3. Use `bulk inserts` Some performance tests: <http://www.arangodb.org/2012/09/04/bulk-inserts-mongodb-couchdb-arangodb>
44,758,773
I am currently trying to work with DotLiquid in C# and I've observed a behavior that I don't quite understand. Since I am not very familiar with C#, I cannot say for sure if my issue is with C# itself, or DotLiquid, so please bear with me. =) I have a very basic `index.liquid` that I am trying to pass a `Table`-object...
2017/06/26
[ "https://Stackoverflow.com/questions/44758773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4631212/" ]
Hopefully saving others from getting tripped up on this. The real reason why the output is the filepath is because **Template.Parse(string source)** expects the actual template *contents*, not a file path. In order to accomplish what you are attempting, you need to use it this way: ``` Template template = Template.Pa...
It is hard to tell without the content of `index.liquid`, but there is already one thing to fix: you are calling `Render` two times, and the second without your object. Try this: ``` public static void createHTML(DataTable table) { string templatePath = @"C:\Path\To\index.liquid"; var template = Template.Pars...
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Note that $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1}).$$ Using $x^2+1 \ge 1$, we get $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1})\ge\ln(x+1).$$
Use the definition of $\operatorname{arcsinh} x$: $$\operatorname{arcsinh} x = \ln (x + \sqrt{1 + x^2})$$
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Let $f\colon(-1,+\infty)\longrightarrow\mathbb R$ be the function defined by $f(x)=\operatorname{arcsinh}(x)-\ln(1+x)$. It is clear that $f(0)=0-0=0$. On the other hand$$\bigl(\forall x\in(-1,+\infty)\bigr):f'(x)=\frac1{\sqrt{1+x^2}}-\frac1{1+x}.$$But, if $x\geqslant0$, then $(1+x)^2=1+x^2+2x\geqslant1+x^2$, and theref...
Use the definition of $\operatorname{arcsinh} x$: $$\operatorname{arcsinh} x = \ln (x + \sqrt{1 + x^2})$$
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
$\begin{array}\\ \sinh(\ln(1+x)) &=\frac12(e^{\ln(1+x)}-e^{-\ln(1+x)})\\ &=\frac12(1+x-\frac1{1+x})\\ &=\frac12(\frac{(1+x)^2-1}{1+x})\\ &=\frac{2x+x^2}{2(1+x)}\\ &=\frac{2x+2x^2-x^2}{2(1+x)}\\ &=x-\frac{x^2}{2(1+x)}\\ &\le x \qquad\text{for } x > -1\\ \end{array} $ Since $\sinh(x)$ and its inverse are monotonic incre...
Use the definition of $\operatorname{arcsinh} x$: $$\operatorname{arcsinh} x = \ln (x + \sqrt{1 + x^2})$$
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Note that $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1}).$$ Using $x^2+1 \ge 1$, we get $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1})\ge\ln(x+1).$$
Defining $$f(x)=\operatorname{arsinh}(x)-\ln(x+1),$$ then we get by differentiating with respect to $x$: $$f'(x)=\frac{1}{\sqrt{1+x^2}}-\frac{1}{x+1}.$$
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Note that $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1}).$$ Using $x^2+1 \ge 1$, we get $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1})\ge\ln(x+1).$$
Let $f\colon(-1,+\infty)\longrightarrow\mathbb R$ be the function defined by $f(x)=\operatorname{arcsinh}(x)-\ln(1+x)$. It is clear that $f(0)=0-0=0$. On the other hand$$\bigl(\forall x\in(-1,+\infty)\bigr):f'(x)=\frac1{\sqrt{1+x^2}}-\frac1{1+x}.$$But, if $x\geqslant0$, then $(1+x)^2=1+x^2+2x\geqslant1+x^2$, and theref...
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Note that $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1}).$$ Using $x^2+1 \ge 1$, we get $$\sinh^{-1}(x) = \ln(x+\sqrt{x^2+1})\ge\ln(x+1).$$
$\begin{array}\\ \sinh(\ln(1+x)) &=\frac12(e^{\ln(1+x)}-e^{-\ln(1+x)})\\ &=\frac12(1+x-\frac1{1+x})\\ &=\frac12(\frac{(1+x)^2-1}{1+x})\\ &=\frac{2x+x^2}{2(1+x)}\\ &=\frac{2x+2x^2-x^2}{2(1+x)}\\ &=x-\frac{x^2}{2(1+x)}\\ &\le x \qquad\text{for } x > -1\\ \end{array} $ Since $\sinh(x)$ and its inverse are monotonic incre...
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Let $f\colon(-1,+\infty)\longrightarrow\mathbb R$ be the function defined by $f(x)=\operatorname{arcsinh}(x)-\ln(1+x)$. It is clear that $f(0)=0-0=0$. On the other hand$$\bigl(\forall x\in(-1,+\infty)\bigr):f'(x)=\frac1{\sqrt{1+x^2}}-\frac1{1+x}.$$But, if $x\geqslant0$, then $(1+x)^2=1+x^2+2x\geqslant1+x^2$, and theref...
Defining $$f(x)=\operatorname{arsinh}(x)-\ln(x+1),$$ then we get by differentiating with respect to $x$: $$f'(x)=\frac{1}{\sqrt{1+x^2}}-\frac{1}{x+1}.$$
2,543,230
before anyone starts blaming me for stating something incorrectly, I copied down the question from my book word by word so I am sorry. I don't know how to approach the problem please help. I was thinking of dividing 3! by 5! but that does not make any sense.
2017/11/29
[ "https://math.stackexchange.com/questions/2543230", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
$\begin{array}\\ \sinh(\ln(1+x)) &=\frac12(e^{\ln(1+x)}-e^{-\ln(1+x)})\\ &=\frac12(1+x-\frac1{1+x})\\ &=\frac12(\frac{(1+x)^2-1}{1+x})\\ &=\frac{2x+x^2}{2(1+x)}\\ &=\frac{2x+2x^2-x^2}{2(1+x)}\\ &=x-\frac{x^2}{2(1+x)}\\ &\le x \qquad\text{for } x > -1\\ \end{array} $ Since $\sinh(x)$ and its inverse are monotonic incre...
Defining $$f(x)=\operatorname{arsinh}(x)-\ln(x+1),$$ then we get by differentiating with respect to $x$: $$f'(x)=\frac{1}{\sqrt{1+x^2}}-\frac{1}{x+1}.$$
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
> > Is it always ok to suggest best formatting practices on code that doesn't follow popular conventions? > > > YES === on Code Review, you can review any aspect of the code you want ([*Do I want feedback about any or all facets of the code?*](https://codereview.stackexchange.com/help/on-topic)). If you feel the ...
I feel that it is OK and valid. Good formatting is one of the best ways to make your code make sense to Mr. Maintainer, along with comments and such. Some marketing people make a living formatting information in a way that's instinctual to the user. Why should programming be any different? Sometimes even a very talen...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
I feel that it is OK and valid. Good formatting is one of the best ways to make your code make sense to Mr. Maintainer, along with comments and such. Some marketing people make a living formatting information in a way that's instinctual to the user. Why should programming be any different? Sometimes even a very talen...
NO, because: ============ Sometimes there are things happening to code-style, when you program for a company. As you specifically asked about, if it's **always** okay to suggest style-changes, I will focus on the **always** you use. Our help center defines: "Do I want feedback about any or all aspects of the code?" a...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
> > Is it always ok to suggest best formatting practices on code that doesn't follow popular conventions? > > > YES === on Code Review, you can review any aspect of the code you want ([*Do I want feedback about any or all facets of the code?*](https://codereview.stackexchange.com/help/on-topic)). If you feel the ...
I agree with the complaint: please don't write a review that consists of formatting nitpicks, unless the formatting is [atrocious and unreadable](https://codereview.stackexchange.com/a/49249/9357). Many programmer already have a misconception that code review is about unproductive arguments on tabs-vs.-spaces, indentat...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
I agree with the complaint: please don't write a review that consists of formatting nitpicks, unless the formatting is [atrocious and unreadable](https://codereview.stackexchange.com/a/49249/9357). Many programmer already have a misconception that code review is about unproductive arguments on tabs-vs.-spaces, indentat...
NO, because: ============ Sometimes there are things happening to code-style, when you program for a company. As you specifically asked about, if it's **always** okay to suggest style-changes, I will focus on the **always** you use. Our help center defines: "Do I want feedback about any or all aspects of the code?" a...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
> > Is it always ok to suggest best formatting practices on code that doesn't follow popular conventions? > > > YES === on Code Review, you can review any aspect of the code you want ([*Do I want feedback about any or all facets of the code?*](https://codereview.stackexchange.com/help/on-topic)). If you feel the ...
As a small addendum to what was already said in all answers: Make clear to op that your advice does not make him a bad coder. As a Programmer, your code is **your baby**. Your heart is often in code and you are emotionally attached. Usually I prefix my style-recommendations to already nicely styled answers with somet...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
> > Is it always ok to suggest best formatting practices on code that doesn't follow popular conventions? > > > YES === on Code Review, you can review any aspect of the code you want ([*Do I want feedback about any or all facets of the code?*](https://codereview.stackexchange.com/help/on-topic)). If you feel the ...
I think that some formatting nitpicks are okay, but be careful about what you're nitpicking about. For some languages, 99.999% of the programmers will be developing using the same IDE. For some, a massive percentage will even all be on the exact same version of the exact same IDE. But in still other languages, there w...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
> > Is it always ok to suggest best formatting practices on code that doesn't follow popular conventions? > > > YES === on Code Review, you can review any aspect of the code you want ([*Do I want feedback about any or all facets of the code?*](https://codereview.stackexchange.com/help/on-topic)). If you feel the ...
NO, because: ============ Sometimes there are things happening to code-style, when you program for a company. As you specifically asked about, if it's **always** okay to suggest style-changes, I will focus on the **always** you use. Our help center defines: "Do I want feedback about any or all aspects of the code?" a...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
As a small addendum to what was already said in all answers: Make clear to op that your advice does not make him a bad coder. As a Programmer, your code is **your baby**. Your heart is often in code and you are emotionally attached. Usually I prefix my style-recommendations to already nicely styled answers with somet...
NO, because: ============ Sometimes there are things happening to code-style, when you program for a company. As you specifically asked about, if it's **always** okay to suggest style-changes, I will focus on the **always** you use. Our help center defines: "Do I want feedback about any or all aspects of the code?" a...
2,151
In an effort to make progress on the oldest JavaScript zombies, I've been offering as much of a review as I'm capable of, based on the content, or the quality of the code, or sometimes, the amount of time that I have available. Even if I can say more, I often leave that to another (more capable) reviewer and move onto ...
2014/07/26
[ "https://codereview.meta.stackexchange.com/questions/2151", "https://codereview.meta.stackexchange.com", "https://codereview.meta.stackexchange.com/users/-1/" ]
I think that some formatting nitpicks are okay, but be careful about what you're nitpicking about. For some languages, 99.999% of the programmers will be developing using the same IDE. For some, a massive percentage will even all be on the exact same version of the exact same IDE. But in still other languages, there w...
NO, because: ============ Sometimes there are things happening to code-style, when you program for a company. As you specifically asked about, if it's **always** okay to suggest style-changes, I will focus on the **always** you use. Our help center defines: "Do I want feedback about any or all aspects of the code?" a...
66,048,484
So I need my bot to get a user from a UserID. I tried it like this: ``` import discord from discord.ext import commands from discord.utils import get client = commands.Bot(command_prefix = '&') @client.command(pass_context = True) async def test(ctx, id : int): user = client.get_user(id) print(user) TOKEN = "" ...
2021/02/04
[ "https://Stackoverflow.com/questions/66048484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15146004/" ]
`ParsedAuthorizationResponse` isn't a *class* (which is why `new` doesn't work), it's a *type*. In this case, it's a bunch of different possible object shapes. Let's have a look ``` export type ParsedAuthorizationResponse = | IAuthResponse< { processorTransactionId: string }, 'AUTHORIZED' | 'CANCELLED'...
Returning a promise type is very easy and is not different then returning a promise of a primitive. Any value you return from an `async` function will be wrapped with a promise, so: ``` const returnsANumber = async (): Promise<number> => { return 42 } type Foo = { foo: true } const returnsAFoo = async (): Promi...
66,048,484
So I need my bot to get a user from a UserID. I tried it like this: ``` import discord from discord.ext import commands from discord.utils import get client = commands.Bot(command_prefix = '&') @client.command(pass_context = True) async def test(ctx, id : int): user = client.get_user(id) print(user) TOKEN = "" ...
2021/02/04
[ "https://Stackoverflow.com/questions/66048484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15146004/" ]
`ParsedAuthorizationResponse` isn't a *class* (which is why `new` doesn't work), it's a *type*. In this case, it's a bunch of different possible object shapes. Let's have a look ``` export type ParsedAuthorizationResponse = | IAuthResponse< { processorTransactionId: string }, 'AUTHORIZED' | 'CANCELLED'...
First, as @thedude said, because your function is already `async` there is no need to return a Promise, whatever you return will be automatically turned into a Promise. Now to answer: "How to return a `ParsedAuthorizationResponse`". Starting with the (part of) defintion: ```js export type ParsedAuthorizationResponse...
41,057,995
I have the following contents from **data.log** file. I wish to extract the ts value and part of the payload (after deadbeef in the payload, third row, starting second to last byte. Please refer to expected output). **data.log** ``` print 1: file offset 0x0 ts=0x584819041ff529e0 2016-12-07 14:13:24.124834649 UTC type...
2016/12/09
[ "https://Stackoverflow.com/questions/41057995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2532296/" ]
Here's one way to get it done: ``` awk -F '=| ' '/^ts=/{printf $2","} /de ad be ef/{if(!a){printf $15$16;a=1}else{print $1$2;a=0}}' data.log ``` Output: ``` 0x584819041ff529e0,85d79121 0x584819041ff52b00,86d79121 ``` Explanation: ``` -F '=| ' : set the field seperator to both '=' and 'space' /^ts...
If you want sed: ``` sed -n -e '/^ts/ {s/^ts=\([^ ]*\) \(.*\)/\1/; H;};' \ -e '/de ad be ef/ {N; s/\(.*\)de ad be ef \([0-9a-f]\+\) \([0-9a-f]\+\) \(.*\) \([0-9a-f]\+\) \([0-9a-f]\+\) \(.*\)/,\2\3\5\6/; H;};' \ -e '$ {x; s/\n,/,/g p;}' file ``` If you are interested in further infos, just ask.
41,057,995
I have the following contents from **data.log** file. I wish to extract the ts value and part of the payload (after deadbeef in the payload, third row, starting second to last byte. Please refer to expected output). **data.log** ``` print 1: file offset 0x0 ts=0x584819041ff529e0 2016-12-07 14:13:24.124834649 UTC type...
2016/12/09
[ "https://Stackoverflow.com/questions/41057995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2532296/" ]
Here's one way to get it done: ``` awk -F '=| ' '/^ts=/{printf $2","} /de ad be ef/{if(!a){printf $15$16;a=1}else{print $1$2;a=0}}' data.log ``` Output: ``` 0x584819041ff529e0,85d79121 0x584819041ff52b00,86d79121 ``` Explanation: ``` -F '=| ' : set the field seperator to both '=' and 'space' /^ts...
awk variant using deadbeef as switch ``` awk -F '[= ]' '/^ts/{s=$2",";a=15} /de ad be ef/{s=s $a $(a+1);if(a==1)print s;a=1}' data.log ``` and a sed variant ``` sed -n -e '/^ts=/{h;b^J}' -e "/de ad be ef/,//{H;g;s/ts=\([^ ]*\).*\n*de ad be ef \(..\) \(..\).*\n\(..\) \(..\).*/\1,\2\3\4\4/p;}" data.log ``` info: "`...
41,057,995
I have the following contents from **data.log** file. I wish to extract the ts value and part of the payload (after deadbeef in the payload, third row, starting second to last byte. Please refer to expected output). **data.log** ``` print 1: file offset 0x0 ts=0x584819041ff529e0 2016-12-07 14:13:24.124834649 UTC type...
2016/12/09
[ "https://Stackoverflow.com/questions/41057995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2532296/" ]
Here's one way to get it done: ``` awk -F '=| ' '/^ts=/{printf $2","} /de ad be ef/{if(!a){printf $15$16;a=1}else{print $1$2;a=0}}' data.log ``` Output: ``` 0x584819041ff529e0,85d79121 0x584819041ff52b00,86d79121 ``` Explanation: ``` -F '=| ' : set the field seperator to both '=' and 'space' /^ts...
With GNU awk for gensub(): ``` $ awk -v RS= '{ gsub(/( |\t)+[^\n]*(\n|$)/," ") print gensub(/.*\nts=(\S+).*de ad be ef (..) (..) (..) (..).*/,"\\1,\\2\\3\\4\\5\\6",1) }' data.log 0x584819041ff529e0,85d79121 0x584819041ff52b00,86d79121 0x584819042006b840,62e69121 ``` The above will work even if deadbeef is s...
50,686,965
I'm trying to make a wrapper in go for the `map` type so that I can add some methods like `contains()` (this almost makes me miss Java). However, I don't know if I can do anything like generics in Java. While almost everything I've read says that Go doesn't have generic types, there must be a better way than writing a...
2018/06/04
[ "https://Stackoverflow.com/questions/50686965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9319868/" ]
Golang does not have generics, as you say. But the maps can be declared using your own types, so you don't necessarily need to write your own "generic" hashmap to use things like "contains" or "is empty". Example (assuming some Icon and Colour types already exist, as well as the `GetTheIcon` function that returns som...
To create functions like contains for maps, you do not need generics. Go can handle this very well, there are more ways to do this, depending on use case some ways can have better performance. You can, for example, consider writing a hashcode function But there is something more to it to consider. In Java generics is...
50,686,965
I'm trying to make a wrapper in go for the `map` type so that I can add some methods like `contains()` (this almost makes me miss Java). However, I don't know if I can do anything like generics in Java. While almost everything I've read says that Go doesn't have generic types, there must be a better way than writing a...
2018/06/04
[ "https://Stackoverflow.com/questions/50686965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9319868/" ]
Golang does not have generics, as you say. But the maps can be declared using your own types, so you don't necessarily need to write your own "generic" hashmap to use things like "contains" or "is empty". Example (assuming some Icon and Colour types already exist, as well as the `GetTheIcon` function that returns som...
Notwithstanding that a Go `map` already supports arbitrary types and some basic constructs as outlined in the [other answer](https://stackoverflow.com/a/50687121/4108803), starting with Go 1.18 you can actually write a generic map type, with an arbitrary method set: ``` type Map[K comparable, V any] map[K]V func (m M...
50,686,965
I'm trying to make a wrapper in go for the `map` type so that I can add some methods like `contains()` (this almost makes me miss Java). However, I don't know if I can do anything like generics in Java. While almost everything I've read says that Go doesn't have generic types, there must be a better way than writing a...
2018/06/04
[ "https://Stackoverflow.com/questions/50686965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9319868/" ]
Notwithstanding that a Go `map` already supports arbitrary types and some basic constructs as outlined in the [other answer](https://stackoverflow.com/a/50687121/4108803), starting with Go 1.18 you can actually write a generic map type, with an arbitrary method set: ``` type Map[K comparable, V any] map[K]V func (m M...
To create functions like contains for maps, you do not need generics. Go can handle this very well, there are more ways to do this, depending on use case some ways can have better performance. You can, for example, consider writing a hashcode function But there is something more to it to consider. In Java generics is...
3,434,527
Here is the code for sorting a `vector` of `string`s ``` #include<iostream> #include <vector> #include <functional> #include <algorithm> #include <ostream> using namespace std; //using std::greater; int main(){ vector<string>s; s.push_back("cat"); s.push_back("a...
2010/08/08
[ "https://Stackoverflow.com/questions/3434527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You are just missing `#include <string>`. The errors do not relate to sorting, they relate to not finding a suitable overload of `<<` to output a string. If you use `std::string`, then include the respective header.
You didn't `#include <string>`.
3,434,527
Here is the code for sorting a `vector` of `string`s ``` #include<iostream> #include <vector> #include <functional> #include <algorithm> #include <ostream> using namespace std; //using std::greater; int main(){ vector<string>s; s.push_back("cat"); s.push_back("a...
2010/08/08
[ "https://Stackoverflow.com/questions/3434527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You didn't `#include <string>`.
Use `#include<string>` This is strange behavior in Visual Studio that it doesn't points out compile error when u use string directly without specifying `#include<string>` but an error is thrown when u use string with any other any stl object/function which try to use any of the overloaded operators.
3,434,527
Here is the code for sorting a `vector` of `string`s ``` #include<iostream> #include <vector> #include <functional> #include <algorithm> #include <ostream> using namespace std; //using std::greater; int main(){ vector<string>s; s.push_back("cat"); s.push_back("a...
2010/08/08
[ "https://Stackoverflow.com/questions/3434527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You are just missing `#include <string>`. The errors do not relate to sorting, they relate to not finding a suitable overload of `<<` to output a string. If you use `std::string`, then include the respective header.
Use `#include<string>` This is strange behavior in Visual Studio that it doesn't points out compile error when u use string directly without specifying `#include<string>` but an error is thrown when u use string with any other any stl object/function which try to use any of the overloaded operators.
75,296
Christoph Wetterich has put out [a paper](https://arxiv.org/abs/1303.6878) in which the universe isn't always expanding; it can be static or expanding just some of the time or even shrinking. And then there is an interaction which makes the masses of fundamental particles change in a complementary way, so as to preserv...
2013/08/26
[ "https://physics.stackexchange.com/questions/75296", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/1486/" ]
First a correction: Wetterich's paper doesn't say the universe is expanding or shrinking. All it says is that physics is invariant under scale changes and that a perspective in which the universe is static or shrinking (depending on the evolution stage) can lead to a simpler description. The scale change applied cons...
Varying electron mass (via e.g. varying Higgs VEV) alone can cause red shift (reflected as the changed photon frequency while an electron jumps from one quantum state to another, with electron-mass-dependent orbiting energy levels) without resorting to the commonly accepted expanding universe scenario. That being said...
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
This could be done using numpy chararray: ``` import numpy as np username = raw_input('User name: ') mail = imaplib.IMAP4(MAIL_HOST) x = np.chararray((20,)) x[:] = list("{:<20}".format(raw_input('Password: '))) mail.login(username, x.tobytes().strip()) x[:] = '' ``` You would have to determine the maximum size of p...
Store the password in a list, and if you just set the list to null, the memory of the array stored in the list is automatically freed.
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
There actually -is- a way to securely erase strings in Python; use the memset C function, as per [Mark data as sensitive in python](https://stackoverflow.com/questions/982682/mark-data-as-sensitive-in-python/983525#983525) Edited to add, long after the post was made: [here's a deeper dive into string interning](http:/...
The correct solution is to use a bytearray() ... which is mutable, and you can safely clear keys and sensitive material from RAM. However, there are some libraries, notably the python "cryptography" library that prevent "bytearray" from being used. This is problematic... to some extent these cryptographic libraries sh...
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
This could be done using numpy chararray: ``` import numpy as np username = raw_input('User name: ') mail = imaplib.IMAP4(MAIL_HOST) x = np.chararray((20,)) x[:] = list("{:<20}".format(raw_input('Password: '))) mail.login(username, x.tobytes().strip()) x[:] = '' ``` You would have to determine the maximum size of p...
EDIT: removed the bad advice... You can also use arrays like the java example if you like, but just overwriting it should be enough. <http://docs.python.org/library/array.html>
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
There actually -is- a way to securely erase strings in Python; use the memset C function, as per [Mark data as sensitive in python](https://stackoverflow.com/questions/982682/mark-data-as-sensitive-in-python/983525#983525) Edited to add, long after the post was made: [here's a deeper dive into string interning](http:/...
Store the password in a list, and if you just set the list to null, the memory of the array stored in the list is automatically freed.
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
If you don't need the mail object to persist once you are done with it, I think your best bet is to perform the mailing work in a subprocess (see the [subprocess](http://docs.python.org/library/subprocess.html) module.) That way, when the subprocess dies, so goes your password.
Store the password in a list, and if you just set the list to null, the memory of the array stored in the list is automatically freed.
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
Python doesn't have that low of a level of control over memory. Accept it, and move on. The **best** you can do is to `del password` after calling `mail.login` so that no references to the password string object remain. Any solution that purports to be able to do more than that is only giving you a false sense of secur...
There actually -is- a way to securely erase strings in Python; use the memset C function, as per [Mark data as sensitive in python](https://stackoverflow.com/questions/982682/mark-data-as-sensitive-in-python/983525#983525) Edited to add, long after the post was made: [here's a deeper dive into string interning](http:/...
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
Python doesn't have that low of a level of control over memory. Accept it, and move on. The **best** you can do is to `del password` after calling `mail.login` so that no references to the password string object remain. Any solution that purports to be able to do more than that is only giving you a false sense of secur...
EDIT: removed the bad advice... You can also use arrays like the java example if you like, but just overwriting it should be enough. <http://docs.python.org/library/array.html>
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
If you don't need the mail object to persist once you are done with it, I think your best bet is to perform the mailing work in a subprocess (see the [subprocess](http://docs.python.org/library/subprocess.html) module.) That way, when the subprocess dies, so goes your password.
EDIT: removed the bad advice... You can also use arrays like the java example if you like, but just overwriting it should be enough. <http://docs.python.org/library/array.html>
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
There actually -is- a way to securely erase strings in Python; use the memset C function, as per [Mark data as sensitive in python](https://stackoverflow.com/questions/982682/mark-data-as-sensitive-in-python/983525#983525) Edited to add, long after the post was made: [here's a deeper dive into string interning](http:/...
If you don't need the mail object to persist once you are done with it, I think your best bet is to perform the mailing work in a subprocess (see the [subprocess](http://docs.python.org/library/subprocess.html) module.) That way, when the subprocess dies, so goes your password.
728,164
How do you store a password entered by the user in memory and erase it securely after it is no longer need? To elaborate, currently we have the following code: ``` username = raw_input('User name: ') password = getpass.getpass() mail = imaplib.IMAP4(MAIL_HOST) mail.login(username, password) ``` After calling the `l...
2009/04/08
[ "https://Stackoverflow.com/questions/728164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72990/" ]
Python doesn't have that low of a level of control over memory. Accept it, and move on. The **best** you can do is to `del password` after calling `mail.login` so that no references to the password string object remain. Any solution that purports to be able to do more than that is only giving you a false sense of secur...
This could be done using numpy chararray: ``` import numpy as np username = raw_input('User name: ') mail = imaplib.IMAP4(MAIL_HOST) x = np.chararray((20,)) x[:] = list("{:<20}".format(raw_input('Password: '))) mail.login(username, x.tobytes().strip()) x[:] = '' ``` You would have to determine the maximum size of p...
50,508,883
I have some data like this: ``` "players": [ { "name": "Molla Wague", "position": "Centre-Back", "jerseyNumber": 13, "dateOfBirth": "1991-02-21", "nationality": "Mali", "contractUntil": "2018-06-30", "marketValue": null }, { "name": "Heurelho Gomes", "position": "Keeper...
2018/05/24
[ "https://Stackoverflow.com/questions/50508883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6223914/" ]
You can first make the array of ordered positions: ``` const ORDERS = [ 'Keeper', 'Centre-Back', ... ] ``` And the sort your initial array by this ORDERS array ``` players.sort((player1, player2) => { return ORDERS.indexOf(player2.position) - ORDERS.indexOf(player1.position); }); ```
You can try with: ``` const positions = [ 'Keeper', 'Centre-Back', 'Right-Back', 'Left-Back', 'Defensive Midfield', 'Central Midfield', 'Attacking Midfield', 'Right Wing', 'Left Wing', 'Centre-Forward', ]; data.players.sort((a, b) => positions.indexOf(a.position) > positions.indexOf(b.position)); ``` Output: `...
50,508,883
I have some data like this: ``` "players": [ { "name": "Molla Wague", "position": "Centre-Back", "jerseyNumber": 13, "dateOfBirth": "1991-02-21", "nationality": "Mali", "contractUntil": "2018-06-30", "marketValue": null }, { "name": "Heurelho Gomes", "position": "Keeper...
2018/05/24
[ "https://Stackoverflow.com/questions/50508883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6223914/" ]
You can first make the array of ordered positions: ``` const ORDERS = [ 'Keeper', 'Centre-Back', ... ] ``` And the sort your initial array by this ORDERS array ``` players.sort((player1, player2) => { return ORDERS.indexOf(player2.position) - ORDERS.indexOf(player1.position); }); ```
You can define an object containing sort priorities and define a custom sorting function as below: ```js players = [ { "name": "Molla Wague", "position": "Centre-Back", "jerseyNumber": 13, "dateOfBirth": "1991-02-21", "nationality": "Mali", "contractUntil": "2018-06-30", "market...
28,763,274
I'm getting a TimeStampToken (RFC3161) by using a java based client. I need to store all the information included in TSTInfo in a database, MySql or Oracle.Is there any specific format to store it?
2015/02/27
[ "https://Stackoverflow.com/questions/28763274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1511523/" ]
There is no specified format1 for this kind of thing. But some obvious alternatives spring to mind: * Store the DER-encoded form as a BLOB. * Take the DER-encoded form, base-64 encoded it and store it in a CHAR(n) column. * Create a table with columns to represent each of the fields of the `TSSInfo` structure ... ass...
Note that if you only store the TSTInfo, you lose the signature, which is the whole point of having an RFC3161 token. The TSTInfo without the signature proves nothing! To preserve its evidentiary property, you really should store the entire timestamp token (which is defined as the signed CMS ContentInfo that wraps the...
148,954
I want to draw block inside another block as the following picture ![enter image description here](https://i.stack.imgur.com/gqcEJ.jpg) I do apologize if the picture is not clear. My problem is how can I draw block inside another block? I don't have a problem with the rest of the picture.
2013/12/08
[ "https://tex.stackexchange.com/questions/148954", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/42366/" ]
This is a way to draw the diagram. ![enter image description here](https://i.stack.imgur.com/qryhQ.jpg) ``` \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,fit,arrows} \begin{document} \begin{center} \begin{tikzpicture}[auto,node distance=2cm,>=stealth'] \tikzset{block/.style= {draw, rectangle, minim...
just small modification/simplification of Jesse code: ``` \documentclass[tikz,border=5mm]{standalone}% my modification \usetikzlibrary{arrows,fit,positioning} \begin{document} \begin{tikzpicture}[node distance=2cm, >=stealth', block/.style = {draw, rectangle, minimum height=2em,minimum width=4em}, sum/.style...
59,579,796
I'm trying to group my observations by a set of variables under another set of variables which is, finally, under a last set of variables. Here's what I have for example: ``` country name ethnicity party Afghanistan john Pashtun X Party Afghanistan oliver Pashtun Y Party ...
2020/01/03
[ "https://Stackoverflow.com/questions/59579796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12647025/" ]
In my case code sign failing issue happened because of keeping project files on shared iCloud directory. I realized that after trying out all popular suggestions like `flutter clean` or xCode wizardry actions related to this issue, so I finally managed to re-create the project in local non-shared drive directory and th...
I managed to fix that by switching off "Automatically manage signing" and used a distribution certificate and profile which I had to create on the Apple developer website beforehand.
39,390,709
Auto Incremented column start with first character of Name, month(09), then four digits that are incremented automatically . (for "Transworld"-August-08-stock number is 1): T080001 using C# and Enitity framework. How can i achieve this?
2016/09/08
[ "https://Stackoverflow.com/questions/39390709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6809105/" ]
You can use temporary table for this task as below: ``` SELECT DISTINCT * INTO #tmpTable FROM MyTable TRUNCATE TABLE MyTable INSERT INTO MyTable SELECT * FROM #tmpTable ```
You can create an empty copy of the table. Then you run an `INSERT INTO new_table SELECT DISTINCT * FROM old_table`. Finally, drop the old table and rename the new one.
39,390,709
Auto Incremented column start with first character of Name, month(09), then four digits that are incremented automatically . (for "Transworld"-August-08-stock number is 1): T080001 using C# and Enitity framework. How can i achieve this?
2016/09/08
[ "https://Stackoverflow.com/questions/39390709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6809105/" ]
You can use temporary table for this task as below: ``` SELECT DISTINCT * INTO #tmpTable FROM MyTable TRUNCATE TABLE MyTable INSERT INTO MyTable SELECT * FROM #tmpTable ```
One way of doing this - using [CTE](https://technet.microsoft.com/en-us/library/ms190766(v=sql.105).aspx) ``` create table #dups (col1 int, col2 int) insert into #dups select null,null union all select null,1 union all select null,1 union all select null,1 union all select null,2 union all select null,2 union all sele...
39,390,709
Auto Incremented column start with first character of Name, month(09), then four digits that are incremented automatically . (for "Transworld"-August-08-stock number is 1): T080001 using C# and Enitity framework. How can i achieve this?
2016/09/08
[ "https://Stackoverflow.com/questions/39390709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6809105/" ]
You can use temporary table for this task as below: ``` SELECT DISTINCT * INTO #tmpTable FROM MyTable TRUNCATE TABLE MyTable INSERT INTO MyTable SELECT * FROM #tmpTable ```
1) If you want to keep the row with the lowest id value: ``` DELETE n1 FROM names n1, names n2 WHERE n1.id > n2.id AND n1.name = n2.name ``` 2) If you want to keep the row with the highest id value: ``` DELETE n1 FROM names n1, names n2 WHERE n1.id < n2.id AND n1.name = n2.name ``` Please get the copy of your tab...
39,390,709
Auto Incremented column start with first character of Name, month(09), then four digits that are incremented automatically . (for "Transworld"-August-08-stock number is 1): T080001 using C# and Enitity framework. How can i achieve this?
2016/09/08
[ "https://Stackoverflow.com/questions/39390709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6809105/" ]
You can use temporary table for this task as below: ``` SELECT DISTINCT * INTO #tmpTable FROM MyTable TRUNCATE TABLE MyTable INSERT INTO MyTable SELECT * FROM #tmpTable ```
If I understood right, you want to avoid for the column2 NULL and blanks? ``` SELECT COLUMN1, COLUMN2 FROM TABLE GROUP BY COLUMN1, COLUMN2 WHERE COLUMN2 NOT NULL AND COULMN2 <> '' ``` This query is going to show results only when the COLUMN2 has some data.
39,390,709
Auto Incremented column start with first character of Name, month(09), then four digits that are incremented automatically . (for "Transworld"-August-08-stock number is 1): T080001 using C# and Enitity framework. How can i achieve this?
2016/09/08
[ "https://Stackoverflow.com/questions/39390709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6809105/" ]
You can use temporary table for this task as below: ``` SELECT DISTINCT * INTO #tmpTable FROM MyTable TRUNCATE TABLE MyTable INSERT INTO MyTable SELECT * FROM #tmpTable ```
try this ``` DELETE FROM [Table] WHERE (ColmnB IN (SELECT ColumnB FROM [Table] AS Table_1 GROUP BY ColumnB HAVING (COUNT(*) > 1))) OR (RTRIM(LTRIM(ISNULL(ColumnB,''))) = '') ``` tab...
13,481,069
Here is the SQL query in question: ``` select * from company1 left join company2 on company2.model LIKE CONCAT(company1.model,'%') where company1.manufacturer = company2.manufacturer ``` company1 contains 2000 rows while company2 contains 9000 rows. The query takes around 25 seconds to complete. I ha...
2012/11/20
[ "https://Stackoverflow.com/questions/13481069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974990/" ]
This query is not conceptually identical to yours, but maybe you want something like this? I am quite sure it will give you the same result as yours: ``` select * from company1 inner join company2 on company1.manufacturer = company2.manufacturer where company2.model LIKE CONCAT(company1.model,'%') ``` **EDIT...
One way to speed this up is to remove the `LIKE CONCAT()` from the join condition. MySQL is not able to use an index for substring based searches like that, so your query results in a full table scan.
13,481,069
Here is the SQL query in question: ``` select * from company1 left join company2 on company2.model LIKE CONCAT(company1.model,'%') where company1.manufacturer = company2.manufacturer ``` company1 contains 2000 rows while company2 contains 9000 rows. The query takes around 25 seconds to complete. I ha...
2012/11/20
[ "https://Stackoverflow.com/questions/13481069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974990/" ]
This query is not conceptually identical to yours, but maybe you want something like this? I am quite sure it will give you the same result as yours: ``` select * from company1 inner join company2 on company1.manufacturer = company2.manufacturer where company2.model LIKE CONCAT(company1.model,'%') ``` **EDIT...
Your `EXPLAIN` shows that you have no indexes that can be used. Appropriate indexes on both tables would help. Either a single index on `(manufacturer)` or a composite `(manufacturer, model)`: ``` ALTER TABLE company1 ADD INDEX manufacturer_model_IDX --- this is just a name (of your choice) (manufacturer...
13,481,069
Here is the SQL query in question: ``` select * from company1 left join company2 on company2.model LIKE CONCAT(company1.model,'%') where company1.manufacturer = company2.manufacturer ``` company1 contains 2000 rows while company2 contains 9000 rows. The query takes around 25 seconds to complete. I ha...
2012/11/20
[ "https://Stackoverflow.com/questions/13481069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974990/" ]
One way to speed this up is to remove the `LIKE CONCAT()` from the join condition. MySQL is not able to use an index for substring based searches like that, so your query results in a full table scan.
Your `EXPLAIN` shows that you have no indexes that can be used. Appropriate indexes on both tables would help. Either a single index on `(manufacturer)` or a composite `(manufacturer, model)`: ``` ALTER TABLE company1 ADD INDEX manufacturer_model_IDX --- this is just a name (of your choice) (manufacturer...
30,312,460
I need to build up an argument list for `find` using values only known at run time. I'm trying to use an array to do so. Below is a simplified version which uses hard coded values. When I echo out the command it appears to be correct (and when I run it manually it does what I'd expect). When it enters the for-loop it...
2015/05/18
[ "https://Stackoverflow.com/questions/30312460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1011471/" ]
You shouldn't escape the quotes. That will make them literal, so it will try to find files whose names actually begin and end with doublequotes. ``` args=(/tmp -iname "*.txt") ``` Then you need to put quotes around `${args[@]}` to tell the shell that it should requote them when expanding the array: ``` find "(" "${...
Bash4 can expand globs recursively with `shopt -s globstar`. Just use `array=(/tmp/**/*.txt)` to get all the elements.
111,685
We have deployed mongodb replica set: ``` mongod --port 27017 --dbpath /opt/eltropy/mongodb/data/rs0-1 --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27018 --dbpath /opt/eltropy/mongodb/data/rs0-1 --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27019 --dbpath /opt/eltropy/mongodb/data/rs0-1 ...
2015/08/20
[ "https://dba.stackexchange.com/questions/111685", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/73201/" ]
The reason ========== The answer is quite simple: when two voting nodes of three are down, the remaining one reverts to secondary, to which – by definition – one can't write. The default [read preference](http://docs.mongodb.org/manual/core/read-preference/) is to read from and write to the primary of a replica set on...
MongoDB nodes will vote of who can be next Primary, with a **majority of votes**. * 3 nodes : at least 2 have to choose a certain node. When 2 of the 3 can't vote, the the remaining one, has 1 vote out of 3 => no majority * 3 nodes + arbiter : now you have 2 votes out of 4, what is still no majority. Solutions: * Yo...
15,125,723
I have an array that I need to access the elements of dependant on which item in a listView has been clicked. The first int value sent to the getView() method i.e int arg0 is this the ID of the element of the array that has been clicked? Do I need to assign the ID from a listview onClickListner? ``` public View getVi...
2013/02/28
[ "https://Stackoverflow.com/questions/15125723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1352057/" ]
Every item in your ListView is a view and getView is responsible for creating these views for your Listview. Following is the excerpt from the Android documentation : ``` public abstract View getView (int position, View convertView, ViewGroup parent) **Parameters** ``` > > **position:** The position of the item wi...
getView has nothing to do with clicks. It gets the view for the Nth position in the list, where N is the first parameter. It should only be called by the ListView itself, its used by the ListView to initialize its views when scrolled.
57,539
I recently read [a New York Times article](https://www.nytimes.com/2018/11/24/opinion/sunday/facebook-twitter-terrorism-extremism.html) that expresses concern about the flourishing of "toxic ideas". Such ideas are characterized as > > Antiglobalism, racial or ethnic supremacy, nationalism, suspicion of the federal go...
2018/11/29
[ "https://philosophy.stackexchange.com/questions/57539", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/31780/" ]
If you reduce your statement to the known facts, of course there is nothing wrong with the statement. "I saw something in the sky on three separate occasions." "The thing or things was alive / mechanistic / inert and personal / impersonal." "I did not know what the thing or things was / I did know what the thing or ...
Historians sometimes make lists of the things they look for when they make a theory to cover the evidence. Here is one such list that I'm familiar with: * Explanatory power: the theory makes a satisfying explanation with few objections. * Explanatory scope: the theory makes a full explanation with few loose ends. * Pl...
10,656,561
I am making an application that calculates some numbers, some of the answers have no decimal and some have. So I made an if-else, to format the numbers using `NSNumberFormatter` depending if they have decimals or not. When it doesn't, everything works fine, the number is correctly formatted and the label autoshrinks c...
2012/05/18
[ "https://Stackoverflow.com/questions/10656561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388326/" ]
Use the following code to avoid a **null** bitmap: --- ``` public class AndroidWebImage extends Activity { ImageView bmImage; LinearLayout view; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setCont...
All the programs which allow screenshots work only on rooted phones? if your phone is a rooted one you can try using this : ``` public class ScreenCapture extends Activity{ LinearLayout view; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generat...