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
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
This is actually built-in, you just need to implement a couple of classes to enable it. Data will be backed up and linked to the user's Google account, so it will be automatically restored if they install the app on a new device, re-install, etc. <http://developer.android.com/guide/topics/data/backup.html>
At the age of 2020, it seems to me that `Shared Storage` is the way to go. Android data and file Storage overview <https://developer.android.com/training/data-storage> Shared storage of documents and files <https://developer.android.com/training/data-storage/shared/documents-files>
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
You should add a `BackupAgentHelper` to your app. Together with the `SharedPreferenceBackupHelper`, it backups the `SharedPreferences` to the cloud (if the device supports it). When the app is reinstalled the data is restored. See: [BackupAgentHelper](http://developer.android.com/reference/android/app/backup/BackupA...
As edthethird said: best lay physical files on device external storage and read them on installation. If the file content needs to be hidden from users just perform a simple encryption/decryption process.
2,615
> > *Mia frato estas vegano.* > > > Ĉi tie, *vegan-* signifas "*iu kiu ne manĝas produktojn de bestoj*". > > *Tiu supo estas vegana.* > > > Tamen ĉi tie, *vegan-* signifas "*farita sen produktoj de bestoj*". Ŝajnas al mi ke la radiko havas malsaman signifon depende ĉu ĝi estas substantivo aŭ adjektivo. Sed ...
2017/01/06
[ "https://esperanto.stackexchange.com/questions/2615", "https://esperanto.stackexchange.com", "https://esperanto.stackexchange.com/users/150/" ]
La radiko *vegan/* estas substantiva, do ĝia baza signifo estas 'homo, kiu vivas sen uzi bestajn produktojn'. Kiam oni adjektivigas ĝin al *vegana*, la ĝenerala signifo estas 'rilata al aŭ karakterizata de vegano(j)', kaj tiu signifo povas plipreciziĝi laŭ la kunteksto: * Oni povas diri *vegana manĝaĵo*. Ĉi tie la sig...
Ŝajnas al mi ke la baza vorto estas “vegan-o”, kaj ke “vegan-a” signifas “rilata al tia dieto kian manĝas vegano. Kontraste, La vorto ”vegetar-ano“ estas kunmetaĵo de ”vegetara“ kaj ”-ano“. Se ni povas supozi ke la uzo de la adjektivaj formoj estas simetriaj (sufiĉe sekura supozo), vi tute pravas ke la esprimoj ”vegan...
2,615
> > *Mia frato estas vegano.* > > > Ĉi tie, *vegan-* signifas "*iu kiu ne manĝas produktojn de bestoj*". > > *Tiu supo estas vegana.* > > > Tamen ĉi tie, *vegan-* signifas "*farita sen produktoj de bestoj*". Ŝajnas al mi ke la radiko havas malsaman signifon depende ĉu ĝi estas substantivo aŭ adjektivo. Sed ...
2017/01/06
[ "https://esperanto.stackexchange.com/questions/2615", "https://esperanto.stackexchange.com", "https://esperanto.stackexchange.com/users/150/" ]
La radiko *vegan/* estas substantiva, do ĝia baza signifo estas 'homo, kiu vivas sen uzi bestajn produktojn'. Kiam oni adjektivigas ĝin al *vegana*, la ĝenerala signifo estas 'rilata al aŭ karakterizata de vegano(j)', kaj tiu signifo povas plipreciziĝi laŭ la kunteksto: * Oni povas diri *vegana manĝaĵo*. Ĉi tie la sig...
> > Vegano - Homo kiu ne manĝas produktojn de besta deveno... > > > Vegana - Konforma al doktrino ne manĝi produktojn de besta deveno: ĉu la **vegetara kaj vegana nutraĵoj** disponigas al la homo sufiĉe da proteinoj? > > > <http://www.reta-vortaro.de/revo/art/vegan.html#vegan.0o> > > > Vegana homo: [![enter im...
53,838,388
it's probably a trivial question, I try to decode a json from a Firebase snapshot, here is the structure of the json : ``` firebaseKey1 : {img1:value1} firebaseKey2 : {img2:value2} firebaseKey3 : {img3:value3} ``` **Here is what I tried:** ``` DatabaseReference firebaseRef = FirebaseDatabase.instance.reference()...
2018/12/18
[ "https://Stackoverflow.com/questions/53838388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3899560/" ]
You don't need to `json.decode`. The returned value is already decoded. ``` {key1:value1} ``` is the result of ``` final Map<String,dynamic> value = {'key1': 'value1'}; print(value.toString()); ```
Maybe what the OP is looking for is: ``` var parsedJSON = snapshot.value; print('img1 : ' + parsedJSON['img1']); ```
2,539,744
This is the first time I'm creating an app using Ruby on Rails. I would like to switch the database depending on the site which is loaded. With php I used to do a simple strpos on http host, and set the database name depending on that. How can I do this with rails?
2010/03/29
[ "https://Stackoverflow.com/questions/2539744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/275372/" ]
When a Rails app starts in production mode, it preloads its classes and retrieves e.g. column data from the configured database. To use multiple databases, you would have to stop it doing this - and that could potentially cause a lot more problems than it solves. A much easier to manage solution is simply to have two ...
You can run your application with different environments (i.e. domain1\_production, domain2\_production etc) so you can define in database.yml database environments for all your domains. But each environment have to run his own proccess in memory. Another solution is to set before\_filter in each model and parsing you...
39,252,136
I'm trying to create a .net core unit test project against framework 4.6.1 which tests an project dependent on Microsoft.SqlServer.Types (10.0.0.0). Prior to .net core I'd add an app.config file with the binding redirect. I've tried this but the binding redirect does not seem to be picked up when I run from visual stud...
2016/08/31
[ "https://Stackoverflow.com/questions/39252136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116747/" ]
If you reference Microsoft.NET.Test.Sdk >= 15.3.0 in your project it automatically turns on the required MSBuild properties, as Fabian says below. See [here](https://github.com/NuGet/Home/issues/5335#issuecomment-306318810.). --- You can add the following settings to your `.csproj` file: ``` <PropertyGroup> <AutoG...
Referencing the NuGet package `Microsoft.NET.Test.Sdk` >= 15.3.0 (I used `Microsoft.NET.Test.Sdk 15.3.0-preview-20170601-03`) solved this problem for me. That package automatically turns on the MSBuild properties mentioned in @Mardoxx's answer. (I got this info from [Martin Andreas Ullrich](https://github.com/dasMulli...
39,252,136
I'm trying to create a .net core unit test project against framework 4.6.1 which tests an project dependent on Microsoft.SqlServer.Types (10.0.0.0). Prior to .net core I'd add an app.config file with the binding redirect. I've tried this but the binding redirect does not seem to be picked up when I run from visual stud...
2016/08/31
[ "https://Stackoverflow.com/questions/39252136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116747/" ]
If you reference Microsoft.NET.Test.Sdk >= 15.3.0 in your project it automatically turns on the required MSBuild properties, as Fabian says below. See [here](https://github.com/NuGet/Home/issues/5335#issuecomment-306318810.). --- You can add the following settings to your `.csproj` file: ``` <PropertyGroup> <AutoG...
In my case none of the solutions mentioned above helped (even if the binding redirects are generated automatically or added manually, looks like these hacks are really not working anymore as @Joao suggested). So I added the desired version of the package to my project, even if it is not used directly and this resolved...
39,252,136
I'm trying to create a .net core unit test project against framework 4.6.1 which tests an project dependent on Microsoft.SqlServer.Types (10.0.0.0). Prior to .net core I'd add an app.config file with the binding redirect. I've tried this but the binding redirect does not seem to be picked up when I run from visual stud...
2016/08/31
[ "https://Stackoverflow.com/questions/39252136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116747/" ]
Referencing the NuGet package `Microsoft.NET.Test.Sdk` >= 15.3.0 (I used `Microsoft.NET.Test.Sdk 15.3.0-preview-20170601-03`) solved this problem for me. That package automatically turns on the MSBuild properties mentioned in @Mardoxx's answer. (I got this info from [Martin Andreas Ullrich](https://github.com/dasMulli...
In my case none of the solutions mentioned above helped (even if the binding redirects are generated automatically or added manually, looks like these hacks are really not working anymore as @Joao suggested). So I added the desired version of the package to my project, even if it is not used directly and this resolved...
33,459,876
I always try to make use of the var keyword when inside functions using CF, but one probably stupid question I have is, how often do you have to use it ? Example : ``` <cfset var local = ""> <!-- set at the top of the function --> <!-- then later in the function --> <cfset var local.firstname = "steve"> <cfset var ...
2015/11/01
[ "https://Stackoverflow.com/questions/33459876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532104/" ]
Which version of ColdFusion are you using? Since ColdFusion 9 `local` is a scope, so there's no point in specifically creating it. To answer your question: all function-local variables need to be actively made local to the function. ColdFusion does not do this automatically. There's two ways of doing this. Via the `v...
You do not need to use the 'var' keyword for variables that are in the 'local' scope. Since 'local' is a structure all its members are part of the same scope. Basically the 'local' struct is just a container to hold all variables that must be in the function's local scope. **UPDATE:** AS of CF9 `local` is an explicit...
33,459,876
I always try to make use of the var keyword when inside functions using CF, but one probably stupid question I have is, how often do you have to use it ? Example : ``` <cfset var local = ""> <!-- set at the top of the function --> <!-- then later in the function --> <cfset var local.firstname = "steve"> <cfset var ...
2015/11/01
[ "https://Stackoverflow.com/questions/33459876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532104/" ]
You do not need to use the 'var' keyword for variables that are in the 'local' scope. Since 'local' is a structure all its members are part of the same scope. Basically the 'local' struct is just a container to hold all variables that must be in the function's local scope. **UPDATE:** AS of CF9 `local` is an explicit...
If you are not using the local scope, you only have to use the keyword `var` once per variable. I was introduced to User Defined Functions with version 7.1. I'm not sure about other versions, but in that one, you had to `var` all your variables right after the `cfargument` tags, before any other commands were executed...
33,459,876
I always try to make use of the var keyword when inside functions using CF, but one probably stupid question I have is, how often do you have to use it ? Example : ``` <cfset var local = ""> <!-- set at the top of the function --> <!-- then later in the function --> <cfset var local.firstname = "steve"> <cfset var ...
2015/11/01
[ "https://Stackoverflow.com/questions/33459876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532104/" ]
Which version of ColdFusion are you using? Since ColdFusion 9 `local` is a scope, so there's no point in specifically creating it. To answer your question: all function-local variables need to be actively made local to the function. ColdFusion does not do this automatically. There's two ways of doing this. Via the `v...
If you are not using the local scope, you only have to use the keyword `var` once per variable. I was introduced to User Defined Functions with version 7.1. I'm not sure about other versions, but in that one, you had to `var` all your variables right after the `cfargument` tags, before any other commands were executed...
4,469,304
Is there a DI framework comparable to Google Guice? And what does Google use?
2010/12/17
[ "https://Stackoverflow.com/questions/4469304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178669/" ]
There is nothing as mature or standard as Guice in the C++ world. However, some people have put together simplistic implementations on their own. Here's a couple. * <http://adam.younglogic.com/2008/07/dependency-injection-in-c/> (source for implementation is at the end of the post) * <http://sourceforge.net/projects/q...
I am currently authoring one called [sauce](https://github.com/phs/sauce), whose design (and name) is directly inspired by guice. I still consider it alpha, but you may find it useful.
4,469,304
Is there a DI framework comparable to Google Guice? And what does Google use?
2010/12/17
[ "https://Stackoverflow.com/questions/4469304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178669/" ]
There is nothing as mature or standard as Guice in the C++ world. However, some people have put together simplistic implementations on their own. Here's a couple. * <http://adam.younglogic.com/2008/07/dependency-injection-in-c/> (source for implementation is at the end of the post) * <http://sourceforge.net/projects/q...
There is a recent one that looks very interesting called [Hypodermic](https://github.com/ybainier/Hypodermic/wiki/Registering-concrete-types), i haven't tested it but it looks pretty active
4,469,304
Is there a DI framework comparable to Google Guice? And what does Google use?
2010/12/17
[ "https://Stackoverflow.com/questions/4469304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178669/" ]
There is nothing as mature or standard as Guice in the C++ world. However, some people have put together simplistic implementations on their own. Here's a couple. * <http://adam.younglogic.com/2008/07/dependency-injection-in-c/> (source for implementation is at the end of the post) * <http://sourceforge.net/projects/q...
I'm the author of [wallaroo](http://wallaroolib.sourceforge.net/). It's actively developed and has the following features: * it's lightweight but powerful * its interface supports both C++11 and C++98 with boost * it's type safe * it doesn't need custom preprocessors / code generators * you can load classes defined in...
4,469,304
Is there a DI framework comparable to Google Guice? And what does Google use?
2010/12/17
[ "https://Stackoverflow.com/questions/4469304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178669/" ]
There is a recent one that looks very interesting called [Hypodermic](https://github.com/ybainier/Hypodermic/wiki/Registering-concrete-types), i haven't tested it but it looks pretty active
I am currently authoring one called [sauce](https://github.com/phs/sauce), whose design (and name) is directly inspired by guice. I still consider it alpha, but you may find it useful.
4,469,304
Is there a DI framework comparable to Google Guice? And what does Google use?
2010/12/17
[ "https://Stackoverflow.com/questions/4469304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178669/" ]
I'm the author of [wallaroo](http://wallaroolib.sourceforge.net/). It's actively developed and has the following features: * it's lightweight but powerful * its interface supports both C++11 and C++98 with boost * it's type safe * it doesn't need custom preprocessors / code generators * you can load classes defined in...
I am currently authoring one called [sauce](https://github.com/phs/sauce), whose design (and name) is directly inspired by guice. I still consider it alpha, but you may find it useful.
38,300,686
I am tried this sample : ``` public string TextFileProcess(string strReadtext, int nMinLine, int nMaxLine) { string strcount = string.Empty; List<string> lstResults = new List<string>(); lstResults.Add(null); string strpattern= @"(?<=[\.!\?])+"; string[] strSplitlines = Rege...
2016/07/11
[ "https://Stackoverflow.com/questions/38300686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6565626/" ]
change `method` to `type` as following ``` function sendEmail(){ $.ajax({ url: "http://formspree.io/email1@gmail.com", type: "POST", data: $('#emailForm').serialize(), dataType: "json", success: function(result){ $("#success").html("Me...
`ajax` is `asynchronus` Your form submit is triggered as soon as the button is clicked and the `ajax` method runs in background. That's why it is triggering `get`. **As `GET` is default http method. look here:** <https://www.w3.org/TR/html401/interact/forms.html#h-17.3> If you have a look at the console it should als...
38,300,686
I am tried this sample : ``` public string TextFileProcess(string strReadtext, int nMinLine, int nMaxLine) { string strcount = string.Empty; List<string> lstResults = new List<string>(); lstResults.Add(null); string strpattern= @"(?<=[\.!\?])+"; string[] strSplitlines = Rege...
2016/07/11
[ "https://Stackoverflow.com/questions/38300686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6565626/" ]
change `method` to `type` as following ``` function sendEmail(){ $.ajax({ url: "http://formspree.io/email1@gmail.com", type: "POST", data: $('#emailForm').serialize(), dataType: "json", success: function(result){ $("#success").html("Me...
The error you are getting might be related to something in your server or your server code. Try copying the request headers and parameters to a [json poster](https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo) and try sending the request from there, if you still get an erro...
67,935,065
``` def checkage(year,month,day): today_day=11 today_month=6 today_year=2021 age=((today_year*365)+ (today_month*30)+today_day)- ((year*365)+(month*30)+day) print(age//12,"year",(age- ((age//12)*365))//30,"month", (age-((age- ((age//12)*365))//30)*30,"days") checkage(1996,12,11) ``` Python :In the last line it i...
2021/06/11
[ "https://Stackoverflow.com/questions/67935065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16196479/" ]
You can reinterpret your problem as the problem finding [*cliques*](https://en.wikipedia.org/wiki/Clique_problem) in a [graph](https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)). The graph is obtained from your distance matrix by interpreting a distance of 0 as creating an edge between two nodes. Once you have...
Your solution is correct! You are getting the following clusters: * cluster **1** with elements *ind4*, *ind5*, *ind6* and *ind9* (at distance 0 from each other). * cluster **2** with element *ind1* * cluster **3** with element *ind7* * cluster **4** with element *ind8* * cluster **5** with element *ind2* * cluster *...
5,302,945
I'm using Doctrine 2 to try and do a query with an inner join. I have a Site entity and a Page entity. Each Site can have many pages and each page can only belong to one site. I have a site\_id foreign key in my pages table rows. In my Site entity, I've created a OneToMany assocatiion where the target entity is my Page...
2011/03/14
[ "https://Stackoverflow.com/questions/5302945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/284630/" ]
You need to explicitly tell Doctrine to fetch those columns: ``` $qb->select('s', 'p') ->form(...) ->join(...) ```
Figured it out. My mappedBy statement was incorrect in Site entity. I was pointing at "Site" when it should have been "site".
27,090,946
Fast question ============= How to correctly add a reference to an external / third-party .NET DLL (which is not a NuGet package and not in GAC) and force it to be shipped as a part of solution (which is under version control) in Visual Studio? Long story ========== I have a Visual Studio 2013 solution, which contai...
2014/11/23
[ "https://Stackoverflow.com/questions/27090946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095779/" ]
I see two possible solutions to your problem 1. You can add the dll on the TFS. Create a folder under your solution called lib, for example and put your dll in there. Then reference the dll from that folder. When you check the changes in , include the lib folder with the dll. Once someone else will get latest, they w...
You can create a new folder in the project where the dll is required then reference the dll in the project from there and then chekck-in the dll. When the other users will get latest project/solution they will get this dll automatically and they will not get problem in building.
27,090,946
Fast question ============= How to correctly add a reference to an external / third-party .NET DLL (which is not a NuGet package and not in GAC) and force it to be shipped as a part of solution (which is under version control) in Visual Studio? Long story ========== I have a Visual Studio 2013 solution, which contai...
2014/11/23
[ "https://Stackoverflow.com/questions/27090946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095779/" ]
I see two possible solutions to your problem 1. You can add the dll on the TFS. Create a folder under your solution called lib, for example and put your dll in there. Then reference the dll from that folder. When you check the changes in , include the lib folder with the dll. Once someone else will get latest, they w...
You may consider checking-in the external DLL in the source control as well. Create an "Externals" folder within the project folder and place external DLLs there. Use this path to reference the external DLL. This should work with other developers as well as when they checkout they will have the DLL and proper relative ...
20,657,938
I want to know how would I get this C code running from the command line in the Bash shell? ``` #include <stdlib.h> #include <stdio.h> #include <ctype.h> /* Size of character buffer to read in a file. */ #define BUFFSIZE 1000000 /* Read file 'filename' into character buffer 'text'.*/ long read_file(char *filename, ...
2013/12/18
[ "https://Stackoverflow.com/questions/20657938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3111480/" ]
have you compiled your code? try `gcc <file.c> -o <outputName>`
I only get a couple of error messages. First, `strerror` and `errno` require these headers: ``` #include <errno.h> #include <string.h> ``` Then `len` isn't declared with a type: ``` int len = 0; ``` After that, you require main: ``` int main() { // do something } ```
20,657,938
I want to know how would I get this C code running from the command line in the Bash shell? ``` #include <stdlib.h> #include <stdio.h> #include <ctype.h> /* Size of character buffer to read in a file. */ #define BUFFSIZE 1000000 /* Read file 'filename' into character buffer 'text'.*/ long read_file(char *filename, ...
2013/12/18
[ "https://Stackoverflow.com/questions/20657938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3111480/" ]
You need to concern yourself less about the size of the file and more about the sizeof of the buffer you are writing into (you might be wiping out data that is not part of the input `text`). Besides fread will return the number of bytes read. Consider this: ``` size_t read_file(char *filename, char *text, size_t len)...
I only get a couple of error messages. First, `strerror` and `errno` require these headers: ``` #include <errno.h> #include <string.h> ``` Then `len` isn't declared with a type: ``` int len = 0; ``` After that, you require main: ``` int main() { // do something } ```
38,250,050
When calling this method in the main project class, filling in parameters etc, I receive an error. The field in the table is listed as `ID` and I am receiving user input from the user field comparing it to the `ID` field in the SQL table. If the input from the user matches the `ID` field and `PASSWORD` field from the S...
2016/07/07
[ "https://Stackoverflow.com/questions/38250050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6561604/" ]
According to your log, the root cause of your error is at the momment you establish the connection to your database, in th line: ``` Connection con = DriverManager.getConnection(url, "admin", "admin"); ``` The error messsage `Connection authentication failure occurred. Reason: Userid or password invalid.` is telling...
Your problem could have many causes. However, if a user types username="", password="" he's going to be authenticated on any case. Also mind about [SQL injection](https://en.wikipedia.org/wiki/SQL_injection).
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point p; p.x = 1; p.y = 2; a.push_back(p); ``` Note that, since `a` is a vector of points (not pointers to them), the push\_back will create a copy of your point struct -- so `p` can safely be destroyed once it goes out of scope.
``` point foo; //initialize with whatever a.push_back(foo); ```
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point mypoint = {0, 1}; a.push_back(mypoint); ``` Or if you're allowed, give `point` a constructor, so that you can use a temporary: ``` a.push_back(point(0,1)); ``` Some people will object if you put a constructor in a class declared with `struct`, and it makes it non-POD, and maybe you aren't in control of t...
``` point p; p.x = 1; p.y = 2; a.push_back(p); ``` Note that, since `a` is a vector of points (not pointers to them), the push\_back will create a copy of your point struct -- so `p` can safely be destroyed once it goes out of scope.
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point p; p.x = 1; p.y = 2; a.push_back(p); ``` Note that, since `a` is a vector of points (not pointers to them), the push\_back will create a copy of your point struct -- so `p` can safely be destroyed once it goes out of scope.
``` struct point { int x; int y; }; vector <point> a; a.push_back( {6,7} ); a.push_back( {5,8} ); ``` Use the curly bracket.
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point p; p.x = 1; p.y = 2; a.push_back(p); ``` Note that, since `a` is a vector of points (not pointers to them), the push\_back will create a copy of your point struct -- so `p` can safely be destroyed once it goes out of scope.
We should use emplace\_back() for user defined data types such as structs.We can use it even with primitive data types as well.
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point mypoint = {0, 1}; a.push_back(mypoint); ``` Or if you're allowed, give `point` a constructor, so that you can use a temporary: ``` a.push_back(point(0,1)); ``` Some people will object if you put a constructor in a class declared with `struct`, and it makes it non-POD, and maybe you aren't in control of t...
``` point foo; //initialize with whatever a.push_back(foo); ```
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` struct point { int x; int y; }; vector <point> a; a.push_back( {6,7} ); a.push_back( {5,8} ); ``` Use the curly bracket.
``` point foo; //initialize with whatever a.push_back(foo); ```
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point foo; //initialize with whatever a.push_back(foo); ```
We should use emplace\_back() for user defined data types such as structs.We can use it even with primitive data types as well.
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point mypoint = {0, 1}; a.push_back(mypoint); ``` Or if you're allowed, give `point` a constructor, so that you can use a temporary: ``` a.push_back(point(0,1)); ``` Some people will object if you put a constructor in a class declared with `struct`, and it makes it non-POD, and maybe you aren't in control of t...
``` struct point { int x; int y; }; vector <point> a; a.push_back( {6,7} ); a.push_back( {5,8} ); ``` Use the curly bracket.
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` point mypoint = {0, 1}; a.push_back(mypoint); ``` Or if you're allowed, give `point` a constructor, so that you can use a temporary: ``` a.push_back(point(0,1)); ``` Some people will object if you put a constructor in a class declared with `struct`, and it makes it non-POD, and maybe you aren't in control of t...
We should use emplace\_back() for user defined data types such as structs.We can use it even with primitive data types as well.
5,289,597
How can I `push_back` a `struct` into a vector? ``` struct point { int x; int y; }; std::vector<point> a; a.push_back( ??? ); ```
2011/03/13
[ "https://Stackoverflow.com/questions/5289597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407650/" ]
``` struct point { int x; int y; }; vector <point> a; a.push_back( {6,7} ); a.push_back( {5,8} ); ``` Use the curly bracket.
We should use emplace\_back() for user defined data types such as structs.We can use it even with primitive data types as well.
18,780,123
I have code that uses Storyboards for seques, like so: ``` - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"ShowDiagnosis"]) { [segue.destinationViewController setHappiness:self.diagnosis]; } ... ``` But I want to do it programmat...
2013/09/13
[ "https://Stackoverflow.com/questions/18780123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/665557/" ]
First of all `segue` can be used only with if you have a `UINavigationController` that will handle the navigation (push, pop, etc). So if you have a `UINavigationController` and you want to push another `UIViewController` on the stack without using `segue` then you can use `pushViewController:animated:` method which a...
First things first, a segue cannot be created programmatically. It is created by the storyboard runtime when it is time to perform. However you may trigger a segue, which is already defined in the interface builder, by calling `performSegueWithIdentifier:`. Other than this, you can provide transitions between view con...
1,896,042
I installed VS2010 B2 on my Win 7 machine. I create a simple DLL project and try to open the file Class1.cs that gets created by Default. I get a error message "The operation could not be completed. Invalid Pointer. So far i have seen this and similar error messages on previous versions of VS2010. Anyone else faced and...
2009/12/13
[ "https://Stackoverflow.com/questions/1896042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37494/" ]
Sounds like a pretty fatal error in a fundamental operation, so it's unlikely to be a simple bug that was overlooked - it's more likely to be a problem with your install - If it were me, I would try reinstalling it (and do so with the default options - if the install was customised it's vaguely possible that a required...
I had this problem when trying to put a style element on an .ascx page. Lots of times you can solve the error by saving the file, closing the page, then re-opening it.
57,288,489
I am trying to make a simple adding calculator on node.js and express.js that can add only two number but when I use the number function of JS that convert strings to a number so I got the error is: ``` RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 4 at ServerResponse.writeHead (_http_server.js:2...
2019/07/31
[ "https://Stackoverflow.com/questions/57288489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11863083/" ]
With a broadcast Receiver: ``` @Override public void onReceive(Context context, Intent intent) { if (ACTION_SHUTDOWN.equals(intent.getAction()) || QUICKBOOT_POWEROFF.equals(intent.getAction())) { // Do something.. } } ``` Apply an intent filter to your manifest declared broadcast receiver to listen t...
Trigger your c service in initrc: 1. trigger by property: on property:sys.shutdown.requested=\* stop cnss-daemon 2. trigger by [shutdown critical](https://android.googlesource.com/platform/system/core/+/refs/heads/master/init/README.md) > > `shutdown <shutdown_behavior>` > Set shutdown behavior of the service ...
7,125
Even though I have signed in, cleared all cache/cookies [Google Instant](http://en.wikipedia.org/wiki/Google_Search#Instant_Search) still doesn't work for me. How can it be fixed? [Edit] The URL I use is [www.google.com.vn](http://www.google.com.vn). I see the dropdown keyword suggestion list but the search result d...
2010/09/29
[ "https://webapps.stackexchange.com/questions/7125", "https://webapps.stackexchange.com", "https://webapps.stackexchange.com/users/3520/" ]
From the [Google Instant FAQ](http://www.google.com/instant/) - > > Google Instant is starting to roll-out > to users on Google domains in the US, > UK, France, Germany, Italy, Spain and > Russia who use the following browsers: > Chrome v5/6, Firefox v3, Safari v5 for > Mac and Internet Explorer v8. Please > no...
No longer works for [anybody](https://www.theverge.com/2017/7/26/16034844/google-kills-off-instant-search-for-mobile-consistency) (:.
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
An analogy which I find useful is **buses**. One side (server) puts information on a bus and sends the bus to the other side (client\user end). The buses are loaded with data which is a sequence of `1` and `0`1. Each sequence has a passenger before it, and that passenger is used to identify *what sort of data* was loa...
One analogy I use in my intro class is transportation. The Internet is the roads, bridges, and highways. The World Wide Web is the cars and trucks that travel along these routes, carrying cargo to/from different places.
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
One analogy I use in my intro class is transportation. The Internet is the roads, bridges, and highways. The World Wide Web is the cars and trucks that travel along these routes, carrying cargo to/from different places.
I gave the following EDRi paper to my students, and they found it very clear. I also had them write a 2 page essay explaining how the internet works, and that also helped them digest the paper. <https://edri.org/files/2012EDRiPapers/how_the_internet_works.pdf>
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
One analogy I use in my intro class is transportation. The Internet is the roads, bridges, and highways. The World Wide Web is the cars and trucks that travel along these routes, carrying cargo to/from different places.
The videos on the code.org YouTube channel are some of the most helpful I've found. For example: [How The Internet Works playlist](https://www.youtube.com/playlist?list=PLzdnOPI1iJNfMRZm5DDxco3UdsFegvuB7)
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
An analogy which I find useful is **buses**. One side (server) puts information on a bus and sends the bus to the other side (client\user end). The buses are loaded with data which is a sequence of `1` and `0`1. Each sequence has a passenger before it, and that passenger is used to identify *what sort of data* was loa...
Since you mentioned that ideally you were looking for a video, a few years ago I used to show a video to my students: **[The Good Warriors of the Net - IP for Peace](https://www.youtube.com/watch?v=x9XWxD6cJuY)** . It is a bit old, but the main concepts are there. Another that I used to show my students was: [How the ...
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
An analogy which I find useful is **buses**. One side (server) puts information on a bus and sends the bus to the other side (client\user end). The buses are loaded with data which is a sequence of `1` and `0`1. Each sequence has a passenger before it, and that passenger is used to identify *what sort of data* was loa...
I gave the following EDRi paper to my students, and they found it very clear. I also had them write a 2 page essay explaining how the internet works, and that also helped them digest the paper. <https://edri.org/files/2012EDRiPapers/how_the_internet_works.pdf>
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
An analogy which I find useful is **buses**. One side (server) puts information on a bus and sends the bus to the other side (client\user end). The buses are loaded with data which is a sequence of `1` and `0`1. Each sequence has a passenger before it, and that passenger is used to identify *what sort of data* was loa...
The videos on the code.org YouTube channel are some of the most helpful I've found. For example: [How The Internet Works playlist](https://www.youtube.com/playlist?list=PLzdnOPI1iJNfMRZm5DDxco3UdsFegvuB7)
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
Since you mentioned that ideally you were looking for a video, a few years ago I used to show a video to my students: **[The Good Warriors of the Net - IP for Peace](https://www.youtube.com/watch?v=x9XWxD6cJuY)** . It is a bit old, but the main concepts are there. Another that I used to show my students was: [How the ...
I gave the following EDRi paper to my students, and they found it very clear. I also had them write a 2 page essay explaining how the internet works, and that also helped them digest the paper. <https://edri.org/files/2012EDRiPapers/how_the_internet_works.pdf>
1,479
I have been having trouble finding a good resource (ideally a video) or analogy that helps me to explain how the Internet and the World Wide Web work. It does not need to be too in-depth. Only enough to cover how web pages are made available to the end user, and how HTTP requests work on the surface. Preferably, somet...
2017/07/07
[ "https://cseducators.stackexchange.com/questions/1479", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1770/" ]
Since you mentioned that ideally you were looking for a video, a few years ago I used to show a video to my students: **[The Good Warriors of the Net - IP for Peace](https://www.youtube.com/watch?v=x9XWxD6cJuY)** . It is a bit old, but the main concepts are there. Another that I used to show my students was: [How the ...
The videos on the code.org YouTube channel are some of the most helpful I've found. For example: [How The Internet Works playlist](https://www.youtube.com/playlist?list=PLzdnOPI1iJNfMRZm5DDxco3UdsFegvuB7)
138,616
I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? **Update.** I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS ...
2008/09/26
[ "https://Stackoverflow.com/questions/138616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22623/" ]
Once you have another window's top level handle, you may be able to call [GetMenu()](http://msdn.microsoft.com/en-us/library/ms647640(VS.85).aspx) to retrieve the Window's system menu and then modify it, eg: ``` HMENU hMenu = GetMenu(hwndNext); ```
You can use [EnumWindows()](http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx) to enumerate top level Windows. I don't have a specific answer for the second part of your question, but if you subclass the window, I imagine you can modify the system menu. EDIT: or do what Chris said: call GetMenu()
138,616
I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? **Update.** I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS ...
2008/09/26
[ "https://Stackoverflow.com/questions/138616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22623/" ]
Once you have another window's top level handle, you may be able to call [GetMenu()](http://msdn.microsoft.com/en-us/library/ms647640(VS.85).aspx) to retrieve the Window's system menu and then modify it, eg: ``` HMENU hMenu = GetMenu(hwndNext); ```
Re: the update - please note that not even Microsoft Windows requires windows to have a sytem menu. GetMenu( ) may return 0. You'll need to intercept window creation as well, because each new top window presumably needs it too. Also, what you propose is rather intrusive to other applications. How are you going to ensu...
138,616
I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? **Update.** I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS ...
2008/09/26
[ "https://Stackoverflow.com/questions/138616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22623/" ]
For Windows, another way to get the top-level windows (besides EnumWindows, which uses a callback) is to get the first child of the desktop and then retrieve all its siblings: ``` HWND wnd = GetWindow(GetDesktopWindow(), GW_CHILD); while (wnd) { // handle 'wnd' here // ... wnd = GetNextWindow(wnd, GW_HWNDN...
Once you have another window's top level handle, you may be able to call [GetMenu()](http://msdn.microsoft.com/en-us/library/ms647640(VS.85).aspx) to retrieve the Window's system menu and then modify it, eg: ``` HMENU hMenu = GetMenu(hwndNext); ```
138,616
I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? **Update.** I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS ...
2008/09/26
[ "https://Stackoverflow.com/questions/138616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22623/" ]
For Windows, another way to get the top-level windows (besides EnumWindows, which uses a callback) is to get the first child of the desktop and then retrieve all its siblings: ``` HWND wnd = GetWindow(GetDesktopWindow(), GW_CHILD); while (wnd) { // handle 'wnd' here // ... wnd = GetNextWindow(wnd, GW_HWNDN...
You can use [EnumWindows()](http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx) to enumerate top level Windows. I don't have a specific answer for the second part of your question, but if you subclass the window, I imagine you can modify the system menu. EDIT: or do what Chris said: call GetMenu()
138,616
I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? **Update.** I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS ...
2008/09/26
[ "https://Stackoverflow.com/questions/138616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22623/" ]
For Windows, another way to get the top-level windows (besides EnumWindows, which uses a callback) is to get the first child of the desktop and then retrieve all its siblings: ``` HWND wnd = GetWindow(GetDesktopWindow(), GW_CHILD); while (wnd) { // handle 'wnd' here // ... wnd = GetNextWindow(wnd, GW_HWNDN...
Re: the update - please note that not even Microsoft Windows requires windows to have a sytem menu. GetMenu( ) may return 0. You'll need to intercept window creation as well, because each new top window presumably needs it too. Also, what you propose is rather intrusive to other applications. How are you going to ensu...
80,873
In X-2: X-Men United, Xavier is being controlled by Jason's illusions and made to try to kill all the mutants. However, Jason is not affected by Xavier's attack. Being a mutant, shouldn't he have been since Charles carried out a global attack on the mutants? Is it because he was inside Cerebro with Charles? Does this a...
2015/02/04
[ "https://scifi.stackexchange.com/questions/80873", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35497/" ]
Cerebro is shielded, or more accurately, Cerebro is a focusing artifact and cannot target inside its self. If I recall correctly, it is explicitly stated in the movie that, if you are inside the chamber, you are immune to the effects.
Because the girl in the illusion with Charles is Jason. He tells Charles: "Find all the mutants". Charles doesn't need to focus on the little girl (who is actually Jason), as he knows where she is, and he is not going to look for himself either. He just targets everyone else.
80,873
In X-2: X-Men United, Xavier is being controlled by Jason's illusions and made to try to kill all the mutants. However, Jason is not affected by Xavier's attack. Being a mutant, shouldn't he have been since Charles carried out a global attack on the mutants? Is it because he was inside Cerebro with Charles? Does this a...
2015/02/04
[ "https://scifi.stackexchange.com/questions/80873", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35497/" ]
Cerebro is shielded, or more accurately, Cerebro is a focusing artifact and cannot target inside its self. If I recall correctly, it is explicitly stated in the movie that, if you are inside the chamber, you are immune to the effects.
Operation-wise, Cerebro is a device that amplifies the brainwaves of the user. For a telepath, it gives the user ability to rapidly read the minds of individuals around the globe from which the user can identify mutants and / or humans. From the movie reference, it is clear that professor Xavier literally connects to t...
80,873
In X-2: X-Men United, Xavier is being controlled by Jason's illusions and made to try to kill all the mutants. However, Jason is not affected by Xavier's attack. Being a mutant, shouldn't he have been since Charles carried out a global attack on the mutants? Is it because he was inside Cerebro with Charles? Does this a...
2015/02/04
[ "https://scifi.stackexchange.com/questions/80873", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/35497/" ]
Operation-wise, Cerebro is a device that amplifies the brainwaves of the user. For a telepath, it gives the user ability to rapidly read the minds of individuals around the globe from which the user can identify mutants and / or humans. From the movie reference, it is clear that professor Xavier literally connects to t...
Because the girl in the illusion with Charles is Jason. He tells Charles: "Find all the mutants". Charles doesn't need to focus on the little girl (who is actually Jason), as he knows where she is, and he is not going to look for himself either. He just targets everyone else.
12,801,021
I have the following: ``` editCity: "/Admin/Citys/Edit?pk=0001I&rk=5505005Z" $('#editCity') .attr('title', "Edit City " + rk) .data('disabled', 'no') .data('href', editCity) .removeClass('disabled'); ``` When I check the HTML with developer tools I see this: ``` <div class="button dialogLink" id="e...
2012/10/09
[ "https://Stackoverflow.com/questions/12801021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Use ``` var editCity = "/Admin/Citys/Edit?pk=0001I&rk=5505005Z"; ``` What you did was a [labeled statement](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/label), consisting only of a string literal and missing a semicolon. --- Btw, jQuery's [`.data()` method](http://api.jquery.com/data/)...
You cannot set a href attribute to a div. you could use data-href instead, or use a a-tag instead of a div.
12,801,021
I have the following: ``` editCity: "/Admin/Citys/Edit?pk=0001I&rk=5505005Z" $('#editCity') .attr('title', "Edit City " + rk) .data('disabled', 'no') .data('href', editCity) .removeClass('disabled'); ``` When I check the HTML with developer tools I see this: ``` <div class="button dialogLink" id="e...
2012/10/09
[ "https://Stackoverflow.com/questions/12801021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Use ``` var editCity = "/Admin/Citys/Edit?pk=0001I&rk=5505005Z"; ``` What you did was a [labeled statement](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/label), consisting only of a string literal and missing a semicolon. --- Btw, jQuery's [`.data()` method](http://api.jquery.com/data/)...
I think jQuery stores the data internally if they don't exist the first time you set them. If you really want to force it: ``` $("#editCity").attr("data-href",editCity) ```
12,801,021
I have the following: ``` editCity: "/Admin/Citys/Edit?pk=0001I&rk=5505005Z" $('#editCity') .attr('title', "Edit City " + rk) .data('disabled', 'no') .data('href', editCity) .removeClass('disabled'); ``` When I check the HTML with developer tools I see this: ``` <div class="button dialogLink" id="e...
2012/10/09
[ "https://Stackoverflow.com/questions/12801021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I think jQuery stores the data internally if they don't exist the first time you set them. If you really want to force it: ``` $("#editCity").attr("data-href",editCity) ```
You cannot set a href attribute to a div. you could use data-href instead, or use a a-tag instead of a div.
99,372
I am in the final stages of my PhD and have been applying for postdocs for the last six months. Recently, I heard back from the job I applied for, we had a phone interview and he was very happy with my experience and skills. In fact he was looking for a new postdoc with the same experience what I did in my PhD. We comm...
2017/11/24
[ "https://academia.stackexchange.com/questions/99372", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/83349/" ]
I will share some information with you, based on two things you mentioned: > > a) You said your advisor is very aggressive and loves to make racist jokes > > > b) You suspect your advisor soured your postdoc application through negative remarks to your prospective employer > > > This sounds like a situation whi...
> > I am really freaking out in this situation. I initially had problems with my PhD advisor because he is very aggressive and loves to make racist jokes. But I managed to handle his sense of humor and aggression. But I feel like he is racially prejudiced to me and will spoil my whole career. > > > A resource you ...
99,372
I am in the final stages of my PhD and have been applying for postdocs for the last six months. Recently, I heard back from the job I applied for, we had a phone interview and he was very happy with my experience and skills. In fact he was looking for a new postdoc with the same experience what I did in my PhD. We comm...
2017/11/24
[ "https://academia.stackexchange.com/questions/99372", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/83349/" ]
I will share some information with you, based on two things you mentioned: > > a) You said your advisor is very aggressive and loves to make racist jokes > > > b) You suspect your advisor soured your postdoc application through negative remarks to your prospective employer > > > This sounds like a situation whi...
I think you had a narrow escape from a similar situation. The professor who requires the references is very unprofessional. 1. If you require some references, you do it before the invitation. Because the person might have rejected other interviews/visits. This is very disrespectful to the potential postdoc. 2. The ref...
99,372
I am in the final stages of my PhD and have been applying for postdocs for the last six months. Recently, I heard back from the job I applied for, we had a phone interview and he was very happy with my experience and skills. In fact he was looking for a new postdoc with the same experience what I did in my PhD. We comm...
2017/11/24
[ "https://academia.stackexchange.com/questions/99372", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/83349/" ]
I will share some information with you, based on two things you mentioned: > > a) You said your advisor is very aggressive and loves to make racist jokes > > > b) You suspect your advisor soured your postdoc application through negative remarks to your prospective employer > > > This sounds like a situation whi...
First of all, everybody is free to write whatever he wants in his recommendation letters and to tell people whatever opinion he has about you and you cannot influence that. So, you need a really solid reason to accuse your PhD advisor of any "racial prejudice" against you (perhaps you have one, I don't know). If he jus...
719,592
I am trying to solve the following problem using strong induction, the problem is the following: > > For any positive integer $n$, let $T\_n$ be the number $1$ if $n<4$ and the number $T\_{n − 1} +T\_{n − 2} +T\_{n − 3}$ if $n\ge 4$. > > > We have $T\_1 =1, T\_2 =1, T\_3 =1, T\_4 =T\_3 +T\_2+T\_1=1+1+1=3$, $T\_5 =T...
2014/03/20
[ "https://math.stackexchange.com/questions/719592", "https://math.stackexchange.com", "https://math.stackexchange.com/users/136745/" ]
Another way: $$I=\int\frac{dx}{\cos^4x+\sin^4x}=\int\frac{(1+\tan^2x)\sec^2x dx}{1+\tan^4x}$$ Setting $\displaystyle\tan x=u,$ $$I=\frac{(1+u^2)du}{1+u^4}=\int\frac{1+\dfrac1{u^2}}{u^2+\dfrac1{u^2}}du$$ $$=\int\frac{1+\dfrac1{u^2}}{\left(u-\dfrac1u\right)^2+2}du$$ Set $\displaystyle u-\dfrac1u=v$
Let me try something mixing the work of chndn and lab bhattacharjee. First let's rewrite the denominator as chndn has tried. $$\int\dfrac1{\cos^4x+\sin^4x}dx=\int\dfrac1{(\cos^2x+\sin^2x)^2-2\sin^2x\cos^2x}dx=$$ $$\int\dfrac1{1-\frac12\sin^22x}dx$$ Now let's do a move similar to lab bhattacharjee's. $$\int\dfrac{\cs...
559,951
Is there a name for the concept that some words have different degrees of precision, and that misalignment or ambiguity over the intended precision easily leads to misunderstanding? Some examples, but please note that I'm not trying to be particularly accurate with these definitions, but instead offered for purpose of...
2021/02/09
[ "https://english.stackexchange.com/questions/559951", "https://english.stackexchange.com", "https://english.stackexchange.com/users/18378/" ]
Northern English dialects typically use a short vowel /æ/ for "a" before an "s" or "th" where southern English dialects would use a longer, further back vowel /ɑ/. However there seem to be exceptions, of which "master" and "plaster" stand out for often having a southern English pronunciation. "master" is explicable as ...
I'm from the Midlands, but have lived in the North West and have now re-located to North Yorkshire and I would always pronounce plaster and master with a short a. However I have noticed and questioned the long a in plaster that my Father in Law uses. I would not say that it is the same as the southern English way. I d...
12,543,828
I have been developing an application which locally works fine. But somehow after deploying on cloud, something went wrong. Here is my logs, ```none a:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core....
2012/09/22
[ "https://Stackoverflow.com/questions/12543828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/893197/" ]
You can configure logging in your application with a log4.xml, but you cannot configure logging at the server level with a log4j configuration. For the most part you will be able to translate the log4j configuration into the standalone.xml configuration. The one current caveat would be using log4j appenders. While the...
``` i am also facing same problem. My application has log4j.properties files, and not able to create the log files configured in properties. please let me know how you have been resolved the issue. My application deployed on Jboss AS 7.1.1. My application log4j.properties file: ############################ ...
8,592,193
I have to do bulk inserts, and need the ids of what's being added. This is a basic example that shows what I am doing (which is obviously horrible for performance). I am looking for a much better way to do this. ``` public void omgThisIsSlow(final Set<ObjectOne> objOneSet, final Set<ObjectTwo...
2011/12/21
[ "https://Stackoverflow.com/questions/8592193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/973479/" ]
If you define the relationships using annotations and define appropriate cascading, you should be able set the object relationships in the objects in java and persist it all in one call. Hibernate will handle setting the foreign keys for you. Documentation - <http://docs.jboss.org/hibernate/annotations/3.5/reference/...
Assuming that you are just looking at getting a large amount of data persisted in one go and your problem is that you don't know what the IDs are going to be as the various related objects are persisted, one possible solution for this is to run all your inserts (as bulk inserts) into ancillary tables (one per real tabl...
8,592,193
I have to do bulk inserts, and need the ids of what's being added. This is a basic example that shows what I am doing (which is obviously horrible for performance). I am looking for a much better way to do this. ``` public void omgThisIsSlow(final Set<ObjectOne> objOneSet, final Set<ObjectTwo...
2011/12/21
[ "https://Stackoverflow.com/questions/8592193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/973479/" ]
I'm not sure but Hibernate makes bulk inserts/updates. The problem I understand is you need to persist the parent object in order to assign the reference to the child object. I would try to persist all the "one" objects. And then, iterate over all their "three" objects and persist them in a second bulk insertion. If ...
Assuming that you are just looking at getting a large amount of data persisted in one go and your problem is that you don't know what the IDs are going to be as the various related objects are persisted, one possible solution for this is to run all your inserts (as bulk inserts) into ancillary tables (one per real tabl...
8,592,193
I have to do bulk inserts, and need the ids of what's being added. This is a basic example that shows what I am doing (which is obviously horrible for performance). I am looking for a much better way to do this. ``` public void omgThisIsSlow(final Set<ObjectOne> objOneSet, final Set<ObjectTwo...
2011/12/21
[ "https://Stackoverflow.com/questions/8592193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/973479/" ]
If you define the relationships using annotations and define appropriate cascading, you should be able set the object relationships in the objects in java and persist it all in one call. Hibernate will handle setting the foreign keys for you. Documentation - <http://docs.jboss.org/hibernate/annotations/3.5/reference/...
I'm not sure but Hibernate makes bulk inserts/updates. The problem I understand is you need to persist the parent object in order to assign the reference to the child object. I would try to persist all the "one" objects. And then, iterate over all their "three" objects and persist them in a second bulk insertion. If ...
91,067
i am travelling on club world from Singapore to London and i understand from their site that the maximum check in luggage is two items at 32kg each. As i am relocating to the country, i currently have more than 2 luggage but total weight should not exceed 64kg. Do you know if BA is strict on the 2 luggage policy and th...
2017/04/04
[ "https://travel.stackexchange.com/questions/91067", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/59494/" ]
If you come with 5 pieces, yes it will be an issue. If you have 3 and you are loyal customer for them (with a status), then you have a good probability to be able to check-in all your luggage without any issue. If you ask me for a percentage, I would say 30-40%. They might also ask you to pay for something extra.
I thought I should mention luggage allowances are higher for nearly all international flights to & from the US (& Canada).
91,067
i am travelling on club world from Singapore to London and i understand from their site that the maximum check in luggage is two items at 32kg each. As i am relocating to the country, i currently have more than 2 luggage but total weight should not exceed 64kg. Do you know if BA is strict on the 2 luggage policy and th...
2017/04/04
[ "https://travel.stackexchange.com/questions/91067", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/59494/" ]
BA provides a free third bag in CW only for people with BA Gold/OneWorld Emerald status. Given that this is a benefit for people with that status level, I rate your chances of an extra bag as roughly zero if you don't have that status. It's worth noting that you can carry two items of hand luggage weighing up to 23kg ...
I thought I should mention luggage allowances are higher for nearly all international flights to & from the US (& Canada).
91,067
i am travelling on club world from Singapore to London and i understand from their site that the maximum check in luggage is two items at 32kg each. As i am relocating to the country, i currently have more than 2 luggage but total weight should not exceed 64kg. Do you know if BA is strict on the 2 luggage policy and th...
2017/04/04
[ "https://travel.stackexchange.com/questions/91067", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/59494/" ]
You can increase your luggage allowance now in advance, by buying additional bags through Manage My Booking on ba.com. (If you have a ticket issued by a travel agent you may have to go back to the agent to discuss this, but for most tickets it will work fine.) Buying additional pieces online is cheaper than doing it at...
I thought I should mention luggage allowances are higher for nearly all international flights to & from the US (& Canada).
37,418,837
Ex: Parse : `int inumber = int.Parse(Console.ReadLine());` (*Data Type*): `int inumber = (int)(Console.Read());` Pls explain for me (give the Ex is better :D ) Thanks! :)
2016/05/24
[ "https://Stackoverflow.com/questions/37418837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6371641/" ]
Well, `Console.Read()` returns `int`, not `String` so the cast in the code is *redundant*: <https://msdn.microsoft.com/en-us/library/system.console.read(v=vs.110).aspx> you can put just ``` int inumber = Console.Read(); // no need to (int) here ``` and please, notice than `Console.Read()` returns not the integer...
you are asking why when you need to 'convert' data from one type to another there are 2 different concepts: casting and parsing. Its actually a very good question. To old programmers like me the answer feels obvious: if the conversion is not very large then its a cast, otherwise you must usean explicit function (like P...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
Programmatically solution: ``` @Order(1) @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { // // ... // @Override protected void configure(HttpSecurity http) throws Exception { http.exceptionHandling().accessDeniedHandler(new AccessDenie...
It looks like spring tries to redirect users who have not logged in to the login page, which is "/index", but that itself is a protected url. The other possibility is, it tries to display /public/403.html, but that is again protected by security configuration. Can you add the following entries and try? ``` <security...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
I have added Spring Access denied page in follwing way: Spring Frame Work: 3.1 Spring Security: 3.1, Java 1.5+ Entry in \*-security.xml: ``` <security:access-denied-handler error-page="/<My Any error page controller name>" /> ``` Example: ``` <security:access-denied-handler error-page="/accessDeniedPage.htm" /> ...
It looks like spring tries to redirect users who have not logged in to the login page, which is "/index", but that itself is a protected url. The other possibility is, it tries to display /public/403.html, but that is again protected by security configuration. Can you add the following entries and try? ``` <security...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
Spring Security uses an AuthenticationEntryPoint object to decide what to do when a user requires authentication. You can create your own AuthenticationEntryPoint bean ( [see javadoc](http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/AuthenticationEntryPoint.html) )...
Can you check your web.xml is supporting forward request? errorPage is a FORWARD request and mostly in web.xml we support REDIRECTS only. Just a thought else your code looks ok to me. Edited A different point of view and This is been taken from working code only. Have a look at [Authenticated Voter class](http://s...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
I have added Spring Access denied page in follwing way: Spring Frame Work: 3.1 Spring Security: 3.1, Java 1.5+ Entry in \*-security.xml: ``` <security:access-denied-handler error-page="/<My Any error page controller name>" /> ``` Example: ``` <security:access-denied-handler error-page="/accessDeniedPage.htm" /> ...
Programmatically solution: ``` @Order(1) @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { // // ... // @Override protected void configure(HttpSecurity http) throws Exception { http.exceptionHandling().accessDeniedHandler(new AccessDenie...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
In your configuration You require the user to be **always** authenticated when entering **any** URL on Your site: ``` <security:intercept-url pattern="/**" access="ROLE_USER" /> ``` I think You should allow the user to be **unauthenticated** when **entering the login page**: ``` <security:intercept-url pattern="/yo...
Spring Security uses an AuthenticationEntryPoint object to decide what to do when a user requires authentication. You can create your own AuthenticationEntryPoint bean ( [see javadoc](http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/AuthenticationEntryPoint.html) )...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
Spring Security uses an AuthenticationEntryPoint object to decide what to do when a user requires authentication. You can create your own AuthenticationEntryPoint bean ( [see javadoc](http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/AuthenticationEntryPoint.html) )...
It looks like spring tries to redirect users who have not logged in to the login page, which is "/index", but that itself is a protected url. The other possibility is, it tries to display /public/403.html, but that is again protected by security configuration. Can you add the following entries and try? ``` <security...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
`AccessDeniedHandler` is invoked when user **is logged in** and there is no permissions to resource ([source here](http://www.jarvana.com/jarvana/view/org/springframework/security/spring-security-web/3.0.5.RELEASE/spring-security-web-3.0.5.RELEASE-sources.jar!/org/springframework/security/web/access/ExceptionTranslatio...
I have added Spring Access denied page in follwing way: Spring Frame Work: 3.1 Spring Security: 3.1, Java 1.5+ Entry in \*-security.xml: ``` <security:access-denied-handler error-page="/<My Any error page controller name>" /> ``` Example: ``` <security:access-denied-handler error-page="/accessDeniedPage.htm" /> ...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
Spring Security uses an AuthenticationEntryPoint object to decide what to do when a user requires authentication. You can create your own AuthenticationEntryPoint bean ( [see javadoc](http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/AuthenticationEntryPoint.html) )...
Programmatically solution: ``` @Order(1) @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { // // ... // @Override protected void configure(HttpSecurity http) throws Exception { http.exceptionHandling().accessDeniedHandler(new AccessDenie...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
`AccessDeniedHandler` is invoked when user **is logged in** and there is no permissions to resource ([source here](http://www.jarvana.com/jarvana/view/org/springframework/security/spring-security-web/3.0.5.RELEASE/spring-security-web-3.0.5.RELEASE-sources.jar!/org/springframework/security/web/access/ExceptionTranslatio...
Spring Security uses an AuthenticationEntryPoint object to decide what to do when a user requires authentication. You can create your own AuthenticationEntryPoint bean ( [see javadoc](http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/AuthenticationEntryPoint.html) )...
7,013,197
I have a spring 3 application with the configurations given below. When any user tries to access a page and he/she isn't logged in, I get an **Access is Denied** exception with an ugly stack trace. How do I handle this exception and not let it dump out a stack trace. I implemented my own access-denied-handler but that ...
2011/08/10
[ "https://Stackoverflow.com/questions/7013197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18548/" ]
In your configuration You require the user to be **always** authenticated when entering **any** URL on Your site: ``` <security:intercept-url pattern="/**" access="ROLE_USER" /> ``` I think You should allow the user to be **unauthenticated** when **entering the login page**: ``` <security:intercept-url pattern="/yo...
`AccessDeniedHandler` is invoked when user **is logged in** and there is no permissions to resource ([source here](http://www.jarvana.com/jarvana/view/org/springframework/security/spring-security-web/3.0.5.RELEASE/spring-security-web-3.0.5.RELEASE-sources.jar!/org/springframework/security/web/access/ExceptionTranslatio...
18,951,375
I've got a template class with an integer parameter, but I only know the template parameter at runtime. Is there any best practice to create template classes at runtime? The solution I've come up with is to create an abstract base class of the template class, that provides the interface and have an adapter class, that...
2013/09/23
[ "https://Stackoverflow.com/questions/18951375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2805645/" ]
1.Actually you are using most of the time images. In andorid images are handled by Bitmap, so these bitmaps will consume more "Heap Memory", because of creating more bitmap objects every time while changing the images. So we have to use "Object Pooling method" to avoid java.lang.OutOfMemoryError exception. Here is the...
Re use the BitmapFactory instance and do not make a new instance for each image that your using. After the call to decodeStream which takes an InputStream argument, you should free all resources in your concrete implementation of this class. Directly calling close on InputStream does nothing.
18,951,375
I've got a template class with an integer parameter, but I only know the template parameter at runtime. Is there any best practice to create template classes at runtime? The solution I've come up with is to create an abstract base class of the template class, that provides the interface and have an adapter class, that...
2013/09/23
[ "https://Stackoverflow.com/questions/18951375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2805645/" ]
try to load your Assets outside the update method, like in the constructor, maybe it loads every time the update runs which is by deltaTime or framerate or whatever and its overloading, i mean update methods usualy run like 100 times a second maybe everytime you call g.newPixmap() it allocates memory for a bitmap each ...
Re use the BitmapFactory instance and do not make a new instance for each image that your using. After the call to decodeStream which takes an InputStream argument, you should free all resources in your concrete implementation of this class. Directly calling close on InputStream does nothing.
768,072
I was facing the problem that postfix could not deliver emails to my home-directory. I have a running Ubuntu 14.04 server and due to some problem with encrypted home-drive postfix was not able to access my Maildir. In mail.log I got the following error: ``` Apr 4 09:51:35 server postfix/smtpd[13658]: connect from lo...
2016/04/04
[ "https://serverfault.com/questions/768072", "https://serverfault.com", "https://serverfault.com/users/347171/" ]
It should be in the mail queue Send a simple email ``` # echo "Hello world" | swaks -4 --server smtp.example.net --from alex.hha@gmail.com --to sf-768072@example.net --h-Subject "Test message" --body - === Trying smtp.example.net:25... === Connected to smtp.example.net. <- 220 smtp.example.net ESMTP Postfix -> EHLO...
TLDR: By default behaviour of postfix, your email was bounced (i.e. your sender will get non-delivery message) and postfix won't keep the email even in the queue. --- Based on both logs from mercury and ALex\_hha, I can concluded that there are different behavior when mail was delivered by [virtual daemon](http://www...
10,316,915
trying to return data using `OracleDataReader`, getting ``` "Object reference not set to an instance of an object " at the line "odr = ocmd.ExecuteReader();", ``` Can anyone suggest what I am missing / done wrong? thanks T ``` OracleConnection cn = null; OracleDataReader odr = null; ...
2012/04/25
[ "https://Stackoverflow.com/questions/10316915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299138/" ]
You declared ocmd as null, but then you created another OracleCommand object as cmd. ocmd was never instantiated. This part is wrong: ``` OracleCommand cmd = new OracleCommand(mysql, cn); odr = ocmd.ExecuteReader(); ``` It should be: ``` OracleCommand cmd = new OracleCommand(mysql, cn); odr = cmd.ExecuteReader(...
`ocmd` and `cmd` are two different variables.
10,316,915
trying to return data using `OracleDataReader`, getting ``` "Object reference not set to an instance of an object " at the line "odr = ocmd.ExecuteReader();", ``` Can anyone suggest what I am missing / done wrong? thanks T ``` OracleConnection cn = null; OracleDataReader odr = null; ...
2012/04/25
[ "https://Stackoverflow.com/questions/10316915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299138/" ]
`ocmd` and `cmd` are two different variables.
``` OracleCommand cmd = new OracleCommand(mysql, cn); ``` should be ``` OracleCommand ocmd = new OracleCommand(mysql, cn); ```
10,316,915
trying to return data using `OracleDataReader`, getting ``` "Object reference not set to an instance of an object " at the line "odr = ocmd.ExecuteReader();", ``` Can anyone suggest what I am missing / done wrong? thanks T ``` OracleConnection cn = null; OracleDataReader odr = null; ...
2012/04/25
[ "https://Stackoverflow.com/questions/10316915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299138/" ]
You declared ocmd as null, but then you created another OracleCommand object as cmd. ocmd was never instantiated. This part is wrong: ``` OracleCommand cmd = new OracleCommand(mysql, cn); odr = ocmd.ExecuteReader(); ``` It should be: ``` OracleCommand cmd = new OracleCommand(mysql, cn); odr = cmd.ExecuteReader(...
``` OracleCommand cmd = new OracleCommand(mysql, cn); ``` should be ``` OracleCommand ocmd = new OracleCommand(mysql, cn); ```
4,885,337
How would I extract Active Directory info (Username, first name, surname) and populate an SQL table with the results? Many thanks Scott
2011/02/03
[ "https://Stackoverflow.com/questions/4885337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/601388/" ]
If you're on .NET 3.5, I would use the new `System.DirectoryServices.AccountManagement` namespace for this. Learn about it here: [Managing Directory Security Principals in the .NET Framework 3.5](http://msdn.microsoft.com/en-us/magazine/cc135979.aspx) Basically, you'd set up a container (a `PrincipalContext`) and th...
There are different ways to do that. I use PHP to get data out of our Active Directory.Take a look at the chapter "[Lightweight Directory Access Protocol](http://www.php.net/manual/en/book.ldap.php)" in the PHP Documentation. It's also easy to populate a database using PHP, e.g. [MySQL](http://www.php.net/manual/en/boo...
4,885,337
How would I extract Active Directory info (Username, first name, surname) and populate an SQL table with the results? Many thanks Scott
2011/02/03
[ "https://Stackoverflow.com/questions/4885337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/601388/" ]
The way we do this for a **LARGE** AD environment: 1. Nightly batch process that runs [AdFind](http://www.joeware.net/freetools/tools/adfind/) (freeware tool) to execute an LDAP query and dump it out to CSV files 2. [BCP](http://msdn.microsoft.com/en-us/library/ms162802(v=SQL.90).aspx) (built-in SQL command line tool)...
There are different ways to do that. I use PHP to get data out of our Active Directory.Take a look at the chapter "[Lightweight Directory Access Protocol](http://www.php.net/manual/en/book.ldap.php)" in the PHP Documentation. It's also easy to populate a database using PHP, e.g. [MySQL](http://www.php.net/manual/en/boo...
4,885,337
How would I extract Active Directory info (Username, first name, surname) and populate an SQL table with the results? Many thanks Scott
2011/02/03
[ "https://Stackoverflow.com/questions/4885337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/601388/" ]
If you just need it in SQL, I'm using the code below ``` INSERT... SELECT A.SAMAccountName, A.Mail, A.displayName FROM (SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn, userAccountControl,mail FROM ''LDAP://domain.ro/DC=doma...
There are different ways to do that. I use PHP to get data out of our Active Directory.Take a look at the chapter "[Lightweight Directory Access Protocol](http://www.php.net/manual/en/book.ldap.php)" in the PHP Documentation. It's also easy to populate a database using PHP, e.g. [MySQL](http://www.php.net/manual/en/boo...
4,885,337
How would I extract Active Directory info (Username, first name, surname) and populate an SQL table with the results? Many thanks Scott
2011/02/03
[ "https://Stackoverflow.com/questions/4885337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/601388/" ]
The way we do this for a **LARGE** AD environment: 1. Nightly batch process that runs [AdFind](http://www.joeware.net/freetools/tools/adfind/) (freeware tool) to execute an LDAP query and dump it out to CSV files 2. [BCP](http://msdn.microsoft.com/en-us/library/ms162802(v=SQL.90).aspx) (built-in SQL command line tool)...
If you're on .NET 3.5, I would use the new `System.DirectoryServices.AccountManagement` namespace for this. Learn about it here: [Managing Directory Security Principals in the .NET Framework 3.5](http://msdn.microsoft.com/en-us/magazine/cc135979.aspx) Basically, you'd set up a container (a `PrincipalContext`) and th...
4,885,337
How would I extract Active Directory info (Username, first name, surname) and populate an SQL table with the results? Many thanks Scott
2011/02/03
[ "https://Stackoverflow.com/questions/4885337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/601388/" ]
The way we do this for a **LARGE** AD environment: 1. Nightly batch process that runs [AdFind](http://www.joeware.net/freetools/tools/adfind/) (freeware tool) to execute an LDAP query and dump it out to CSV files 2. [BCP](http://msdn.microsoft.com/en-us/library/ms162802(v=SQL.90).aspx) (built-in SQL command line tool)...
If you just need it in SQL, I'm using the code below ``` INSERT... SELECT A.SAMAccountName, A.Mail, A.displayName FROM (SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn, userAccountControl,mail FROM ''LDAP://domain.ro/DC=doma...
53,302,061
I am using `mat-tabs` from Angular Material and I need to create the tabs dynamically depending on some conditions. ``` <mat-tab-group #tabsGroup (selectedTabChange)="tabChanged($event)" (selectedIndexChange)="selectedIndexChange($event)" [(selectedIndex)]="selectedIndex"> <mat-tab id="tab0" label="First tab"> ...
2018/11/14
[ "https://Stackoverflow.com/questions/53302061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5142554/" ]
You can use `ng-template` for this like following. ``` <ng-template #content1> <div>Content 1</div> </ng-template> <ng-template #content2> <div>Content 2!</div> </ng-template> ``` Then use in your tabs accordingly. ``` <mat-tab id="tab0" [label]="yourFirstLabel"> <div *ngIf="yourFlag; then content1 else co...
You could try using an `*ngFor` to keep the tabs dynamic **html** ``` <mat-tab-group #tabsGroup (selectedTabChange)="tabChanged($event)" (selectedIndexChange)="selectedIndexChange($event)" [(selectedIndex)]="selectedIndex"> <mat-tab *ngFor="let tab in tabList" id="{{tab.tabId}}" label="tab.label"> <div [i...
2,922,030
Problem -------- Show that $f:M\_f \rightarrow A\_f$ is bijective when $f(x)=\frac{x-1}{x+1}$ **Edit** when $M\_f \in \mathbb{R}\setminus \{-1\}$ and $A\_f \subset \mathbb{R}$ Attempt to solve ----------------- $f:M\_f\rightarrow A\_f$ is bijective when it is injective and surjective at the same time. ### Injec...
2018/09/18
[ "https://math.stackexchange.com/questions/2922030", "https://math.stackexchange.com", "https://math.stackexchange.com/users/481104/" ]
Observe that $$f(x) = \frac{x - 1}{x + 1} = 1 - \frac{2}{x + 1}$$ Thus, the range of $f$ is $\mathbb{R} - \{1\}$. To ensure that $f: \mathbb{R} - \{-1\} \to A\_f$ is surjective, we must define $A\_f = \mathbb{R} - \{1\}$. For $y \neq 1$, \begin{align\*} f\left(\frac{1 + y}{1 - y}\right) & = \frac{\frac{1 + y}{1 - y...
If $A\_f$ is the "set of all outputs". This means that $$ A\_f = \left\{\, \frac{x-1}{x+1} \,\middle|\, x\in\mathbb R\setminus\{-1\}\,\right\}. $$ Hence every $y\in A\_f$ is of the form $$ y = \frac{x-1}{x+1} = f(x) $$ for some $x\in \mathbb R\setminus\{-1\} = M\_f$, so $f\colon M\_f\to A\_f$ is surjective. --- The o...
58,314,230
I have many strings. Each string something like: * "i\_love\_pizza\_123" * "whatever\_this\_is\_now\_later" * "programming\_is\_awesome" * "stack\_overflow\_ftw" * ...etc I need to be able to convert each string to a random number, 1-10. Each time that string gets converted, it should consistently be the same number....
2019/10/10
[ "https://Stackoverflow.com/questions/58314230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/673664/" ]
Here's a quick demo how you can do it. ``` function getOneToTenHash($str) { $hash = hash('sha256', $str, true); $unpacked = unpack("L", $hash); // convert first 4 bytes of hash to 32-bit unsigned int $val = $unpacked[1]; return ($val % 10) + 1; // get 1 - 10 value } for ($i = 0; $i < 100; $i++) { ...
below maybe what u want ```php $inStr = "hello world"; $md5Str = md5($inStr); $len = strlen($md5Str); $out = 0; for($i=0; $i<$len; $i++) { $out = 7*$out + intval($md5Str[$i]); // if you want more random, can and random() here } $out = ($out % 10 + 9)%10; // scope= [1,10] ```
35,827,382
In the SPOJ problem [PPATH](http://www.spoj.com/problems/PPATH/) we are given two four-digit prime numbers and we have to convert, in the least possible steps, the first prime into the second one by changing a single digit at a time and at each step the number should be prime. We have to output 'IMPOSSIBLE' if the prim...
2016/03/06
[ "https://Stackoverflow.com/questions/35827382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6025301/" ]
You can use CASE to branch between two scenarios when Sequence is null or not. You can also use ISNULL and COALESCE for null checking Added code sample, as requested in comments ``` REPLACE(STR(temp.AdminTestId,5),' ','0') + '-' + REPLACE(STR(A.UserTestId,5),' ','0') + ISNULL('-' + REPLACE(STR(A.Sequence,2),' ','0...
Concatenating null values to a string will return a null string in Sql server. The solution is usually to use Sql server's built in function to convert null values to empty strings, so your code would look like this: ``` REPLACE(COALESCE(STR(temp.AdminTestId,5), ''),' ','0') + '-' + REPLACE(COALESCE(STR(A.UserTestId,...
68,518,006
I have if conditions that display depending on the value in sql database column. What I am trying to achieve is to have different colors for each output. This is my code ```html <?php $statusshow = $row0["accStatus"]?> <p>Status:> <?php if ($statusshow == "1") {echo "Pending Confirmation!";} elseif ($st...
2021/07/25
[ "https://Stackoverflow.com/questions/68518006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16164121/" ]
To minimize codelines you can add a function which will return text message and style for provided input: ``` function getMessageAndColor($status) { if ($status == "1") {return ["Pending Confirmation!", "color: red;"];} elseif ($status == "2") {return ["Confirmed!", "color: green;"];} elseif ($status == "3...
You can put each phrase into its own span with an inline style attribute. ``` <?php $statusshow = $row0["accStatus"]?> <p>Status: <?php if ($statusshow == "1") {echo "<span style="color: red;">Pending Confirmation!</span>";} elseif ($statusshow == "2") {echo "<span style="color: green;">Confirmed!</span...
68,518,006
I have if conditions that display depending on the value in sql database column. What I am trying to achieve is to have different colors for each output. This is my code ```html <?php $statusshow = $row0["accStatus"]?> <p>Status:> <?php if ($statusshow == "1") {echo "Pending Confirmation!";} elseif ($st...
2021/07/25
[ "https://Stackoverflow.com/questions/68518006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16164121/" ]
To minimize codelines you can add a function which will return text message and style for provided input: ``` function getMessageAndColor($status) { if ($status == "1") {return ["Pending Confirmation!", "color: red;"];} elseif ($status == "2") {return ["Confirmed!", "color: green;"];} elseif ($status == "3...
Set variables in the `if` statements for the color and message. Then use the variables when you echo the span. ``` $<php $statusshow = $row0["accStatus"]; if ($statusshow == "1") { $message ="Pending Confirmation!"; $color = "red"; } elseif ($statusshow == "2") { $message ="Confirmed!"; $color = "gree...
68,518,006
I have if conditions that display depending on the value in sql database column. What I am trying to achieve is to have different colors for each output. This is my code ```html <?php $statusshow = $row0["accStatus"]?> <p>Status:> <?php if ($statusshow == "1") {echo "Pending Confirmation!";} elseif ($st...
2021/07/25
[ "https://Stackoverflow.com/questions/68518006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16164121/" ]
To minimize codelines you can add a function which will return text message and style for provided input: ``` function getMessageAndColor($status) { if ($status == "1") {return ["Pending Confirmation!", "color: red;"];} elseif ($status == "2") {return ["Confirmed!", "color: green;"];} elseif ($status == "3...
```html <?php $statusshow = $row0["accStatus"]?> <p>Status:> <?php if ($statusshow == "1") { echo "<span style='color: green'>Pending Confirmation!</span>"; } elseif ($statusshow == "2") { echo "<span style='color: green'>Confirmed!</span>"; } elseif ($statusshow == "3") { echo "<span st...