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
5,799,532
Can anyone tell me why the following dialog box does not show until the *asynchronous* thread has finished. I cannot figure this one out. This is running in the main UI thread. Not sure why a new thread would affect the flow of the main UI thread ``` dialog = new ProgressDialog(this); ...
2011/04/27
[ "https://Stackoverflow.com/questions/5799532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726541/" ]
You need to call the `start()` method of the anonymous Thread, not the `run()` method. From the [docs](http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html#start()): > > public void start(): Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. > > >
call the start method i reccomend to use use AsyncTask see [this](http://developer.android.com/reference/android/os/AsyncTask.html) , it has proper thread handling mechanism [see this example as well](https://stackoverflow.com/questions/1921514/how-to-run-a-runnable-thread-in-android)
5,799,532
Can anyone tell me why the following dialog box does not show until the *asynchronous* thread has finished. I cannot figure this one out. This is running in the main UI thread. Not sure why a new thread would affect the flow of the main UI thread ``` dialog = new ProgressDialog(this); ...
2011/04/27
[ "https://Stackoverflow.com/questions/5799532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726541/" ]
call the start method i reccomend to use use AsyncTask see [this](http://developer.android.com/reference/android/os/AsyncTask.html) , it has proper thread handling mechanism [see this example as well](https://stackoverflow.com/questions/1921514/how-to-run-a-runnable-thread-in-android)
Don't expect threads to follow the flow of your code. I suggest to use AsyncTask and for showing the dialog you can show the dialog in onPreExecute() and remove it in onPostExecute() or may be you like to try runOnUiThread()
1,025,428
I wanted to know is there any way programmatically in win32, where I can get the URL being fetched from browser. Like for example as we have MIB table, which shows data sent and received from Ethernet card, can we get the URL being fetched from system Thanks in advance.
2009/06/22
[ "https://Stackoverflow.com/questions/1025428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122939/" ]
This is an IE-only solution, but if you write a [browser helper object](http://msdn.microsoft.com/en-us/library/bb250489(VS.85).aspx), it will be notified before IE navigates to a new URL.
There is no simple way to do this. The main problem you will encounter is that each browser on your system will independently connect to a webserver. That's just a straightforward HTTP connection, usually on port 80. The browser will send the URL in an HTTP request, possibly in multiple TCP packets. So, unless you are ...
1,025,428
I wanted to know is there any way programmatically in win32, where I can get the URL being fetched from browser. Like for example as we have MIB table, which shows data sent and received from Ethernet card, can we get the URL being fetched from system Thanks in advance.
2009/06/22
[ "https://Stackoverflow.com/questions/1025428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122939/" ]
This is an IE-only solution, but if you write a [browser helper object](http://msdn.microsoft.com/en-us/library/bb250489(VS.85).aspx), it will be notified before IE navigates to a new URL.
You could try using [WinPCap](http://wiki.wireshark.org/WinPcap), which is what's utilized by Wireshark. What this would allow you to do is put the network interface into "promiscuous mode," and from there you could just look for HTTP traffic. From there, you could extract the URLs that are being requested, no matter w...
28,237,338
I tested the following codes many times. It works well and I get the result of "return photoMenu\_sb.ToString();" as soon as I remove the string argument photoFileName. But when I declare and try to pass the string photoFileName nothing happens. Why? I think the problem lies in declaring and passing the string photoF...
2015/01/30
[ "https://Stackoverflow.com/questions/28237338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822465/" ]
Try creating a string variable that holds the javascript function string: ``` var img = String.Format("<img src='Images/Design/openmenu.png' onclick='photoMenu({0},'{1}')' />", item.IDphoto, item.photoFileName); photosPopup_sb.Append(img); ``` In your JavaScript, you need to also set the json data property for the...
I think you are missing a parenthesis ")": ``` photosPopup_sb.Append("<img src=\"Images/Design/openmenu.png\" onclick=\"photoMenu(" + IDphoto + ", '" + photoFileName + "')\" />"); ```
28,237,338
I tested the following codes many times. It works well and I get the result of "return photoMenu\_sb.ToString();" as soon as I remove the string argument photoFileName. But when I declare and try to pass the string photoFileName nothing happens. Why? I think the problem lies in declaring and passing the string photoF...
2015/01/30
[ "https://Stackoverflow.com/questions/28237338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822465/" ]
Try creating a string variable that holds the javascript function string: ``` var img = String.Format("<img src='Images/Design/openmenu.png' onclick='photoMenu({0},'{1}')' />", item.IDphoto, item.photoFileName); photosPopup_sb.Append(img); ``` In your JavaScript, you need to also set the json data property for the...
I don't see an example value of your `photoFileName` but if it has backslashes, you would probably have to make sure that the string is escaped properly. For example: ``` //causes errors called(1, 'file\path\img.png'); //successful called(1, 'file/path/img.png'); ```
60,211
I'm using the KeyboardState state way (if there are any others) of handling key presses for a PC game. It has been working fine for single key presses but now I am trying to handle multiple key presses at once. I have it grab the newState at the top and then save it to the oldState at the bottom. I've tried it this wa...
2013/08/04
[ "https://gamedev.stackexchange.com/questions/60211", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/22632/" ]
This should do the trick. You have to record last state to be able to compare 'alt' button state. If you compare it to last state, you can see if it's being held down. After you are sure, alt is being held down, you have to make sure that D2 was just pressed. You do this, by checking if in last state it was up and is n...
Its your use of `else` that is messing you up. The "else" (D2) is only checked if the Alt is not pressed. The reason it works when holding 2 down first, is because the next frame it senses the alt. try: ``` for(I = 0; currentKeys.Length, I++)//how you syntaxed it { if(curren...[i] == leftAlt) { altPressed=tr...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
I can't give you the full answer, but I am pretty sure you will find it in "Fundamentals of Texture Mapping and Image Warping" by Paul S. Heckbert: <http://www.cs.cmu.edu/~ph/texfund/texfund.pdf> (in the appendix it contains source code for all kinds of mappings)
Do you want help from algorithmic point of view (Transformations etc) or are you looking for help on how to achieve transformations specifically using Sandy 3D flash engine?
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
Let (u,v) represent "texture" coordinates. Your handles stay at the same texture coordinates regardless of grid distortions. So, in texture space, A=(0,0) B=(1,0) C=(1,1) D=(0,1) A'=(au,av) B'=(bu,bv) ... We can convert from texture space to pixel space. P(u,v) = A\*(1-u)*(1-v) + B*u\*(1-v) + C*u*v + D\*(1-u)\*v (u...
You speak of a 2D system, yet the distortion you're applying is a 3D distortion (albeit projected back down into 2d, of course) - is that intentional? In general, I'm not actually sure it's possibly to compute A'new's new location without more information about the perspective projection being using than just ABCD's n...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
Let (u,v) represent "texture" coordinates. Your handles stay at the same texture coordinates regardless of grid distortions. So, in texture space, A=(0,0) B=(1,0) C=(1,1) D=(0,1) A'=(au,av) B'=(bu,bv) ... We can convert from texture space to pixel space. P(u,v) = A\*(1-u)*(1-v) + B*u\*(1-v) + C*u*v + D\*(1-u)\*v (u...
Do you want help from algorithmic point of view (Transformations etc) or are you looking for help on how to achieve transformations specifically using Sandy 3D flash engine?
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
This looks like a linear transformation to me. We know this because any line in the original graph is also a line in the transformed graph (this is not always true of the demo you gave, but will be true if you follow the directions you gave in your question and not allow concave vertices). I do believe that AS3 has bui...
Are you sure that you want to be getting into all of this for handles? in the examples the handles are there to act as reference points on the movieclip for drawing, they are not related in any way to the image or the distortion apon it. if you are wanting to just have the handlers inside the image then you would just ...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
This looks like a linear transformation to me. We know this because any line in the original graph is also a line in the transformed graph (this is not always true of the demo you gave, but will be true if you follow the directions you gave in your question and not allow concave vertices). I do believe that AS3 has bui...
You could probably figure something out, but I doubt that you or your users are going to like the result. To see why, select a point in the interior of the image. Say you want to move it upwards by a bit. You can do that by moving any one of the four corners (try it in the demo). That means if you wanted to put a hand...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
This looks like a linear transformation to me. We know this because any line in the original graph is also a line in the transformed graph (this is not always true of the demo you gave, but will be true if you follow the directions you gave in your question and not allow concave vertices). I do believe that AS3 has bui...
You speak of a 2D system, yet the distortion you're applying is a 3D distortion (albeit projected back down into 2d, of course) - is that intentional? In general, I'm not actually sure it's possibly to compute A'new's new location without more information about the perspective projection being using than just ABCD's n...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
I can't give you the full answer, but I am pretty sure you will find it in "Fundamentals of Texture Mapping and Image Warping" by Paul S. Heckbert: <http://www.cs.cmu.edu/~ph/texfund/texfund.pdf> (in the appendix it contains source code for all kinds of mappings)
You speak of a 2D system, yet the distortion you're applying is a 3D distortion (albeit projected back down into 2d, of course) - is that intentional? In general, I'm not actually sure it's possibly to compute A'new's new location without more information about the perspective projection being using than just ABCD's n...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
Let (u,v) represent "texture" coordinates. Your handles stay at the same texture coordinates regardless of grid distortions. So, in texture space, A=(0,0) B=(1,0) C=(1,1) D=(0,1) A'=(au,av) B'=(bu,bv) ... We can convert from texture space to pixel space. P(u,v) = A\*(1-u)*(1-v) + B*u\*(1-v) + C*u*v + D\*(1-u)\*v (u...
You could probably figure something out, but I doubt that you or your users are going to like the result. To see why, select a point in the interior of the image. Say you want to move it upwards by a bit. You can do that by moving any one of the four corners (try it in the demo). That means if you wanted to put a hand...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
I can't give you the full answer, but I am pretty sure you will find it in "Fundamentals of Texture Mapping and Image Warping" by Paul S. Heckbert: <http://www.cs.cmu.edu/~ph/texfund/texfund.pdf> (in the appendix it contains source code for all kinds of mappings)
Are you sure that you want to be getting into all of this for handles? in the examples the handles are there to act as reference points on the movieclip for drawing, they are not related in any way to the image or the distortion apon it. if you are wanting to just have the handlers inside the image then you would just ...
2,942,191
I have a grid in a 2D system like the one in the before image where all points A,B,C,D,A',B',C',D' are given (meaning I know the respective x- and y-coordinates). I need to calculate the x- and y-coordinates of A(new), B(new), C(new) and D(new) when the grid is distorted (so that A' is moved to A'(new), B' is moved to...
2010/05/31
[ "https://Stackoverflow.com/questions/2942191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/248762/" ]
Let (u,v) represent "texture" coordinates. Your handles stay at the same texture coordinates regardless of grid distortions. So, in texture space, A=(0,0) B=(1,0) C=(1,1) D=(0,1) A'=(au,av) B'=(bu,bv) ... We can convert from texture space to pixel space. P(u,v) = A\*(1-u)*(1-v) + B*u\*(1-v) + C*u*v + D\*(1-u)\*v (u...
Are you sure that you want to be getting into all of this for handles? in the examples the handles are there to act as reference points on the movieclip for drawing, they are not related in any way to the image or the distortion apon it. if you are wanting to just have the handlers inside the image then you would just ...
12,697,189
How would I use TypeScript in a Windows 8 Store app that's JavaScript-based? I don't see any obvious way of doing this.
2012/10/02
[ "https://Stackoverflow.com/questions/12697189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132042/" ]
Many of your questions are answered by the Encyclopedia example on the typescript site. > > <http://www.typescriptlang.org/Samples/#Encyclopedia> > > > Since TypeScript produces JavaScript Windows 8 and the Windows Store see them as a normal JavaScript based Windows Store application. The referenced example conta...
Check out the TypeScript sample source code, they have full Win 8 app as an example: <http://typescript.codeplex.com/SourceControl/changeset/view/d397c54a55db>
12,697,189
How would I use TypeScript in a Windows 8 Store app that's JavaScript-based? I don't see any obvious way of doing this.
2012/10/02
[ "https://Stackoverflow.com/questions/12697189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132042/" ]
Many of your questions are answered by the Encyclopedia example on the typescript site. > > <http://www.typescriptlang.org/Samples/#Encyclopedia> > > > Since TypeScript produces JavaScript Windows 8 and the Windows Store see them as a normal JavaScript based Windows Store application. The referenced example conta...
Although the Encyclopedia example is a representation of how TypeScript is used, there is not built in functionality to do so. See the following link to see a complete walkthrough. <http://blog.tattoocoder.com/2012/10/typescript-for-windows-8-store-apps.html>
12,697,189
How would I use TypeScript in a Windows 8 Store app that's JavaScript-based? I don't see any obvious way of doing this.
2012/10/02
[ "https://Stackoverflow.com/questions/12697189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132042/" ]
Many of your questions are answered by the Encyclopedia example on the typescript site. > > <http://www.typescriptlang.org/Samples/#Encyclopedia> > > > Since TypeScript produces JavaScript Windows 8 and the Windows Store see them as a normal JavaScript based Windows Store application. The referenced example conta...
I recently build a project template to get started more quickly when building Store apps using TypeScript. <http://timmykokke.com/2014/01/store-app-typescript-project-template/> --- ***Update:*** I've added the templates to <http://sidewaffle.com/> which makes them a lot easier to use.
434,411
[![Mac Fullscreen](https://i.stack.imgur.com/FC7Eu.jpg)](https://i.stack.imgur.com/FC7Eu.jpg) When I'm opening a new window in google chrome then chrome is taking a huge empty space below the apple menu bar.
2022/01/01
[ "https://apple.stackexchange.com/questions/434411", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/445610/" ]
This is a bug: [Issue 1264148: Empty space above tab bar in Monterey with Menu bar when "Automatically show and hide the menu bar in full screen" is disabled.](https://bugs.chromium.org/p/chromium/issues/detail?id=1264148#c30) There is this a Reddit thread that suggests a workaround: [Huge gap at the top when Chrome i...
Not sure that it won't come back (I am new to Macbook). After trying my new Air M1 for a day (I did experience the space glitch), I wiped it thinking that I would resell. I am a Chromebook person, and actually just figured out that I could do video editing on my Smartphone (only reason Chromebook was being difficult). ...
16,060,340
Given I have a dataframe `df` like this containing the columns `Key` and `User`. ``` Key User 1 Bob 2 Tobi 1 Bob 3 Bob 4 Bob 5 Bob 6 Tobi 5 Bob ``` I want to create a new column whichs value is calculated like this: > > Frequency of this rows key in the dataset / number of rows w...
2013/04/17
[ "https://Stackoverflow.com/questions/16060340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/944732/" ]
Here's one approach using `table`, `prop.table`, and `merge`. Assuming your data.frame is called "mydf": ``` > merge(mydf, as.data.frame(prop.table(table(mydf), margin = 2))) Key User Freq 1 1 Bob 0.3333333 2 1 Bob 0.3333333 3 2 Tobi 0.5000000 4 3 Bob 0.1666667 5 4 Bob 0.1666667 6 5 Bob 0.33333...
If your data set is called dat using `ave` is one approach: ``` ## dat <- read.table(text="Key User ## 1 Bob ## 2 Tobi ## 1 Bob ## 3 Bob ## 4 Bob ## 5 Bob ## 6 Tobi ## 5 Bob", header=TRUE) dat$Freq <- paste(with(dat, ave(Key, Key, FUN=length)), with(dat, ave(as.character(User), U...
2,020
As I am a French student in IT I have to work on a Big-Data project using French data (the country, not the language). What I'm looking for is a data set of something interesting like weather or traffic which is large (more than 100 Gb) and frequently updated. I do not really know where to look at and I will apprecia...
2014/05/12
[ "https://opendata.stackexchange.com/questions/2020", "https://opendata.stackexchange.com", "https://opendata.stackexchange.com/users/2823/" ]
I also think that [Twitter data](https://dev.twitter.com/docs/api/streaming) is the best way to get >100Gb french dataset. OpenStreetMaps gives really great open data but you can't reach 100Gb easily : [the Integral Metropolitan France dataset](https://www.data.gouv.fr/fr/dataset/donnees-openstreetmap-integrales-de-fr...
There was a [similar (French) question](https://opendata.stackexchange.com/q/1801/1511) recently and I posted several answers. The difference may be that you are interested in France-data and the other question was for French-language data. I think the most appropriate answer was for collecting Twitter data, which I'll...
2,020
As I am a French student in IT I have to work on a Big-Data project using French data (the country, not the language). What I'm looking for is a data set of something interesting like weather or traffic which is large (more than 100 Gb) and frequently updated. I do not really know where to look at and I will apprecia...
2014/05/12
[ "https://opendata.stackexchange.com/questions/2020", "https://opendata.stackexchange.com", "https://opendata.stackexchange.com/users/2823/" ]
I also think that [Twitter data](https://dev.twitter.com/docs/api/streaming) is the best way to get >100Gb french dataset. OpenStreetMaps gives really great open data but you can't reach 100Gb easily : [the Integral Metropolitan France dataset](https://www.data.gouv.fr/fr/dataset/donnees-openstreetmap-integrales-de-fr...
The US National Intelligence Agency (NGA) maintains a geographic feature database for each country in the world. The data is kept in the Geographic Name Server (GNS). The format is somewhat arcane by today's standards. I have converted each country's dataset into a standardized CSV format to make it more friendly to de...
2,020
As I am a French student in IT I have to work on a Big-Data project using French data (the country, not the language). What I'm looking for is a data set of something interesting like weather or traffic which is large (more than 100 Gb) and frequently updated. I do not really know where to look at and I will apprecia...
2014/05/12
[ "https://opendata.stackexchange.com/questions/2020", "https://opendata.stackexchange.com", "https://opendata.stackexchange.com/users/2823/" ]
I also think that [Twitter data](https://dev.twitter.com/docs/api/streaming) is the best way to get >100Gb french dataset. OpenStreetMaps gives really great open data but you can't reach 100Gb easily : [the Integral Metropolitan France dataset](https://www.data.gouv.fr/fr/dataset/donnees-openstreetmap-integrales-de-fr...
Website of the government open data project. <http://www.data.gouv.fr/> Everything you want and more.
2,020
As I am a French student in IT I have to work on a Big-Data project using French data (the country, not the language). What I'm looking for is a data set of something interesting like weather or traffic which is large (more than 100 Gb) and frequently updated. I do not really know where to look at and I will apprecia...
2014/05/12
[ "https://opendata.stackexchange.com/questions/2020", "https://opendata.stackexchange.com", "https://opendata.stackexchange.com/users/2823/" ]
I also think that [Twitter data](https://dev.twitter.com/docs/api/streaming) is the best way to get >100Gb french dataset. OpenStreetMaps gives really great open data but you can't reach 100Gb easily : [the Integral Metropolitan France dataset](https://www.data.gouv.fr/fr/dataset/donnees-openstreetmap-integrales-de-fr...
You can check the databases of the [INSEE](http://www.insee.fr/en/bases-de-donnees/) (National Institute of Statistics and Economic Studies). If you are a teacher or student you can use the online statistical data for non-commercial use [details over here](http://www.insee.fr/en/publics/default.asp)
163,610
I'm attempting to find companies who mention a particular service in on their homepage. To do this, I am iterating through a csv file with two columns - ID and URL. I'm using BeautifulSoup to get the html and regex to find the string. At present, my code works, but it feels very clunky and takes forever. I'm also not ...
2017/05/18
[ "https://codereview.stackexchange.com/questions/163610", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/139101/" ]
Collection initializer ====================== You can improve and simplify your code by first tuning the `Node`. * make it `IEnumerable<T>` and consequently remove the `Children` and `HasChildren` properties because now we can use LINQ's `Any` * let the `Name` property take care of the formatting and keep the `value`...
A typical iterative preorder traversal works like this: Create a stack, push the root to the stack. While the stack is not empty, process the top element and push its children right-to-left to the stack. So I suggest the following function to traverse the nodes: ``` static void IterateNodes(Node[] nodes) { forea...
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
If your project is non commercial you can use this [Froala](https://github.com/froala/wysiwyg-rails)
Use [Trix](https://trix-editor.org/) by Basecamp: > > Trix is an open-source project from Basecamp, the creators of Ruby on Rails. Millions of people trust their text to Basecamp, and we built Trix to give them the best possible editing experience. > > >
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
If your project is non commercial you can use this [Froala](https://github.com/froala/wysiwyg-rails)
You can use `Mercury` its a full featured HTML5 editor ``` gem 'mercury-rails' rails generate mercury:install ``` <http://jejacks0n.github.io/mercury/> github: <https://github.com/jejacks0n/mercury>
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
I'd suggest to use gem **[ckeditor](https://github.com/galetahub/ckeditor)** it's really perfect solution, i used it recently in my Rails 3.2 project
I've been using [Bootsy](https://github.com/volmer/bootsy). It's simple and easy to use, however I have not been able to get the "image" upload => carrierwave to store on S3 servers. But everything else with it is fantastic.
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
I'd suggest to use gem **[ckeditor](https://github.com/galetahub/ckeditor)** it's really perfect solution, i used it recently in my Rails 3.2 project
Use [Trix](https://trix-editor.org/) by Basecamp: > > Trix is an open-source project from Basecamp, the creators of Ruby on Rails. Millions of people trust their text to Basecamp, and we built Trix to give them the best possible editing experience. > > >
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
I'd suggest to use gem **[ckeditor](https://github.com/galetahub/ckeditor)** it's really perfect solution, i used it recently in my Rails 3.2 project
We use [TinyMCE](http://www.tinymce.com/) quite a bit. No unbelievable feature set or anything, but it does have a nice jQuery integration plugin (which goes a long way for us). The live preview functionality seems [very doable](https://www.google.com/search?sourceid=chrome&ie=UTF-8&q=tinymce%20live%20preview).
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
A pretty cool and fancy one is [Sir Trevor JS](https://github.com/madebymany/sir-trevor-js). There is also a [gem](https://github.com/madebymany/sir-trevor-rails)
You can use `Mercury` its a full featured HTML5 editor ``` gem 'mercury-rails' rails generate mercury:install ``` <http://jejacks0n.github.io/mercury/> github: <https://github.com/jejacks0n/mercury>
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
A pretty cool and fancy one is [Sir Trevor JS](https://github.com/madebymany/sir-trevor-js). There is also a [gem](https://github.com/madebymany/sir-trevor-rails)
Old question but check out **froala**: <https://github.com/froala/wysiwyg-rails> and the plugins main homepage <https://www.froala.com/wysiwyg-editor>
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
We use [TinyMCE](http://www.tinymce.com/) quite a bit. No unbelievable feature set or anything, but it does have a nice jQuery integration plugin (which goes a long way for us). The live preview functionality seems [very doable](https://www.google.com/search?sourceid=chrome&ie=UTF-8&q=tinymce%20live%20preview).
You can use `Mercury` its a full featured HTML5 editor ``` gem 'mercury-rails' rails generate mercury:install ``` <http://jejacks0n.github.io/mercury/> github: <https://github.com/jejacks0n/mercury>
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
I'd suggest to use gem **[ckeditor](https://github.com/galetahub/ckeditor)** it's really perfect solution, i used it recently in my Rails 3.2 project
Old question but check out **froala**: <https://github.com/froala/wysiwyg-rails> and the plugins main homepage <https://www.froala.com/wysiwyg-editor>
9,876,074
A class exists that I have no control over: ``` public class MyPerson { private String name; private int elevation; // getters and setters } ``` I want to persist this person into Mongo, but I cannot alter this class definition with `@Entity` and other annotations. I'd like the document in Mongo to look some...
2012/03/26
[ "https://Stackoverflow.com/questions/9876074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322722/" ]
I've been using [Bootsy](https://github.com/volmer/bootsy). It's simple and easy to use, however I have not been able to get the "image" upload => carrierwave to store on S3 servers. But everything else with it is fantastic.
Old question but check out **froala**: <https://github.com/froala/wysiwyg-rails> and the plugins main homepage <https://www.froala.com/wysiwyg-editor>
62,808,166
Steps followed to create 1. Create a virtual environment and activate it 2. pip install elasticsearch 3. Zip the folder inside site-packages.zip 4.Create Layer in AWS (say name is `elastic`) 5. Add the code below in lambda\_handler and add the Layer `elastic` Below is code ``` import json from elasticsearch import...
2020/07/09
[ "https://Stackoverflow.com/questions/62808166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If I may, I would like to recommend an alternative technique which has never failed me. The technique includes **docker tool** described in the recent **AWS blog**: * [How do I create a Lambda layer using a simulated Lambda environment with Docker?](https://aws.amazon.com/premiumsupport/knowledge-center/lambda-layer-s...
As one option is already mentioned by @Marcin which is required Docker to be installed in the target machine. If you want to skip docker then you can use below script to create and publish layer to AWS. All you need ``` ./creater_layer.sh <package_name> <layer_name> ./creater_layer.sh elasticsearch my-layer ``` sc...
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
Difference is in the field you select. When counting `COUNT(*)` NULL values are taken into account (count all rows returned). When counting `COUNT(num)` NULL values are NOT taken into account (count all non-null fields). That is a standard behavior in SQL, whatever the DBMS used [Source](http://dev.mysql.com/doc/r...
`count(*)` returns number of rows, `count(num)` returns number of rows where `num` is not `null`. Change your last query to `select count(*) from test where num is null` to get the result you expect.
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
`count(*)` returns number of rows, `count(num)` returns number of rows where `num` is not `null`. Change your last query to `select count(*) from test where num is null` to get the result you expect.
Considering the output given above, the result of the query count(num) should be 2.
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
Difference is in the field you select. When counting `COUNT(*)` NULL values are taken into account (count all rows returned). When counting `COUNT(num)` NULL values are NOT taken into account (count all non-null fields). That is a standard behavior in SQL, whatever the DBMS used [Source](http://dev.mysql.com/doc/r...
`Count(*)` counts the number of rows, `COUNT(num)` counts the number of **not-null** values in **column num.**
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
`Count(*)` counts the number of rows, `COUNT(num)` counts the number of **not-null** values in **column num.**
Considering the output given above, the result of the query count(num) should be 2.
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
Difference is in the field you select. When counting `COUNT(*)` NULL values are taken into account (count all rows returned). When counting `COUNT(num)` NULL values are NOT taken into account (count all non-null fields). That is a standard behavior in SQL, whatever the DBMS used [Source](http://dev.mysql.com/doc/r...
Considering the output given above, the result of the query count(num) should be 2.
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
Difference is in the field you select. When counting `COUNT(*)` NULL values are taken into account (count all rows returned). When counting `COUNT(num)` NULL values are NOT taken into account (count all non-null fields). That is a standard behavior in SQL, whatever the DBMS used [Source](http://dev.mysql.com/doc/r...
In second case first count values are eliminated and then where clause comes in picture. While in first case when you are using `*` row with null is not eliminated. If you are counting on a coll which contains null and you want rows with null to be included in count than use ``` Count(ISNULL(col,0)) ```
11,028,021
I have a table ``` num ---- NULL NULL NULL NULL 55 NULL NULL NULL 99 ``` when I wrote ``` select COUNT(*) from tbl where num is null ``` the output was 7 but when I wrote ``` select COUNT(num) from tbl where num is null ``` the output was 0 what's the difference between these two queries ??
2012/06/14
[ "https://Stackoverflow.com/questions/11028021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1432033/" ]
In second case first count values are eliminated and then where clause comes in picture. While in first case when you are using `*` row with null is not eliminated. If you are counting on a coll which contains null and you want rows with null to be included in count than use ``` Count(ISNULL(col,0)) ```
Considering the output given above, the result of the query count(num) should be 2.
445,936
Однажды я на одном сайте, давая ответ, написал, что буква Х в русском языке изредка может озвончаться — передавать звонкий согласный звук. В принципе важен звук, а не фонема (о фонеме я и не писал вовсе). А мне в ответном комментарии указали, что я допустил ошибку, причём ещё и грубую. Я согласен, что буква Х передаё...
2018/12/14
[ "https://rus.stackexchange.com/questions/445936", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/862/" ]
**По смыслу очень подходят "виджет без состояния" и "виджет с состоянием"** Вот так и переводите. Это достаточно общепринятые (специальные) термины, не нужно придумывать вместо них неизвестные и непонятные другим людям. Иногда используют другие варианты перевода, например: "с сохранением состояния" и, соответственно, ...
Активный виджет/Пассивный виджет (неактивный)?
445,936
Однажды я на одном сайте, давая ответ, написал, что буква Х в русском языке изредка может озвончаться — передавать звонкий согласный звук. В принципе важен звук, а не фонема (о фонеме я и не писал вовсе). А мне в ответном комментарии указали, что я допустил ошибку, причём ещё и грубую. Я согласен, что буква Х передаё...
2018/12/14
[ "https://rus.stackexchange.com/questions/445936", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/862/" ]
**По смыслу очень подходят "виджет без состояния" и "виджет с состоянием"** Вот так и переводите. Это достаточно общепринятые (специальные) термины, не нужно придумывать вместо них неизвестные и непонятные другим людям. Иногда используют другие варианты перевода, например: "с сохранением состояния" и, соответственно, ...
В Интернете можно найти такие названия: Stateless and Statefull widgets — виджеты с изменяемыми и неизменяемыми состояниями. Другой (короткий) вариант: изменяемые и неизменяемые виджеты. (Виджет с неизменяемым состоянием не содержит параметры, которые можно менять). В этой статье рассказано о Stateless объектах в общ...
279,425
In the ($\log\rho, \log T$) plane for stars, the lower right corner corresponds to the equation of state of radiation pressure. This means that as a star gets hotter and less dense, radiation pressure is dominant. However, high temperatures lead to more particles and less photons by processes like photodisintegration ...
2016/09/10
[ "https://physics.stackexchange.com/questions/279425", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/72422/" ]
Perhaps a better statement is "the mass of the ropes is very much less than the other masses involved in the problem"? So to accelerate such a rope there must be a net force acting on the rope but that net force is much less than other forces which are acting. In your studies you will find many such assumptions mad...
you assume rope to be massless because its mass is very small in comparison of the masses attached with the rope,and if you have one equation in which one variable is very small in comparison of the other variables then you could neglect that.By following the argument only you could say that the rope is massless.
279,425
In the ($\log\rho, \log T$) plane for stars, the lower right corner corresponds to the equation of state of radiation pressure. This means that as a star gets hotter and less dense, radiation pressure is dominant. However, high temperatures lead to more particles and less photons by processes like photodisintegration ...
2016/09/10
[ "https://physics.stackexchange.com/questions/279425", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/72422/" ]
When we say "assume the rope is massless," it's really an idiom that's letting you know what sort of simplifying assumptions you will be permitted to make. A more rigorous definition is that we are exploring the behavior of the system as the mass of the rope becomes infinitesimally small. If you know calculus, we're ta...
you assume rope to be massless because its mass is very small in comparison of the masses attached with the rope,and if you have one equation in which one variable is very small in comparison of the other variables then you could neglect that.By following the argument only you could say that the rope is massless.
279,425
In the ($\log\rho, \log T$) plane for stars, the lower right corner corresponds to the equation of state of radiation pressure. This means that as a star gets hotter and less dense, radiation pressure is dominant. However, high temperatures lead to more particles and less photons by processes like photodisintegration ...
2016/09/10
[ "https://physics.stackexchange.com/questions/279425", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/72422/" ]
Perhaps a better statement is "the mass of the ropes is very much less than the other masses involved in the problem"? So to accelerate such a rope there must be a net force acting on the rope but that net force is much less than other forces which are acting. In your studies you will find many such assumptions mad...
rope is not massless, its mass is too small that it can be neglected.As far as your question is concerned that why it have acceleration my answer is that t is part of a system which is moving with a certain acceleration so it acquire s acceleration of the system.
279,425
In the ($\log\rho, \log T$) plane for stars, the lower right corner corresponds to the equation of state of radiation pressure. This means that as a star gets hotter and less dense, radiation pressure is dominant. However, high temperatures lead to more particles and less photons by processes like photodisintegration ...
2016/09/10
[ "https://physics.stackexchange.com/questions/279425", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/72422/" ]
When we say "assume the rope is massless," it's really an idiom that's letting you know what sort of simplifying assumptions you will be permitted to make. A more rigorous definition is that we are exploring the behavior of the system as the mass of the rope becomes infinitesimally small. If you know calculus, we're ta...
rope is not massless, its mass is too small that it can be neglected.As far as your question is concerned that why it have acceleration my answer is that t is part of a system which is moving with a certain acceleration so it acquire s acceleration of the system.
63,932,597
I have a file (tab delimited) which looks like this: ``` 1 2 3 4 5 a,f f,g g g f df d,a a,a l ll dd ff g,g ll ff pp ff a ll pp ``` Now I want to make a list of the values under the 3th column. This is my code: ``` my_list = [] with open(my_file, 'r') as my_table: m...
2020/09/17
[ "https://Stackoverflow.com/questions/63932597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14200890/" ]
We can use `APIKeyHeader` to remove the X-Remote-User header from the API signature, but still enforcing the header to be present. ``` from fastapi.security import APIKeyHeader apiKey = APIKeyHeader(name="X-Remote-User") @app.get("/user/me") async def get_user_me(x_remote_user: str = Depends(apiKey)): return {"U...
One approach is to generate the OpenApi schema as described in the documentation [Extending OpenAPI](https://fastapi.tiangolo.com/advanced/extending-openapi/). After the generation, remove the X-Remote-User from the schema. In the configuration could be a flag that the application it is behind a reverse proxy to execut...
63,932,597
I have a file (tab delimited) which looks like this: ``` 1 2 3 4 5 a,f f,g g g f df d,a a,a l ll dd ff g,g ll ff pp ff a ll pp ``` Now I want to make a list of the values under the 3th column. This is my code: ``` my_list = [] with open(my_file, 'r') as my_table: m...
2020/09/17
[ "https://Stackoverflow.com/questions/63932597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14200890/" ]
We can use `APIKeyHeader` to remove the X-Remote-User header from the API signature, but still enforcing the header to be present. ``` from fastapi.security import APIKeyHeader apiKey = APIKeyHeader(name="X-Remote-User") @app.get("/user/me") async def get_user_me(x_remote_user: str = Depends(apiKey)): return {"U...
A new param will be soon available for `Header`, `Query` and other to exclude elements from the openAPI output: `include_in_schema=False` Example: ```py def test(x_forwarded_for: str = Header(None, include_in_schema=False)): ... ``` Here the patch state: <https://github.com/tiangolo/fastapi/pull/3144>
68,388,477
I have a list ``` List1 = ['Cappuccino','Café Latte','Expresso','Macchiato ','Irish coffee '] ``` I have to take input sentence from user and if any of the word matches from List1 should return the string from that list1 along with some legend . Example: Enter your input string : User Input : `I want 1 Cappuccino.`...
2021/07/15
[ "https://Stackoverflow.com/questions/68388477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9377345/" ]
Just add following style on `.newsletter_section` ``` display:flex; align-items: center; ``` and follwing style on `.newsletter_input_section` ``` display: flex; justify-content: flex-end; ```
```html <!DOCTYPE html> <html> <head> <title>Test</title> <style type="text/css" media="screen"> .newsletter_section{ width:100% !important; background: #455657; overflow:hidden; padding-top:25px; padding-bottom:25px } .newsletter_text_section { width: 40%; color: #fff; float: left; ...
58,502,880
I am new to python and trying to run the following code to get the files in the specified format on the current path using the if-else statement. ``` from pathlib import Path path=Path() for file in path.glob('*.txt'): if file.exists(): print(file) else: print("No items match your search") `...
2019/10/22
[ "https://Stackoverflow.com/questions/58502880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11893427/" ]
``` for file in path.glob('*.txt') ``` Your `for` loop runs for every file that `glob` finds, hence ``` for file in path.glob('*.txt'): if file.exists(): ``` is rather pointless, because `file` must exist, otherwise `glob` would not have reported it. What you want is to check if glob has returned any files: ...
Here's how I would do it: ``` from pathlib import Path cwd = Path() files = list(cwd.glob('*.txt')) if files: for file in files: print(file) else: print("No items match your search") ``` Similarly to Ofer, I would transform the [generator function](https://realpython.com/introduction-to-python-gener...
58,502,880
I am new to python and trying to run the following code to get the files in the specified format on the current path using the if-else statement. ``` from pathlib import Path path=Path() for file in path.glob('*.txt'): if file.exists(): print(file) else: print("No items match your search") `...
2019/10/22
[ "https://Stackoverflow.com/questions/58502880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11893427/" ]
If files are found using `path.glob('*.txt')` then they necessarily exist, so there's no reason why `if file.exists()` will ever evaluate to `False` The correct way to check if no files were found is to check the length of results: ``` from pathlib import Path path=Path() result = list(path.glob('*.txt')) if len(res...
Here's how I would do it: ``` from pathlib import Path cwd = Path() files = list(cwd.glob('*.txt')) if files: for file in files: print(file) else: print("No items match your search") ``` Similarly to Ofer, I would transform the [generator function](https://realpython.com/introduction-to-python-gener...
32,788,656
I want to store large number (millions) of user avatars in the file system. But the files must be uniformly distributed in the file system so that it scales well as more files added. **The avatars are 5-10KB in size images. The application is ASP.NET MVC (C#)** Storing: Consider these following unique user ids: bob,...
2015/09/25
[ "https://Stackoverflow.com/questions/32788656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/182305/" ]
You can try my [Favorite Documents](https://vlasovstudio.com/favorite-documents/) extension. It allows you to quickly open chosen files or jump to them in Solution Explorer.
Are you allowed to alter the solution itself? If so, right click the solution, **Add New Solution Folder**, name it something you'll recognize, then do **Add Existing Item** operation(s) to put in the files you'd like to see. There is no requirement for a file to be in only one folder. Do this multiple times and col...
30,574,831
I am looping over collection of `Person` in scala view in PlayFramework2.2.6. `Person` class is superclass for classes `User`,`Contact`. While looping I would like to access some parameters specified for extending classes like `email` attribute in `User` class. Here is model's classes: ``` public class Person { in...
2015/06/01
[ "https://Stackoverflow.com/questions/30574831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2794446/" ]
The Scala/Twirl equivalents should be: To verify instance type: ``` person.isInstanceOf[User] // bool? ``` To cast: ``` person.asInstanceOf[User] // User instance ```
Use pattern matching: ``` @for(person <- persons) { @person match { case _ : User => {@{_.email}} case _ => {@{}} } } ``` This will look cleaner if you ever need to make an "If type of Contact" condition
57,976,184
I'm trying to JSDoc a simple React Typescript component with hooks. Unfortunately, I can't seem to find a way that makes JSDoc work with declared destructured arrays. There are [some](https://stackoverflow.com/questions/45788606/how-to-document-deconstructed-parameters-with-jsdoc) [answers](https://stackoverflow.com/qu...
2019/09/17
[ "https://Stackoverflow.com/questions/57976184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6418561/" ]
It would help: ``` /** * @typedef {Boolean} LoadingState — documentation for isLoading * @description Additional doc */ /** * @typedef {Function} LoadingStateSetter — documentation for setIsLoading */ /** * @type {[LoadingState, LoadingStateSetter]} Loading */ const [...
You can try this: ```js /** @type {boolean} */ const initialState = false const [isLoading, setIsLoading] = React.useState(initialState) ```
57,976,184
I'm trying to JSDoc a simple React Typescript component with hooks. Unfortunately, I can't seem to find a way that makes JSDoc work with declared destructured arrays. There are [some](https://stackoverflow.com/questions/45788606/how-to-document-deconstructed-parameters-with-jsdoc) [answers](https://stackoverflow.com/qu...
2019/09/17
[ "https://Stackoverflow.com/questions/57976184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6418561/" ]
It would help: ``` /** * @typedef {Boolean} LoadingState — documentation for isLoading * @description Additional doc */ /** * @typedef {Function} LoadingStateSetter — documentation for setIsLoading */ /** * @type {[LoadingState, LoadingStateSetter]} Loading */ const [...
The actual best solution to be found here is by using parentheses. Otherwise jsdoc does not seem to catch it: ```js const [authFormInput, setAuthFormInput] = useState(/** @type {AuthFormInput} */({..})); ```
57,976,184
I'm trying to JSDoc a simple React Typescript component with hooks. Unfortunately, I can't seem to find a way that makes JSDoc work with declared destructured arrays. There are [some](https://stackoverflow.com/questions/45788606/how-to-document-deconstructed-parameters-with-jsdoc) [answers](https://stackoverflow.com/qu...
2019/09/17
[ "https://Stackoverflow.com/questions/57976184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6418561/" ]
It would help: ``` /** * @typedef {Boolean} LoadingState — documentation for isLoading * @description Additional doc */ /** * @typedef {Function} LoadingStateSetter — documentation for setIsLoading */ /** * @type {[LoadingState, LoadingStateSetter]} Loading */ const [...
The cleanest way I found is to use `types.d.ts`, since we're likely gonna need to type out more than just a `useState` and we can keep a lot of the code there for cleanliness: ``` // types.d.ts: declare type State = string; declare type SetState = (stateParam: State) => void; declare type UseState = [State, SetState];...
57,976,184
I'm trying to JSDoc a simple React Typescript component with hooks. Unfortunately, I can't seem to find a way that makes JSDoc work with declared destructured arrays. There are [some](https://stackoverflow.com/questions/45788606/how-to-document-deconstructed-parameters-with-jsdoc) [answers](https://stackoverflow.com/qu...
2019/09/17
[ "https://Stackoverflow.com/questions/57976184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6418561/" ]
You can try this: ```js /** @type {boolean} */ const initialState = false const [isLoading, setIsLoading] = React.useState(initialState) ```
The actual best solution to be found here is by using parentheses. Otherwise jsdoc does not seem to catch it: ```js const [authFormInput, setAuthFormInput] = useState(/** @type {AuthFormInput} */({..})); ```
57,976,184
I'm trying to JSDoc a simple React Typescript component with hooks. Unfortunately, I can't seem to find a way that makes JSDoc work with declared destructured arrays. There are [some](https://stackoverflow.com/questions/45788606/how-to-document-deconstructed-parameters-with-jsdoc) [answers](https://stackoverflow.com/qu...
2019/09/17
[ "https://Stackoverflow.com/questions/57976184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6418561/" ]
You can try this: ```js /** @type {boolean} */ const initialState = false const [isLoading, setIsLoading] = React.useState(initialState) ```
The cleanest way I found is to use `types.d.ts`, since we're likely gonna need to type out more than just a `useState` and we can keep a lot of the code there for cleanliness: ``` // types.d.ts: declare type State = string; declare type SetState = (stateParam: State) => void; declare type UseState = [State, SetState];...
57,976,184
I'm trying to JSDoc a simple React Typescript component with hooks. Unfortunately, I can't seem to find a way that makes JSDoc work with declared destructured arrays. There are [some](https://stackoverflow.com/questions/45788606/how-to-document-deconstructed-parameters-with-jsdoc) [answers](https://stackoverflow.com/qu...
2019/09/17
[ "https://Stackoverflow.com/questions/57976184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6418561/" ]
The actual best solution to be found here is by using parentheses. Otherwise jsdoc does not seem to catch it: ```js const [authFormInput, setAuthFormInput] = useState(/** @type {AuthFormInput} */({..})); ```
The cleanest way I found is to use `types.d.ts`, since we're likely gonna need to type out more than just a `useState` and we can keep a lot of the code there for cleanliness: ``` // types.d.ts: declare type State = string; declare type SetState = (stateParam: State) => void; declare type UseState = [State, SetState];...
55,539,534
I have has\_many\_attached images relationship in Post model. I want to order the images by their filename when showing them on the Post show page. How can I order by filename? Example: ``` <% @post.images.order("id DESC").each do |image| %> ``` Is it possible to just order by filename through something like activ...
2019/04/05
[ "https://Stackoverflow.com/questions/55539534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5494897/" ]
When you add the has\_many\_attached macro to a class it actually adds the following relationships to your class ``` class Post < ApplicationRecord has_many :image_attachments, -> { where(name: 'image') }, class_name: "ActiveStorage::Attachment", as: :record, inverse_of: :record, dependent: false has_many ...
If you have the class setup with ActiveStorage like: ``` class Post < ApplicationRecord has_many_attached :images end ``` You can run this to order and avoid N+1 queries ``` @post.images.includes(:blob).references(:blob).order(:filename) ```
55,539,534
I have has\_many\_attached images relationship in Post model. I want to order the images by their filename when showing them on the Post show page. How can I order by filename? Example: ``` <% @post.images.order("id DESC").each do |image| %> ``` Is it possible to just order by filename through something like activ...
2019/04/05
[ "https://Stackoverflow.com/questions/55539534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5494897/" ]
When you add the has\_many\_attached macro to a class it actually adds the following relationships to your class ``` class Post < ApplicationRecord has_many :image_attachments, -> { where(name: 'image') }, class_name: "ActiveStorage::Attachment", as: :record, inverse_of: :record, dependent: false has_many ...
For Rails 6 I needed ```rb @post.images.includes(:blob).references(:blob).order('active_storage_blobs.filename ASC').each do |image| # ... end ```
55,539,534
I have has\_many\_attached images relationship in Post model. I want to order the images by their filename when showing them on the Post show page. How can I order by filename? Example: ``` <% @post.images.order("id DESC").each do |image| %> ``` Is it possible to just order by filename through something like activ...
2019/04/05
[ "https://Stackoverflow.com/questions/55539534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5494897/" ]
When you add the has\_many\_attached macro to a class it actually adds the following relationships to your class ``` class Post < ApplicationRecord has_many :image_attachments, -> { where(name: 'image') }, class_name: "ActiveStorage::Attachment", as: :record, inverse_of: :record, dependent: false has_many ...
If anyone is googling for **general** solution how to reorder `has_many_attached` attachments you can do it by adding a Array/JSON-Array/Serialized field to the model which declares the `has_many_attached` and store ids of ActiveStorage::Attachment in order. Then you can do something like: ``` # app/models/entry.rb cl...
55,539,534
I have has\_many\_attached images relationship in Post model. I want to order the images by their filename when showing them on the Post show page. How can I order by filename? Example: ``` <% @post.images.order("id DESC").each do |image| %> ``` Is it possible to just order by filename through something like activ...
2019/04/05
[ "https://Stackoverflow.com/questions/55539534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5494897/" ]
For Rails 6 I needed ```rb @post.images.includes(:blob).references(:blob).order('active_storage_blobs.filename ASC').each do |image| # ... end ```
If you have the class setup with ActiveStorage like: ``` class Post < ApplicationRecord has_many_attached :images end ``` You can run this to order and avoid N+1 queries ``` @post.images.includes(:blob).references(:blob).order(:filename) ```
55,539,534
I have has\_many\_attached images relationship in Post model. I want to order the images by their filename when showing them on the Post show page. How can I order by filename? Example: ``` <% @post.images.order("id DESC").each do |image| %> ``` Is it possible to just order by filename through something like activ...
2019/04/05
[ "https://Stackoverflow.com/questions/55539534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5494897/" ]
For Rails 6 I needed ```rb @post.images.includes(:blob).references(:blob).order('active_storage_blobs.filename ASC').each do |image| # ... end ```
If anyone is googling for **general** solution how to reorder `has_many_attached` attachments you can do it by adding a Array/JSON-Array/Serialized field to the model which declares the `has_many_attached` and store ids of ActiveStorage::Attachment in order. Then you can do something like: ``` # app/models/entry.rb cl...
64,513,007
Consider a html form which has different input fields in which one of them is of [type = file] and the user has to upload an image to it, and if the user does not upload an image and clicks submit, I like to update it with a default image of my own and then submit the form. Does anyone know how to implement it? Thank...
2020/10/24
[ "https://Stackoverflow.com/questions/64513007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If the answer from the flow will always have the properties "PurchaseOrderNumber", "LineNumber" and "OrderedPurchaseQuantity" in this order, then you will need to have them in the same order if you want to use a regular expression to parse this answer: ``` ClearCollect(_purchlinesData, Match( GetPurchLine...
Since `OrderedPurchaseQuantity` is an integer, what happens if you remove the double quotes around the value in the `MatchAll()` statement? **From this...** `""OrderedPurchaseQuantity"":""(?<OrderedPurchaseQuantity>[^""]*)""` **To this...** `""OrderedPurchaseQuantity"":(?<OrderedPurchaseQuantity>[^""]*)` Because the...
1,348
I'm using [PostgreSQL 8.3](http://en.wikipedia.org/wiki/Postgresql)+[PostGIS 1.3](http://en.wikipedia.org/wiki/PostGIS) to store geospatial data on [Ubuntu 8.04 Hardy](http://en.wikipedia.org/wiki/List_of_Ubuntu_releases#Ubuntu_8.04_LTS_.28Hardy_Heron.29). This particular version of PostGIS has a bug when calculating...
2011/02/20
[ "https://dba.stackexchange.com/questions/1348", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/972/" ]
To limit memory consumption, the main configuration parameter is `work_mem`. Since this applies per operation, not per query, you cannot simply set it to N if you want to spend N amount of memory, but you have to tweak and tune it a bit to get the desired result. This doesn't help, however, in case of bugs and other m...
Have a look at the [Postgres Wiki](http://wiki.postgresql.org/wiki/Priorities#Prioritizing_users.2C_queries.2C_or_databases): > > PostgreSQL has no facilities to limit > what resources a particular user, > query, or database consumes, or > correspondingly to set priorities such > that one user/query/database gets...
17,957,181
I created a line that appends an object to a list in the following manner ``` >>> foo = list() >>> def sum(a, b): ... c = a+b; return c ... >>> bar_list = [9,8,7,6,5,4,3,2,1,0] >>> [foo.append(sum(i,x)) for i, x in enumerate(bar_list)] [None, None, None, None, None, None, None, None, None, None] >>> foo [9, 9, 9,...
2013/07/30
[ "https://Stackoverflow.com/questions/17957181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1963929/" ]
I think it's generally frowned upon to use list comprehensions just for side-effects, so I would say a for loop is better in this case. But in any case, couldn't you just do `foo = [sum(i,x) for i, x in enumerate(bar_list)]`?
You should **definitely** drop the list comprehension. End of. * You are confusing anyone reading your code. You are building a list for the side-effects. * You are paying CPU cycles and memory for building a list you are discarding again. In your simplified case, you are overlooking the fact you could have used a li...
17,957,181
I created a line that appends an object to a list in the following manner ``` >>> foo = list() >>> def sum(a, b): ... c = a+b; return c ... >>> bar_list = [9,8,7,6,5,4,3,2,1,0] >>> [foo.append(sum(i,x)) for i, x in enumerate(bar_list)] [None, None, None, None, None, None, None, None, None, None] >>> foo [9, 9, 9,...
2013/07/30
[ "https://Stackoverflow.com/questions/17957181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1963929/" ]
Yes, this is bad style. A list comprehension is to build a list. You're building a list full of `None`s and then throwing it away. Your actual desired result is a side effect of this effort. Why not define `foo` using the list comprehension in the first place? ``` foo = [sum(i,x) for i, x in enumerate(bar_list)] ```...
I think it's generally frowned upon to use list comprehensions just for side-effects, so I would say a for loop is better in this case. But in any case, couldn't you just do `foo = [sum(i,x) for i, x in enumerate(bar_list)]`?
17,957,181
I created a line that appends an object to a list in the following manner ``` >>> foo = list() >>> def sum(a, b): ... c = a+b; return c ... >>> bar_list = [9,8,7,6,5,4,3,2,1,0] >>> [foo.append(sum(i,x)) for i, x in enumerate(bar_list)] [None, None, None, None, None, None, None, None, None, None] >>> foo [9, 9, 9,...
2013/07/30
[ "https://Stackoverflow.com/questions/17957181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1963929/" ]
Yes, this is bad style. A list comprehension is to build a list. You're building a list full of `None`s and then throwing it away. Your actual desired result is a side effect of this effort. Why not define `foo` using the list comprehension in the first place? ``` foo = [sum(i,x) for i, x in enumerate(bar_list)] ```...
You should **definitely** drop the list comprehension. End of. * You are confusing anyone reading your code. You are building a list for the side-effects. * You are paying CPU cycles and memory for building a list you are discarding again. In your simplified case, you are overlooking the fact you could have used a li...
27,026,541
the code is: ------------ ``` from tkinter import * import tkinter as tk global colour global colourselection global count canvas_height = 700 canvas_width = 900 canvas_colour = "black" p1_x = canvas_width/2 p1_y = canvas_height line_width = 5 line_length = 5 def colour(self): global p1_colour p1_colour ...
2014/11/19
[ "https://Stackoverflow.com/questions/27026541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4271708/" ]
Use contextlib.ExitStack() to handle the input files as a group and zip to read lines from all of the files: ``` import contextlib import os filenames = ['a','b','c','d','e'] output_file = 'fred' # setup files for test for filename in filenames: with open(filename, 'w') as fp: for i in range(10): ...
If you are sure you have exactly 5 files, this will work. If you need to make this work on a varying number of files, it gets a bit more complex. ``` with open("file1.txt") as f: file1 = f.readlines() with open("file2.txt") as f: file2 = f.readlines() with open("file3.txt") as f: file3 = f.readlines() with...
27,026,541
the code is: ------------ ``` from tkinter import * import tkinter as tk global colour global colourselection global count canvas_height = 700 canvas_width = 900 canvas_colour = "black" p1_x = canvas_width/2 p1_y = canvas_height line_width = 5 line_length = 5 def colour(self): global p1_colour p1_colour ...
2014/11/19
[ "https://Stackoverflow.com/questions/27026541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4271708/" ]
Use contextlib.ExitStack() to handle the input files as a group and zip to read lines from all of the files: ``` import contextlib import os filenames = ['a','b','c','d','e'] output_file = 'fred' # setup files for test for filename in filenames: with open(filename, 'w') as fp: for i in range(10): ...
Your bash didn't work because you were trying to insert into a line which didn't exist before you insert. ``` echo "\n" > file_to_insert.txt for i in {1..5};do for((num=1;num<66;num++);do line_num=$((num*i) queryline=$(sed -n '${num}p' 'file${i}.txt' sed -i "${num}i '$queryline'" 'file_to_insert.txt' do...
27,026,541
the code is: ------------ ``` from tkinter import * import tkinter as tk global colour global colourselection global count canvas_height = 700 canvas_width = 900 canvas_colour = "black" p1_x = canvas_width/2 p1_y = canvas_height line_width = 5 line_length = 5 def colour(self): global p1_colour p1_colour ...
2014/11/19
[ "https://Stackoverflow.com/questions/27026541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4271708/" ]
Use contextlib.ExitStack() to handle the input files as a group and zip to read lines from all of the files: ``` import contextlib import os filenames = ['a','b','c','d','e'] output_file = 'fred' # setup files for test for filename in filenames: with open(filename, 'w') as fp: for i in range(10): ...
Here is an `gnu awk` (gnu do to the `ARGIND` (file selector)) ``` awk -v t=5 '{c=c<FNR?FNR:c; for (i=1;i<=t;i++) if (ARGIND==i) a[i FS FNR]=$0} END {for (i=1;i<=c;i++) for (j=1;j<=t;j++) print a[j FS i]}' file1 file2 file3 file4 file5 ``` You set `t` to the number of files. Example: ``` cat f1 file1 one file1 two ...
27,026,541
the code is: ------------ ``` from tkinter import * import tkinter as tk global colour global colourselection global count canvas_height = 700 canvas_width = 900 canvas_colour = "black" p1_x = canvas_width/2 p1_y = canvas_height line_width = 5 line_length = 5 def colour(self): global p1_colour p1_colour ...
2014/11/19
[ "https://Stackoverflow.com/questions/27026541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4271708/" ]
Use contextlib.ExitStack() to handle the input files as a group and zip to read lines from all of the files: ``` import contextlib import os filenames = ['a','b','c','d','e'] output_file = 'fred' # setup files for test for filename in filenames: with open(filename, 'w') as fp: for i in range(10): ...
A good possibility to achieve what you want is to stick with standard utilities: here `paste` (specified by POSIX) is recommended: ``` paste -d '\n' file1 file2 file3 file4 file5 ``` or, if you like Bashisms: ``` paste -d '\n' file{1..5} ``` This generalizes trivially to any number of files.
2,910,229
> > How to show that: > $$ \int\_{0}^{\infty}\frac{1}{e^x-1}\left[\frac{12\,e^x}{(e^x-1)^2}-\frac{12}{x^2}+1\right]\,dx=\frac{5}{2}+\frac{\zeta'(2)}{\zeta(2)}-\frac{\zeta'(0)}{\zeta(0)}\tag{1} $$ > Is it possible to split the integral into two integrals representing ${\zeta'}/{\zeta}(0)$ and ${\zeta'}/{\zeta}(2)$....
2018/09/09
[ "https://math.stackexchange.com/questions/2910229", "https://math.stackexchange.com", "https://math.stackexchange.com/users/367051/" ]
Let us consider the integral $$I\_{1}\left(s\right)=\int\_{0}^{\infty}\frac{x^{s-1}e^{x}}{\left(e^{x}-1\right)^{3}}dx,\,\mathrm{Re}\left(s\right)>3.$$ Then, by the dominated convergence theorem, we get $$I\_{1}\left(s\right)=-\frac{1}{2}\sum\_{k\geq2}k\left(k-1\right)\int\_{0}^{\infty}x^{s-1}e^{-kx}dx$$ $$=-\frac{1}{2}...
This is to address your question about splitting the integral into two integrals representing ${\zeta'}/{\zeta}(0)$ and ${\zeta'}/{\zeta}(2)$. I have been intrigued by this kind of question already before encountering your question (see my edits to [this answer](https://mathoverflow.net/a/271633)), wondering whether ${...
2,091,179
i am designing a card game.. multiple clients will connect to a single server object. should i store the instance variables in the protocol or the server object?
2010/01/19
[ "https://Stackoverflow.com/questions/2091179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180444/" ]
You obviously want to use source control. Its one of the basics for working on software - you'll be quickly laughed at for not doing so. Its really pick your poison - I would strong recommend [Git](http://git-scm.org) via a site such as [Github](http://github.com) or [Gitorious](http://gitorious.org), though there is n...
Without source code control, you simply cannot do anything useful. I use subversion. As for project tools, maybe [assembla.com](http://www.assembla.com), with opensource option? I like and use it, though you might want to use the standard FOSS sites mentioned by Totophil Paid option also exists and assembla.c...
2,091,179
i am designing a card game.. multiple clients will connect to a single server object. should i store the instance variables in the protocol or the server object?
2010/01/19
[ "https://Stackoverflow.com/questions/2091179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180444/" ]
You obviously want to use source control. Its one of the basics for working on software - you'll be quickly laughed at for not doing so. Its really pick your poison - I would strong recommend [Git](http://git-scm.org) via a site such as [Github](http://github.com) or [Gitorious](http://gitorious.org), though there is n...
Using a SCM is a minimal requirement for serious programming period. I can't figure how some people can code (even alone) without using one. There is a lot of good and free SCM (my favorites are Git and Mercurial) out there, there is no excuses not using one. Collaboration can be achieved in many ways. Minimal solut...
2,091,179
i am designing a card game.. multiple clients will connect to a single server object. should i store the instance variables in the protocol or the server object?
2010/01/19
[ "https://Stackoverflow.com/questions/2091179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180444/" ]
As far as I can gather the main driving factors, and please correct me if I'm wrong, in you situation for establishing the collaboration environment are: * A team of 4-5 people with limited programming experience. * 3 months time cap for the initial product. * No existing dev environment you could easily re-use. * Due...
Without source code control, you simply cannot do anything useful. I use subversion. As for project tools, maybe [assembla.com](http://www.assembla.com), with opensource option? I like and use it, though you might want to use the standard FOSS sites mentioned by Totophil Paid option also exists and assembla.c...
2,091,179
i am designing a card game.. multiple clients will connect to a single server object. should i store the instance variables in the protocol or the server object?
2010/01/19
[ "https://Stackoverflow.com/questions/2091179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180444/" ]
As far as I can gather the main driving factors, and please correct me if I'm wrong, in you situation for establishing the collaboration environment are: * A team of 4-5 people with limited programming experience. * 3 months time cap for the initial product. * No existing dev environment you could easily re-use. * Due...
Using a SCM is a minimal requirement for serious programming period. I can't figure how some people can code (even alone) without using one. There is a lot of good and free SCM (my favorites are Git and Mercurial) out there, there is no excuses not using one. Collaboration can be achieved in many ways. Minimal solut...
2,091,179
i am designing a card game.. multiple clients will connect to a single server object. should i store the instance variables in the protocol or the server object?
2010/01/19
[ "https://Stackoverflow.com/questions/2091179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180444/" ]
Without source code control, you simply cannot do anything useful. I use subversion. As for project tools, maybe [assembla.com](http://www.assembla.com), with opensource option? I like and use it, though you might want to use the standard FOSS sites mentioned by Totophil Paid option also exists and assembla.c...
Using a SCM is a minimal requirement for serious programming period. I can't figure how some people can code (even alone) without using one. There is a lot of good and free SCM (my favorites are Git and Mercurial) out there, there is no excuses not using one. Collaboration can be achieved in many ways. Minimal solut...
48,594,725
Software like ffmpeg/avconv, imagemagick convert. Do they use an intermediate format: ``` format1 -> I. F. format2 -> I. F. I. F. -> format2 I. F. -> format3 ... ``` Or do they have a *method* for converting from and to each supported format: ``` format1 -> format2 format1 -> format3 format2 -> format1 format2 -> ...
2018/02/03
[ "https://Stackoverflow.com/questions/48594725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145359/" ]
Change your code to: ``` $(".ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-icon-only.ui-dialog-titlebar-close").click(function (e) { alert('Hi'); // actions }); ``` Your `<button>` element have multiple selectors, so you need to use a period for all selectors and with no space (because these all a...
**Its look like you have entered the wrong class in the selector** ```js jQuery(document).ready(function(){ $(".ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-icon-only.ui-dialog-titlebar-close").click(function (e) { alert('Hi'); // actions }); }); ``` ```html <script src="https://ajax.googleap...
70,370,224
It's saying that it doesn't recognize ganache-cli as a command, despite installing it and everything else as directed. Using: * brownie v1.17.2 * node v17.2.0 (npm v8.1.4) * nvm 0.39.0 * Python 3.9.7 * Ganache CLI v6.12.2 (ganache-core: 2.13.2) As part of the Solidity course [here](https://www.youtube.com/watch?v=M5...
2021/12/15
[ "https://Stackoverflow.com/questions/70370224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17637503/" ]
Looks like this can be resolved using nvm v 16. ``` nvm install 16 nvm use 16 node --version v16.13.1 x@y brownie_simple_storage % brownie run scripts/deploy.py Brownie v1.17.2 - Python development framework for Ethereum BrownieSimpleStorageProject is the active project. Launching 'ganache-cli --port 8545 --gasLimi...
Most likely the issue you're dealing with is because ganache is already running in another active project, in order to have brownie recognize ganache is to make sure that's the only environment running ganache close to the project running the node. Which, is most likely the web3 simple storage file... not the newly cre...
27,852
In an attempt to solve [this question](https://gamedev.stackexchange.com/questions/27058/how-to-programatically-retarget-animations-from-one-skeleton-to-another), I decided to figure out the absolute (world space) directions of each joint in the source pose (as normalized unit vectors), and then rotate the joints of th...
2012/04/23
[ "https://gamedev.stackexchange.com/questions/27852", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/1553/" ]
From your description of your problem, it sounds like the heart of the matter might be that your representation is currently missing data. A bone isn't simply the vector from one joint to the next — it's a full transformation matrix representing the orientation of the local frame, either with respect to world space or ...
If I got this right, you are storing the whole skeleton bones vertexes into a matrix. I think your problem is more related to the way you are storing the Bones than to quaternions themselves. I'll try to explain what I mean: Since you basically have the result of the rotation (a rotated bone to use as a model), and ...
8,281,555
I have a complex query in PostgreSQL and I want to use the result of it in other operations like UPDATEs and DELETEs, something like: ``` <COMPLEX QUERY>; UPDATE WHERE <COMPLEX QUERY RESULT> = ?; DELETE WHERE <COMPLEX QUERY RESULT> = ?; UPDATE WHERE <COMPLEX QUERY RESULT> = ?; ``` I don't want to have to do the comp...
2011/11/26
[ "https://Stackoverflow.com/questions/8281555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/734984/" ]
You can loop through the query results like @phatfingers demonstrates (probably with a generic `record` variable or scalar variables instead of a `rowtype`, if the result type of the query doesn't match any existing rowtype). This is a good idea for **few resulting rows** or when **sequential processing** is necessary....
``` DECLARE r foo%rowtype; BEGIN FOR r IN [COMPLEX QUERY] LOOP -- process r END LOOP; RETURN; END ```
23,428,594
**index.php:** Form is within a Bootstrap modal. ``` <form class="form-horizontal" action="core/login.php" method="post"> ... </form> ``` **core/login.php:** ``` if($conn){ ... if ($count > 0) { ... } else { echo "Login Failed"; } oci_free_statement($stid); oci_close($conn); } ``` How can ...
2014/05/02
[ "https://Stackoverflow.com/questions/23428594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2656114/" ]
I used your code and created this: ``` NSDate *yesterday; NSTimeInterval interval; NSCalendar *cal = [NSCalendar currentCalendar]; [cal rangeOfUnit:NSDayCalendarUnit startDate:&yesterday interval:&interval forDate:[NSDate date]]; yesterday = [yesterday dateByAddingTimeInterval:-interval]; N...
Hi I write this Function for LocalTime it Takes input of date as String and covert to Local Time String. May it help you ``` +(NSString*)LocalTimeWitheDateString:(NSString*)dateString{ NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; NSTimeZone *timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; ...
51,792,045
I am trying to subtract the values from two arrays. I have also tried with an `if` condition, `null` value, `foreach` and a lot other methods like `array_filter`, but I failed. `$exit_price` contains: ``` array ( 0 => 2205, 1 => 6680, 2 => 50351, 3 => 100, 4 => 100, 5 => 1200, 6 => 900, ...
2018/08/10
[ "https://Stackoverflow.com/questions/51792045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`disableAnswer(answers, index)` is evaluated only once upon rendering. Initially, `answerVal` is `null`, as no answers have been selected yet, so `disableAnswer` returns `true`, causing all radio buttons to be disabled immediately. A quick fix is to add `answerVal` as a function argument (i.e., `disableAnswer(answers,...
You can do something like this, check if input is clicked or if not clicked in that case make disabled set to false. ``` <input :disabled="disableAnswer(answer)" /> ``` Js ``` disableAnswer : function(answer){ if(this.answerVal=="" ||this.answerVal==answer.answerName) { return false; } else { r...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
You can't do it with standard library. Using **pytz** module you can convert any naive/aware datetime object to any other time zone. Lets see some examples using Python 3. > > Naive objects created through class method `utcnow()` > > > To convert a **naive** object to any other time zone, first you have to conver...
for a specific situation:  input utc datetime string. // usually from log  output locale datetime string. ```py def utc_to_locale(utc_str): # from utc to locale d1=datetime.fromisoformat(utc_str+'-00:00') return d1.astimezone().strftime('%F %T.%f')[:-3] ``` tests: ``` >>> utc_to_locale('2022-02-14...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
The easiest way I have found is to get the time offset of where *you* are, then subtract that from the hour. ``` def format_time(ts,offset): if not ts.hour >= offset: ts = ts.replace(day=ts.day-1) ts = ts.replace(hour=ts.hour-offset) else: ts = ts.replace(hour=ts.hour-offset) return...
A simple (but maybe flawed) way that works in Python 2 and 3: ``` import time import datetime def utc_to_local(dt): return dt - datetime.timedelta(seconds = time.timezone) ``` Its advantage is that it's trivial to write an inverse function
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
In Python 3.3+: ``` from datetime import datetime, timezone def utc_to_local(utc_dt): return utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None) ``` In Python 2/3: ``` import calendar from datetime import datetime, timedelta def utc_to_local(utc_dt): # get integer timestamp to avoid precision lost ...
I think I figured it out: computes number of seconds since epoch, then converts to a local timzeone using time.localtime, and then converts the time struct back into a datetime... ``` EPOCH_DATETIME = datetime.datetime(1970,1,1) SECONDS_PER_DAY = 24*60*60 def utc_to_local_datetime( utc_datetime ): delta = utc_dat...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
In Python 3.3+: ``` from datetime import datetime, timezone def utc_to_local(utc_dt): return utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None) ``` In Python 2/3: ``` import calendar from datetime import datetime, timedelta def utc_to_local(utc_dt): # get integer timestamp to avoid precision lost ...
Use timedelta to switch between timezones. All you need is the offset in hours between timezones. Don't have to fiddle with boundaries for all 6 elements of a datetime object. timedelta handles leap years, leap centuries, etc., too, with ease. You must first ``` from datetime import datetime, timedelta ``` Then if ...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
The easiest way I have found is to get the time offset of where *you* are, then subtract that from the hour. ``` def format_time(ts,offset): if not ts.hour >= offset: ts = ts.replace(day=ts.day-1) ts = ts.replace(hour=ts.hour-offset) else: ts = ts.replace(hour=ts.hour-offset) return...
Here is another way to change timezone in datetime format (I know I wasted my energy on this but I didn't see this page so I don't know how) without min. and sec. cause I don't need it for my project: ``` def change_time_zone(year, month, day, hour): hour = hour + 7 #<-- difference if hour >= 24: d...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
Since Python 3.9 you can use the `zoneinfo` module. First lets get that time with `utcnow()`: ``` >>> from datetime import datetime >>> database_time = datetime.utcnow() >>> database_time datetime.datetime(2021, 9, 24, 4, 18, 27, 706532) ``` Then create the time zones: ``` >>> from zoneinfo import ZoneInfo >>> utc...
I think I figured it out: computes number of seconds since epoch, then converts to a local timzeone using time.localtime, and then converts the time struct back into a datetime... ``` EPOCH_DATETIME = datetime.datetime(1970,1,1) SECONDS_PER_DAY = 24*60*60 def utc_to_local_datetime( utc_datetime ): delta = utc_dat...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
In Python 3.3+: ``` from datetime import datetime, timezone def utc_to_local(utc_dt): return utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None) ``` In Python 2/3: ``` import calendar from datetime import datetime, timedelta def utc_to_local(utc_dt): # get integer timestamp to avoid precision lost ...
Since Python 3.9 you can use the `zoneinfo` module. First lets get that time with `utcnow()`: ``` >>> from datetime import datetime >>> database_time = datetime.utcnow() >>> database_time datetime.datetime(2021, 9, 24, 4, 18, 27, 706532) ``` Then create the time zones: ``` >>> from zoneinfo import ZoneInfo >>> utc...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
Use `time.timezone`, it gives an integer in "seconds west of UTC". For example: ```py from datetime import datetime, timedelta, timezone import time # make datetime from timestamp, thus no timezone info is attached now = datetime.fromtimestamp(time.time()) # make local timezone with time.timezone local_tz = timezon...
for a specific situation:  input utc datetime string. // usually from log  output locale datetime string. ```py def utc_to_locale(utc_str): # from utc to locale d1=datetime.fromisoformat(utc_str+'-00:00') return d1.astimezone().strftime('%F %T.%f')[:-3] ``` tests: ``` >>> utc_to_locale('2022-02-14...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
In Python 3.3+: ``` from datetime import datetime, timezone def utc_to_local(utc_dt): return utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None) ``` In Python 2/3: ``` import calendar from datetime import datetime, timedelta def utc_to_local(utc_dt): # get integer timestamp to avoid precision lost ...
This is a terrible way to do it but it avoids creating a definition. It fulfills the requirement to stick with the basic Python3 library. ``` # Adjust from UST to Eastern Standard Time (dynamic) # df.my_localtime should already be in datetime format, so just in case df['my_localtime'] = pd.to_datetime.df['my_localtime...
4,563,272
I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to local `datetime` using the default local timezone (i.e., as if the `datetime` was created using `datetime.now()`). How c...
2010/12/30
[ "https://Stackoverflow.com/questions/4563272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/558340/" ]
You can't do it with standard library. Using **pytz** module you can convert any naive/aware datetime object to any other time zone. Lets see some examples using Python 3. > > Naive objects created through class method `utcnow()` > > > To convert a **naive** object to any other time zone, first you have to conver...
The standard Python library does not come with any `tzinfo` implementations at all. I've always considered this a surprising shortcoming of the datetime module. The [documentation for the tzinfo class](http://docs.python.org/library/datetime.html#tzinfo-objects) does come with some useful examples. Look for the large ...