qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
2,900,084
I have a list of integers and I need to count how many of them are > 0. I'm currently doing it with a list comprehension that looks like this: ``` sum([1 for x in frequencies if x > 0]) ``` It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more...
2010/05/24
[ "https://Stackoverflow.com/questions/2900084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122808/" ]
A slightly more Pythonic way would be to use a generator instead: ``` sum(1 for x in frequencies if x > 0) ``` This avoids generating the whole list before calling `sum()`.
If the array only contains elements >= 0 (i.e. all elements are either 0 or a positive integer) then you could just count the zeros and subtract this number form the length of the array: ``` len(arr) - arr.count(0) ```
39,773,279
I have over 20,000 records that are being exported from a program that look like this: ``` Parent : 000691195 CUSTNO : 115225036-AD COMPANY : BROOK FURNITURE RENTAL ADDRESS1 : 100 N FIELD DR city : LAKE FOREST STATE : IL ZIP : 600452580 Parent : 000691195 CUSTNO : 116952265-AD COMPANY : BROOK FU...
2016/09/29
[ "https://Stackoverflow.com/questions/39773279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6900128/" ]
Rather than converting your function to a template, convert your class to a template: ``` template <class T> class myclass { private: T *data; public: myclass(size_t size) : data(new T[size]) { } ... // Add copy constructor, assignment operator, and a destructor // to properly manage the pointe...
Convert your whole class to a templated class ``` template<typename T> class Container { public: Container() : data(NULL) {} ~Container() { if (data) { delete [] data; } } T* foo(int size) { if (data) { delete [] data; } data =...
39,773,279
I have over 20,000 records that are being exported from a program that look like this: ``` Parent : 000691195 CUSTNO : 115225036-AD COMPANY : BROOK FURNITURE RENTAL ADDRESS1 : 100 N FIELD DR city : LAKE FOREST STATE : IL ZIP : 600452580 Parent : 000691195 CUSTNO : 116952265-AD COMPANY : BROOK FU...
2016/09/29
[ "https://Stackoverflow.com/questions/39773279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6900128/" ]
You may consider making your whole class a template, like this: ``` template <typename T> class Foo { private: T *data; public: Foo(size_t size_): data{new T[size]} { } ~Foo() { delete[] data; } }; ``` Implementation is here only partial. See this about [rule of 3, 5, 0](h...
Convert your whole class to a templated class ``` template<typename T> class Container { public: Container() : data(NULL) {} ~Container() { if (data) { delete [] data; } } T* foo(int size) { if (data) { delete [] data; } data =...
18,441,255
Basically (said slightly tongue-in-cheek) I have a csv file in a format like this: ``` "ID","Name","Phone Number" "00001","Ricky Stallman","07771111111" "00003","Harrison Ford","07701010101" "00003","Harrison Ford","" "00008","Bob Geldof","07712121212" ``` Where the 'Harrison Ford' entry appears again in my csv ther...
2013/08/26
[ "https://Stackoverflow.com/questions/18441255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2409166/" ]
Try this: ``` awk -F',' '$3!~/""/{nbr=$3} {print $1","$2","nbr}' file ``` If the third column is "" then use the last valid value.
A gawk solution could be used: ``` #!/usr/bin/gawk -f match($0, /"([^\"]*)".*,"([^"]*)","([^"]*)"/, t) { key = t[1] "|" t[2] ## Or just key = t[2] to be less strict. if (!(t[3] == "" && key in a)) { a[key] = t[3] } printf "\"%s\",\"%s\",\"\"%s\"\n", t[1], t[2], a[key] } ``` Condensed: ``` ...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
What was causing the issue for me was **changing the name** together with **changing the relations** associated with the entity. So my resolution in my case was: * Changing the name back to the old one * Adding the migration (then was able to do it) * Updating the database * Changing the name of the entity and gener...
This has happened to me when I was doing it for a small web project. The web's .csproj failed to load one time and visual studio decided to change the default project to a random one that did load. Because the app.config in the new default project did not contain any connectionStrings... EF could not find anywhere to...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
Looks like a bug. Do you mind filing it at <http://entityframework.codeplex.com/workitem/list/advanced> with details allowing to reproduce the problem?
I got this error when using Fluent API in `OnModelCreating` like this: ``` modelBuilder.Entity<ApplicationUser>() .Property(b => b.Id) .HasColumnType("nvarchar(128)"); ``` Changed to this and then everything worked: ``` modelBuilder.Entity<ApplicationUser>() .Property(b => b.Id) .HasColumnType("nvar...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
I got this error when using Fluent API in `OnModelCreating` like this: ``` modelBuilder.Entity<ApplicationUser>() .Property(b => b.Id) .HasColumnType("nvarchar(128)"); ``` Changed to this and then everything worked: ``` modelBuilder.Entity<ApplicationUser>() .Property(b => b.Id) .HasColumnType("nvar...
I ran into the same problem, I found this issue: [Migrations: "Sequence contains no elements" in model differ after renaming PK property when self-referencing relationship with no FK property (independent association)](http://entityframework.codeplex.com/workitem/569) which is the situation that I'm stuck with. it's a ...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
This problem occurs to me when a try to define type and size of a column with `DataAnnotations`. BAD: ``` [Column(TypeName="VARCHAR(254)")] public string ColumnName { get; set; } ``` OK: ``` [MaxLength(254)] [Column(TypeName="VARCHAR")] public string ColumnName { get; set; } ```
I also encountered this because I was trying to run a migration with a class missing the public access modifier. Once I added this - the error was resolved.
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
Looks like a bug. Do you mind filing it at <http://entityframework.codeplex.com/workitem/list/advanced> with details allowing to reproduce the problem?
I ran into the same problem, I found this issue: [Migrations: "Sequence contains no elements" in model differ after renaming PK property when self-referencing relationship with no FK property (independent association)](http://entityframework.codeplex.com/workitem/569) which is the situation that I'm stuck with. it's a ...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
Looks like a bug. Do you mind filing it at <http://entityframework.codeplex.com/workitem/list/advanced> with details allowing to reproduce the problem?
In my case it was due to a mistake on my part. In my configuration, I accidentally included a navigation property instead of the property that represented the column, for example: ``` HasIndex(x => new { x.ID, x.Parent }).IsUnique(); ``` which should have been ``` HasIndex(x => new { x.ID, x.ParentID }).IsUnique();...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
I got this error when using Fluent API in `OnModelCreating` like this: ``` modelBuilder.Entity<ApplicationUser>() .Property(b => b.Id) .HasColumnType("nvarchar(128)"); ``` Changed to this and then everything worked: ``` modelBuilder.Entity<ApplicationUser>() .Property(b => b.Id) .HasColumnType("nvar...
This has happened to me when I was doing it for a small web project. The web's .csproj failed to load one time and visual studio decided to change the default project to a random one that did load. Because the app.config in the new default project did not contain any connectionStrings... EF could not find anywhere to...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
I also encountered this because I was trying to run a migration with a class missing the public access modifier. Once I added this - the error was resolved.
In my case it was due to a mistake on my part. In my configuration, I accidentally included a navigation property instead of the property that represented the column, for example: ``` HasIndex(x => new { x.ID, x.Parent }).IsUnique(); ``` which should have been ``` HasIndex(x => new { x.ID, x.ParentID }).IsUnique();...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
Looks like a bug. Do you mind filing it at <http://entityframework.codeplex.com/workitem/list/advanced> with details allowing to reproduce the problem?
This has happened to me when I was doing it for a small web project. The web's .csproj failed to load one time and visual studio decided to change the default project to a random one that did load. Because the app.config in the new default project did not contain any connectionStrings... EF could not find anywhere to...
12,500,625
**command:** add-migration blahblah -verbose **error:** Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run`add-migration` yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with m...
2012/09/19
[ "https://Stackoverflow.com/questions/12500625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/850990/" ]
This problem occurs to me when a try to define type and size of a column with `DataAnnotations`. BAD: ``` [Column(TypeName="VARCHAR(254)")] public string ColumnName { get; set; } ``` OK: ``` [MaxLength(254)] [Column(TypeName="VARCHAR")] public string ColumnName { get; set; } ```
I have encountered the same problem when there is inheritance between two entities and I wanted to create a index on a property on one of them. There is a [reported bug on this issue](https://github.com/aspnet/EntityFramework6/issues/673) on version 6.3. When I removed the inheritance or the index, migration was crea...
7,092,430
``` [WebMethod] public static List<Employee> GetData() { List<Employee> oEmployee = new List<Employee> { new Employee("Arijit","Accounts",23000,'01/01/2001'), new Employee("Tridip","Sales",15000,'01/01/2005'), new Employee("Dibyendu","IT",16000,'...
2011/08/17
[ "https://Stackoverflow.com/questions/7092430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/508127/" ]
I think you better to use a feature called "JQuery Templates". more information with a good example can be found here <http://weblogs.asp.net/hajan/archive/2010/12/13/jquery-templates-in-asp-net-introduction.aspx> and here is a more of an advanced example: <http://weblogs.asp.net/dwahlin/archive/2009/05/03/using-jque...
you can use jquery templates.This will be a help <http://www.borismoore.com/2010/09/introducing-jquery-templates-1-first.html>
35,511,063
Beginner developer here - I'm creating a card game in Android Studio using java, and I have cards (ImageViews) being created on the click of a button in my Horizontal LinearLayout. Everything is working great, but when the objects get to the edge of the mobile screen, they just disappear as they are created. I'm havi...
2016/02/19
[ "https://Stackoverflow.com/questions/35511063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4783762/" ]
``` var t = "2016-02-18T23:07:00.000-08:00" var u = Date.parse(t); ```
Just use Moment.js: ``` moment('2016-02-18T23:07:00.000-08:00').format('LLL'); ``` Returns: > > February 19, 2016 8:07 AM > > > Or just a timestamp: ``` Date.parse('2016-02-18T23:07:00.000-08:00'); ``` Works fine <https://momentjs.com>
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I haven't used selenium, but if you know the image's URL, why not just do: ``` from urllib import urlretrieve urlretrieve(url, filename) ``` which will save the url to the filename. more info [here](http://docs.python.org/library/urllib.html#urllib.urlretrieve)
How about going to the image URL and then taking a screenshot of the page? Firefox displays the image in full screen. Hope this helps..
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
To do this the way you want (to actually capture the content sent down to the browser) you'd need to modify Selenium RC's proxy code (see ProxyHandler.java) and store the files locally on the disk in parallel to sending the response back to the browser.
How about going to the image URL and then taking a screenshot of the page? Firefox displays the image in full screen. Hope this helps..
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I was trying to accomplish the same task, but the images I wanted to grab were the size of my monitor (wallpaper) -- so the capture screenshot workaround didn't work for me. I figured out a way to do it... I've got selenium set up to go to the page I want (which induces all the session goodies) Then I used a program c...
How about going to the image URL and then taking a screenshot of the page? Firefox displays the image in full screen. Hope this helps..
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I found code that puts an image in to a canvas, then converts it to data - which could then be base64 encoded for example. My thought was to call this using the eval command in selenium, however in my testing the toDataURL is throwing a security error 1000. Seems like it is so close to a solution if not for that error....
How about going to the image URL and then taking a screenshot of the page? Firefox displays the image in full screen. Hope this helps..
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
To do this the way you want (to actually capture the content sent down to the browser) you'd need to modify Selenium RC's proxy code (see ProxyHandler.java) and store the files locally on the disk in parallel to sending the response back to the browser.
I haven't used selenium, but if you know the image's URL, why not just do: ``` from urllib import urlretrieve urlretrieve(url, filename) ``` which will save the url to the filename. more info [here](http://docs.python.org/library/urllib.html#urllib.urlretrieve)
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I was trying to accomplish the same task, but the images I wanted to grab were the size of my monitor (wallpaper) -- so the capture screenshot workaround didn't work for me. I figured out a way to do it... I've got selenium set up to go to the page I want (which induces all the session goodies) Then I used a program c...
I haven't used selenium, but if you know the image's URL, why not just do: ``` from urllib import urlretrieve urlretrieve(url, filename) ``` which will save the url to the filename. more info [here](http://docs.python.org/library/urllib.html#urllib.urlretrieve)
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I found code that puts an image in to a canvas, then converts it to data - which could then be base64 encoded for example. My thought was to call this using the eval command in selenium, however in my testing the toDataURL is throwing a security error 1000. Seems like it is so close to a solution if not for that error....
I haven't used selenium, but if you know the image's URL, why not just do: ``` from urllib import urlretrieve urlretrieve(url, filename) ``` which will save the url to the filename. more info [here](http://docs.python.org/library/urllib.html#urllib.urlretrieve)
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I found code that puts an image in to a canvas, then converts it to data - which could then be base64 encoded for example. My thought was to call this using the eval command in selenium, however in my testing the toDataURL is throwing a security error 1000. Seems like it is so close to a solution if not for that error....
To do this the way you want (to actually capture the content sent down to the browser) you'd need to modify Selenium RC's proxy code (see ProxyHandler.java) and store the files locally on the disk in parallel to sending the response back to the browser.
816,704
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 sel...
2009/05/03
[ "https://Stackoverflow.com/questions/816704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/84196/" ]
I found code that puts an image in to a canvas, then converts it to data - which could then be base64 encoded for example. My thought was to call this using the eval command in selenium, however in my testing the toDataURL is throwing a security error 1000. Seems like it is so close to a solution if not for that error....
I was trying to accomplish the same task, but the images I wanted to grab were the size of my monitor (wallpaper) -- so the capture screenshot workaround didn't work for me. I figured out a way to do it... I've got selenium set up to go to the page I want (which induces all the session goodies) Then I used a program c...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
> > Teacher stated that the ionic compounds dissolve in water except some carbonates. > > > That is, at best, an oversimplification. Other ionic compounds such as silver sulfide are sparingly soluble in water. Note that this isn't a carbonate. And sodium hydrogen carbonate - $\ce{NaHCO3}$ - is soluble in water. ...
Solubility of salts is not a prediction that I like to make. It all comes down to $\Delta{G}\_{sol} < 0$. That condition is fulfilled when $\Delta{H}\_{sol} < 0$ and $T \Delta{S}\_{sol} > 0$ or one factor outweighs the other. There's two problems. Lattice enthalpies are large, as are solvation enthalpies, and the comm...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
As someone said here, this: > > The teacher stated that the ionic compounds dissolve in water except > some carbonates. > > > Is indeed an oversimplification. First of all, the distinction between an "ionic compound" to other compounds isn't too defined. What your teacher probably said, or didn't say but wanted ...
> > Teacher stated that the ionic compounds dissolve in water except some carbonates. > > > That is, at best, an oversimplification. Other ionic compounds such as silver sulfide are sparingly soluble in water. Note that this isn't a carbonate. And sodium hydrogen carbonate - $\ce{NaHCO3}$ - is soluble in water. ...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
> > Teacher stated that the ionic compounds dissolve in water except some carbonates. > > > That is, at best, an oversimplification. Other ionic compounds such as silver sulfide are sparingly soluble in water. Note that this isn't a carbonate. And sodium hydrogen carbonate - $\ce{NaHCO3}$ - is soluble in water. ...
To be very honest with you, it's almost impossible to predict accurately, the solubility of compounds. At the end of the day, it's best to memorize them. Yes, there are some cases wherein a certain logic or reasoning can be used, but mostly its better to just memorize the thing. As Abel said, it comes down to a difficu...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
For an ionic substance to dissolve in water, there are two competing factors that determine the enthalpy of solution $\Delta{H}\_\mathrm{sol}$ which is the enthalpy (energy) change when a solute is dissolved in a solvent: 1. The lattice energy (LE), the energy of formation of the crystal between infinitely separated i...
Solubility of salts is not a prediction that I like to make. It all comes down to $\Delta{G}\_{sol} < 0$. That condition is fulfilled when $\Delta{H}\_{sol} < 0$ and $T \Delta{S}\_{sol} > 0$ or one factor outweighs the other. There's two problems. Lattice enthalpies are large, as are solvation enthalpies, and the comm...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
As someone said here, this: > > The teacher stated that the ionic compounds dissolve in water except > some carbonates. > > > Is indeed an oversimplification. First of all, the distinction between an "ionic compound" to other compounds isn't too defined. What your teacher probably said, or didn't say but wanted ...
For an ionic substance to dissolve in water, there are two competing factors that determine the enthalpy of solution $\Delta{H}\_\mathrm{sol}$ which is the enthalpy (energy) change when a solute is dissolved in a solvent: 1. The lattice energy (LE), the energy of formation of the crystal between infinitely separated i...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
For an ionic substance to dissolve in water, there are two competing factors that determine the enthalpy of solution $\Delta{H}\_\mathrm{sol}$ which is the enthalpy (energy) change when a solute is dissolved in a solvent: 1. The lattice energy (LE), the energy of formation of the crystal between infinitely separated i...
To be very honest with you, it's almost impossible to predict accurately, the solubility of compounds. At the end of the day, it's best to memorize them. Yes, there are some cases wherein a certain logic or reasoning can be used, but mostly its better to just memorize the thing. As Abel said, it comes down to a difficu...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
As someone said here, this: > > The teacher stated that the ionic compounds dissolve in water except > some carbonates. > > > Is indeed an oversimplification. First of all, the distinction between an "ionic compound" to other compounds isn't too defined. What your teacher probably said, or didn't say but wanted ...
Solubility of salts is not a prediction that I like to make. It all comes down to $\Delta{G}\_{sol} < 0$. That condition is fulfilled when $\Delta{H}\_{sol} < 0$ and $T \Delta{S}\_{sol} > 0$ or one factor outweighs the other. There's two problems. Lattice enthalpies are large, as are solvation enthalpies, and the comm...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
Solubility of salts is not a prediction that I like to make. It all comes down to $\Delta{G}\_{sol} < 0$. That condition is fulfilled when $\Delta{H}\_{sol} < 0$ and $T \Delta{S}\_{sol} > 0$ or one factor outweighs the other. There's two problems. Lattice enthalpies are large, as are solvation enthalpies, and the comm...
To be very honest with you, it's almost impossible to predict accurately, the solubility of compounds. At the end of the day, it's best to memorize them. Yes, there are some cases wherein a certain logic or reasoning can be used, but mostly its better to just memorize the thing. As Abel said, it comes down to a difficu...
17,089
I studied the solubility of compounds in water. I have found that [calcium carbonate](http://en.wikipedia.org/wiki/Calcium_carbonate) doesn't dissolve in water. The teacher stated that the ionic compounds dissolve in water except some carbonates. What would be a clear elaboration of this phenomenon?
2014/10/05
[ "https://chemistry.stackexchange.com/questions/17089", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/8197/" ]
As someone said here, this: > > The teacher stated that the ionic compounds dissolve in water except > some carbonates. > > > Is indeed an oversimplification. First of all, the distinction between an "ionic compound" to other compounds isn't too defined. What your teacher probably said, or didn't say but wanted ...
To be very honest with you, it's almost impossible to predict accurately, the solubility of compounds. At the end of the day, it's best to memorize them. Yes, there are some cases wherein a certain logic or reasoning can be used, but mostly its better to just memorize the thing. As Abel said, it comes down to a difficu...
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project.
Make a "Default.png" file (with a capital "D"). Then clean all targets and build again.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
Check the case of the file name. Default.png, default.png, Default.PNG and DEFAULT.png are all different files on the device, but not in the simulator.
Make sure the name of the file begins with a capital "D", then clean and rebuild.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project.
Select your Default.png in the groups and files window and make sure in the file listing above the editor window that the checkbox on the far right is checked. Without this the file will not be copied to the application bundle after compilation is finished.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project.
Make sure the name of the file begins with a capital "D", then clean and rebuild.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
Make a "Default.png" file (with a capital "D"). Then clean all targets and build again.
Make sure the name of the file begins with a capital "D", then clean and rebuild.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
Check the case of the file name. Default.png, default.png, Default.PNG and DEFAULT.png are all different files on the device, but not in the simulator.
Sometimes this issue hapens, when .png file was renamed from .jpg file. So, for example, you had image.jpg, you've renamed in to image.png, and using this image.png. It'll be correctly displayed in simulator, and won't work on device
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project.
Sometimes this issue hapens, when .png file was renamed from .jpg file. So, for example, you had image.jpg, you've renamed in to image.png, and using this image.png. It'll be correctly displayed in simulator, and won't work on device
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
Check the case of the file name. Default.png, default.png, Default.PNG and DEFAULT.png are all different files on the device, but not in the simulator.
Select your Default.png in the groups and files window and make sure in the file listing above the editor window that the checkbox on the far right is checked. Without this the file will not be copied to the application bundle after compilation is finished.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
Make sure the name of the file begins with a capital "D", then clean and rebuild.
Select your Default.png in the groups and files window and make sure in the file listing above the editor window that the checkbox on the far right is checked. Without this the file will not be copied to the application bundle after compilation is finished.
1,067,998
i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device
2009/07/01
[ "https://Stackoverflow.com/questions/1067998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83905/" ]
Sometimes this issue hapens, when .png file was renamed from .jpg file. So, for example, you had image.jpg, you've renamed in to image.png, and using this image.png. It'll be correctly displayed in simulator, and won't work on device
Select your Default.png in the groups and files window and make sure in the file listing above the editor window that the checkbox on the far right is checked. Without this the file will not be copied to the application bundle after compilation is finished.
191,945
I'd appreciate advice regarding both the implementation detail and ways to improve usage/performance/generic. There are two parts: `XDelegate`, which is I got from [here](http://blog.coldflake.com/posts/C++-delegates-on-steroids/), and `XEvent`, which is the event implementation similar to C#. ``` #pragma once #inclu...
2018/04/13
[ "https://codereview.stackexchange.com/questions/191945", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/167053/" ]
The constructor of `uniform_int_distribution` has default arguments: ``` template<typename T> explicit uniform_int_distribution(T a = 0, T b = std::numeric_limits<T>::max()); ``` (I don't know why `a` defaults to 0 rather than to the minimum `T`, but there you go). You can reduce ...
As it stands right now, every time you need a random number, you're creating a new instance of `std::mt19937`, then using `std::random_device` to seed this instance, then (finally) getting a number and returning it. What you (nearly always) want to do is create *one* instance of `std::mt19937`, seed it once, and then ...
49,361,487
I needed to fetch first block in "*.*" string (i.e '\*') in shell script. I found that instead of printing the string it is displaying list of all file in current directory. How overcome this issue? main purpose is change string "asterisk.asterick" (this read from /etc/rsyslog.conf) to "\*.debug", here first field i...
2018/03/19
[ "https://Stackoverflow.com/questions/49361487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295604/" ]
Actually you have to quote variable itself. `echo "$ccvv"`
As i understand it... ``` $ echo "*.*" *.* $ ccvv="*.*" $ echo $ccvv *.* ``` Or?
49,361,487
I needed to fetch first block in "*.*" string (i.e '\*') in shell script. I found that instead of printing the string it is displaying list of all file in current directory. How overcome this issue? main purpose is change string "asterisk.asterick" (this read from /etc/rsyslog.conf) to "\*.debug", here first field i...
2018/03/19
[ "https://Stackoverflow.com/questions/49361487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295604/" ]
As i understand it... ``` $ echo "*.*" *.* $ ccvv="*.*" $ echo $ccvv *.* ``` Or?
You could use `sed`'s substitution: ``` sed -i.bak 's/\([a-zA-Z0-9*]\+\.\).*/\1debug/g' InputFile ``` Here `.bak` will create a backup file named `InputFile.bak` before doing the replacement. Example input: ``` some text *.conf some text some.text ``` Output: ``` some text *.debug some text some.debug ```
49,361,487
I needed to fetch first block in "*.*" string (i.e '\*') in shell script. I found that instead of printing the string it is displaying list of all file in current directory. How overcome this issue? main purpose is change string "asterisk.asterick" (this read from /etc/rsyslog.conf) to "\*.debug", here first field i...
2018/03/19
[ "https://Stackoverflow.com/questions/49361487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295604/" ]
Actually you have to quote variable itself. `echo "$ccvv"`
You could use `sed`'s substitution: ``` sed -i.bak 's/\([a-zA-Z0-9*]\+\.\).*/\1debug/g' InputFile ``` Here `.bak` will create a backup file named `InputFile.bak` before doing the replacement. Example input: ``` some text *.conf some text some.text ``` Output: ``` some text *.debug some text some.debug ```
49,887,433
I'm calling a function in React within componentDidMount that queries the DOM however the DOM isn't rendered in time even though i'm calling it after componentDidMount. The strange thing is that in webpack it all works fine and the DOM is rendered and ready for my querySelectorAll. However when built it isn't. I've tr...
2018/04/17
[ "https://Stackoverflow.com/questions/49887433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8675833/" ]
As explained in [this answer](https://stackoverflow.com/a/36056794/242365), `componentDidMount` is called after all the children components have been mounted, but before any parent components have been mounted. For me it worked to delay my code using `setTimeout()` (with 0 ms delay) from within `componentDidMount`.
`componentDidMount` is only called once in the lifecycle of any component, render againt will not reinitialize the component. Have you ever try with `componentDidUpdate`. This hit when component is updated.
66,402,661
My images were working fine, but right now i have a problem with my storage directory. Before they were going here : [![enter image description here](https://i.stack.imgur.com/0bTei.png)](https://i.stack.imgur.com/0bTei.png) But now they are going here : [![enter image description here](https://i.stack.imgur.com/H4...
2021/02/27
[ "https://Stackoverflow.com/questions/66402661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14737749/" ]
Well, it's because you're doing it the wrong way. If you really intended to define the **disk** in which you wanted to store your image files, you had to pass the *disk* name as the second argument of the `\Illuminate\Http\UploadedFile->store(...)` method. [Specifying A Disk](https://laravel.com/docs/8.x/filesystem#s...
use asset in laravel to fix the issue, ex : ``` {{asset('avatars/imagename.png')}} ``` instead of : storage method , while showing the picture.
1,923,948
I have several forms each having a hidden field that identifies this form...I want to check for this field in my view then based on the result determine which form will be processed. How should i go about this?
2009/12/17
[ "https://Stackoverflow.com/questions/1923948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/217647/" ]
You should be using [Django Forms](http://docs.djangoproject.com/en/dev/topics/forms/). They are very powerful and quite extensible.
As long as the data is passed to the view in the post you should be able to grab it: ``` if request.method == "POST": if "hidden_field_name" in request.POST: ## do something ```
67,279,246
I have 2 functions. Add dynamic rows and Autonumbering. My problem is, my autonumbering is not working on my dynamically added rows. I wonder what could be the problem? The "class="form-control" is all the same for my input type field. However, it is still not working. I have provided my js fiddle below. <https://prnt...
2021/04/27
[ "https://Stackoverflow.com/questions/67279246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14793352/" ]
You can use the [`Sum` function [Django docs]](https://docs.djangoproject.com/en/3.2/ref/models/querysets/#sum) with a [Conditional Expression [Django docs]](https://docs.djangoproject.com/en/3.2/ref/models/conditional-expressions/) to annotate a value according to which you would order: ``` from django.db.models impo...
You can access fiels of related models by double underscore. See documentation [here](https://docs.djangoproject.com/en/3.2/ref/models/querysets/#order-by). Try: ``` Business.objects.all().order_by("upvote__gender") ```
43,980,849
I am building an app that needs to subscribe to record changes in the public database of iCloud. Now, after watching the apple video's and reading their documentation, I decided to get to work. However, I immediately got stuck here: [![enter image description here](https://i.stack.imgur.com/Nnta4.png)](https://i.stack...
2017/05/15
[ "https://Stackoverflow.com/questions/43980849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2378196/" ]
Seems like `CKSubscription` is really more or less deprecated. According to <http://iosdevetips.blogspot.de/2016/06/deprecated-apis-in-ios-10.html> you should use `CKRecordZoneSubscription` and `CKQuerySubscription` now. --- **Update:** Like Trevis pointed out, the docs are not really helpful here, but at least Xcod...
If you are looking for a new class to substitute Apple's own documentation, use `CKQuerySubscription` in place of `CKSubscription`. They have almost identical initializers.
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
Depends on the side effects of the weapon. * If a 3 m wide, 12,750 km long plug through the center of the Earth simply **disappears**, at worst there will be two smallish volcanoes and a couple of earthquakes. The total material is roughly a cube 450 m to a side. * If sufficient force is applied to **punch** such a pl...
The first thing that occurs to me is that 10 feet in diameter is very, very, very etc. insignificant compared to the total surface area of the Earth (196,900,000 square miles). The second thing that occurs to me is the location of the event -- 150 miles south of the north pole, or latitude 87.5 degrees north. It's ver...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
In the dept of the Earth the hole would be filled in moments. In the surface two things may happen, depending on the state of the dynamic system that is going on beneath the crust: * some minor seismic activity happens because of a sudden (and quite little) lack of pressure, deep landslides block lava from coming out ...
Immediate Effect ---------------- You're going to get a pair of volcanoes. They might turn out fairly small, but I think there is a good possibility of super-volcanic eruptions. Consider this: the pressure around the surface of the solid inner core[1] is estimated to be around 330GPa (3.3 million atmospheres). A supe...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
I would assume this depends on how the Beam did its work. If it just "deleted" the matter in its way, just about nothing would happen excpet that some random Animal will have a pretty bad day. If the Beam melts its way across you may see a pretty big explosion on both sides of the Planet. The first when the Beam enter...
Immediate Effect ---------------- You're going to get a pair of volcanoes. They might turn out fairly small, but I think there is a good possibility of super-volcanic eruptions. Consider this: the pressure around the surface of the solid inner core[1] is estimated to be around 330GPa (3.3 million atmospheres). A supe...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
In the dept of the Earth the hole would be filled in moments. In the surface two things may happen, depending on the state of the dynamic system that is going on beneath the crust: * some minor seismic activity happens because of a sudden (and quite little) lack of pressure, deep landslides block lava from coming out ...
> > How would this impact life on the planet after this event, if at all? > > > Say good bye to life. An end to end hole on Earth would not be stable, and would collapse under the gravitational force exerted by the planet. That would alone would release a large amount of energy which would surely evaporate the oc...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
Depends on the side effects of the weapon. * If a 3 m wide, 12,750 km long plug through the center of the Earth simply **disappears**, at worst there will be two smallish volcanoes and a couple of earthquakes. The total material is roughly a cube 450 m to a side. * If sufficient force is applied to **punch** such a pl...
Soil doesn't behave like that when hit. We have craters, not cylindrical cavities all the way through when a meteor falls for example. In order to displace so much matter neatly, the amount of energy involved would probably be enough to turn the planet into plasma. [XKCD What If no. 20](https://what-if.xkcd.com/20/) i...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
Depends on the side effects of the weapon. * If a 3 m wide, 12,750 km long plug through the center of the Earth simply **disappears**, at worst there will be two smallish volcanoes and a couple of earthquakes. The total material is roughly a cube 450 m to a side. * If sufficient force is applied to **punch** such a pl...
Other answers have addressed the qualitative details of what happens, I want to try and put some numbers to it. If the hole is filled by material flowing in from the sides, then the amount of energy released by the expanding material is roughly equal to its pressure times the volume of expansion. Looking at the plot f...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
Other answers have addressed the qualitative details of what happens, I want to try and put some numbers to it. If the hole is filled by material flowing in from the sides, then the amount of energy released by the expanding material is roughly equal to its pressure times the volume of expansion. Looking at the plot f...
> > How would this impact life on the planet after this event, if at all? > > > Say good bye to life. An end to end hole on Earth would not be stable, and would collapse under the gravitational force exerted by the planet. That would alone would release a large amount of energy which would surely evaporate the oc...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
Depends on the side effects of the weapon. * If a 3 m wide, 12,750 km long plug through the center of the Earth simply **disappears**, at worst there will be two smallish volcanoes and a couple of earthquakes. The total material is roughly a cube 450 m to a side. * If sufficient force is applied to **punch** such a pl...
Immediate Effect ---------------- You're going to get a pair of volcanoes. They might turn out fairly small, but I think there is a good possibility of super-volcanic eruptions. Consider this: the pressure around the surface of the solid inner core[1] is estimated to be around 330GPa (3.3 million atmospheres). A supe...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
Immediate Effect ---------------- You're going to get a pair of volcanoes. They might turn out fairly small, but I think there is a good possibility of super-volcanic eruptions. Consider this: the pressure around the surface of the solid inner core[1] is estimated to be around 330GPa (3.3 million atmospheres). A supe...
> > How would this impact life on the planet after this event, if at all? > > > Say good bye to life. An end to end hole on Earth would not be stable, and would collapse under the gravitational force exerted by the planet. That would alone would release a large amount of energy which would surely evaporate the oc...
185,676
During a battle between two extremely powerful space wizards, a beam of magical lightning has blasted a perfectly circular hole around 10 feet in diameter directly through an Earth-sized planet. In and out like a gunshot through paper. How would this impact life on the planet after this event, if at all? NOTE: The inc...
2020/09/16
[ "https://worldbuilding.stackexchange.com/questions/185676", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/54953/" ]
I would assume this depends on how the Beam did its work. If it just "deleted" the matter in its way, just about nothing would happen excpet that some random Animal will have a pretty bad day. If the Beam melts its way across you may see a pretty big explosion on both sides of the Planet. The first when the Beam enter...
Soil doesn't behave like that when hit. We have craters, not cylindrical cavities all the way through when a meteor falls for example. In order to displace so much matter neatly, the amount of energy involved would probably be enough to turn the planet into plasma. [XKCD What If no. 20](https://what-if.xkcd.com/20/) i...
57,143,087
I want to plot the tree generated by DEAP using pygraphviz. I tried to follow the example in this [DEAP document](https://deap.readthedocs.io/en/master/tutorials/advanced/gp.html), but got the following error: ``` Traceback (most recent call last): File "<input>", line 24, in <module> File "C:\Users\xxyao\program\...
2019/07/22
[ "https://Stackoverflow.com/questions/57143087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287711/" ]
I had the same problem. And solved it by executed "dot -c" in conda cmd.
Exactly, just open anaconda Prompt environment and type "dot -c" command and error fixed. [enter image description here](https://i.stack.imgur.com/k0EMB.png)
57,143,087
I want to plot the tree generated by DEAP using pygraphviz. I tried to follow the example in this [DEAP document](https://deap.readthedocs.io/en/master/tutorials/advanced/gp.html), but got the following error: ``` Traceback (most recent call last): File "<input>", line 24, in <module> File "C:\Users\xxyao\program\...
2019/07/22
[ "https://Stackoverflow.com/questions/57143087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287711/" ]
I had the same problem. And solved it by executed "dot -c" in conda cmd.
I made something that may be considered a bit of cheating, but hope it helps. First, agraph.py takes into account the position of the directory so you may want to put the working dot ahead of the others ``` import os os.environ["PATH"] = "C:\\Program Files\\Graphviz\\bin" + os.pathsep + os.getenv("PATH") ``` Then I ...
57,143,087
I want to plot the tree generated by DEAP using pygraphviz. I tried to follow the example in this [DEAP document](https://deap.readthedocs.io/en/master/tutorials/advanced/gp.html), but got the following error: ``` Traceback (most recent call last): File "<input>", line 24, in <module> File "C:\Users\xxyao\program\...
2019/07/22
[ "https://Stackoverflow.com/questions/57143087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287711/" ]
I had the same problem. And solved it by executed "dot -c" in conda cmd.
Follow @Saul answer is worked for me. I think the root cause may be the `agraph.py` allow only limited PATH environment variable so even you add `C:\\Program Files\\Graphviz\\bin` still not work. But be careful, I suggest the solution for this way should be secured by below ``` GVZPath = "C:\\Program Files\\Graphviz\...
57,143,087
I want to plot the tree generated by DEAP using pygraphviz. I tried to follow the example in this [DEAP document](https://deap.readthedocs.io/en/master/tutorials/advanced/gp.html), but got the following error: ``` Traceback (most recent call last): File "<input>", line 24, in <module> File "C:\Users\xxyao\program\...
2019/07/22
[ "https://Stackoverflow.com/questions/57143087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287711/" ]
I made something that may be considered a bit of cheating, but hope it helps. First, agraph.py takes into account the position of the directory so you may want to put the working dot ahead of the others ``` import os os.environ["PATH"] = "C:\\Program Files\\Graphviz\\bin" + os.pathsep + os.getenv("PATH") ``` Then I ...
Exactly, just open anaconda Prompt environment and type "dot -c" command and error fixed. [enter image description here](https://i.stack.imgur.com/k0EMB.png)
57,143,087
I want to plot the tree generated by DEAP using pygraphviz. I tried to follow the example in this [DEAP document](https://deap.readthedocs.io/en/master/tutorials/advanced/gp.html), but got the following error: ``` Traceback (most recent call last): File "<input>", line 24, in <module> File "C:\Users\xxyao\program\...
2019/07/22
[ "https://Stackoverflow.com/questions/57143087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9287711/" ]
I made something that may be considered a bit of cheating, but hope it helps. First, agraph.py takes into account the position of the directory so you may want to put the working dot ahead of the others ``` import os os.environ["PATH"] = "C:\\Program Files\\Graphviz\\bin" + os.pathsep + os.getenv("PATH") ``` Then I ...
Follow @Saul answer is worked for me. I think the root cause may be the `agraph.py` allow only limited PATH environment variable so even you add `C:\\Program Files\\Graphviz\\bin` still not work. But be careful, I suggest the solution for this way should be secured by below ``` GVZPath = "C:\\Program Files\\Graphviz\...
21,700,055
This question is not related to coding issues but how we write our codes. For example take the append function. When we use jQuery append to insert long divs, it is easy to lose track of it's correctness. Example: ``` $('#someDiv').append('<div><span><div> .............. hundreds of div here ..... </div></span></div>'...
2014/02/11
[ "https://Stackoverflow.com/questions/21700055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768337/" ]
If you have to add the HTML inline style I would suggest the following format. ``` var html = '<div class="somediv">\ <div class="otherdiv">\ . .. ... </div>\ </div>'; $('#somediv').append(html); ```
My solution would be to create all these elements ``` div1 = $(document.createElement('div')); div1.attr(..); div1.css(..); container.append(..) ``` This means a lot of code but you can outsource it, can easily change attributes and its good readable...
21,700,055
This question is not related to coding issues but how we write our codes. For example take the append function. When we use jQuery append to insert long divs, it is easy to lose track of it's correctness. Example: ``` $('#someDiv').append('<div><span><div> .............. hundreds of div here ..... </div></span></div>'...
2014/02/11
[ "https://Stackoverflow.com/questions/21700055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768337/" ]
You can do it this way - ``` $('#someDiv').append($('<div>').append($('<span>')) .append($('<div>')) .append($('<div>')) .append($('<div>')) .append($('<div>')) ) ``` You can also add `css` sty...
My solution would be to create all these elements ``` div1 = $(document.createElement('div')); div1.attr(..); div1.css(..); container.append(..) ``` This means a lot of code but you can outsource it, can easily change attributes and its good readable...
32,993
In the four lowest gears (i.e the 28 cog end) when in both the big and small ring, loud noises can be heard coming from what appears to be near the front derailleur. I've uploaded a video of the noise here: If I shift up from the 4th smallest gear then the noise goes away. I've checked to make show the chain isn't ru...
2015/08/27
[ "https://bicycles.stackexchange.com/questions/32993", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/18835/" ]
Ascertain that the chain is not visibly touching the front derailleur. Check that your rear cassette is fitted correctly; lock-ring is tight and the correct spacers used between sprockets. Are you using a matching chain, chain rings and rear derailleur? i.e. are they all 'n' speed; i.e. do not mix and match a 9 speed...
Depending on the geometry of your frame, the noise could very well be caused by cross chaining, especially if you have very short chain stays. If you've ruled out rubbing, and this is in fact the problem, you don't have many options unfortunately. You can pick a cassette/crank combination that ensures you spend most ...
59,694,050
I want to use React IDE developign environment: ``` https://reactide.io/ ``` But now word about installation instructions. And no windows installers can see. Can somebody help me?
2020/01/11
[ "https://Stackoverflow.com/questions/59694050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2301515/" ]
I know this is a way that I do that sometimes. it takes advantage of the VLOOKUP(....TRUE) [default] option. =VLOOKUP(9^99,FILTER({ROW(A:A),A:A},B:B=D1),2)
Here you will know about sort and array\_Constrain: ``` =array_constrain(filter(sort({A1:A,row(A1:A)},2,false),B1:B=D1),1,1) ``` or you can use query: ``` =query(filter({A1:A,row(A1:A)},B1:B=D1),"Select Col1 order by Col2 desc limit 1") ``` or you can use indirect: ``` =indirect("A" & max(filter(row(A:A),B:B=D1)...
1,459,589
**Q:** *When is the perimeter of a triangle minimum for a given area?* This is how I went about it: --- Let the sides of the triangle be $a$, $b$ & $c$. > > $s = \dfrac{a+b+c}{2}$ > > By AM-GM inequality, > > $\dfrac{s+(s-a)+(s-b)+(s-c)}{4}\ge \sqrt[4]{s(s-a)(s-b)(s-c)}$ ---$({1})$ > > Since $\sq...
2015/10/01
[ "https://math.stackexchange.com/questions/1459589", "https://math.stackexchange.com", "https://math.stackexchange.com/users/156313/" ]
Someone's been pulling your leg - this is a trick question. The perimeter of a triangle of a given area $S$ is unbounded! Indeed, for any $P>0$, we can construct a triangle whose area is $S$ and whose perimeter is greater than $P$. Consider a triangle whose base is of length $P$ and whose height is $\frac{2 S}{P}$. I...
Consider a right triangle with sides $n, 1/n, \sqrt{n^2+1/n^2}$. This has area $\frac12$ and perimeter greater than $2n$. However, on a sphere, the perimeter and the area of triangles are bounded.
17,496,438
Brand new to Phalcon (and frameworks in general) so forgive my n00b-ness. I want to load my config in my bootstrap file, then have it stored in the session (so it only needs to be loaded once, and accessible globally). I've got my session being created, and I'm successfully loading my configuration info into $Config....
2013/07/05
[ "https://Stackoverflow.com/questions/17496438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/251859/" ]
Are you trying to speed up your app by only loading the config once? If so have you profiled the app to make sure it is actually a bottle neck? I have a 55 line config file and using [xdebug](http://xdebug.org/) and [qcachegrind](http://sourceforge.net/projects/qcachegrindwin/) I can see that loading the config file t...
I found the Vokuro sample application a really useful way to learn about how a Phalcon app is structured. If you are trying to make the config available within your controller code then using dependency injection might be what you need, you may not need to store the config in session as well. Good luck on your journey.
15,282,552
I'm running into a `stack level too deep` and have an infinite loop, but I can't figure out why, so I'm hoping someone else can spot it. I have this method in my Game model: ``` def self.record_win_or_tie(game_id) game = Game.find(game_id) if game.home_team_score > game.away_team_score game.home_team_won = ...
2013/03/07
[ "https://Stackoverflow.com/questions/15282552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/994581/" ]
Use an instance variable to ensure it only gets saved once. However, because this is a class method, it will not be thread safe. Instead make this an instance method like so: ``` def record_win_or_tie return if @inside_callback @inside_callback = true if home_team_score > away_team_score update_attributes(...
Could it be that you have defined an after\_save callback that calls Game.record\_win\_or\_tie again? That would explain the infinite recursion. Otherwise we'd need to see the entire Game model
15,282,552
I'm running into a `stack level too deep` and have an infinite loop, but I can't figure out why, so I'm hoping someone else can spot it. I have this method in my Game model: ``` def self.record_win_or_tie(game_id) game = Game.find(game_id) if game.home_team_score > game.away_team_score game.home_team_won = ...
2013/03/07
[ "https://Stackoverflow.com/questions/15282552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/994581/" ]
Could it be that you have defined an after\_save callback that calls Game.record\_win\_or\_tie again? That would explain the infinite recursion. Otherwise we'd need to see the entire Game model
``` class Game < ActiveRecord::Base # def self.record_win_or_tie(game_id) # deprecated end class GameObserver < ActiveRecord::Observer def after_save(game) if (game.home_team_score > game.away_team_score) && game.home_team_won != true game.home_team_won = true game.save end end end ```
15,282,552
I'm running into a `stack level too deep` and have an infinite loop, but I can't figure out why, so I'm hoping someone else can spot it. I have this method in my Game model: ``` def self.record_win_or_tie(game_id) game = Game.find(game_id) if game.home_team_score > game.away_team_score game.home_team_won = ...
2013/03/07
[ "https://Stackoverflow.com/questions/15282552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/994581/" ]
Could it be that you have defined an after\_save callback that calls Game.record\_win\_or\_tie again? That would explain the infinite recursion. Otherwise we'd need to see the entire Game model
If for some reason it has to be in an after\_save, instead of saving the current instance and triggering the after save, or adding spurious instance variables, call update on the db directly. ``` if game.home_team_score > game.away_team_direct Game.update_all({:home_team_won => true}, :id => id) end # Check the syn...
15,282,552
I'm running into a `stack level too deep` and have an infinite loop, but I can't figure out why, so I'm hoping someone else can spot it. I have this method in my Game model: ``` def self.record_win_or_tie(game_id) game = Game.find(game_id) if game.home_team_score > game.away_team_score game.home_team_won = ...
2013/03/07
[ "https://Stackoverflow.com/questions/15282552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/994581/" ]
Use an instance variable to ensure it only gets saved once. However, because this is a class method, it will not be thread safe. Instead make this an instance method like so: ``` def record_win_or_tie return if @inside_callback @inside_callback = true if home_team_score > away_team_score update_attributes(...
``` class Game < ActiveRecord::Base # def self.record_win_or_tie(game_id) # deprecated end class GameObserver < ActiveRecord::Observer def after_save(game) if (game.home_team_score > game.away_team_score) && game.home_team_won != true game.home_team_won = true game.save end end end ```
15,282,552
I'm running into a `stack level too deep` and have an infinite loop, but I can't figure out why, so I'm hoping someone else can spot it. I have this method in my Game model: ``` def self.record_win_or_tie(game_id) game = Game.find(game_id) if game.home_team_score > game.away_team_score game.home_team_won = ...
2013/03/07
[ "https://Stackoverflow.com/questions/15282552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/994581/" ]
Use an instance variable to ensure it only gets saved once. However, because this is a class method, it will not be thread safe. Instead make this an instance method like so: ``` def record_win_or_tie return if @inside_callback @inside_callback = true if home_team_score > away_team_score update_attributes(...
If for some reason it has to be in an after\_save, instead of saving the current instance and triggering the after save, or adding spurious instance variables, call update on the db directly. ``` if game.home_team_score > game.away_team_direct Game.update_all({:home_team_won => true}, :id => id) end # Check the syn...
72,921,495
I'm trying to log any startup errors but the logs are not flowing into application insights. I tried configuring app insights in program.cs but still I don't see any logs. ```cs public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureLogging(logging => ...
2022/07/09
[ "https://Stackoverflow.com/questions/72921495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8973136/" ]
Just add another limiter in `app\Providers\RouteServiceProvider.php` inside `configureRateLimiting` function like so; ``` protected function configureRateLimiting() { //Default Limiter RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by(optional($request->user())->id...
you can use this code ``` RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()); }); ```
72,921,495
I'm trying to log any startup errors but the logs are not flowing into application insights. I tried configuring app insights in program.cs but still I don't see any logs. ```cs public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureLogging(logging => ...
2022/07/09
[ "https://Stackoverflow.com/questions/72921495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8973136/" ]
Just add another limiter in `app\Providers\RouteServiceProvider.php` inside `configureRateLimiting` function like so; ``` protected function configureRateLimiting() { //Default Limiter RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by(optional($request->user())->id...
I think in your case you can do: ``` $success = RateLimiter::attempt('send-message:'.$user->id, $maxAttempts, function () { // Send message }, 1440); if (!$success) { // Rate limit hit.. } ```
55,522,899
I am learning about loops and I have this code to check if a number is prime or not, but doesn't work. Where is the bug? ``` x <- 7 y <- seq(1,sqrt(x),by=1) for(i in 1: sqrt(x)){ if(y[x%%y == 0]) { print("FALSE") }else{ print("TRUE") } } ``` This gives me the right solution, but it repeats the answer as man...
2019/04/04
[ "https://Stackoverflow.com/questions/55522899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10490754/" ]
We can `groupby` with `cumcount` and before that drop duplicates so each same, `user_id` and `sc_id` get the same `subcat_counter`. After that we `fillna` with `forwardfill (ffill)`: ``` df['subcat_counter'] = df.drop_duplicates(['user_id', 'sc_id'])\ .groupby(['user_id'])['sc_id']\ ...
You can do it this way using `groupby` ``` df['subcat_counter'] = (df.groupby('user_id')['sc_id'] .transform(lambda x: x.diff().gt(0).cumsum() + 1)) ``` Output: ``` user_id sc_id subcat_counter 0 1 100 1 1 1 100 1 2 1 101 ...
2,977,840
Greetings, I'm having a weird seg fault problem. My application dumps a core file at runtime. After digging into it I found it died in this block: ``` #include <lib1/c.h> ... x::c obj; obj.func1(); ``` I defined class c in a library lib1: ``` namespace x { struct c { c(); ...
2010/06/04
[ "https://Stackoverflow.com/questions/2977840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358789/" ]
1. Violations of the "one definition rule" don't have to be diagnosed by your compiler. In fact, they are often only going to be known at link time when you link multiple object files together. At link time, the information about the original class definitions may not exist any more (they are not needed after the com...
Just a guess but I don't see any `using namespace x;` so perhaps it used one namespace instead of the other?
2,977,840
Greetings, I'm having a weird seg fault problem. My application dumps a core file at runtime. After digging into it I found it died in this block: ``` #include <lib1/c.h> ... x::c obj; obj.func1(); ``` I defined class c in a library lib1: ``` namespace x { struct c { c(); ...
2010/06/04
[ "https://Stackoverflow.com/questions/2977840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358789/" ]
1. Violations of the "one definition rule" don't have to be diagnosed by your compiler. In fact, they are often only going to be known at link time when you link multiple object files together. At link time, the information about the original class definitions may not exist any more (they are not needed after the com...
With the advent of templates it became necessary to allow multiple definitions of a body of code with the same name; there was no way for the compiler to know if the same template code had already been generated in another compilation unit i.e. source file. When the linker finds these duplicates, it assumes they are id...
2,977,840
Greetings, I'm having a weird seg fault problem. My application dumps a core file at runtime. After digging into it I found it died in this block: ``` #include <lib1/c.h> ... x::c obj; obj.func1(); ``` I defined class c in a library lib1: ``` namespace x { struct c { c(); ...
2010/06/04
[ "https://Stackoverflow.com/questions/2977840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358789/" ]
1. Violations of the "one definition rule" don't have to be diagnosed by your compiler. In fact, they are often only going to be known at link time when you link multiple object files together. At link time, the information about the original class definitions may not exist any more (they are not needed after the com...
On the linker level this is **library interpositioning**. The effective symbol bound unfortunately depends on the order of object files on linker command line (this is, sigh, historical). From what you describe it looks that `lib1` comes first in linker argument list and `lib2` comes second and *interposes* on symbols...
2,977,840
Greetings, I'm having a weird seg fault problem. My application dumps a core file at runtime. After digging into it I found it died in this block: ``` #include <lib1/c.h> ... x::c obj; obj.func1(); ``` I defined class c in a library lib1: ``` namespace x { struct c { c(); ...
2010/06/04
[ "https://Stackoverflow.com/questions/2977840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358789/" ]
1. Violations of the "one definition rule" don't have to be diagnosed by your compiler. In fact, they are often only going to be known at link time when you link multiple object files together. At link time, the information about the original class definitions may not exist any more (they are not needed after the com...
There's lots of answers about the one definition rule. However, to me, this looks a lot more like a missing copy constructor. To elaborate: If the copy constructor is called on your object, then you will get a memory leak. This is because delete will be called on the same set of pointers twice. ``` namespace x { ...
2,624,339
I get this error when using linq-to-sql with timestamp as part of a composite primary key: "The primary key column of type 'Timestamp' cannot be generated by the server." I'm guessing this may be due to the fact timestamp is just a row version thus perhaps it must be created after the insert? Or...
2010/04/12
[ "https://Stackoverflow.com/questions/2624339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254428/" ]
**don't use the timestamp data type!!** > > The timestamp syntax is deprecated. > This feature will be removed in a > future version of Microsoft SQL > Server. Avoid using this feature in > new development work, and plan to > modify applications that currently use > this feature. > > > **timestamp (Transac...
You can work around it.. set * Auto Generated Value to True * Auto-Sync to OnInsert ...unless you already have of course
22,562,456
I'm trying to make the save button in the message part of the discussion board go back to the team site instead of staying on the discussion board page. I've been looking for a few hours but i havent been able to find much. i tried to insert this code: ``` <script type="text/javasccript"> $(document).ready(function() ...
2014/03/21
[ "https://Stackoverflow.com/questions/22562456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3446954/" ]
You can change the Source parameter of the new item form querystring like this: ``` http://siteurl/testing/teamsite/Lists/Team%20Discussion/New1.aspx?Source=siteurl ``` When you click Cancel or Save button, the page will be redirected to the url specified. Then no jquery will be required for overriding Save button. ...
It didn't work for me either but I eventually made it work by commenting all the lines apart from first variable and outputting it to the console. Console output was telling me that there aspForm is null. So I knew at that instant that "form[name=aspnetForm]" does not exist in the source code. By inspecting the source ...
22,562,456
I'm trying to make the save button in the message part of the discussion board go back to the team site instead of staying on the discussion board page. I've been looking for a few hours but i havent been able to find much. i tried to insert this code: ``` <script type="text/javasccript"> $(document).ready(function() ...
2014/03/21
[ "https://Stackoverflow.com/questions/22562456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3446954/" ]
You can change the Source parameter of the new item form querystring like this: ``` http://siteurl/testing/teamsite/Lists/Team%20Discussion/New1.aspx?Source=siteurl ``` When you click Cancel or Save button, the page will be redirected to the url specified. Then no jquery will be required for overriding Save button. ...
I've seen so many posts on how to do this – without the `SOURCE` querystring. So I have tested this solution for hours in SharePoint 2013. This SAVE button absolutely redirects as expected; I have it redirecting to `"/Pages/default.aspx"`. ```js $(document).ready(function() { var elementName; var oldPostbackUrl; var...
9,157,910
I would like to add a custom view for my application. For this I use WindowsManager: ``` final WindowManager wm = getWindowManager(); final View view = ((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.game_menu, null); WindowManager.LayoutParams lp = new Wind...
2012/02/06
[ "https://Stackoverflow.com/questions/9157910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1180387/" ]
Views, which added by windows manager not receive onKey event due to android safety politics.
I'm still fairly new at this, but I'm trying to get similar functionality working. Here's what got it working for me (in Kotlin): ``` mOverlayView = LayoutInflater.from(this).inflate(R.layout.overlay_layout, null) val params = WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, Windo...
9,157,910
I would like to add a custom view for my application. For this I use WindowsManager: ``` final WindowManager wm = getWindowManager(); final View view = ((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.game_menu, null); WindowManager.LayoutParams lp = new Wind...
2012/02/06
[ "https://Stackoverflow.com/questions/9157910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1180387/" ]
you may add these `setFocusableInTouchMode(true);` in your view
I'm still fairly new at this, but I'm trying to get similar functionality working. Here's what got it working for me (in Kotlin): ``` mOverlayView = LayoutInflater.from(this).inflate(R.layout.overlay_layout, null) val params = WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, Windo...
73,463,580
I want to use `Connection.createArrayOf` method to create a `java.sql.Array` to use in a prepared statement, but all of the following implementations throw ***Feature Not Supported Exception*** Is there no implementation of this method? Is it deprecated? Is there any other way to initialize `java.sql.Array`? Or have I...
2022/08/23
[ "https://Stackoverflow.com/questions/73463580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7605967/" ]
I had the same issue for a while but then, I chose to use [NamedParameterJdbcTemplate](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html). You can use [MapSqlParameterSource](https://docs.spring.io/spring-framework/docs/current/java...
MySQL does not support ARRAY data types. However, as you've tagged `spring-data-jpa` in this question, you can write your query methods to take a List and let Spring handle it. e.g. ``` List<SomeClass> findBySomeFieldIn(List<Integer> ids); ``` Or, here's a simple prepared statement built with a list of Integer in a...
20,078,445
I'm new to Jquery. I have created two dropdownlists `min_cost` and `max_cost` using a Yii extension `combobox.` Below is the code I used to create the combobox. ``` <?php $this->widget('ext.combobox.EJuiComboBox', array( 'model' => $model, 'attribute' => 'min_cost', // data to populate the ...
2013/11/19
[ "https://Stackoverflow.com/questions/20078445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3004356/" ]
Try this. ``` string pathToDirctory = "D:\\testDirectory"; DirectoryInfo dirInfo = new DirectoryInfo(pathToDirctory); string path = dirInfo.FullName; Console.WriteLine(path); ```
A `DirectoryInfo` represents a particular directory. When you create it, what directory it represents is dependent on the path you give it. If you give it an *absolute* path like `c:\foo\bar\baz\bat`, that's the directory you get. If, on the other hand, you give it a *relative* path, like `foo\bar\baz\bat`, the path is...
42,005,518
Hello Scripters from all over, I am currently working on a VBScript to pull Query parameters from an excel sheet and run a Query on an SQL server *(Sybase ASE)* for each line in the excel sheet. Currently I have the code that pulls the parameters successfully and runs the first row, but when I begin the next row, the ...
2017/02/02
[ "https://Stackoverflow.com/questions/42005518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7506388/" ]
So after much testing of different ideas, I finally got the code to work. The issue happened when MyRecordSet was being closed. The status went back to 0 and when you attempted to re-open MyRecordSet, it would fail with a broken object. Reconnecting an then re-opening MyRecordSet led to the same error. So here is the f...
The connection object doesn't need to be opened and closed for every query. Try it this way: ``` Dim MyConnection, MyExcel, MyExcelBook, MyExcelSheet Dim ConnectionString, Parameter1, Parameter2, SQL, I ConnectionString = "Driver=ODBC Driver;UserID=Admin;Password=Pass;" Set MyExcel = CreateObject("Excel.Application"...
20,333,299
I have a menu that is dynamically created. When the user selects a value, I need to get that value and use it for a query statement. This is not a form, just a menu on the page. I have: ``` <select name="topic" id="topic"> <option value="optiont" selected="selected">Select topic...</option> <?php ...
2013/12/02
[ "https://Stackoverflow.com/questions/20333299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1451652/" ]
The problem is that you've only read in one line at a time. Why don't you read in the entire file and match against that. ``` my $file; { local $/; $file = <FILE>; } ```
If you absolutely have to do this, you could try setting the newline separator to undef: ``` #!/usr/bin/perl use warnings; use strict; my $infile = 'in.txt'; open my $input, '<', $infile or die "Can't open to $infile: $!"; my $reserch_interests; $/=undef; while(<$input>){ if($_ =~ /(Research Interests)/){ ...
20,333,299
I have a menu that is dynamically created. When the user selects a value, I need to get that value and use it for a query statement. This is not a form, just a menu on the page. I have: ``` <select name="topic" id="topic"> <option value="optiont" selected="selected">Select topic...</option> <?php ...
2013/12/02
[ "https://Stackoverflow.com/questions/20333299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1451652/" ]
You can simply go get more lines at that point: ``` while (<FILE>) { if (m/Research Interests/) { while (<FILE>) { if (m/<p>(.*)<p>/) { print "Research Interests: $1"; last; } } } } ``` I don't know whether your file is huge or not, but it's worth learning techniques that don'...
If you absolutely have to do this, you could try setting the newline separator to undef: ``` #!/usr/bin/perl use warnings; use strict; my $infile = 'in.txt'; open my $input, '<', $infile or die "Can't open to $infile: $!"; my $reserch_interests; $/=undef; while(<$input>){ if($_ =~ /(Research Interests)/){ ...
61,104,516
I have a memory leak problem regarding a node js/express API running on AWS using fargate. The picture says it all: [memory usage of the container running the node app](https://i.stack.imgur.com/5OQ1S.png) This is kinda giving me a headache... I have tried using Jmeter and running the same requests against my local d...
2020/04/08
[ "https://Stackoverflow.com/questions/61104516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10049427/" ]
Sorry for late update. The problem was that node itself was leaking memory. It resolved itself once i went from 12.16.0 to 12.16.4. Additional info (look at the graphs and you will see the same pattern of the jumps in memory as the picture i posted): <https://github.com/nodejs/node/issues/33266>
[![Memory Utilization](https://i.stack.imgur.com/DGwuQ.jpg)](https://i.stack.imgur.com/DGwuQ.jpg) Quite a similar scenario here both with Fargate and NodeJS, trying to diagnose it, I'll provide feedback ASAP
54,946,143
I am new to DASK. I can submit 10 tasks using the client.map(funct\_name, iterator) where the iterator is a list which contain the 10 elements. Now, I want to submit the next task let's say 11th task when anyone from earlier submitted 10 tasks is completed. I know there is something called process pooling in python...
2019/03/01
[ "https://Stackoverflow.com/questions/54946143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2736302/" ]
The easiest thing you can do is to use [`wait`](https://distributed.readthedocs.io/en/latest/api.html#distributed.wait) before submitting the new work ``` futs = client.map(funct_name, iterator) distributed.wait(futs) out = client.submit(eleventh, args) ``` If, however, you wanted to submit your new work while the p...
You might want to look at the `as_completed` object here: <http://docs.dask.org/en/latest/futures.html#waiting-on-futures> ``` from dask.distributed import as_completed futures = client.map(score, x_values) for future in as_completed(futures): ... client.submit(...) ```
46,596,443
The rename part does not have any code yet, but the rest does have the code to go along with it. I keep getting that the variable for copy and remove aren't declared, but I did. What am I doing wrong? ``` #!/usr/bin/perl use warnings; use strict; sub menu { my $args = shift; my $title = $args->{title}; my $ch...
2017/10/06
[ "https://Stackoverflow.com/questions/46596443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8729416/" ]
I cleaned up missing semicolons, dollar signs, braces, duplicated lines ... and formatting. I also added the missing `use File::Copy`. Your code wasn't so far off at all but I can see that you got lost in so many little errors. So here is the most important note: **Enter code a little at a time and make sure that it ...
You have an extremely detailed answer from [zdim](https://stackoverflow.com/users/4653379/zdim). That's the one you should accept. But here's a list of what I had to fix in order to get your code running: * Removed the duplicate `print "done\n"` and the following close brackets at the end of the first menu option subr...
1,288
Reference these search results: * ["without plugin"](https://wordpress.stackexchange.com/search?q=%22without%20plugin%22) (27 results) * ["without a plugin"](https://wordpress.stackexchange.com/search?q=%22without%20a%20plugin%22) (84 results) * ["without using a plugin"](https://wordpress.stackexchange.com/search?q=%...
2012/11/17
[ "https://wordpress.meta.stackexchange.com/questions/1288", "https://wordpress.meta.stackexchange.com", "https://wordpress.meta.stackexchange.com/users/3966/" ]
I don’t see what we can do in these cases: Closing a question which is okay in all other aspects would be too drastic, and editing it out would change the meaning too much. My recommendation: Answer the question, ignore the “without a plugin” part. Our answers are **never** written just for the asker (that would be “t...
Let's compare these requests: * Without a plugin please! * I would like answer, explaining internal code mechanics of this. * I had seen plugin accomplishing this, but have trouble following its code and would like it explained. * and so on... The problem is - they are essentially same in what they ask for *technical...