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
12,925,401
I have created the following custom ValidationAttribute: ``` public class DateRangeAttribute : ValidationAttribute, IClientValidatable { public DateTime MinimumDate = new DateTime(1901, 1, 1); public DateTime MaximumDate = new DateTime(2099, 12, 31); public DateRangeAttribute(string minDate, string maxDate, s...
2012/10/17
[ "https://Stackoverflow.com/questions/12925401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/645258/" ]
You need to take the `Type` of the resource class as an argument and then use reflections to get the property value. ``` public class DateRangeAttribute : ValidationAttribute, IClientValidatable { public DateTime MinimumDate = new DateTime(1901, 1, 1); public DateTime MaximumDate = new DateTime(2099, 12, 31); pr...
You are not attempting the impossible, but you are going to have to work around the limitation just a tad. So, to comply with the compiler we have two options and the first is the most ideal, change the generated `Resources` class. ``` public class Resources { public const string PropMinimumDate = "12/15/2010"; pu...
16,168
When using `VertexColors`, the docs state: > > The interior of the polygon is colored by interpolating between the colors specified by `VertexColors`. > > > It however doesn't say how this interpolation is carried out. I've seen at times that small quirks show up that I wouldn't expect, and I'm wondering if some...
2012/12/12
[ "https://mathematica.stackexchange.com/questions/16168", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/1194/" ]
The behavior you are seeing is, that OpenGL (which is most probably used) has to break your your polygon of many vertices into triangles. What you then see are artifacts of the linear interpolation of the colors. When you assign a random color to each vertex, you can observe the triangle structure ``` aim = {Cos[2 π #...
As stated in my answer, the problem for the arc was solved with just creating polygons such that they ended up without defects similar to how halirutan did it, which is a method to avoid these problems in specific cases. But in the general case this doesn't work out, so I also found a solution by triangulating the poly...
16,168
When using `VertexColors`, the docs state: > > The interior of the polygon is colored by interpolating between the colors specified by `VertexColors`. > > > It however doesn't say how this interpolation is carried out. I've seen at times that small quirks show up that I wouldn't expect, and I'm wondering if some...
2012/12/12
[ "https://mathematica.stackexchange.com/questions/16168", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/1194/" ]
The behavior you are seeing is, that OpenGL (which is most probably used) has to break your your polygon of many vertices into triangles. What you then see are artifacts of the linear interpolation of the colors. When you assign a random color to each vertex, you can observe the triangle structure ``` aim = {Cos[2 π #...
Here's a triangulation approach that might work easily and more generally. Let's start with one of your problematic examples: ``` drawing = draw[5, 0.414] ``` ![bad example](https://i.stack.imgur.com/PegE1.png) Now, let's triangulate, after getting rid of `10^-17` type expressions. ``` Graphics`Mesh`MeshInit[]; pt...
16,168
When using `VertexColors`, the docs state: > > The interior of the polygon is colored by interpolating between the colors specified by `VertexColors`. > > > It however doesn't say how this interpolation is carried out. I've seen at times that small quirks show up that I wouldn't expect, and I'm wondering if some...
2012/12/12
[ "https://mathematica.stackexchange.com/questions/16168", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/1194/" ]
As can be seen from the images presented, the interpolation being done under the hood by `VertexColors` depends on a prior triangulation of the polygon, thus resulting in visible triangular bands. The approaches presented thus far have all needed to perform a preliminary triangulation; I shall now present a method that...
As stated in my answer, the problem for the arc was solved with just creating polygons such that they ended up without defects similar to how halirutan did it, which is a method to avoid these problems in specific cases. But in the general case this doesn't work out, so I also found a solution by triangulating the poly...
16,168
When using `VertexColors`, the docs state: > > The interior of the polygon is colored by interpolating between the colors specified by `VertexColors`. > > > It however doesn't say how this interpolation is carried out. I've seen at times that small quirks show up that I wouldn't expect, and I'm wondering if some...
2012/12/12
[ "https://mathematica.stackexchange.com/questions/16168", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/1194/" ]
As can be seen from the images presented, the interpolation being done under the hood by `VertexColors` depends on a prior triangulation of the polygon, thus resulting in visible triangular bands. The approaches presented thus far have all needed to perform a preliminary triangulation; I shall now present a method that...
Here's a triangulation approach that might work easily and more generally. Let's start with one of your problematic examples: ``` drawing = draw[5, 0.414] ``` ![bad example](https://i.stack.imgur.com/PegE1.png) Now, let's triangulate, after getting rid of `10^-17` type expressions. ``` Graphics`Mesh`MeshInit[]; pt...
308,658
Please advise and share your solution. **In 2008 R2** ``` DECLARE @ErrMsg varchar (25) SET @ErrMsg = 'Test Raiserror in 2008 R2' RAISERROR 50002 @ErrMsg ``` The above statement produces the following output. > > Msg 50002, Level 16, State 1, Line 4 Test Raiserror in 2008 R2 Completion time: 2022-03-12T20:12:20.1...
2022/03/12
[ "https://dba.stackexchange.com/questions/308658", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/249408/" ]
``` RAISERROR 50002 @ErrMsg ``` This form of `RAISERROR` syntax was deprecated many versions ago and removed from the product entirely in the SQL Server 2012 release. From the [Discontinued Database Engine Functionality in SQL Server 2012 page](https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2012/m...
You're missing a comma between the parameters of your `RAISERROR` call in `RAISERROR 50002 @ErrMsg`. It should actually be `RAISERROR 50002, @ErrMsg` to be syntactically correct. Per the docs on [`RAISERROR`](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/raiserror-transact-sql?view=sql-server-ver15): ...
14,246,524
I have a star rating system as defined like this: ``` <span class="rating_container"> <span class="star_container"> <a rel="nofollow" href="" class="star star_1" >1<span class="rating">Terrible</span></a> <a rel="nofollow" href="" class="star star_2" >2<span class="rating">Bad</span></a> ...
2013/01/09
[ "https://Stackoverflow.com/questions/14246524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849065/" ]
Try : ``` $(".star_5").trigger('mouseover'); ``` This will trigger the mouseover action whatever it happens to be, rather than emulating it, offering a measure of future-proofing against changes to the mouseover handler.
I think what you need is ``` $('.star.star_5').addClass('active'); ``` **Note** the no-space between `.star` and `.star_5` and the `_` in `star_5`. (Thanks [@wirey](https://stackoverflow.com/questions/14246524/how-can-i-simulate-a-mouseover-event-with-jquery/14246552#comment19768194_14246552))
14,246,524
I have a star rating system as defined like this: ``` <span class="rating_container"> <span class="star_container"> <a rel="nofollow" href="" class="star star_1" >1<span class="rating">Terrible</span></a> <a rel="nofollow" href="" class="star star_2" >2<span class="rating">Bad</span></a> ...
2013/01/09
[ "https://Stackoverflow.com/questions/14246524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849065/" ]
I think what you need is ``` $('.star.star_5').addClass('active'); ``` **Note** the no-space between `.star` and `.star_5` and the `_` in `star_5`. (Thanks [@wirey](https://stackoverflow.com/questions/14246524/how-can-i-simulate-a-mouseover-event-with-jquery/14246552#comment19768194_14246552))
In CSS (which is what jQuery selectors are based on), `.class1 .class2` means "an element with class2 that has an ancestor with class1". This is not what you want. You want `.class1.class2` which means "an element with both class1 and class2": ``` $('.star.star_5').addClass('active'); ```
14,246,524
I have a star rating system as defined like this: ``` <span class="rating_container"> <span class="star_container"> <a rel="nofollow" href="" class="star star_1" >1<span class="rating">Terrible</span></a> <a rel="nofollow" href="" class="star star_2" >2<span class="rating">Bad</span></a> ...
2013/01/09
[ "https://Stackoverflow.com/questions/14246524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849065/" ]
I think what you need is ``` $('.star.star_5').addClass('active'); ``` **Note** the no-space between `.star` and `.star_5` and the `_` in `star_5`. (Thanks [@wirey](https://stackoverflow.com/questions/14246524/how-can-i-simulate-a-mouseover-event-with-jquery/14246552#comment19768194_14246552))
In case you really want to simulate an event: You can trigger JavaScript events using parameterless forms of the corresponding jQuery functions. For example: ``` $('.star.star_5').mouseover(); ```
14,246,524
I have a star rating system as defined like this: ``` <span class="rating_container"> <span class="star_container"> <a rel="nofollow" href="" class="star star_1" >1<span class="rating">Terrible</span></a> <a rel="nofollow" href="" class="star star_2" >2<span class="rating">Bad</span></a> ...
2013/01/09
[ "https://Stackoverflow.com/questions/14246524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849065/" ]
Try : ``` $(".star_5").trigger('mouseover'); ``` This will trigger the mouseover action whatever it happens to be, rather than emulating it, offering a measure of future-proofing against changes to the mouseover handler.
In CSS (which is what jQuery selectors are based on), `.class1 .class2` means "an element with class2 that has an ancestor with class1". This is not what you want. You want `.class1.class2` which means "an element with both class1 and class2": ``` $('.star.star_5').addClass('active'); ```
14,246,524
I have a star rating system as defined like this: ``` <span class="rating_container"> <span class="star_container"> <a rel="nofollow" href="" class="star star_1" >1<span class="rating">Terrible</span></a> <a rel="nofollow" href="" class="star star_2" >2<span class="rating">Bad</span></a> ...
2013/01/09
[ "https://Stackoverflow.com/questions/14246524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/849065/" ]
Try : ``` $(".star_5").trigger('mouseover'); ``` This will trigger the mouseover action whatever it happens to be, rather than emulating it, offering a measure of future-proofing against changes to the mouseover handler.
In case you really want to simulate an event: You can trigger JavaScript events using parameterless forms of the corresponding jQuery functions. For example: ``` $('.star.star_5').mouseover(); ```
35,580
Is there any difference in meaning and usage between the two expressions below? * (me) voy de compras. * (me) voy a hacer compras. According to <https://forum.wordreference.com/threads/ir-de-compras-hacer-la-compra.140571/> , "ir de compras" implies that you're going from shop to shop, looking for what you want. Also...
2020/08/28
[ "https://spanish.stackexchange.com/questions/35580", "https://spanish.stackexchange.com", "https://spanish.stackexchange.com/users/22797/" ]
The meaning is the same as far as I can tell, but in actual usage I've only ever encountered “(me) voy de compras”. This is my personal experience, though. There's a difference between “voy de compras” and “voy a hacer compras” (with no reflexive pronoun) because the latter could conceivably be interpreted as “I'm goi...
"Ir de compras" is the same that "Ir a hacer compras". The difference may be is that you say "voy de compras" when you are "shopping", you don't know what you want, you are mostly visiting shops, you are expending your time in shops. If you say "voy a hacer las compras de la semana" it means you know what you want buy,...
7,701,193
I’ve been working on a cloud based (AWS EC2 ) PHP Web Application, and I’m struggling with one issue when it comes to working with multiple servers (all under an AWS Elastic Load Balancer). On one server, when I upload the latest files, they’re instantly in production across the entire application. But this isn’t true ...
2011/10/09
[ "https://Stackoverflow.com/questions/7701193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/969352/" ]
We use scalr.net to manage our web servers and load balancer instances. It worked pretty well until now. we have a server farm for each of our environments (2 production farms, staging, sandbox). We have a pre configured roles for a web servers so it's super easy to open new instances and scale when needed. the web ser...
Have a good look at [KwateeSDCM](http://sdcm.kwatee.net). It enables you to deploy files and software on any number of servers and, if needed, to customize server-specific parameters along the way. There's a post about [deploying a web application](http://blog.kwatee.net/2011/05/deploy-web-application-on-multiple.html)...
13,075,090
I have three tables, **A**, **B**, and **C**. They all hold different data, but have some columns in common. If **A**, **B**, and **C** all have columns **C1** and **C2** then how can I look up a specific **C2** value using a **C1** value that could be in any of the 3 tables? Basically, I want to do a simple look-up ...
2012/10/25
[ "https://Stackoverflow.com/questions/13075090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857994/" ]
You do this by doing a union of the tables in the `from` clause: ``` select c2 from ((select c1, c2 from a) union all (select c1, c2 from b) union all (select c1, c2 from c) ) t where c1 = <your value> ``` I've used `union all` for performance reasons. If you are concerned about duplicate values, ei...
I don't know what you mean by " a specific C2 value using a C1 value ", but, whatever your query would be for the view, repeat that query and union the results, ``` SELECT * FROM A WHERE C2 = ? UNION ALL SELECT * FROM B WHERE C2 = ? UNION ALL SELECT * FROM C WHERE C2 = ? ``` (The view is a standard SQL feature, and ...
14,718,205
I am currently working on a small Java game in eclipse, and am knee deep in a few thousand lines of code. Right now, I am specifically attempting to use a String's contents to paint an image, and am wondering if it is possible. If it is it would save me at least a few hundred lines of individual variables for each imag...
2013/02/05
[ "https://Stackoverflow.com/questions/14718205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2044333/" ]
Put each image in a [`Map`](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html) keyed by the string ``` imageMap.put("ladder", new ImageIcon (getClass ().getResource ("ladder.png"))); //... imageMap.get(floorContents [currentX] [currentY]).paintIcon (this, g, 0, 0); ``` Of course, you should key to see if...
``` if (floorContents [currentX] [currentY] != "none") ``` Should be more like: ``` if (!floorContents [currentX] [currentY].equals("none")) ``` See [String comparison in Java](https://stackoverflow.com/questions/5286310/string-comparison-in-java) (and [about 500 more](https://stackoverflow.com/search?q=[string]...
14,718,205
I am currently working on a small Java game in eclipse, and am knee deep in a few thousand lines of code. Right now, I am specifically attempting to use a String's contents to paint an image, and am wondering if it is possible. If it is it would save me at least a few hundred lines of individual variables for each imag...
2013/02/05
[ "https://Stackoverflow.com/questions/14718205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2044333/" ]
Put each image in a [`Map`](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html) keyed by the string ``` imageMap.put("ladder", new ImageIcon (getClass ().getResource ("ladder.png"))); //... imageMap.get(floorContents [currentX] [currentY]).paintIcon (this, g, 0, 0); ``` Of course, you should key to see if...
I would kill use of strings altogether. "none" is code-smell for `null` if I ever saw it. Why even match on a `String` at all. ``` ImageIcon[][] floorContents; ImageIcon ladder = new ImageIcon (getClass ().getResource ("ladder.png")); floorContents[currentX][currentY] = ladder; public void paint (Graphics g) { if ...
11,797,409
> > **Possible Duplicate:** > > [C++ - Check if pointer is pointing to valid memory (Can't use NULL checks here)](https://stackoverflow.com/questions/11787650/c-check-if-pointer-is-pointing-to-valid-memory-cant-use-null-checks-here) > > > How to check if pointer is valid without a wrapper or additional memory ...
2012/08/03
[ "https://Stackoverflow.com/questions/11797409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1565515/" ]
A pointer is valid if "you didn't deleted that or this memory is allocated or at al you can access that memory". So I suggest: 1. Keep track of memory you have allocated. If this pointer is not in any of those blocks, you didn't allocate it. 2. When you delete a pointer or free memory, remove it from the list. That wa...
This valid check checked in windows only (VS),here is the function: ``` #pragma once //ptrvalid.h __inline bool isValid(void* ptr) { if (((uint)ptr)&7==7) return false; char _prefix; __try { _prefix=*(((char*)ptr)-1); } __except (true) { return false; } switch (_prefix) ...
22,516,410
I need to parse the string and I am having trouble identifying the order number. Here few examples with expected answer. I need Oracle SQL expression to ruturn the value ``` SOURCE_COLUMN PARAMETER RETURN_VALUE AAA_BBB_CCC_DDD AAA 1 AAA_BBB_CCCC_DDD BBB 2 AAA_BBB_CC_DDD ...
2014/03/19
[ "https://Stackoverflow.com/questions/22516410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3319643/" ]
This query does what you want: ``` select (case when source_column like '%'||param||'%' then 1 + coalesce(length(substr(source_column, 1, instr(source_column, param) - 1)) - length(replace(substr(source_column, 1, instr(source_column, param) - 1), '_', '')), ...
For your particular example (stable string patterns): ``` SQL> with t as ( 2 select 'AAA_BBB_CCC_DDD' SOURCE_COLUMN, 'AAA' PARAM FROM DUAL UNION ALL 3 select 'AAA_BBB_CCC_DDD' SOURCE_COLUMN, 'BBB' PARAM FROM DUAL UNION ALL 4 select 'AAA_BBB_CCC_DDD' SOURCE_COLUMN, 'CCC' PARAM FROM DUAL UNION ALL 5 select '...
22,516,410
I need to parse the string and I am having trouble identifying the order number. Here few examples with expected answer. I need Oracle SQL expression to ruturn the value ``` SOURCE_COLUMN PARAMETER RETURN_VALUE AAA_BBB_CCC_DDD AAA 1 AAA_BBB_CCCC_DDD BBB 2 AAA_BBB_CC_DDD ...
2014/03/19
[ "https://Stackoverflow.com/questions/22516410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3319643/" ]
This query does what you want: ``` select (case when source_column like '%'||param||'%' then 1 + coalesce(length(substr(source_column, 1, instr(source_column, param) - 1)) - length(replace(substr(source_column, 1, instr(source_column, param) - 1), '_', '')), ...
You can use `ROW_NUMBER()` in the following manner ``` SELECT source_column ,PARAM ,CASE WHEN ind IS NULL THEN 0 ELSE Row_number() over ( PARTITION BY source_column ORDER BY ind) END AS Return_Value FROM (SELECT source_column ,Param ,CASE WHEN Instr(source_c...
12,945
I've got an easy question concerning residual analysis. So when I compute a QQ-Plot with standardized residuals $\widehat{d}$ on the y-axis and I observe normal distributed standardized residuals, why can I assume that the error term $u$ is normal distributed? I'd think that if $\widehat{d}$ looks normal distributed I ...
2011/07/12
[ "https://stats.stackexchange.com/questions/12945", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/4496/" ]
The $u$s are unobserved and the $\hat{d}$s are just estimates of them.
In a linear model $ y = X\beta + u $ with $u \sim N(0, \sigma^2I)$, the vector of raw residuals is $ \hat u = y - \hat y = (I - H)y $ where the hat matrix $H = X(X'X)^{-1}X' $. The response $y$ is normally distributed given the assumed normality of the error terms. Consequently, if the model assumes normality correctly...
12,945
I've got an easy question concerning residual analysis. So when I compute a QQ-Plot with standardized residuals $\widehat{d}$ on the y-axis and I observe normal distributed standardized residuals, why can I assume that the error term $u$ is normal distributed? I'd think that if $\widehat{d}$ looks normal distributed I ...
2011/07/12
[ "https://stats.stackexchange.com/questions/12945", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/4496/" ]
This inference is no different from any other inference we make. We assume a default (you could call it a 'null'). In this case, it's that the underlying distribution is Gaussian. We examine the data to see if they are inconsistent with our default hypothesis. If the qq-plot of our residuals looks sufficiently Gaussian...
In a linear model $ y = X\beta + u $ with $u \sim N(0, \sigma^2I)$, the vector of raw residuals is $ \hat u = y - \hat y = (I - H)y $ where the hat matrix $H = X(X'X)^{-1}X' $. The response $y$ is normally distributed given the assumed normality of the error terms. Consequently, if the model assumes normality correctly...
39,559,204
Suppose I have a function x^2+y^2=1, how can I graph this function in R? I have tried: [enter image description here](http://i.stack.imgur.com/0SAID.png) but it doesn't work and says: [enter image description here](http://i.stack.imgur.com/ApA6P.png)
2016/09/18
[ "https://Stackoverflow.com/questions/39559204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6845690/" ]
To plot a circle: ----------------- ``` plot.new() plot.window(xlim = c(-1, 1), ylim = c(-1, 1)) theta <- seq(0, 2 * pi, length = 200) lines(x = cos(theta), y = sin(theta)) ``` [![enter image description here](https://i.stack.imgur.com/sBSqu.png)](https://i.stack.imgur.com/sBSqu.png) Plot the unit circle with the...
Try this: ``` x <- seq(-1,1,.01) plot(0,0, xlim=c(-1,1), ylim=c(-1,1)) curve(sqrt(1-x^2), add=TRUE) curve(-sqrt(1-x^2), add=TRUE) ```
12,969,622
I found a little javascript snippet for including javascripts only if they was not included before. That is working with my own scripts, but with two third-party libraries it's not working and I really don't know why. ``` var included_files = new Array(); function include_once(script_filename) { if (!...
2012/10/19
[ "https://Stackoverflow.com/questions/12969622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1598840/" ]
`include_dom` is asynchronous. It loads the scripts in parallel, and you can't really determine when the scripts will be loaded. You try to use jQuery right after you started the download, which doesn't work. You need to use a script that allows you to specify a callback for loaded scripts. I would recommend require.j...
You are adding the scripts to the DOM, but not letting them load before you try to use the functions they provide. You need to bind a callback to the load event of the script elements you are adding. (At least in most browsers, you might have to implement some hacks in others; you may wish to examine the source code ...
12,969,622
I found a little javascript snippet for including javascripts only if they was not included before. That is working with my own scripts, but with two third-party libraries it's not working and I really don't know why. ``` var included_files = new Array(); function include_once(script_filename) { if (!...
2012/10/19
[ "https://Stackoverflow.com/questions/12969622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1598840/" ]
Did someone say callback? ``` function include_once(script_filename, callback) { if (!in_array(script_filename, included_files)) { included_files[included_files.length] = script_filename; include_dom(script_filename, callback); } } function include_dom(script_filename, call...
You are adding the scripts to the DOM, but not letting them load before you try to use the functions they provide. You need to bind a callback to the load event of the script elements you are adding. (At least in most browsers, you might have to implement some hacks in others; you may wish to examine the source code ...
12,969,622
I found a little javascript snippet for including javascripts only if they was not included before. That is working with my own scripts, but with two third-party libraries it's not working and I really don't know why. ``` var included_files = new Array(); function include_once(script_filename) { if (!...
2012/10/19
[ "https://Stackoverflow.com/questions/12969622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1598840/" ]
`include_dom` is asynchronous. It loads the scripts in parallel, and you can't really determine when the scripts will be loaded. You try to use jQuery right after you started the download, which doesn't work. You need to use a script that allows you to specify a callback for loaded scripts. I would recommend require.j...
Use a script loader. [yepnope](http://yepnopejs.com/) will do everything you are trying to do and more
12,969,622
I found a little javascript snippet for including javascripts only if they was not included before. That is working with my own scripts, but with two third-party libraries it's not working and I really don't know why. ``` var included_files = new Array(); function include_once(script_filename) { if (!...
2012/10/19
[ "https://Stackoverflow.com/questions/12969622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1598840/" ]
Did someone say callback? ``` function include_once(script_filename, callback) { if (!in_array(script_filename, included_files)) { included_files[included_files.length] = script_filename; include_dom(script_filename, callback); } } function include_dom(script_filename, call...
Use a script loader. [yepnope](http://yepnopejs.com/) will do everything you are trying to do and more
71,609,582
I have a very basic html file (using electron); ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> File Uploader </title> <link rel="stylesheet" href="style.css"> <script defer src="render.js"></script> <...
2022/03/24
[ "https://Stackoverflow.com/questions/71609582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18569258/" ]
You can use a cte that returns the array of strings with a number that corresponds to the order of the string in the results and a `LEFT` join of the table: ``` WITH cte(id, word) AS (VALUES ROW(1, 'data'), ROW(2, 'riga'), ROW(3, 'ciao'), ROW(4, 'parola') ) SELECT COALESCE(p.en, 'not found') en, COALESCE(p.de...
Use `coalesce` to fill in a null value with a default. ``` select coalesce(en, 'not found'), coalesce(de, 'not found') ... ``` For the second part, how to make all the `in` values show up as rows, see [this answer](https://stackoverflow.com/a/71579841/14660).
72,150,149
I have the following data set: which is daily sum. Based on this, how do i get last 7 days sum, 14 days sum and 21 days for each row in new columns. I have tried to get last 7 days sum by using below query. but Its is giving cumulative sum instead of giving lookback to last 7 days. ``` select date,sum(amount) as amou...
2022/05/07
[ "https://Stackoverflow.com/questions/72150149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1929387/" ]
``` df[''] = df.groupby(['Customer ID', 'Product Code']).cumcount() df = df.pivot(index=['Customer ID', 'Product Code'], columns='') print(df) ``` Output: ``` Days since the last transaction 0 1 2 Customer ID Product Code A ...
Below python code also worked for me. ``` #keep only the needed data grouped = df.groupby(['Customer_ID','Product Code'], as_index=False).agg({"Days since the last transaction": lambda x: x.tolist()[:3]+[x.iat[-1]]}).explode("Days since the last transaction") #get the count for the age columns grouped["idx"] = groupe...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
**It is possible to stroke *arbitrary paths* with a gradient, or any other fill effect, such as a pattern.** As you have found, stroked paths are not rendered with the current gradient. Only filled paths use the gradient (when you turn them in to a clip and then draw the gradient). **However**, Core Graphics has an a...
I created a Swift version of Benjohn's answer. ``` class MyView: UIView { override func draw(_ rect: CGRect) { super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } context.addPath(createPath().cgPath) context.setLineWidth(15) context.replacePathWithSt...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
After several tries I'm now sure that gradients doesn't affect strokes, so I think it's impossible to draw gradient lines with `CGContextStrokePath()`. For horizontal and vertical lines the solution is to use `CGContextAddRect()` instead, which fortunately is what I need. I replaced ``` CGContextMoveToPoint(context, x...
You can use Core Animation layers. You can use a [CAShaperLayer](http://developer.apple.com/IPhone/library/documentation/GraphicsImaging/Reference/CAShapeLayer_class/Reference/Reference.html) for your line by settings its path property and then you can use a [CAGradientLayer](http://developer.apple.com/iphone/library/d...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
You can use Core Animation layers. You can use a [CAShaperLayer](http://developer.apple.com/IPhone/library/documentation/GraphicsImaging/Reference/CAShapeLayer_class/Reference/Reference.html) for your line by settings its path property and then you can use a [CAGradientLayer](http://developer.apple.com/iphone/library/d...
``` CGContextMoveToPoint(context, frame.size.width-200, frame.origin.y+10); CGContextAddLineToPoint(context, frame.size.width-200, 100-10); CGFloat colors[16] = { 0,0, 0, 0, 0, 0, 0, .8, 0, 0, 0, .8, 0, 0,0 ,0 }; CGColorSpaceRef baseSpace = CGColorSpaceCreateDeviceRGB(); CGGradientRef gradient = CGGradientC...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
**It is possible to stroke *arbitrary paths* with a gradient, or any other fill effect, such as a pattern.** As you have found, stroked paths are not rendered with the current gradient. Only filled paths use the gradient (when you turn them in to a clip and then draw the gradient). **However**, Core Graphics has an a...
**Swift 5** Version This code worked for me. ``` override func draw(_ rect: CGRect) { super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } drawGradientBorder(rect, context: context) } fileprivate func drawGradientBorder(_ rect: CGRect, context: CGContext) { ...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
**It is possible to stroke *arbitrary paths* with a gradient, or any other fill effect, such as a pattern.** As you have found, stroked paths are not rendered with the current gradient. Only filled paths use the gradient (when you turn them in to a clip and then draw the gradient). **However**, Core Graphics has an a...
After you draw the line, you can call ``` CGContextClip(context); ``` to clip further drawing to your line area. If you draw the gradient, it should now be contained within the line area. Note that you will need to use a clear color for your line if you just want the gradient to show, and not the line underneath it...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
After several tries I'm now sure that gradients doesn't affect strokes, so I think it's impossible to draw gradient lines with `CGContextStrokePath()`. For horizontal and vertical lines the solution is to use `CGContextAddRect()` instead, which fortunately is what I need. I replaced ``` CGContextMoveToPoint(context, x...
I created a Swift version of Benjohn's answer. ``` class MyView: UIView { override func draw(_ rect: CGRect) { super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } context.addPath(createPath().cgPath) context.setLineWidth(15) context.replacePathWithSt...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
I created a Swift version of Benjohn's answer. ``` class MyView: UIView { override func draw(_ rect: CGRect) { super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } context.addPath(createPath().cgPath) context.setLineWidth(15) context.replacePathWithSt...
``` CGContextMoveToPoint(context, frame.size.width-200, frame.origin.y+10); CGContextAddLineToPoint(context, frame.size.width-200, 100-10); CGFloat colors[16] = { 0,0, 0, 0, 0, 0, 0, .8, 0, 0, 0, .8, 0, 0,0 ,0 }; CGColorSpaceRef baseSpace = CGColorSpaceCreateDeviceRGB(); CGGradientRef gradient = CGGradientC...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
After several tries I'm now sure that gradients doesn't affect strokes, so I think it's impossible to draw gradient lines with `CGContextStrokePath()`. For horizontal and vertical lines the solution is to use `CGContextAddRect()` instead, which fortunately is what I need. I replaced ``` CGContextMoveToPoint(context, x...
``` CGContextMoveToPoint(context, frame.size.width-200, frame.origin.y+10); CGContextAddLineToPoint(context, frame.size.width-200, 100-10); CGFloat colors[16] = { 0,0, 0, 0, 0, 0, 0, .8, 0, 0, 0, .8, 0, 0,0 ,0 }; CGColorSpaceRef baseSpace = CGColorSpaceCreateDeviceRGB(); CGGradientRef gradient = CGGradientC...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
You can use Core Animation layers. You can use a [CAShaperLayer](http://developer.apple.com/IPhone/library/documentation/GraphicsImaging/Reference/CAShapeLayer_class/Reference/Reference.html) for your line by settings its path property and then you can use a [CAGradientLayer](http://developer.apple.com/iphone/library/d...
**Swift 5** Version This code worked for me. ``` override func draw(_ rect: CGRect) { super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } drawGradientBorder(rect, context: context) } fileprivate func drawGradientBorder(_ rect: CGRect, context: CGContext) { ...
1,303,855
I know how to draw a simple line: ``` CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); ``` And I know how to do a gradient rectangle, i.g.: ``` CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRG...
2009/08/20
[ "https://Stackoverflow.com/questions/1303855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112136/" ]
After you draw the line, you can call ``` CGContextClip(context); ``` to clip further drawing to your line area. If you draw the gradient, it should now be contained within the line area. Note that you will need to use a clear color for your line if you just want the gradient to show, and not the line underneath it...
**Swift 5** Version This code worked for me. ``` override func draw(_ rect: CGRect) { super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } drawGradientBorder(rect, context: context) } fileprivate func drawGradientBorder(_ rect: CGRect, context: CGContext) { ...
23,475,848
I have been searching and coding with the Google Maps iOS SDK 1.7.2 I need to build an app that displays custom InfoWindow after the marker is tapped. Google posted a [YouTube Video](https://www.youtube.com/watch?v=ILiBXYscsyY), that shows how to do it with just ONE marker. The practical use scenario uses more than ...
2014/05/05
[ "https://Stackoverflow.com/questions/23475848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
using date('d.m.Y') will cut off the hours, minutes and seconds. Thus returning you the timestamp it was at midnight. If you use strtotime without filtering it through date, it returns the hours, minutes and seconds according to current time. Here in occurence, you ran the script arround 17 hours after midnight. ``` ...
The format of `date()` matters as strtotime will interpret it different depending on that. Stick to standard formats like YYYY-MM-DD and you'll get expected results. In your case, you use `d.m.Y` which will give you `01.04.2014`. Is that April 1st or January 4th? PHP doesn't know so it guesses in this case. If you use...
23,475,848
I have been searching and coding with the Google Maps iOS SDK 1.7.2 I need to build an app that displays custom InfoWindow after the marker is tapped. Google posted a [YouTube Video](https://www.youtube.com/watch?v=ILiBXYscsyY), that shows how to do it with just ONE marker. The practical use scenario uses more than ...
2014/05/05
[ "https://Stackoverflow.com/questions/23475848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This has to do with how `strtotime()` interprets your date string. From the [documentation for `strtotime()`](http://php.net/strtotime): > > Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is a...
The format of `date()` matters as strtotime will interpret it different depending on that. Stick to standard formats like YYYY-MM-DD and you'll get expected results. In your case, you use `d.m.Y` which will give you `01.04.2014`. Is that April 1st or January 4th? PHP doesn't know so it guesses in this case. If you use...
2,521,059
When I make changes to a Flex project and rerun the project, it seems that FlashBuilder4 rewrites my html wrapper that embeds the SWF. But I have additional javascript code in the html wrapper and don't want to keep losing my code. I had to re-write the code once and it was a pain in the neck. How do I stop it from re...
2010/03/26
[ "https://Stackoverflow.com/questions/2521059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299300/" ]
Turn off "Generate HTML Wrapper file" in Project settings. [![Generate HTML Wrapper file](https://i.stack.imgur.com/kDyI2.png)](https://i.stack.imgur.com/kDyI2.png) This will delete the auto-generated HTML wrapper file in your bin directory. If you need to keep it, make a copy first and put it back after turning off ...
If Flash Builder 4 is indeed based off Flex Builder 3 as you mentioned then the real solution you are looking for is to edit the HTML wrapper template in **<Flex-Project-Folder>/html-template/index.template.html** and put your own modifications there. You need to be mindful of the tokens used in the template while edi...
2,521,059
When I make changes to a Flex project and rerun the project, it seems that FlashBuilder4 rewrites my html wrapper that embeds the SWF. But I have additional javascript code in the html wrapper and don't want to keep losing my code. I had to re-write the code once and it was a pain in the neck. How do I stop it from re...
2010/03/26
[ "https://Stackoverflow.com/questions/2521059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299300/" ]
Turn off "Generate HTML Wrapper file" in Project settings. [![Generate HTML Wrapper file](https://i.stack.imgur.com/kDyI2.png)](https://i.stack.imgur.com/kDyI2.png) This will delete the auto-generated HTML wrapper file in your bin directory. If you need to keep it, make a copy first and put it back after turning off ...
I had the same problem with FB4. My project is an ActionScript project. All you have to do is drop `[SWF(width="300", height="300", backgroundColor="#ffffff", frameRate="30")]` into your default package beneath the imports and it will use these setting to generate the HTML. Howie
2,521,059
When I make changes to a Flex project and rerun the project, it seems that FlashBuilder4 rewrites my html wrapper that embeds the SWF. But I have additional javascript code in the html wrapper and don't want to keep losing my code. I had to re-write the code once and it was a pain in the neck. How do I stop it from re...
2010/03/26
[ "https://Stackoverflow.com/questions/2521059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299300/" ]
Turn off "Generate HTML Wrapper file" in Project settings. [![Generate HTML Wrapper file](https://i.stack.imgur.com/kDyI2.png)](https://i.stack.imgur.com/kDyI2.png) This will delete the auto-generated HTML wrapper file in your bin directory. If you need to keep it, make a copy first and put it back after turning off ...
Flash Builder 4.7 Right-click on the project of interest in the Package Explorer, select "properties", select "Actionscript Compiler", deselect the "Generate HTML wrapper file" checkbox. Check the adobe link for details: <http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-120529f3137a1e031d6-7fff.html>
2,521,059
When I make changes to a Flex project and rerun the project, it seems that FlashBuilder4 rewrites my html wrapper that embeds the SWF. But I have additional javascript code in the html wrapper and don't want to keep losing my code. I had to re-write the code once and it was a pain in the neck. How do I stop it from re...
2010/03/26
[ "https://Stackoverflow.com/questions/2521059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299300/" ]
If Flash Builder 4 is indeed based off Flex Builder 3 as you mentioned then the real solution you are looking for is to edit the HTML wrapper template in **<Flex-Project-Folder>/html-template/index.template.html** and put your own modifications there. You need to be mindful of the tokens used in the template while edi...
Flash Builder 4.7 Right-click on the project of interest in the Package Explorer, select "properties", select "Actionscript Compiler", deselect the "Generate HTML wrapper file" checkbox. Check the adobe link for details: <http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-120529f3137a1e031d6-7fff.html>
2,521,059
When I make changes to a Flex project and rerun the project, it seems that FlashBuilder4 rewrites my html wrapper that embeds the SWF. But I have additional javascript code in the html wrapper and don't want to keep losing my code. I had to re-write the code once and it was a pain in the neck. How do I stop it from re...
2010/03/26
[ "https://Stackoverflow.com/questions/2521059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299300/" ]
I had the same problem with FB4. My project is an ActionScript project. All you have to do is drop `[SWF(width="300", height="300", backgroundColor="#ffffff", frameRate="30")]` into your default package beneath the imports and it will use these setting to generate the HTML. Howie
Flash Builder 4.7 Right-click on the project of interest in the Package Explorer, select "properties", select "Actionscript Compiler", deselect the "Generate HTML wrapper file" checkbox. Check the adobe link for details: <http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-120529f3137a1e031d6-7fff.html>
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
``` sudo gem install -n /usr/local/bin cocoapods ``` Try this. It will definately work.
``` sudo chown -R $(whoami):admin /usr/local ``` That will give permissions back (Homebrew installs ruby there)
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
That is because of the new security function of OS X "El Capitan". Try adding `--user-install` instead of using sudo: ``` $ gem install *** --user-install ``` For example, if you want to install fake3 just use: ``` $ gem install fake3 --user-install ```
``` sudo chown -R $(whoami):admin /usr/local ``` That will give permissions back (Homebrew installs ruby there)
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
Looks like when upgrading to OS X El Capitain, the /usr/local directory is modified in multiple ways : 1. user permissions are reset (this is also a problem for people using Homebrew) 2. binaries and symlinks might have been deleted or altered [Edit] There's also a preliminary thing to do : upgrade Xcode... Solutio...
I ran across the same issue after installing El Capitan, I tried to install sass and compass into a symfony project, the following command returned the following error: $ sudo gem install compass ERROR: Error installing compass: ERROR: Failed to build gem native extension. ``` /System/Library/Frameworks/Ruby.framew...
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
**Disclaimer:** @theTinMan and other Ruby developers often point out not to use `sudo` when installing gems and point to things like [RVM](http://rvm.io/rvm/install). That's absolutely true when doing Ruby development. Go ahead and use that. However, many of us just want some binary that happens to be distributed as a...
That is because of the new security function of OS X "El Capitan". Try adding `--user-install` instead of using sudo: ``` $ gem install *** --user-install ``` For example, if you want to install fake3 just use: ``` $ gem install fake3 --user-install ```
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
You have to update Xcode to the newest one (v7.0.1) and everything will work as normal. If after you install the newest Xcode and still doesn't work try to install gem in this way: ``` sudo gem install -n /usr/local/bin GEM_NAME_HERE ``` For example: ``` sudo gem install -n /usr/local/bin fakes3 sudo gem instal...
This is the solution that I have used: *Note: this fix is for compass as I wrote it on another SO question, but I have used the same process to restore functionality to all terminal processes, obviously the gems you are installing are different, but the process is the same.* I had the same issue. It is due to Apple i...
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
**Disclaimer:** @theTinMan and other Ruby developers often point out not to use `sudo` when installing gems and point to things like [RVM](http://rvm.io/rvm/install). That's absolutely true when doing Ruby development. Go ahead and use that. However, many of us just want some binary that happens to be distributed as a...
I had to `rm -rf ./vendor` then run `bundle install` again.
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
That is because of the new security function of OS X "El Capitan". Try adding `--user-install` instead of using sudo: ``` $ gem install *** --user-install ``` For example, if you want to install fake3 just use: ``` $ gem install fake3 --user-install ```
As it have been said, the issue comes from a security function of Mac OSX since "El Capitan". Using the default system Ruby, the install process happens in the `/Library/Ruby/Gems/2.0.0` directory which is not available to the user and gives the error. You can have a look to your Ruby environments parameters with the...
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
As it have been said, the issue comes from a security function of Mac OSX since "El Capitan". Using the default system Ruby, the install process happens in the `/Library/Ruby/Gems/2.0.0` directory which is not available to the user and gives the error. You can have a look to your Ruby environments parameters with the...
You might have two options: 1. If you've installed ruby and rails, you can first try running the command: ``` rvm fix-permissions ``` 2. You can uninstall ruby completely, and reinstall in your `~` directory aka your home directory. If you're using homebrew the command is: ``` brew uninstall ruby ``` For rails ...
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
``` sudo gem install -n /usr/local/bin cocoapods ``` Try this. It will definately work.
Looks like when upgrading to OS X El Capitain, the /usr/local directory is modified in multiple ways : 1. user permissions are reset (this is also a problem for people using Homebrew) 2. binaries and symlinks might have been deleted or altered [Edit] There's also a preliminary thing to do : upgrade Xcode... Solutio...
31,972,983
I've created a simple timer class which counts down from 20 to zero unless its timerStop variable is set to true, and updates a JTextFiled in an Array of GUIs after each second. Every time the timer is used a new GameTimer is created and passed to a new Thread. PROBLEM: The first run of the timer executes as expected...
2015/08/12
[ "https://Stackoverflow.com/questions/31972983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4965561/" ]
**Disclaimer:** @theTinMan and other Ruby developers often point out not to use `sudo` when installing gems and point to things like [RVM](http://rvm.io/rvm/install). That's absolutely true when doing Ruby development. Go ahead and use that. However, many of us just want some binary that happens to be distributed as a...
Reinstalling RVM worked for me, but I had to reinstall all of my gems afterward: ``` rvm implode \curl -sSL https://get.rvm.io | bash -s stable --ruby rvm reload ```
401,939
I am wondering which API url scheme should I use. I am designing multi-site project so that the URL can looks like: ``` [GET] /website/1 [GET] /website/1/category [GET] /website/1/product ``` Which is life saving since we inject the root website id for the resources we want to list **but** there are cases when th...
2019/12/02
[ "https://softwareengineering.stackexchange.com/questions/401939", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/320543/" ]
There are two (main) schools of thought on this. The first is that you create URIs that are human readable and that you can construct from an understanding of the structure. The other is that URIs should not be (or need not be) understandable or 'constructable'. In the latter school, all URIs are retrieved from the ser...
Another way to look at this is what can be a base URI and can `/website/1/` be a base URI? Please have a look at [Establishing a Base URI](https://www.rfc-editor.org/rfc/rfc3986#page-28). There are several ways to decide how a URI can be considered as Base URI. Specifically to your question, if somehow a client receiv...
139,006
I have a Asus EEE PC Netbook, 1015CX. I have created a bootable usb to try Ubuntu and to test how it looks. The main problem is that the screen resolution is locked at 800x600 where as my netbook usually runs at 1024 minimum. How can I change it? I see no option in the menu.
2012/05/18
[ "https://askubuntu.com/questions/139006", "https://askubuntu.com", "https://askubuntu.com/users/64466/" ]
Type "Displays" in the dash or click on the computer icon in the top right corner and select the second item in the menu.
Try launching the "Displays" control applet. If X thinks you can change your resolution, you can do it here.
139,006
I have a Asus EEE PC Netbook, 1015CX. I have created a bootable usb to try Ubuntu and to test how it looks. The main problem is that the screen resolution is locked at 800x600 where as my netbook usually runs at 1024 minimum. How can I change it? I see no option in the menu.
2012/05/18
[ "https://askubuntu.com/questions/139006", "https://askubuntu.com", "https://askubuntu.com/users/64466/" ]
Mik: tried xrandr -s 1024x600 (which this netbook runs at in Windows) and got: "size 1024x600 not found in available modes" Zigg: In Lubunut, 'monitor settings applet only offers 800x600 Right,just found this, which may be the solution: [Support for Intel GMA 3600](http://ubuntuforums.org/showpost.php?p=11976680&po...
Try launching the "Displays" control applet. If X thinks you can change your resolution, you can do it here.
139,006
I have a Asus EEE PC Netbook, 1015CX. I have created a bootable usb to try Ubuntu and to test how it looks. The main problem is that the screen resolution is locked at 800x600 where as my netbook usually runs at 1024 minimum. How can I change it? I see no option in the menu.
2012/05/18
[ "https://askubuntu.com/questions/139006", "https://askubuntu.com", "https://askubuntu.com/users/64466/" ]
You can even use custom resolution with this method. It really works for me. <http://dfourtheye.blogspot.in/2013/04/ubuntu-screen-custom-resolution.html>
Try launching the "Displays" control applet. If X thinks you can change your resolution, you can do it here.
139,006
I have a Asus EEE PC Netbook, 1015CX. I have created a bootable usb to try Ubuntu and to test how it looks. The main problem is that the screen resolution is locked at 800x600 where as my netbook usually runs at 1024 minimum. How can I change it? I see no option in the menu.
2012/05/18
[ "https://askubuntu.com/questions/139006", "https://askubuntu.com", "https://askubuntu.com/users/64466/" ]
Type "Displays" in the dash or click on the computer icon in the top right corner and select the second item in the menu.
Mik: tried xrandr -s 1024x600 (which this netbook runs at in Windows) and got: "size 1024x600 not found in available modes" Zigg: In Lubunut, 'monitor settings applet only offers 800x600 Right,just found this, which may be the solution: [Support for Intel GMA 3600](http://ubuntuforums.org/showpost.php?p=11976680&po...
139,006
I have a Asus EEE PC Netbook, 1015CX. I have created a bootable usb to try Ubuntu and to test how it looks. The main problem is that the screen resolution is locked at 800x600 where as my netbook usually runs at 1024 minimum. How can I change it? I see no option in the menu.
2012/05/18
[ "https://askubuntu.com/questions/139006", "https://askubuntu.com", "https://askubuntu.com/users/64466/" ]
Type "Displays" in the dash or click on the computer icon in the top right corner and select the second item in the menu.
You can even use custom resolution with this method. It really works for me. <http://dfourtheye.blogspot.in/2013/04/ubuntu-screen-custom-resolution.html>
14,611,727
I'm scraping content off of a public domain site (cancer.gov), and I want to reformat the markup because it's terribly formatted in a table. I have jQuery at my disposal, and I'm just trying to put it into the console so I can copy it and paste it into Vim. I've gotten as far as making an array of the `td` elements I ...
2013/01/30
[ "https://Stackoverflow.com/questions/14611727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/931934/" ]
Creating a jQuery object does not magically turn them into DOM elements. --- Just create on big string of HTML, and pass that to the jQuery constructor: ``` var questions = $('selector here...').text().split('?'); questions = $('<h3>' + questions.join('?</h3><h3>') + '?<h3>' ); ``` Here's your fiddle: <http://jsf...
You could simply grab the content into an array and then do whatever you want with the array without the worry of the question mark. ``` var myarr = $('#Table1').find('tr:even');//even to exclude the hr rows ``` here I show some things you can do with that: ``` var myQuest = myarr.find('td:eq(0)').map(function () {...
208,956
How can I find the base current of this circuit. I was trying to find \$\beta \$ from \$(\beta+1)I\_B = I\_E \$. where \$V\_{BE}=0.7V, I\_E=0.5mA\$ ![schematic](https://i.stack.imgur.com/jJKlv.png) [simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fjJKlv.png) – Schematic created usi...
2016/01/01
[ "https://electronics.stackexchange.com/questions/208956", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/35407/" ]
That PNP is biased off. I suspect you really intended to put an NPN there, and exchange the E & C ?
Edit, now that you've exchanged the PNP for an NPN. Ve = (Ic \* R2)-5V. Vb = Vbe + Ve. Ib = (Vc - Vb)/ R3 **IF** your drawing is correct, then you're thinking about this too much. Vbe = 0.7V. There's a 100,000 ohm resister that the voltage appears across. I= V/R. That's the base current. BTW, the current should be fl...
208,956
How can I find the base current of this circuit. I was trying to find \$\beta \$ from \$(\beta+1)I\_B = I\_E \$. where \$V\_{BE}=0.7V, I\_E=0.5mA\$ ![schematic](https://i.stack.imgur.com/jJKlv.png) [simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fjJKlv.png) – Schematic created usi...
2016/01/01
[ "https://electronics.stackexchange.com/questions/208956", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/35407/" ]
That PNP is biased off. I suspect you really intended to put an NPN there, and exchange the E & C ?
You know the emitter current. That current through the emitter resistor gives the emitter voltage. Adding the base-emitter voltage to the known emitter voltage gives the base voltage. The difference between the collector voltage (known) and the base voltage (just calculated), divided by the base bias resistor, gives yo...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
> > I’m supposed to assign a unique number to each producer and consumer > thread. How do I assign a unique number to producer and consumer > threads? > > > Add an instance (non-static) variable to the Producer/Consumer classes. When you initialize the new Producer/Consumer Objects, pass in the unique number. Yo...
I tried the following which might work for you, except for the buffer condition on 3, which you can add the part of the code by yourself. Hope this helps. ``` public class Message { private String msg; public Message(String msg) { super(); this.msg = msg; } public String getMsg(){ ...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
> > I’m supposed to assign a unique number to each producer and consumer > thread. How do I assign a unique number to producer and consumer > threads? > > > Add an instance (non-static) variable to the Producer/Consumer classes. When you initialize the new Producer/Consumer Objects, pass in the unique number. Yo...
Please refer the below code. You can change the constant values based on the command line arguments. I have tested the code, its working as per your requirement. ``` import java.util.LinkedList; import java.util.Queue; public class ProducerConsumerProblem { public static int CAPACITY = 10; // At a time maximum of...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
> > I’m supposed to assign a unique number to each producer and consumer > thread. How do I assign a unique number to producer and consumer > threads? > > > Add an instance (non-static) variable to the Producer/Consumer classes. When you initialize the new Producer/Consumer Objects, pass in the unique number. Yo...
``` public class ProducerConsumerTest { public static void main(String[] args) { CubbyHole c = new CubbyHole(); Producer p1 = new Producer(c, 1); Consumer c1 = new Consumer(c, 1); p1.start(); c1.start(); } } class CubbyHole { private int contents; private boole...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
For producer consumer problem best solution is BlockingQueue. I was testing a few things so designed same kind of program now modified it as per your need. See if it helps. ``` import java.util.concurrent.*; public class ThreadingExample { public static void main(String args[]){ BlockingQueue<Message> bl...
I tried the following which might work for you, except for the buffer condition on 3, which you can add the part of the code by yourself. Hope this helps. ``` public class Message { private String msg; public Message(String msg) { super(); this.msg = msg; } public String getMsg(){ ...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
For producer consumer problem best solution is BlockingQueue. I was testing a few things so designed same kind of program now modified it as per your need. See if it helps. ``` import java.util.concurrent.*; public class ThreadingExample { public static void main(String args[]){ BlockingQueue<Message> bl...
Please refer the below code. You can change the constant values based on the command line arguments. I have tested the code, its working as per your requirement. ``` import java.util.LinkedList; import java.util.Queue; public class ProducerConsumerProblem { public static int CAPACITY = 10; // At a time maximum of...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
For producer consumer problem best solution is BlockingQueue. I was testing a few things so designed same kind of program now modified it as per your need. See if it helps. ``` import java.util.concurrent.*; public class ThreadingExample { public static void main(String args[]){ BlockingQueue<Message> bl...
``` public class ProducerConsumerTest { public static void main(String[] args) { CubbyHole c = new CubbyHole(); Producer p1 = new Producer(c, 1); Consumer c1 = new Consumer(c, 1); p1.start(); c1.start(); } } class CubbyHole { private int contents; private boole...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
I tried the following which might work for you, except for the buffer condition on 3, which you can add the part of the code by yourself. Hope this helps. ``` public class Message { private String msg; public Message(String msg) { super(); this.msg = msg; } public String getMsg(){ ...
``` public class ProducerConsumerTest { public static void main(String[] args) { CubbyHole c = new CubbyHole(); Producer p1 = new Producer(c, 1); Consumer c1 = new Consumer(c, 1); p1.start(); c1.start(); } } class CubbyHole { private int contents; private boole...
19,696,968
I’m writing a program that implements the Producer Consumer problem in Java using multithreading concepts. Below are few details how I’m supposed to do it: 1) The main thread should create a buffer with capacity specified as a command line argument. The number of producer and consumer threads are also specified as com...
2013/10/31
[ "https://Stackoverflow.com/questions/19696968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2201650/" ]
Please refer the below code. You can change the constant values based on the command line arguments. I have tested the code, its working as per your requirement. ``` import java.util.LinkedList; import java.util.Queue; public class ProducerConsumerProblem { public static int CAPACITY = 10; // At a time maximum of...
``` public class ProducerConsumerTest { public static void main(String[] args) { CubbyHole c = new CubbyHole(); Producer p1 = new Producer(c, 1); Consumer c1 = new Consumer(c, 1); p1.start(); c1.start(); } } class CubbyHole { private int contents; private boole...
65,939,751
Been struggling with the following: I have a JSON response of orders from our Ecommerce website (Shopify). I need to create a CSV from the response. Everything is fine for me until I get to the line item details. I only get the first item in the array. I have seen other solutions that showed the other array items as ad...
2021/01/28
[ "https://Stackoverflow.com/questions/65939751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2037475/" ]
Here is working sample of it in VB.NET ``` Dim json As String json = " { ""email"": ""anemail@adomain.com"", ""financial_status"": ""paid"", ""name"": ""#CCC94440"", ""line_items"": [ { ""title"": ""product1"", ""quantity"": 3 }, { ""title"": ""product2"", "...
To be honest, with all your emerging requirements, it's going to get messier and messier to keep trying to ram all this into a single line of LINQ... I'd head to jsonutils.com and paste the json there to turn it into VB, turn on PascalCase and JsonProperty attributes: ``` Public Class LineItem <JsonProperty("tit...
23,477,344
I have the following code: ``` <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta name="_csrf" th:content="${_csrf.token}"/> <!-- default header name is X-CSRF-TOKEN --> <meta name="_csrf_header" th:content="${_csrf.headerName}"/> <title>Fileupload Test</title> </head> <body> <p...
2014/05/05
[ "https://Stackoverflow.com/questions/23477344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2000811/" ]
``` <!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"><head> <meta name="_csrf" th:content="${_csrf.token}"/> <!-- default header name is X-CSRF-TOKEN --> <meta name="_csrf_header" th:content="${_csrf.headerName}"/> ``` and ``` var token = $("meta[name='_csrf']").attr("content"); var header = $("meta[name...
Personally using same configuration as you (Thymleaf, Spring MVC, Spring Sec) i only was able to utilise meta csrf when uploading via ajax and direct inserts into action URL if submitting in standard fashion. So different types of forms used: e.g. ``` <form action="#" th:action="@{/fileUpload} + '?' + ${_csrf.paramet...
23,477,344
I have the following code: ``` <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta name="_csrf" th:content="${_csrf.token}"/> <!-- default header name is X-CSRF-TOKEN --> <meta name="_csrf_header" th:content="${_csrf.headerName}"/> <title>Fileupload Test</title> </head> <body> <p...
2014/05/05
[ "https://Stackoverflow.com/questions/23477344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2000811/" ]
After fighting with this issue for some time, I finally figured out why the code in the [official Spring documentation](https://docs.spring.io/spring-security/site/docs/current/reference/html/csrf.html#csrf-include-csrf-token-ajax) doesn't work... Notice the following: ``` <meta name="_csrf" content="${_csrf.token}" /...
Personally using same configuration as you (Thymleaf, Spring MVC, Spring Sec) i only was able to utilise meta csrf when uploading via ajax and direct inserts into action URL if submitting in standard fashion. So different types of forms used: e.g. ``` <form action="#" th:action="@{/fileUpload} + '?' + ${_csrf.paramet...
23,477,344
I have the following code: ``` <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta name="_csrf" th:content="${_csrf.token}"/> <!-- default header name is X-CSRF-TOKEN --> <meta name="_csrf_header" th:content="${_csrf.headerName}"/> <title>Fileupload Test</title> </head> <body> <p...
2014/05/05
[ "https://Stackoverflow.com/questions/23477344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2000811/" ]
After fighting with this issue for some time, I finally figured out why the code in the [official Spring documentation](https://docs.spring.io/spring-security/site/docs/current/reference/html/csrf.html#csrf-include-csrf-token-ajax) doesn't work... Notice the following: ``` <meta name="_csrf" content="${_csrf.token}" /...
``` <!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"><head> <meta name="_csrf" th:content="${_csrf.token}"/> <!-- default header name is X-CSRF-TOKEN --> <meta name="_csrf_header" th:content="${_csrf.headerName}"/> ``` and ``` var token = $("meta[name='_csrf']").attr("content"); var header = $("meta[name...
10,091,918
Say I have an object ``` MyObj stuff; ``` To get the address of stuff, I would print ``` cout << &stuff << endl; 0x22ff68 ``` I want to save 0x22ff68 in a string. I know you can't do this: ``` string cheeseburger = (string) &stuff; ``` Is there a way to accomplish this?
2012/04/10
[ "https://Stackoverflow.com/questions/10091918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You could use [std::ostringstream](http://www.cplusplus.com/reference/iostream/ostringstream/). See also [this question](https://stackoverflow.com/questions/8287188/stdostringstream-printing-the-address-of-the-c-string-instead-of-its-content). But don't expect the address you have to be really meaningful. It could var...
You can try using a string format char strAddress[] = "0x00000000"; // Note: You should allocate the correct size, here I assumed that you are using 32 bits address sprintf(strAddress, "0x%x", &stuff); Then you create your string from this char array using the normal string constructors
10,091,918
Say I have an object ``` MyObj stuff; ``` To get the address of stuff, I would print ``` cout << &stuff << endl; 0x22ff68 ``` I want to save 0x22ff68 in a string. I know you can't do this: ``` string cheeseburger = (string) &stuff; ``` Is there a way to accomplish this?
2012/04/10
[ "https://Stackoverflow.com/questions/10091918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You could use [std::ostringstream](http://www.cplusplus.com/reference/iostream/ostringstream/). See also [this question](https://stackoverflow.com/questions/8287188/stdostringstream-printing-the-address-of-the-c-string-instead-of-its-content). But don't expect the address you have to be really meaningful. It could var...
Here's a way to save the address of a pointer to a string and then convert the address back to a pointer. I did this as a proof of concept that `const` didn't really offer any protection, but I think it answers this question well. ``` #include <iostream> #include <string> #include <sstream> using namespace std; int...
875,578
I have code that looks like this: ``` template<class T> class list { public: class iterator; }; template<class T> class list::iterator { public: iterator(); protected: list* lstptr; }; list<T>::iterator::iterator() { //??? } ``` I want to make the constructor of `list::iterator` to make `iterator::...
2009/05/17
[ "https://Stackoverflow.com/questions/875578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can pass the list to the constructor of iterator: ``` list xlst; list::iterator xitr(xlst); ``` Or, you could make an iterator factory function: ``` list xlst; list::iterator xitr = xlst.create_iter(); ``` In the factory function case, the `create_iter()` function can use `this` to refer to the enclosing list...
Since you don't need to change (reseat) the pointer and there's no need for the NULL value, I would instead use a reference. Also you can use an initializer list when assigning the member variable (and have to if you're using a reference). ``` template<class T> class list::iterator { public: iterator( list& parent...
36,496,998
I created a task link and a contextual one for base\_route: entity.node.canonical mymodule.routing.yml ``` mymodule.mycustomroute: path: '/node/{node}/custom-path' defaults: _form: '\Drupal\mymodule\Form\MyForm' requirements: _permission: 'my permission' node: '[0-9]+' ``` mymodule.links.tasks.yml...
2016/04/08
[ "https://Stackoverflow.com/questions/36496998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3493566/" ]
**mymodule/mymodule.routing.yml** : ``` mymodule.mycustomroute: path: '/node/{node}/custom-path' defaults: _form: '\Drupal\mymodule\Form\MyForm' requirements: _permission: 'my permission' _custom_access: '\Drupal\mymodule\Access\NodeTypeAccessCheck::access' _node_types: 'node_type_1,node_type_2,n...
Or you can specify route parameters in the mymodule.links.menu.yml file: ``` mymodule.add_whatever: title: 'Add whatever' description: 'Add whatever' route_name: node.add route_parameters: { node_type: 'name_of_node_type' } menu_name: main weight: 7 ```
55,376,142
The issue i am facing is that when i click on active button all the article's active button change to inactive.. i want to change the status of that article id which i set to inactive from active. All articles will remain active or inactive as described status in database.how i can get this? If i Inactive Article butto...
2019/03/27
[ "https://Stackoverflow.com/questions/55376142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
```html <button class="btn btn-sm btn-danger delete-article-btn mybtn-{{$article['aID']}}" rel="{{ $article['aID'] }}" rel2="1">Active </button> ``` ```js <script> $(document).on('click','.delete-article-btn',function(){ var id = $(this).attr('re...
You are changing the the html content of all the buttons with the class ".delete-article-btn" ``` if (response == 1) { $('.delete-article-btn').html('Inactive'); } else { $('.delete-article-btn').html('Active'); } ``` You have to specify which button you have to update maybe with a data attribute, as you prefe...
30,288,360
I wrote this code, but I can't handle with ".?!" and other combination of such characters? Could someone help me? I need to count the sentences in a line. ``` #include<stdlib.h> #include<string.h> #include<stdio.h> int main(){ int say=0,i; char line[250]; gets(line); ...
2015/05/17
[ "https://Stackoverflow.com/questions/30288360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3017046/" ]
The Jinja template folder for app dirs defaults to `jinja2` not the standard `templates` folder. So try the following directory structure and Django will locate your Jinja templates: ``` mysite mysite myapp jinja2 myapp index.html manage.py ```
Another thing to consider is that render\_to\_response can not take a context\_instance for jinja2 templates <https://github.com/django-haystack/django-haystack/issues/1163> I believe, but I might be wrong, but I think jinja2 can't share the same directory as the django templates. try ``` TEMPLATES = { 'BACKEND'...
30,288,360
I wrote this code, but I can't handle with ".?!" and other combination of such characters? Could someone help me? I need to count the sentences in a line. ``` #include<stdlib.h> #include<string.h> #include<stdio.h> int main(){ int say=0,i; char line[250]; gets(line); ...
2015/05/17
[ "https://Stackoverflow.com/questions/30288360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3017046/" ]
Another thing to consider is that render\_to\_response can not take a context\_instance for jinja2 templates <https://github.com/django-haystack/django-haystack/issues/1163> I believe, but I might be wrong, but I think jinja2 can't share the same directory as the django templates. try ``` TEMPLATES = { 'BACKEND'...
The Jinja template folder for app dirs defaults to jinja2 not the standard templates folder. So try the following directory structure and Django will locate your Jinja templates: mysite mysite myapp jinja2 myapp index.html manage.py And instead of: return render(request, 'myapp/index.html') you should writ...
30,288,360
I wrote this code, but I can't handle with ".?!" and other combination of such characters? Could someone help me? I need to count the sentences in a line. ``` #include<stdlib.h> #include<string.h> #include<stdio.h> int main(){ int say=0,i; char line[250]; gets(line); ...
2015/05/17
[ "https://Stackoverflow.com/questions/30288360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3017046/" ]
The Jinja template folder for app dirs defaults to `jinja2` not the standard `templates` folder. So try the following directory structure and Django will locate your Jinja templates: ``` mysite mysite myapp jinja2 myapp index.html manage.py ```
The Jinja2 template backend searches the `jinja2` folder in the app directories, instead of `templates`. This has the advantange of preventing DTL and Jinja2 templates from being confused, especially if you enable multiple templating engines in your project. I would recommend sticking with the default behaviour, and r...
30,288,360
I wrote this code, but I can't handle with ".?!" and other combination of such characters? Could someone help me? I need to count the sentences in a line. ``` #include<stdlib.h> #include<string.h> #include<stdio.h> int main(){ int say=0,i; char line[250]; gets(line); ...
2015/05/17
[ "https://Stackoverflow.com/questions/30288360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3017046/" ]
The Jinja template folder for app dirs defaults to `jinja2` not the standard `templates` folder. So try the following directory structure and Django will locate your Jinja templates: ``` mysite mysite myapp jinja2 myapp index.html manage.py ```
The Jinja template folder for app dirs defaults to jinja2 not the standard templates folder. So try the following directory structure and Django will locate your Jinja templates: mysite mysite myapp jinja2 myapp index.html manage.py And instead of: return render(request, 'myapp/index.html') you should writ...
30,288,360
I wrote this code, but I can't handle with ".?!" and other combination of such characters? Could someone help me? I need to count the sentences in a line. ``` #include<stdlib.h> #include<string.h> #include<stdio.h> int main(){ int say=0,i; char line[250]; gets(line); ...
2015/05/17
[ "https://Stackoverflow.com/questions/30288360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3017046/" ]
The Jinja2 template backend searches the `jinja2` folder in the app directories, instead of `templates`. This has the advantange of preventing DTL and Jinja2 templates from being confused, especially if you enable multiple templating engines in your project. I would recommend sticking with the default behaviour, and r...
The Jinja template folder for app dirs defaults to jinja2 not the standard templates folder. So try the following directory structure and Django will locate your Jinja templates: mysite mysite myapp jinja2 myapp index.html manage.py And instead of: return render(request, 'myapp/index.html') you should writ...
3,022,656
How to understand why the set of nonsigular matrices is a differentiable submanifold of the the of matrices (of size $n$). I thought of introducing, given a nonsingular matrix $A$, the mapping $f:X\mapsto \det(X)-\det(A)$. But from this on I do not know how to proceed. Also, how to determine the tangent space at a po...
2018/12/02
[ "https://math.stackexchange.com/questions/3022656", "https://math.stackexchange.com", "https://math.stackexchange.com/users/600438/" ]
The idea is that the singular matrices in $M\_{m \times q}(\Bbb R)$ form a closed subset, as they constitute precisely the subset $\text{det}^{-1}(\{0\})$, and $\text{det}$ is a continuous function on $M\_{m \times q}(\Bbb R)$. So the subset of nonsingular matrices is the open set $M\_{m \times q}(\Bbb R) \setminus \te...
It is an open subspace of a vector space, $Gl(n,\mathbb{R})=det^{-1}(\mathbb{R}-\{0\}$. Here the vector space is the space of $n\times n$-matrices so it is a submaniflod with one chart which is the embedding map $Gl(n,\mathbb{R})\rightarrow M(n,\mathbb{R})$.
13,742,313
Given a table of tuples of currency and exchange rate, such as the following: ``` EUR CHF 1.20 USD EUR 0.80 CHF JPY 1.30 ``` How can I simply generate all the exchange rate between currency (A,B) and also (B,A)? I would like to have the following: ``` EUR CHF CHF EUR EUR USD USD EUR USD CHF CHF USD ``` with a...
2012/12/06
[ "https://Stackoverflow.com/questions/13742313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/701829/" ]
Though you are using `AsyncTask`, its `onPostExecute()` method is executed on UI thread (to let you update your views etc). Actually, the only method of `AsyncTask` executed in separate thread is `doInBackground()`, so you have to perform all operations involving I/O (disk, network), only in this method, otherwise you'...
From the Android Doc **android.os.NetworkOnMainThreadException** clearly stated that from `android 2.3.3` you can not call URL in main UI thread. Please cross check it and make sure you did not do this mistake **From Android Developer** The exception that is thrown when an application attempts to perform a networking...
11,562,553
Please, share your experience in using software echo cancellers on Android: 1. Built-in (the one that appeared in v3.0, as I hear) 2. Speex 3. WebRTC 4. Etc.
2012/07/19
[ "https://Stackoverflow.com/questions/11562553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/915913/" ]
I'm just finishing the AEC work on android, I tried speex/android-built-in-ec/webrtc-aec and webrtc-aecm(echo control on mobile), and finally choose the AECM module, and there are some tips: 1. speex and webrtc-aec is not good for running on mobile(for low CPU perform reason). 2. android built-in EC is working, but th...
There are two issues that relates to AEC on Android: 1. CPU. Most AEC algorithms does not perform well with low CPU. 2. Echo Path - many VoIP application on Android introduce echo delay that is higher than what the free algorithm can handle (efficiently). Bottom line, I suggest that you first measure the echo delay (...
62,412,262
I am attempting to train the keras VGG-19 model on RGB images, when attempting to feed forward this error arises: ``` ValueError: Input 0 of layer block1_conv1 is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [224, 224, 3] ``` When reshaping image to (224, 224, 3, 1) to include bat...
2020/06/16
[ "https://Stackoverflow.com/questions/62412262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13641853/" ]
You will have to unsqueeze one dimension to turn your shape into `[1, 224, 224, 3'`: ``` for idx in tqdm(range(train_data.get_ds_size() // batch_size)): # train step batch = train_data.get_train_batch() for sample, label in zip(batch[0], batch[1]): sample = tf.reshape(sample, [1, *sample.shape]) #...
You use wrong dimension for the image batch, "When reshaping image to (224, 224, 3, 1) to include batch dim" -- this should be (x, 224, 224, 3), where `x` is the number of the images in the batch.
25,681,018
So I have these 3 tables: t\_student which looks like this: ``` STUDENT_ID| FIRST_NAME |LAST_NAME ----------------------------------- 1 | Ivan | Petrov 2 | Ivan | Ivanov 3 | Georgi | Georgiev ``` t\_course which looks like this: ``` course_id | NAME |LECTURER_NAME...
2014/09/05
[ "https://Stackoverflow.com/questions/25681018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155020/" ]
Select all courses from your course Table, join the enrolment table and group by your course id. With count() you can select the number of Students ``` SELECT MAX(t_course.NAME) AS Course_name, COUNT(t_enrolment.student_fk) AS Count_students FROM t_course LEFT JOIN t_enrolment ON t_enrolment.course_fk = t_...
Is this your homework? ``` select count(*) Count_students, c.name as course_name from t_enrolment e, t_course c group where e.course_fk = c.course_id by c.name ```
25,681,018
So I have these 3 tables: t\_student which looks like this: ``` STUDENT_ID| FIRST_NAME |LAST_NAME ----------------------------------- 1 | Ivan | Petrov 2 | Ivan | Ivanov 3 | Georgi | Georgiev ``` t\_course which looks like this: ``` course_id | NAME |LECTURER_NAME...
2014/09/05
[ "https://Stackoverflow.com/questions/25681018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155020/" ]
Select all courses from your course Table, join the enrolment table and group by your course id. With count() you can select the number of Students ``` SELECT MAX(t_course.NAME) AS Course_name, COUNT(t_enrolment.student_fk) AS Count_students FROM t_course LEFT JOIN t_enrolment ON t_enrolment.course_fk = t_...
You need a select statement with a join to the couse table (for the `Course_name`). Group by `'t_course'.name` to use the `COUNT(*)` function this will work: ``` SELECT COUNT(*) AS Count_students, c.NAME AS Course_name FROM t_enrolment e JOIN course c ON e.course_fk = c.course_id GROUP BY c.NAME ``` **More informa...
71,244,250
### Input ``` import numpy as np import itertools a = np.array([ 1, 6, 7, 8, 10, 11, 13, 14, 15, 19, 20, 23, 24, 26, 28, 29, 33, 34, 41, 42, 43, 44, 45, 46, 47, 52, 54, 58, 60, 61, 65, 70, 75]).astype(np.uint8) b = np.array([ 2, 3, 4, 10, 12, 14, 16, 20, 22, 26, 28, 29, 30, 31, 34, 36, 37, 38, 39, ...
2022/02/23
[ "https://Stackoverflow.com/questions/71244250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18158000/" ]
You could do it like so: ``` # create full Cartessian product and keep items in sorted form arr = np.stack(np.meshgrid(a, b, c), axis=-1).reshape(-1, 3) arr_sort = np.sort(arr, axis=1) # apply condition 1: no duplicates between sorted items u, idx_c1 = np.unique(arr_sort, return_index=True, axis=0) arr_filter, arr_so...
It is going to be quite hard to get numpy to go as fast as the filtered python iterator because numpy processes whole structures that will inevitably be larger than the result of filtering sets. Here is the best I could come up with to process the product of arrays in such a way that the result is filtered on unique c...
71,244,250
### Input ``` import numpy as np import itertools a = np.array([ 1, 6, 7, 8, 10, 11, 13, 14, 15, 19, 20, 23, 24, 26, 28, 29, 33, 34, 41, 42, 43, 44, 45, 46, 47, 52, 54, 58, 60, 61, 65, 70, 75]).astype(np.uint8) b = np.array([ 2, 3, 4, 10, 12, 14, 16, 20, 22, 26, 28, 29, 30, 31, 34, 36, 37, 38, 39, ...
2022/02/23
[ "https://Stackoverflow.com/questions/71244250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18158000/" ]
Why current implementations are slow ------------------------------------ While the first solution is faster than the second one, it is quite inefficient since it creates a lot of temporary CPython objects (at least 6 per item of `itertools.product`). **Creating a lot of objects is expensive because they are dynamical...
It is going to be quite hard to get numpy to go as fast as the filtered python iterator because numpy processes whole structures that will inevitably be larger than the result of filtering sets. Here is the best I could come up with to process the product of arrays in such a way that the result is filtered on unique c...
71,244,250
### Input ``` import numpy as np import itertools a = np.array([ 1, 6, 7, 8, 10, 11, 13, 14, 15, 19, 20, 23, 24, 26, 28, 29, 33, 34, 41, 42, 43, 44, 45, 46, 47, 52, 54, 58, 60, 61, 65, 70, 75]).astype(np.uint8) b = np.array([ 2, 3, 4, 10, 12, 14, 16, 20, 22, 26, 28, 29, 30, 31, 34, 36, 37, 38, 39, ...
2022/02/23
[ "https://Stackoverflow.com/questions/71244250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18158000/" ]
Why current implementations are slow ------------------------------------ While the first solution is faster than the second one, it is quite inefficient since it creates a lot of temporary CPython objects (at least 6 per item of `itertools.product`). **Creating a lot of objects is expensive because they are dynamical...
You could do it like so: ``` # create full Cartessian product and keep items in sorted form arr = np.stack(np.meshgrid(a, b, c), axis=-1).reshape(-1, 3) arr_sort = np.sort(arr, axis=1) # apply condition 1: no duplicates between sorted items u, idx_c1 = np.unique(arr_sort, return_index=True, axis=0) arr_filter, arr_so...
23,912
According to [Wikipedia](https://en.wikipedia.org/wiki/Korean_War), there were many belligerents on the South Korean side involved in the war. This includes The UK, France, Australia, Canada, Greece and many, many others. Why, then, is there so much more hatred towards the US when other countries were a part of the wa...
2017/08/22
[ "https://politics.stackexchange.com/questions/23912", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/16352/" ]
While Alexander's points are correct and certainly do not help the USA win North Korean sympathies, I think that more than an historical view the answer lies in the current situation: * USA is the only foreign power that still has troops stationed in South Korea. * USA was the most powerful nation of the UN coalition....
Also according to Wikipedia (same article, in the box on the right, under "Strength"), albeit the Korea war was a U.N. mandate, the U.S. was the main force, providing 326k out of 370k of the allied personnel, or about 90%, plus they supplied most of the armament; and [they appointed the commander of the allied forces](...
23,912
According to [Wikipedia](https://en.wikipedia.org/wiki/Korean_War), there were many belligerents on the South Korean side involved in the war. This includes The UK, France, Australia, Canada, Greece and many, many others. Why, then, is there so much more hatred towards the US when other countries were a part of the wa...
2017/08/22
[ "https://politics.stackexchange.com/questions/23912", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/16352/" ]
Also according to Wikipedia (same article, in the box on the right, under "Strength"), albeit the Korea war was a U.N. mandate, the U.S. was the main force, providing 326k out of 370k of the allied personnel, or about 90%, plus they supplied most of the armament; and [they appointed the commander of the allied forces](...
The US has a variety of justifications for having hundreds of thousands of troops and thousands of bases overseas. The US presence in Japan and South Korea, in particular, is contingent on the North Korean threat. If North Korea ceases to be a threat, the US troops stationed in South Korea and Japan will have even less...
23,912
According to [Wikipedia](https://en.wikipedia.org/wiki/Korean_War), there were many belligerents on the South Korean side involved in the war. This includes The UK, France, Australia, Canada, Greece and many, many others. Why, then, is there so much more hatred towards the US when other countries were a part of the wa...
2017/08/22
[ "https://politics.stackexchange.com/questions/23912", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/16352/" ]
While Alexander's points are correct and certainly do not help the USA win North Korean sympathies, I think that more than an historical view the answer lies in the current situation: * USA is the only foreign power that still has troops stationed in South Korea. * USA was the most powerful nation of the UN coalition....
The US maintained a particularly destructive and deadly [bombing campaign](http://www.newsweek.com/us-forget-korean-war-led-crisis-north-592630) on North Korea during the Korean war: > > During the course of the three-year war, which both sides accuse one > another of provoking, t**he U.S. dropped 635,000 tons of ex...
23,912
According to [Wikipedia](https://en.wikipedia.org/wiki/Korean_War), there were many belligerents on the South Korean side involved in the war. This includes The UK, France, Australia, Canada, Greece and many, many others. Why, then, is there so much more hatred towards the US when other countries were a part of the wa...
2017/08/22
[ "https://politics.stackexchange.com/questions/23912", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/16352/" ]
While Alexander's points are correct and certainly do not help the USA win North Korean sympathies, I think that more than an historical view the answer lies in the current situation: * USA is the only foreign power that still has troops stationed in South Korea. * USA was the most powerful nation of the UN coalition....
The US has a variety of justifications for having hundreds of thousands of troops and thousands of bases overseas. The US presence in Japan and South Korea, in particular, is contingent on the North Korean threat. If North Korea ceases to be a threat, the US troops stationed in South Korea and Japan will have even less...
23,912
According to [Wikipedia](https://en.wikipedia.org/wiki/Korean_War), there were many belligerents on the South Korean side involved in the war. This includes The UK, France, Australia, Canada, Greece and many, many others. Why, then, is there so much more hatred towards the US when other countries were a part of the wa...
2017/08/22
[ "https://politics.stackexchange.com/questions/23912", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/16352/" ]
The US maintained a particularly destructive and deadly [bombing campaign](http://www.newsweek.com/us-forget-korean-war-led-crisis-north-592630) on North Korea during the Korean war: > > During the course of the three-year war, which both sides accuse one > another of provoking, t**he U.S. dropped 635,000 tons of ex...
The US has a variety of justifications for having hundreds of thousands of troops and thousands of bases overseas. The US presence in Japan and South Korea, in particular, is contingent on the North Korean threat. If North Korea ceases to be a threat, the US troops stationed in South Korea and Japan will have even less...