qid
int64
1
74.7M
question
stringlengths
0
70k
date
stringlengths
10
10
metadata
list
response
stringlengths
0
115k
13,769,762
Our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially. What I'm seeing in the code is that I cannot enter multi-choice mode mode unless I have something selected, and if I unselect that item, multi-choice mode exits (con...
2012/12/07
[ "https://Stackoverflow.com/questions/13769762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337455/" ]
It's very hacky, but I've done this by having an item selected, but making it look like it's not selected, by making the background temporarily transparent. When an item is then selected by the user, the secretly-selected item is deselected and the background restored to normal. Or, if it's the secretly-selected item w...
71,164,473
does anyone have an example of how to remove the records from the table before starting or after finishing the tests? My tests are working perfectly fine and all that remains is to automatically remove the records in the table. If anyone has an example link I would be very happy.
2022/02/17
[ "https://Stackoverflow.com/questions/71164473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18223187/" ]
You set the console log inside the printNumbers function. Since the state update is async, you'd have to put the console.log inside the useEffect to be notified after an update. Something similar to: ``` useEffect(()=>{ console.log(numbers); },[numbers,aNumber]) const [numbers, setNumbers] = ({number1: 2, number2:...
62,287,390
I am working on a web application at the moment that has a an api at the top level domain (mydomain.com) and an SPA at subdomain (spa.mydomain.com). In the SPA I have added, `axios.defaults.withCredentials = true` To login in I run the following code, ``` axios.get('/sanctum/csrf-cookie').then(response => { axi...
2020/06/09
[ "https://Stackoverflow.com/questions/62287390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57872/" ]
Turns out when our Azure DevOps instance was first set up, all our users set up Microsoft accounts with their company emails. Later when we finally stood up Azure AD but before we connected it to DevOps we added a new project and set the permissions for a few existing employees. For some reason the user permissions on ...
31,079,002
I have a solution with a C# project of 'library' and a project 'JavaScript' after that compiled it generates a .winmd file being taken to another project. But this project is built on x86 and I need to compile for x64, to run the application in order x64 get the following error: ``` 'WWAHost.exe' (Script): Loaded 'Scr...
2015/06/26
[ "https://Stackoverflow.com/questions/31079002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It looks like you were making calls with no Access Token at all, to data that's publicly visible on Facebook.com v1.0 of Facebook's Graph API was deprecated in April 2014 and scheduled for removal after 2015-04-30 - one of the changes between v1.0 and v2.0 was that in v2.0 all calls require an Access Token - the depre...
334,167
I am late game Alien Crossfire, attacking with gravitons aremed with [string disruptor](https://strategywiki.org/wiki/Sid_Meier%27s_Alpha_Centauri/Weapon#String_Disruptor). Unfortunately, the others have gotten wise and are building everything [AAA](https://strategywiki.org/wiki/Sid_Meier%27s_Alpha_Centauri/Special_Ab...
2018/06/24
[ "https://gaming.stackexchange.com/questions/334167", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/92813/" ]
Psi attack/defense is orthogonal to conventional weapons. Its result depends on *Morale* levels of attacking/defending units. If an attacker/defender is a *Mind Worm*, they have their own class, plus both faction's *Planet (Green)* scores/attitudes largely affect the outcome of the fight. **Answer:** see what's your ...
43,377,941
**Goal**: I aim to use t-SNE (t-distributed Stochastic Neighbor Embedding) in R for dimensionality reduction of my training data (with *N* observations and *K* variables, where *K>>N*) and subsequently aim to come up with the t-SNE representation for my test data. **Example**: Suppose I aim to reduce the K variables ...
2017/04/12
[ "https://Stackoverflow.com/questions/43377941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5634399/" ]
This the mail answer from the author (Jesse Krijthe) of the Rtsne package: > > Thank you for the very specific question. I had an earlier request for > this and it is noted as an open issue on GitHub > (<https://github.com/jkrijthe/Rtsne/issues/6>). The main reason I am > hesitant to implement something like this ...
62,380,246
As the title says is there a way to programmatically render (into a DOM element) a component in angular? For example, in React I can use `ReactDOM.render` to turn a component into a DOM element. I am wondering if it's possible to something similar in Angular?
2020/06/15
[ "https://Stackoverflow.com/questions/62380246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6009213/" ]
At first you'll need to have a template in your HTML file at the position where you'll want to place the dynamically loaded component. ```html <ng-template #placeholder></ng-template> ``` In the component you can inject the `DynamicFactoryResolver` inside the constructor. Once you'll execute the `loadComponent()` fu...
12,881
No matter how I rearrange this, the increment compare always returns false.... I have even taken it out of the if, and put it in its own if: ``` int buttonFSM(button *ptrButton) { int i; i = digitalRead(ptrButton->pin); switch(ptrButton->buttonState) { case SW_UP: if(i==0 && ++ptrButton-...
2015/06/24
[ "https://arduino.stackexchange.com/questions/12881", "https://arduino.stackexchange.com", "https://arduino.stackexchange.com/users/10817/" ]
Looks to me like the path where the if doesn't happen are getting you. You don't show what DBNC\_TICS is set to, but I'm assuming it's > 1. ptrButton->debounceTics will never be greater than 1 because you always: ``` ptrButton->debounceTics = 0; ```
64,999,490
Hi I'm learning right now how to upload images to database, but I'm getting this error/notice. ``` </select> <input type="text" name="nama" class="input-control" placeholder="Nama Produk" required> <input type="text" name="harga" class="input-control" placeholder="Harga Produk" require...
2020/11/25
[ "https://Stackoverflow.com/questions/64999490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14704128/" ]
You need to add `enctype="multipart/form-data"` to your form <https://www.php.net/manual/en/features.file-upload.post-method.php> > > **Note:** > Be sure your file upload form has attribute > enctype="multipart/form-data" otherwise the file upload will not work. > > >
21,657,910
Can we change the color of the text based on the color of the background image? I have a background image which i have appended it to body. When you reload the page every time the background image gets changed. But i have my menus which are positioned on the image having text color as black. If the background image is ...
2014/02/09
[ "https://Stackoverflow.com/questions/21657910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1999172/" ]
use switch case to handle ``` switch(backgroundimage){ case "black.jpg": document.body.color = "white"; break; case "white.jpg": document.body.color = "black"; break; case "green.jpg": document.body.color = "gray"; break; } ```
2,274,695
My colleague has been using "new function()" with a lower case "f" to define new objects in JavaScript. It seems to work well in all major browsers and it also seems to be fairly effective at hiding private variables. Here's an example: ``` var someObj = new function () { var inner = 'some value'; ...
2010/02/16
[ "https://Stackoverflow.com/questions/2274695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/188740/" ]
I've seen that technique before, it's valid, you are using a function expression as if it were a [Constructor Function](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function). But IMHO, you can achieve the same with an auto-invoking function expression, I don't really see the point of using the...
1,806,990
Since nothing so far is working I started a new project with ``` python scrapy-ctl.py startproject Nu ``` I followed the tutorial exactly, and created the folders, and a new spider ``` from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy....
2009/11/27
[ "https://Stackoverflow.com/questions/1806990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/215094/" ]
Please also check the version of scrapy. The latest version uses "name" instead of "domain\_name" attribute to uniquely identify a spider.
20,931,619
I got nearly 10 functions in class having similar pattern like following function ``` SQLiteDatabase database = this.getWritableDatabase(); try { //Some different code , all other code(try,catch,finally) is same in all functions } catch (SQLiteException e) { Log.e(this.getClass().getName...
2014/01/05
[ "https://Stackoverflow.com/questions/20931619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033305/" ]
There are a number of frameworks out there that drastically simplify database interaction that you can use, but if you want to do things on your own, and are interested in the Java way to do things like this, here's the idea: Make your "executor" like so: ``` public class Executor { public static void runOperation(...
32,580,318
Please help me for How to convert data from {"rOjbectId":["abc","def",ghi","ghikk"]} to "["abc", "def", "ghi", "ghikk"] using ajax
2015/09/15
[ "https://Stackoverflow.com/questions/32580318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4003128/" ]
You can load a placeholder image, but then you must *load* that image (when you're already loading another image). If you load something like a spinner via a `GET` request, that should be ok since you can set cache headers from the server so the browser does not actually make any additional requests for that loading im...
9,458,253
Perhaps I am worrying over nothing. I desire for data members to closely follow the RAII idiom. How can I initialise a protected pointer member in an abstract base class to null? I know it should be null, but wouldn't it be nicer to ensure that is universally understood? Putting initialization code outside of the ini...
2012/02/26
[ "https://Stackoverflow.com/questions/9458253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866333/" ]
I have had this problem in the past - and fixed it. The images you're displaying are much too large. I love using html or css to resize my images (because who wants to do it manually), but the fact remains that most browsers will hiccup when moving them around. I'm not sure why. With the exception of Opera, which us...
34,211,201
I have a Python script that uploads a Database file to my website every 5 minutes. My website lets the user query the Database using PHP. If a user tries to run a query while the database is being uploaded, they will get an error message > > PHP Warning: SQLite3::prepare(): Unable to prepare statement: 11, database ...
2015/12/10
[ "https://Stackoverflow.com/questions/34211201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2893712/" ]
First of all there is a weird thing with your implementation: you use a parameter `n` that you never use, but simply keep passing and you never modify. Secondly the second recursive call is incorrect: ``` else: m = y*power(y, x//2, n) #Print statement only used as check print(x, m) return m*m ``` If...
38,921,847
I want to remove the card from the `@hand` array if it has the same rank as the given input. I'm looping through the entire array, why doesn't it get rid of the last card? Any help is greatly appreciated! Output: ``` 2 of Clubs 2 of Spades 2 of Hearts 2 of Diamonds 3 of Clubs 3 of Spades ------------ 2 of Clubs 2 of ...
2016/08/12
[ "https://Stackoverflow.com/questions/38921847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5140582/" ]
`remove_cards(value)` has an issue: one should not `delete` during iteration. The correct way would be to [`Array#reject!`](http://ruby-doc.org/core-2.3.1/Array.html#method-i-reject-21) cards from a hand: ``` def remove_cards(value) @hands.reject! { |hand_card| hand_card.rank == value } end ```
39,707
I have a 2006 Vespa LX 150 that starts up and idles perfectly but, when giving it any gas at all, it starts to stall and it is not delivering enough power to move forward. I let it idle for a good 5-10 minutes and kept trying but to no avail. It has never acted strangely like this at all (never anything weird with the...
2016/12/12
[ "https://mechanics.stackexchange.com/questions/39707", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/9501/" ]
1. Try replacing your Air-filter, if you haven't done during your last service check-up 2. Also check your Spark Plug for carbon soot and clean if necessary
13,540,903
TextView.setAllCaps() started as of API 14. What is its equivalent for older APIs (e.g. 13 and lowers)? I cannot find such method on lower APIs. Is maybe setTransformationMethod() responsible for this on older APIs? If yes, how should I use it? `TextView.setTransformationMethod(new TransformationMethod() {...` is a bi...
2012/11/24
[ "https://Stackoverflow.com/questions/13540903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437039/" ]
Try this: ``` textView.setText(textToBeSet.toUpperCase()); ```
6,126,126
If you declare an inheritance hierarchy where both the parent and child class have a static method of the same name and parameters\*, Visual Studio will raise warning [CS0108](http://msdn.microsoft.com/en-us/library/3s8070fc.aspx): Example: ``` public class BaseClass { public static void DoSomething() { }...
2011/05/25
[ "https://Stackoverflow.com/questions/6126126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/533907/" ]
Members of the SubClass will not be able to access the DoSomething from BaseClass without explicitly indicating the class name. So it is effectively "hidden" to members of SubClass, but still accessible. For example: ``` public class SubClass : BaseClass { public static void DoSomething() { } public ...
14,847,913
I try to implement the zoom in/out by spread/pinch gesture and the drag and drop functions on a Relative Layout. This is the code of my OnPinchListener to handle the zoom effect. The **mainView** is the RelativeLayout defined in the layout xml file. I implement the touch listener in the **fakeview** which should be...
2013/02/13
[ "https://Stackoverflow.com/questions/14847913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2067294/" ]
you need to get the transformation matrix and use that to transform your original points. so something like this (after you do the scaling): ``` Matrix m = view.getMatrix(); //gives you the transform matrix m.mapPoints(newPoints, oldPoints); //transform the original points. ```
3,851,022
$A^{2}-2A=\begin{bmatrix} 5 & -6 \\ -4 & 2 \end{bmatrix}$ Can someone help me solve this? I've been trying to solve it for a while, but no matter what I try, the only information that I manage to get about A is that if $A=\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ then $c=\frac{2b}{3}$. Any help would be apprec...
2020/10/04
[ "https://math.stackexchange.com/questions/3851022", "https://math.stackexchange.com", "https://math.stackexchange.com/users/832188/" ]
Denote by $I$ the identity matrix. Then, completing squares you can write $$A^2 - 2A = A^2 -2IA + I^2 -I^2 = (A-I)^2 -I^2.$$ Hence, your equation is equivalent to $$(A-I)^2 = X + I$$ since $I^2 = I$. Denote by $Y=X+I$ the new matrix (which is known). You want to find $B$ such that $B^2=Y.$ Here, I recommend to diagonal...
68,767,520
I have a discord bot that gets info from an API. The current issue I'm having is actually getting the information to be sent when the command is run. ``` const axios = require('axios'); axios.get('https://mcapi.us/server/status?ip=asean.my.to') .then(response => { console.log(response.data); }); module.exports = { ...
2021/08/13
[ "https://Stackoverflow.com/questions/68767520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15076973/" ]
probably your page is refreshed, try to use preventDefault to prevent the refresh ``` $('#submit').click(function(event){ //your code here event.preventDefault(); } ```
40,306,717
First of all i am new to Angular 2 and i am trying to setup new project where i want user to login and if login is successful (which is always in my case) then user should be rerouted to another component. Here is my code: <https://github.com/tsingh38/Angular2Demo> I am also struck with compilation error here > > ...
2016/10/28
[ "https://Stackoverflow.com/questions/40306717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5160771/" ]
Use `Trim`: (*and also in this case consider changing to the query syntax, IMO more readable when it comes to joins*) ``` var fidn = from post in repository.users join meta in repository.usersLG on post.pcod equals meta.pcod where post.fam_v.Trim() == "Johny" select new Final { ...
238,163
I have Echo's buried in code all over my notebook, I'd like a flag to turn them all on or off globally. * Sure `Unprotect[Echo];Echo=Identity` would disable them, but then you can't re-enable them * A solution that works for all the various types of Echos (EchoName, EchoEvaluation, ...) would be nice * `QuietEcho` doe...
2021/01/13
[ "https://mathematica.stackexchange.com/questions/238163", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/403/" ]
[`Echo`](http://reference.wolfram.com/language/ref/Echo) has an autoload, so you need to make sure the symbol is autoloaded before you modify its values: ``` DisableEcho[] := (Unprotect[Echo]; Echo; Echo = #&; Protect[Echo];) EnableEcho[] := (Unprotect[Echo]; Echo=.; Protect[Echo];) ``` Test: ``` DisableEcho[] Ec...
29,922,241
Here is my Database: `bott_no_mgmt_data` ``` random_no ; company_id ; bottle_no ; date ; returned ; returned_to_stock ; username 30201 ; MY COMP ; 1 ; 2015-04-28 ; 10 ; NULL ; ANDREW 30202 ; MY COMP ; 2 ; 2015-04-28 ; 10 ; NULL ; ANDREW 3020...
2015/04/28
[ "https://Stackoverflow.com/questions/29922241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4842148/" ]
All joins should be written before Where clause as Daan mentions: ``` select yt.* from bott_no_mgmt_data yt inner join( select bottle_no, max(random_no) random_no from bott_no_mgmt_data WHERE username = 'ANDREW' group by bottle_no ) ss on yt.bottle_no = ss.bottle_no and yt.random_no = ss.random_no LEFT ...
17,435,721
I have a project with multiple modules say "Application A" and "Application B" modules (these are separate module with its own pom file but are not related to each other). In the dev cycle, each of these modules have its own feature branch. Say, ``` Application A --- Master \ - F...
2013/07/02
[ "https://Stackoverflow.com/questions/17435721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/710802/" ]
You can do this with a before update trigger. You would use such a trigger to assign the value of `offer_nr` based on the historical values. The key code would be: ``` new.offer_nr = (select coalesce(1+max(offer_nr), 1) from offers o where o.company_id = new.company_id ) ...
35,029,058
HTML CODE ``` <select class="form-control" name="min_select[]"> <option value="15">15</option> <option value="30">30</option> </select> ``` JQuery Code ``` var val1[]; $('select[name="min_select[]"] option:selected').each(function() { val1.push($(this).val()); }); ``` when i run this c...
2016/01/27
[ "https://Stackoverflow.com/questions/35029058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4089992/" ]
The declaration array syntax is in correct.Please check the below code ``` var val1=[]; $('select[name="min_select[]"] option:selected').each(function() { val1.push($(this).val()); }); ```
28,808,099
I am writing a script which will pick the last created file for the given process instance. The command I use in my script is ``` CONSOLE_FILE=`ls -1 "$ABP_AJTUH_ROOT/console/*${INSTANCE}*" | tail -1` ``` but while the script is getting executed, the above command changes to ``` ls -1 '....../console/*ABP*' ``` ...
2015/03/02
[ "https://Stackoverflow.com/questions/28808099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4623068/" ]
You cannot use double quotes around the wildcard, because that turns the asterisks into literal characters. ``` CONSOLE_FILE=`ls -1 "$ABP_AJTUH_ROOT"/console/*"$INSTANCE"* | tail -1` ``` should work, but see the caveats against <http://mywiki.wooledge.org/ParsingLs> and generally <http://mywiki.wooledge.org/BashPitf...
60,744,543
I'm trying to get the Download Folder to show on my file explorer. However on Android 9, when I use the getexternalstoragedirectory() method is showing self and emulated directories only and if I press "emulated" I cannot see more folders, it shows an empty folder. So this is how I'm getting the path, it's working fin...
2020/03/18
[ "https://Stackoverflow.com/questions/60744543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10871734/" ]
This is because [dictionaries](https://docs.julialang.org/en/v1/base/collections/#Dictionaries-1) in Julia (`Dict`) are not ordered: each dictionary maintains a *set* of keys. The order in which one gets keys when one iterates on this set is not defined, and can vary as one inserts new entries. There are two things tha...
5,803,170
I have encountered a problem when trying to select data from a table in MySQL in Java by a text column that is in utf-8. The interesting thing is that with code in Python it works well, in Java it doesn't. The table looks as follows: ``` CREATE TABLE `x` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `text` varchar(...
2011/04/27
[ "https://Stackoverflow.com/questions/5803170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/429274/" ]
Okay, my bad. The database was wrongly built. It was built through the mysql client that by default is latin1 so in the database the data were encoded by utf8 twice. The problem and the major difference between the two source codes is in that the Python code doesn't set the default charset (therefore it is latin1) whe...
24,220,365
I have this SQL server instance which is shared by several client-processes. I want queries to finish taking as little time as possible. Say a call needs to read 1k to 10k records from this shared Sql Server. My natural choice would be to use ExecuteReaderAsync to take advantage of async benefits such as reusing threa...
2014/06/14
[ "https://Stackoverflow.com/questions/24220365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298622/" ]
Whether you use sync or async to call SQL Server makes no difference for the work that SQL Server does and for the CPU-bound work that ADO.NET does to serialize and deserialize request and response. So no matter what you chose the difference will be small. Using async is not about saving CPU time. It is about saving m...
3,398,839
I'm trying to prove this by induction, but something doesn't add up. I see a solution given [here](https://www.algebra.com/algebra/homework/word/misc/Miscellaneous_Word_Problems.faq.question.29292.html), but it is actually proving that the expression is **greater** than $2\sqrt{n}$. I'd appreciate some insight.
2019/10/18
[ "https://math.stackexchange.com/questions/3398839", "https://math.stackexchange.com", "https://math.stackexchange.com/users/209695/" ]
Base step: 1<2. Inductive step: $$\sum\_{j=1}^{n+1}\frac1{\sqrt{j}} < 2\sqrt{n}+\frac1{\sqrt{n+1}}$$ So if we prove $$2\sqrt{n}+\frac1{\sqrt{n+1}}<2\sqrt{n+1}$$ we are done. Indeed, that holds true: just square the left hand side sides to get $$4n+2\frac{\sqrt{n}}{\sqrt{n+1}}+\frac1{n+1}<4n+3<4n+4$$ which is the squa...
32,969,687
I have a scenario where I need to auto generate the value of a column if it is null. Ex: `employeeDetails`: ``` empName empId empExtension A 101 null B 102 987 C 103 986 D 104 null E 105 null ``` `employeeDepartment`: ``` deptName empId HR 101 ADMIN 10...
2015/10/06
[ "https://Stackoverflow.com/questions/32969687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3622730/" ]
You should be able to do that with a CTE to grab [ROW\_NUMBER](https://msdn.microsoft.com/en-us/library/ms186734.aspx), and then [COALESCE](https://msdn.microsoft.com/en-us/library/ms190349.aspx) to only use that number where the value is NULL: ``` WITH cte AS( SELECT empId, empExtension, ROW_NUMBER() OVER(ORDER BY ...
62,440,916
I'm brand new to python 3 & my google searches have been unproductive. Is there a way to write this: ``` for x in range(10): print(x) ``` as this: ``` print(x) for x in range(10) ``` I do not want to return a list as the `arr = [x for x in X]` list comprehension syntax does. EDIT: I'm not actually in that s...
2020/06/18
[ "https://Stackoverflow.com/questions/62440916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4048592/" ]
No, there isn't. Unless you consider this a one liner: ``` for x in range(6): print(x) ``` but there's no reason to do that.
37,455,599
When I run my project on my iphone or in the simulator it works fine. When I try to run it on an ipad I get the below error: *file was built for arm64 which is not the architecture being linked (armv7)* The devices it set to Universal. Does anybody have an idea about what else I should check?
2016/05/26
[ "https://Stackoverflow.com/questions/37455599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5367540/" ]
Just in case somebody has the same problem as me. Some of my target projects had different iOS Deployment target and that is why the linking failed. After moving them all to the same the problem was solved.
2,315,242
I'm just starting a new project on ASP.NET MVC and this will be the first project actually using this technology. As I created my new project with Visual Studio 2010, it created to my sql server a bunch of tables with "aspnet\_" prefix. Part of them deal with the built-in user accounts and permission support. Now, I ...
2010/02/23
[ "https://Stackoverflow.com/questions/2315242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/266159/" ]
If you are choosing to use the Membership API for your site, then this [link](http://www.asp.net/(S(pdfrohu0ajmwt445fanvj2r3))/learn/security/tutorial-08-cs.aspx) has information regarding how to add extra information to a user. I was faced with the same scenario recently and ended up ditching the membership functiona...
7,710,639
I am modifying a regex validator control. The regex at the moment looks like this: ``` (\d*\,?\d{2}?){1}$ ``` As I can understand it allows for a number with 2 decimal places. I need to modify it like this: * The number must range from 0 - 1.000.000. (Zero to one million). * The number may or may not have 2 deci...
2011/10/10
[ "https://Stackoverflow.com/questions/7710639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817455/" ]
Try this regex: ``` ^(((0|[1-9]\d{0,5})(\,\d{2})?)|(1000000(\,00)?))$ ``` It accepts numbers like: `"4", "4,23", "123456", "1000000", "1000000,00"`, but don't accepts: `",23", "4,7", "1000001", "4,234", "1000000,55"`. If you want accept only numbers with exactly two decimals, use this regex: ``` ^(((0|[1-9]\d{0,...
24,444,188
can someone please tell me what is going wrong? I am trying to create a basic login page and that opens only when a correct password is written ``` <html> <head> <script> function validateForm() { var x=document.forms["myForm"]["fname"].value; if (x==null || x=="") { alert("First name must be filled out"); retu...
2014/06/27
[ "https://Stackoverflow.com/questions/24444188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2771301/" ]
try this ``` BufferedWriter writer = new BufferedWriter(new FileWriter("result.txt")); for (String element : misspelledWords) { writer.write(element); writer.newLine(); } ``` Adding line separator at the end (like "\n") should work on most OS,but to be on safer side you should use **S...
47,331,969
I'm trying to merge informations in two different data frames, but problem begins with uneven dimensions and trying to use not the column index but the information in the column. merge function in R or join's (dplyr) don't work with my data. I have to dataframes (One is subset of the others with updated info in the la...
2017/11/16
[ "https://Stackoverflow.com/questions/47331969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8609239/" ]
`%in%` from base-r is there to rescue. ``` df1=data.frame(Name = print(LETTERS[1:9]), val = seq(1:3), Case = c("NA","1","NA","NA","1","NA","1","NA","NA"), stringsAsFactors = F) df2 = data.frame(Name = c("A","D","H"), val = seq(1:3), Case = "1", stringsAsFactors = F) df1$Case <- ifelse(df1$Name %in% df2$N...
5,669,878
I'm building a WSGI web app and I have a MySQL database. I'm using MySQLdb, which provides cursors for executing statements and getting results. **What is the standard practice for getting and closing cursors?** In particular, how long should my cursors last? Should I get a new cursor for each transaction? I believe y...
2011/04/14
[ "https://Stackoverflow.com/questions/5669878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484488/" ]
Instead of asking what is standard practice, since that's often unclear and subjective, you might try looking to the module itself for guidance. In general, using the `with` keyword as another user suggested is a great idea, but in this specific circumstance it may not give you quite the functionality you expect. As o...
56,148,199
I am new to the Ruby on Rails ecosystem so might question might be really trivial. I have set up an Active Storage on one of my model ```rb class Sedcard < ApplicationRecord has_many_attached :photos end ``` And I simply want to seed data with `Faker` in it like so: ```rb require 'faker' Sedcard.destroy_all 20....
2019/05/15
[ "https://Stackoverflow.com/questions/56148199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2828594/" ]
I found the problem myself. I was using UUID as my model's primary key which is not natively compatible with ActiveStorage. Thus, I more or less followed the instructions [here](https://www.wrburgess.com/posts/2018-02-03-1.html)
199,883
Say I have an expansion of terms containing functions `y[j,t]` and its derivatives, indexed by `j` with the index beginning at 0 whose independent variable are `t`, like so: `Expr = y[0,t]^2 + D[y[0,t],t]*y[0,t] + y[0,t]*y[1,t] + y[0,t]*D[y[1,t],t] + (y[1,t])^2*y[0,t] +` ... etc. Now I wish to define new functions i...
2019/06/06
[ "https://mathematica.stackexchange.com/questions/199883", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/41975/" ]
Since [`Show`](http://reference.wolfram.com/language/ref/Show) uses the [`PlotRange`](http://reference.wolfram.com/language/ref/PlotRange) setting from the first plot, you can just set your plot range when defining the first plot: ``` p1=LogLogPlot[ RO, {t,0.00001,0.05}, PlotRange -> {{10^-5, 10^-4}, All},...
61,989,976
I am trying to perform JWT auth in spring boot and the request are getting stuck in redirect loop. **JWTAuthenticationProvider** ``` @Component public class JwtAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider { @Autowired private JwtUtil jwtUtil; @Override public boolean supp...
2020/05/24
[ "https://Stackoverflow.com/questions/61989976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4457734/" ]
I believe the the reason for this is because you have not actually set the `AuthenticationSuccessHandler` for the bean `JwtAuthenticationFilter`, since it is not actually set it will keep looping around super and chain and later when the error needs to be sent since response is already written in `super()` `chain.doFil...
4,177,291
I have the following string: ``` Mon Sep 14 15:24:40 UTC 2009 ``` I need to format it into a string like this: ``` 14/9/2009 ``` How do I do it in Java?
2010/11/14
[ "https://Stackoverflow.com/questions/4177291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/264419/" ]
Use [`SimpleDateFormat`](http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html) (click the javadoc link to see patterns) to parse the string in one pattern to a fullworthy [`Date`](http://download.oracle.com/javase/6/docs/api/java/util/Date.html) and use another one to format the parsed `Date` to...
44,169,413
[Error Message Picture](https://i.stack.imgur.com/kkbkN.png) I basically followed the instructions from the below link EXACTLY and I'm getting this damn error? I have no idea what I'm supposed to do, wtf? Do I need to create some kind of persisted method?? There were several other questions like this and after reading...
2017/05/24
[ "https://Stackoverflow.com/questions/44169413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6484371/" ]
Changed the bottom portion to: ``` def self.from_omniauth(auth) where(provider: auth.provider, uid: auth.uid).first_or_create do |user| user.email = auth.info.email user.password = Devise.friendly_token[0,20] user.name = auth.info.name # assuming the user model has a name end end ``` ran rails g mig...
29,130,635
I read [this](https://stackoverflow.com/questions/5842903/block-tridiagonal-matrix-python), but I wasn't able to create a (N^2 x N^2) - matrix **A** with (N x N) - *matrices* **I** on the lower and upper side-diagonal and **T** on the diagonal. I tried this ``` def prep_matrix(N): I_N = np.identity(N) NV = zer...
2015/03/18
[ "https://Stackoverflow.com/questions/29130635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2668777/" ]
Dirty, hacky, inefficient, solution (assumes use of forms authentication): ``` public void Global_BeginRequest(object sender, EventArgs e) { if( Context.User != null && !String.IsNullOrWhiteSpace(Context.User.Identity.Name) && Context.Session != null && Context.Session["IAMTRACKE...
25,677,031
I want Rails to automatically translate placeholder text like it does with form labels. How can I do this? Form labels are translated automatically like this: ``` = f.text_field :first_name ``` This helper uses the locale file: ``` en: active_model: models: user: attributes: first_nam...
2014/09/05
[ "https://Stackoverflow.com/questions/25677031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615384/" ]
If using Rails 4.2, you can set the placeholder attribute to true: ``` = f.text_field :first_name, placeholder: true ``` and specify the placeholder text in the locale file like this: ``` en: helpers: placeholder: user: first_name: "Your name" ```
3,829,150
If I call `console.log('something');` from the popup page, or any script included off that it works fine. However as the background page is not directly run off the popup page it is not included in the console. Is there a way that I can get `console.log()`'s in the background page to show up in the console for the po...
2010/09/30
[ "https://Stackoverflow.com/questions/3829150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383759/" ]
Any *extension page* (except [content scripts](http://developer.chrome.com/extensions/content_scripts.html)) has direct access to the background page via [`chrome.extension.getBackgroundPage()`](http://developer.chrome.com/extensions/extension.html#method-getBackgroundPage). That means, within the [popup page](http://...
66,233,268
I am working on a project where we frequently work with a list of usernames. We also have a function to take a username and return a dataframe with that user's data. E.g. ``` users = c("bob", "john", "michael") get_data_for_user = function(user) { data.frame(user=user, data=sample(10)) } ``` We often: 1. Iterate...
2021/02/16
[ "https://Stackoverflow.com/questions/66233268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2518602/" ]
You can use this: ``` s_index=df.index.to_series() l = s_index.groupby(s_index.diff().ne(1).cumsum()).agg(list).to_numpy() ``` Output: ``` l[0] [45, 46, 47] ``` and ``` l[1] [51, 52] ```
6,677,308
I'm using jQuery Treeview. Is there's a way to populate a children node in a specific parent on onclick event? Please give me some advise or simple sample code to do this.
2011/07/13
[ "https://Stackoverflow.com/questions/6677308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/768789/" ]
You can trigger the change event yourself in the `inputvalue` function: ``` function inputvalue(){ $("#inputid").val("bla").change(); } ``` Also notice the correction of your syntax... in jQuery, `val` is a function that takes a string as a parameter. You can't assign to it as you are doing. Here is an [example ...
24,010
UPDATE Have included an image. As you can see, LED is ON when base is floating. This is a 2N222A transistor. ![enter image description here](https://i.stack.imgur.com/0x1RH.jpg) ![enter image description here](https://i.stack.imgur.com/C2V28.jpg) --- Playing with an NPN bipolar transistor. The Collector is connect...
2011/12/21
[ "https://electronics.stackexchange.com/questions/24010", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/4336/" ]
Okay, looking at the picture I think you may have the transistor the wrong way round. Try turning it round. See this picture for reference: ![enter image description here](https://i.stack.imgur.com/tDQzJ.png) As you can see the collector is on the right with the flat part facing you, so you have the collector con...
23,238,724
I have a layout as follows for mobile .. ``` +------------------------+ | (col-md-6) Div 1 | +------------------------+ | (col-md-6) Div 2 | +------------------------+ | (col-md-6) Div 3 | +------------------------+ | (col-md-6) Div 4 | +---------------------...
2014/04/23
[ "https://Stackoverflow.com/questions/23238724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/505055/" ]
The problem is not linked to data.frame, but simply that you cannot have in the same vector objects of class numeric and objects of class character. It is NOT possible. The person who started the project before you should not have used the string "Error" to indicate a missing data. Instead, you should use NA : ``` x=...
74,081,278
I have a dataframe which looks like this: ``` val "ID: abc\nName: John\nLast name: Johnson\nAge: 27" "ID: igb1\nName: Mike\nLast name: Jackson\nPosition: CEO\nAge: 42" ... ``` I would like to extract Name, Position and Age from those values and turn them into separate columns to get dataframe which looks like this: ...
2022/10/15
[ "https://Stackoverflow.com/questions/74081278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17378883/" ]
As mentioned in the comment, `True/False` values are also the instances of `int` in Python, so you can add one more condition to check if the value is not an instance of `bool`: ```py >>> lst = [True, 19, 19.5, False] >>> [x for x in lst if isinstance(x, int) and not isinstance(x, bool)] [19] ```
25,207,910
I'm adding a new model to rails\_admin. The list page displays datetime fields correctly, even without any configuration. But the detail (show) page for a given object does not display datetimes. How do I configure rails\_admin to show datetime fields on the show page? Model file: alert\_recording.rb: ``` class Alert...
2014/08/08
[ "https://Stackoverflow.com/questions/25207910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3923011/" ]
These fields are hidden by default as you can see here: <https://github.com/sferik/rails_admin/blob/ead1775c48754d6a99c25e4d74494a60aee9b4d1/lib/rails_admin/config.rb#L277> You can overwrite this setting on your config initializer, just open the file `config/initializers/rails_admin.rb` and add this line to it: `con...
54,405,329
I'm new to QT and I've watched some tutorials about how to create a widget app. In most of them, I had to modify label text using: ``` ui->label->setText("smthg"); ``` I've tried the same thing with QTextEdit and can't seem have access to it. Tried `ui->help_plz`, says **"no member named "textEdit" in UI::MainWindo...
2019/01/28
[ "https://Stackoverflow.com/questions/54405329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10935201/" ]
It says `no member named "textEdit" in UI::MainWindow` because there isn't anything called `textEdit` in your `.ui` file (you can search it yourself to confirm it). You cannot access UI elements that are not there. Add a line edit to your ui file.
18,392,750
Trying to work out where I have screwed up with trying to create a count down timer which displays seconds and milliseconds. The idea is the timer displays the count down time to an NSString which updates a UILable. The code I currently have is ``` -(void)timerRun { if (self.timerPageView.startCountdown) { ...
2013/08/23
[ "https://Stackoverflow.com/questions/18392750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2556050/" ]
You have a timer that will execute roughly 100 times per second (interval of 0.01). You decrement a value by `1` each time. Therefore, your `self.timerPageView.sec` variable appears to be hundredths of a second. To get the number of seconds, you need to divide this value by 100. To get the number of milliseconds, you...
4,882,465
I am quite a noob when it comes to deploying a Django project. I'd like to know what are the various methods to deploy Django project and which one is the most preferred.
2011/02/03
[ "https://Stackoverflow.com/questions/4882465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277848/" ]
Use the Nginx/Apache/mod-wsgi and you can't go wrong. If you prefer a simple alternative, just use Apache. There is a very good deployment document: <http://lethain.com/entry/2009/feb/13/the-django-and-ubuntu-intrepid-almanac/>
23,898,432
I have this source of a single file that is successfully compiled in C: ``` #include <stdio.h> int a; unsigned char b = 'A'; extern int alpha; int main() { extern unsigned char b; double a = 3.4; { extern a; printf("%d %d\n", b, a+1); } return 0; } ``` After running it, the outpu...
2014/05/27
[ "https://Stackoverflow.com/questions/23898432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2565010/" ]
The problem is here: ``` System.out.println("Average of column 1:" + (myTable [0][0] + myTable [0][1] + myTable [0][2] + myTable [0][3] + myTable [0][4]) / 4 ); ``` You're accessing to `myTable[0][4]`, when `myTable` is defined as `int[5][4]`. Fix this and your code will work. ``` System.out.println("Average of co...
2,884,715
I am currently investigating the specific square number $a^n+1$ and whether it can become a square. I know that $a^n+1$ cannot be a square if n is even because then I can write n=2x, and so $(a^n)^2$+1 is always smaller than $(a^n+1)^2$. But what about odd powers of n? Can they allow $a^n+1$ to become a square? Or a ...
2018/08/16
[ "https://math.stackexchange.com/questions/2884715", "https://math.stackexchange.com", "https://math.stackexchange.com/users/449771/" ]
To answer the question in the title: The next square after $n^2$ is $(n+1)^2=n^2+2n+1 > n^2+1$ if $n>0$. Therefore, $n^2+1$ is never a square, unless $n=0$.
4,623,475
The MySQL Stored Procedure was: ``` BEGIN set @sql=_sql; PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; set _ires=LAST_INSERT_ID(); END$$ ``` I tried to convert it to: ``` BEGIN EXECUTE _sql; SELECT INTO _ires CURRVAL('table_seq'); RETURN; ...
2011/01/07
[ "https://Stackoverflow.com/questions/4623475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563296/" ]
You can add an option 'expression' to the configuration. Normally it gets a "$user" as argument. So you can do something like: ``` array('allow', 'actions'=>array('index','update', 'create', 'delete'), 'expression'=> '$user->isAdmin', ), ``` Note that I haven't tested this but I think it will work. Take a loo...
3,988,620
This should be straight foreward, but I simply can't figure it out(!) I have a UIView 'filled with' a UIScrollView. Inside the scrollView I wan't to have a UITableView. I have hooked up both the scrollView and the tableView with IBOutlet's in IB and set the ViewController to be the delegate and datasource of the tabl...
2010/10/21
[ "https://Stackoverflow.com/questions/3988620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/463808/" ]
Personally, I would define the key-states as disjoint states and write a simple state-machine, thus: ``` enum keystate { inactive, firstPress, active }; keystate keystates[256]; Class::CalculateKeyStates() { for (int i = 0; i < 256; ++i) { keystate &k = keystates[i]; switch (k) ...
4,084,790
AFAIK GHC is the most common compiler today, but I also see, that some other ompilers are available too. Is GHC really the best choice for all purposes or may I use something else instead? For instance, I read that some compiler (forgot the name) does better on optimizations, but doesn't implements all extensions.
2010/11/03
[ "https://Stackoverflow.com/questions/4084790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/417501/" ]
GHC is by far the most widely used Haskell compiler, and it offers the most features. There are other options, though, which sometimes have some benefits over GHC. These are some of the more popular alternatives: [Hugs](http://www.haskell.org/hugs/) - Hugs is an interpreter (I don't think it includes a compiler) which...
3,551
I have a chunk of text I need to paste into Illustrator. No matter what I do, I can't resize the text area without scaling the text. I want to resize the area and have the text wrap (font size to remain the same). How can I do this? I'm using CS5.1
2011/09/06
[ "https://graphicdesign.stackexchange.com/questions/3551", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/2357/" ]
Select your `Type` tool. Instead of clicking on your canvas, click and drag to draw a box. Put whatever copy you want inside the type box and when you resize the box it will reflow the text instead of changing the font. You can also link multiple type boxes together to flow text across multiple points on your artboard...
21,816,154
I have a question about if a animation ends that it will like `gotoAndStop()` to another frame ``` if (bird.hitTestObject(pipe1)) { bird.gotoAndStop(3); //frame 3 = animation } ``` after it ends it will need to go the Game Over frame (frame 3) and I use the `Flash Timeline` not `.as` thanks!
2014/02/16
[ "https://Stackoverflow.com/questions/21816154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3316757/" ]
Java does not provide a convenient way to list the "files" in a "directory", when that directory is backed by a JAR file on the classpath (see [How do I list the files inside a JAR file?](https://stackoverflow.com/questions/1429172/how-do-i-list-the-files-inside-a-jar-file) for some work-arounds). I believe this is bec...
3,197,405
I got the following crash logs after my app crashes: ``` 0 libobjc.A.dylib 0x000034f4 objc_msgSend + 20 1 UIKit 0x000a9248 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 644 2 UIKit 0x000a8eac -[UITableView(...
2010/07/07
[ "https://Stackoverflow.com/questions/3197405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27404/" ]
My best guess would be that something isn't linking correctly in one of you .xib views. Another common cause of this is an object being called upon that's already been released from memory. Try tracing this with `NSZombieEnabled`
22,953,075
I am using jQuery mobile 1.4.2. I need to shift the search icon from left to right and how can I avoid the clear button appearing. ``` <div data-role=page"> <form method="post"> <input name="search" id="search" value="" placeholder="Buscar" type="search" onfocus="this.placeholder = ''" onblur="this.placeho...
2014/04/09
[ "https://Stackoverflow.com/questions/22953075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3350169/" ]
The constructor is `new Rect(left,top,width,height)` Any fewer arguments will result in those many fields not being set. eg. `new Rect(1,2,3)` will return a Rect object with no height Screenshot here : <http://puu.sh/81KSa/e225064bec.png>
33,958,674
In the repository class of WebApi project there is the method `GetSingleIncluding()` that returns an entity with indluded objects that were passed as parameters. ``` private readonly EFDbContext _context; private IDbSet<T> _entities; private IDbSet<T> Entities { get { _entities = _entities ...
2015/11/27
[ "https://Stackoverflow.com/questions/33958674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4275342/" ]
With the information we have so far, I think you need a query with a PIVOT: ``` SELECT P.VehicleNo, V.DriverConsoleVersion, P.[1] AS [Device1SwVersion], P.[2] AS [Device1SwVersion], P.[3] AS [Device1SwVersion] FROM ( SELECT VehicleNo, [1], [2], [3] FROM ( SELECT VehicleNo, DevicePosition, DeviceSwVersi...
70,504,314
I have some code which captures a key. Now i have in event.code the real key-name and in event.key i get the key-char. To make an example: I press SHIFT and J, so i get: *event.code: SHIFT KEYJ* *event.key: J* So, i get in event.key the "interpreted key" from shift J. But now i need to convert the native key to a cha...
2021/12/28
[ "https://Stackoverflow.com/questions/70504314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17779252/" ]
Solution was the H2 version. We upgraded also H2 to 2.0 but that version is not compatible with Spring Batch 4.3.4. Downgrade to H2 version 1.4.200 solved the issue.
11,240,180
I want to run a .exe file (or) any application from pen drive on insert in to pc. I dont want to use Autorun.inf file, as all anti virus software's blocks it. I have used portable application launcher also, that also using autorun only. so once again anti virus software blocks it. Is there any alternative option, such ...
2012/06/28
[ "https://Stackoverflow.com/questions/11240180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1487797/" ]
Anti-virus programs block autorun.inf on the solely purpose not to allow some .exe-s to start automatically on pen drive insert. So, basically, what you're asking is impossible.
1,712,401
Here is what I have so far: Let $\varepsilon > 0$ be given We want for all $n >N$, $|1/n! - 0|< \varepsilon$ We know $1/n <ε$ and $1/n! ≤ 1/n < ε$. I don't know how to solve for $n$, given $1/n!$. And this is where I get stuck in my proof, I cannot solve for $n$, and therefore cannot pick $N > \cdots$.
2016/03/25
[ "https://math.stackexchange.com/questions/1712401", "https://math.stackexchange.com", "https://math.stackexchange.com/users/325725/" ]
Since $0 < \frac{1}{n!} < \frac{1}{n}$, by the squeeze theorem... Without squeeze theorem: Let $\epsilon > 0$. Define $N = \epsilon^{-1}$. Then if $n > N$, $$\left|\frac{1}{n!}\right| = \frac{1}{n!} < \frac{1}{n} < \frac{1}{N} = \epsilon$$
5,637,808
I got my first android phone since two week And I'm starting my first real App. My phone is a LG Optimus 2X and one of the missing thing is a notification led for when there is a missed call, sms, email ect ... So I'm wondering what's the best way to do this. For know I've a broatcastreceiver for incoming sms, and th...
2011/04/12
[ "https://Stackoverflow.com/questions/5637808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/704403/" ]
``` UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(myCallback:)]; self.navigationItem.rightBarButtonItem = addButton; [addButton release]; ```
151,322
Recently, I read a lot of good articles about how to do good encapsulation. And when I say "good encapsulation", I am not talking about hiding private fields with public properties; I am talking about preventing users of your API from doing wrong things. Here are two good articles about this subject: <http://blog.plo...
2012/06/02
[ "https://softwareengineering.stackexchange.com/questions/151322", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/44035/" ]
Answer: When you have your interface complete, then automatically you are done with encapsulation. It does not matter if implemenation or consumption part is incomplete, you are done since interface is accepted as final. **Proper development tools should reduce cost more than tools cost themself.** You suggest that i...
14,790,045
I am trying to insert a new column into a CSV file after existing data. For example, my CSV file currently contains: ``` Heading 1 Heading 2 1 1 0 2 1 0 ``` I have a list of integers in format: ``` [1,0,1,2,1,2,1,1] ``` **How can i insert this list into the CSV file under 'Header 2'?** ...
2013/02/09
[ "https://Stackoverflow.com/questions/14790045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1987845/" ]
I guess this question is already kind of old but I came across the same problem. Its not any "best practice" solution but here is what I do. In `twig` you can use this `{{ path('yourRouteName') }}` thing in a perfect way. So in my `twig` file I have a structure like that: ``` ... <a href="{{ path('myRoute') }}">...
24,923,412
I am attempting to use Tkinter for the first time on my computer, and I am getting the error in the title, "NameError: name 'Tk' is not defined", citing the "line root = Tk()". I have not been able to get Tkinter to work in any form. I am currently on a macbook pro using python 2.7.5. I have tried re-downloading python...
2014/07/24
[ "https://Stackoverflow.com/questions/24923412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3871003/" ]
You have some other module that is taking the name "Tkinter", shadowing the one you actually want. Rename or remove it. ``` import Tkinter print Tkinter.__file__ ```
280,990
I have a list: ``` \begin{enumerate}[label={[\Roman*]},ref={[\Roman*]}] \item\label{item1} The first item. \end{enumerate} ``` What I want to achieve is this: In the most instances, I want to refer to the items of the list by the format specified above (that is: `\ref{item1}` should in general produce "[I]"). Ho...
2015/12/01
[ "https://tex.stackexchange.com/questions/280990", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/93296/" ]
Define `ref=` to use a macro, instead of the explicit brackets; such a macro can be redefined to do nothing when the brackets are not wanted. ``` \documentclass{article} \usepackage{enumitem,xparse} \usepackage[colorlinks]{hyperref} \makeatletter \NewDocumentCommand{\nobracketref}{sm}{% \begingroup\let\bracketref\@...
1,556,700
there is a page ($9\times 9$) how many different rectangles can you draw with odd area? rectangles are different if they are different on size and place. for example if a rectangle is $15$ squares, its area is odd. if a rectangle is $12$ squares, its area is even. I have no idea how to approach this question so I c...
2015/12/02
[ "https://math.stackexchange.com/questions/1556700", "https://math.stackexchange.com", "https://math.stackexchange.com/users/295268/" ]
If the area has to be odd, the length and breadth both have to be odd. Hence, we count the number of rectangles by first choosing a row and a column ($10 \cdot 10$ ways to do this), and then choosing another row and column which are at an odd distance from the chosen one ($5 \cdot 5$ ways to do this). But we have count...
31,633,191
What is the best way of removing element from a list by either a comparison to the second list or a list of indices. ``` val myList = List(Dog, Dog, Cat, Donkey, Dog, Donkey, Mouse, Cat, Cat, Cat, Cat) val toDropFromMylist = List(Cat, Cat, Dog) ``` Which the indices accordance with myList are: ``` val indices = Li...
2015/07/26
[ "https://Stackoverflow.com/questions/31633191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/79147/" ]
Using `toDropFromMylist` is actually the simplest. ``` scala> myList diff toDropFromMylist res0: List[String] = List(Dog, Donkey, Dog, Donkey, Mouse, Cat, Cat, Cat) ```
233,158
I am working on a web api and I am curios about the `HTTP SEARCH` verb and how you should use it. My first approach was, well you could use it surely for a search. But asp.net WebApi doesn't support the `SEARCH` verb. My question is basically, should I use `SEARCH` or is it not important? PS: I found the `SEARCH` ve...
2014/03/21
[ "https://softwareengineering.stackexchange.com/questions/233158", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/82918/" ]
The HTTP protocol is defined by RFC documents. RFC2616 defines HTTP/1.1 the current release. SEARCH is not documented as a verb in this document.
3,639,718
I recreated a Select box and its dropdown function using this: ``` $(".selectBox").click(function(e) { if (!$("#dropDown").css("display") || $("#dropDown").css("display") == "none") $("#dropDown").slideDown(); else $("#dropDown").slideUp(); e.preventDefault(); }); ``` The only problem is ...
2010/09/03
[ "https://Stackoverflow.com/questions/3639718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/324529/" ]
You also need to stop a click from *inside* the `#dropdown` from bubbling back up to `body`, like this: ``` $(".selectBox, #dropdown").click(function(e) { e.stopPropagation(); }); ``` We're using [`event.stopPropagation()`](http://api.jquery.com/event.stopPropagation/) it stops the click from bubbling up, causing...
28,429,768
Lets say I have a `ItemsControl`which is used to render buttons for a list of viewModels ``` <ItemsControl ItemsSource="{Binding PageViewModelTypes}"> <ItemsControl.ItemTemplate> <DataTemplate> <Button Content="{Binding Name}" CommandParameter="{Binding }"...
2015/02/10
[ "https://Stackoverflow.com/questions/28429768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/931051/" ]
Bind the button content to the item content and your templates will be resolved to the actual types: ``` <ItemsControl.ItemTemplate> <DataTemplate> <Button Content="{Binding}" CommandParameter="{Binding }" /> </DataTemplate> </ItemsControl.ItemTemplate> ```
39,070,614
Here is a program about the Fibonacci sequence. Each time the code branches off again you are calling the fibonacci function from within itself two times. ``` def fibonacci(number) if number < 2 number else fibonacci(number - 1) + fibonacci(number - 2) end end puts fibonacci(6) ``` The only thing I u...
2016/08/22
[ "https://Stackoverflow.com/questions/39070614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is just the direct 1:1 translation (with a simple twist) of the standard mathematical definition of the Fibonacci Function: ``` Fib(0) = 0 Fib(1) = 1 Fib(n) = Fib(n-2) + Fib(n-1) ``` Translated to Ruby, this becomes: ``` def fib(n) return 0 if n.zero? return 1 if n == 1 fib(n-2) + fib(n-1) end ``` It's...
20,506,847
How can I retrieve all keys in a Hash in Ruby, also the nested ones. Duplicates should be ignored, e.g. ``` { a: 3, b: { b: 2, b: { c: 5 } } }.soberize => [:a, :b, :c] ``` What would be the fastest implementation?
2013/12/10
[ "https://Stackoverflow.com/questions/20506847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1642429/" ]
Simple recursive solution: ``` def recursive_keys(data) data.keys + data.values.map{|value| recursive_keys(value) if value.is_a?(Hash) } end def all_keys(data) recursive_keys(data).flatten.compact.uniq end ``` Usage: ``` all_keys({ a: 3, b: { b: 2, b: { c: 5 } } }) => [:a, :b, :c] ```
11,602,072
I'm reading through K&R and the question is to: write a program to copy its input to its output, replacing each string of one or more blanks by a single blank. In my mind I think I know what I need to do, set up a boolean to know when I am in a space or not. I've attempted it and did not succeed. I've found this code a...
2012/07/22
[ "https://Stackoverflow.com/questions/11602072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1259395/" ]
At this point: ``` if(c == ' ') { if(inspace == 0) // <-- here ``` If inspace is equal to 1, it will not execute the if body, it will jump to: ``` if(c != ' ') { ``` And as long as c == ' ' above will be false, so it will skip the if body and jump to: ``` while((c = getchar()) != EOF) { ``` And this will c...
172,847
I am new to CartoDB/Leaflet. Here's my fiddle... <http://jsfiddle.net/zippyferguson/fLkqgf4q/1/> If you click the play button, I want it to load data to the map year by year from 1966 to 2015 from a CartoDB query. But, with each iteration, the map is cleared of data, and then the next year data appears. I am looking t...
2015/12/07
[ "https://gis.stackexchange.com/questions/172847", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/62913/" ]
You correctly remove previous layer(s) only once the data for the new layer is received, but not its tiles (images). That is why your map appears empty for a short time. You could first attach your `removeAllLayersExcept` callback to the [`"load"` event](http://leafletjs.com/reference.html#tilelayer-load) of your new ...
284,563
I am going to move from Blogger to WordPress and I also don't want to set earlier Blogger Permalink structure in WordPress. Now I want to know if there is any way to redirect URLs as mentioned below. Current (In Blogger): ``` http://www.example.com/2017/10/seba-online-form-fill-up-2018.html ``` After (In WordPress)...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284563", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
If `/seba-online-form-fill-up-2018.html` is an actual WordPress URL then this is relatively trivial to do in `.htaccess`. For example, the following one-liner using mod\_rewrite could be used. This should be placed *before* the existing WordPress directives in `.htaccess`: ``` RewriteRule ^\d{4}/\d{1,2}/(.+\.html)$ /$...
36,739,985
Here is my code at the moment ``` percentagesOff = [5,10,15.....] for percentage in percentagesOff: print("Percent off: ",percentage, end= " ") ``` and the output looks like this ``` Percent off: 5 Percent off: 10 Percent off: 15 ``` and so on. This is an example of what I want my code to look like. (have ...
2016/04/20
[ "https://Stackoverflow.com/questions/36739985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6027397/" ]
I really dislike teachers who tell students to accomplish something without having shown them the *right* tool for the job. I'm guessing you haven't yet been introduced to the `string.format()` method? Without which, lining up your columns will be an utter pain. You're trying to use a hammer when you need a screwdriver...
12,765,480
Are there any major overhead differences between using a `UNIQUE` constraint on two columns and simply having one column that contains the concatenation of the two column values/GUID and using an index on that? For example, instead of using `|John|Smith|` (two different columns) as the unique constraint, would it be mo...
2012/10/07
[ "https://Stackoverflow.com/questions/12765480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/369784/" ]
I would go with adding those two columns and define a unique constraint on them as they seem to have business relevance and a GUID doesn't seem to be suitable. Also, the motivation to NOT combine them is to avoid any `SUBSTRING` operations at a later point to process them separately.
22,105,306
So I have this script that is a counter that follows an infinite animation. The counter resets to 0 everytime an interation finishes. On the line fourth from the bottom I am trying to invoke a x.classList.toggle() to change css when the counter hits 20. When I replace the classList.toggle with an alert() function it wo...
2014/02/28
[ "https://Stackoverflow.com/questions/22105306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3355076/" ]
You can't append a `list` to a `tuple` because tuples are ["immutable"](http://docs.python.org/2/library/functions.html#tuple) (they can't be changed). It is however easy to append a *tuple* to a *list*: ``` vertices = [(0, 0), (0, 0), (0, 0)] for x in range(10): vertices.append((x, y)) ``` You can add tuples to...
7,233,392
Is there any way I can authenticate a Facebook user without requiring them to connect in the front end? I'm trying to report the number of "likes" for an alcohol-gated page and will need to access the information with an over-21 access token, but do not want to have to log in every time I access the data. Or is there...
2011/08/29
[ "https://Stackoverflow.com/questions/7233392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/402606/" ]
When you're requesting the access token you're going to use to check the Page, request the `offline_access` extended permission and the token won't expire when you/the user logs out.
23,673,577
I have an object that is apparently double deleted despite being kept track of by smart pointers. I am new to using smart pointers so I made a simple function to test whether I am using the object correctly. ``` int *a = new int(2); std::shared_ptr<int> b(a); std::shared_ptr<int> c(a); ``` This set of lines in the ...
2014/05/15
[ "https://Stackoverflow.com/questions/23673577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3639950/" ]
A `shared_ptr` expects to *own* the pointed-at object. What you've done is to create *two* separate smart pointers, each of which thinks it has exclusive ownership of the underlying `int`. They don't know about each other's existence, they don't talk to each other. Therefore, when they go out of scope, both pointers d...
230,264
I was reading about CMS and ERP. And got confused at this point that whether a system can both be an ERP and a CMS? is it possible?
2014/02/25
[ "https://softwareengineering.stackexchange.com/questions/230264", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/121236/" ]
In a very theoretical sense yes. But in most cases this would not make very much sense. The basic functionality of an ERP system is business management. The data produced here may become part of the data displayed on a web site. But normally the data here is pure text and numbers, like definitions of products, orders, ...
286,606
In the application there is a dialog where only numeric string entries are valid. Therefore I would like to set the numeric keyboard layout. Does anyone know how to simulate key press on the keyboard or any other method to change the keyboard layout? Thanks!
2008/11/13
[ "https://Stackoverflow.com/questions/286606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22996/" ]
You don't need to. Just like full windows, you can set the edit control to be numeric input only. You can either do it [manually](http://msdn.microsoft.com/en-us/library/bb761655(VS.85).aspx) or in the dialog editor in the properites for the edit control. The SIP should automatically display the numeric keyboard when...
844,323
If $\cos{(A-B)}=\frac{3}{5}$ and $\sin{(A+B)}=\frac{12}{13}$, then find $\cos{(2B)}$. Correct answer = 63/65. I tried all identities I know but I have no idea how to proceed.
2014/06/23
[ "https://math.stackexchange.com/questions/844323", "https://math.stackexchange.com", "https://math.stackexchange.com/users/159625/" ]
Every $B(4,k)$ admits a graceful labeling. We prove this by induction on $k$. Our induction hypothesis is: every $B(4,k)$ admits a graceful labeling where the vertex of degree 1 has label 0. For $k=1$ we cyclically assign the labels $1,4,3,5$ to the vertices of the cycle. Then add one pending edge to the vertex with l...
51,548,884
``` try: folderSizeInMB= int(subprocess.check_output('du -csh --block-size=1M', shell=True).decode().split()[0]) print('\t\tTotal download progress (MB):\t' + str(folderSizeInMB), end = '\r') except Exception as e: print('\t\tDownloading' + '.'*(loopCount - gv.parallelDownloads + 3), end = '\r') ``` I hav...
2018/07/26
[ "https://Stackoverflow.com/questions/51548884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2868465/" ]
The error is being shown by the shell, printing to stderr. Because you’re not redirecting its stderr, it just goes straight through to your own program’s stderr, which goes to your terminal. If you don’t want this—or any other shell features—then the simplest solution is to just not use the shell. Pass a list of argum...
81,247
I work with reconstructing fossil skeletons of human ancestors. Bones are usually incomplete and I need to assemble whole virtual bones from laser scans of different fossil parts of the bone I have scanned. How can I efficiently delete parts I don't need so that I can assemble whole virtual bones? I know it's easy to d...
2017/06/12
[ "https://blender.stackexchange.com/questions/81247", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/40161/" ]
Hope this helps: You can try centering the mesh in an axis (X or Y most commonly) and then use `numpad 1` or `numpad 3` to get an isometric view of the mesh along that axis. (Depending on your blender config, you might need to also press `numpad 5`) Then you can press `z` and `tab` to go into wireframe mode and edit ...
6,527,788
In Objective C I want to create a simple application that posts a string to a php file using ASIHTTPRequest. I have no need for an interface and am finding it hard to find any example code. Does anyone know where I can find code, or can anyone give me an example of such code?
2011/06/29
[ "https://Stackoverflow.com/questions/6527788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/559142/" ]
The ASIHTTPRequest documentation covers this. Specifically, [Sending a form POST with ASIFormDataRequest](http://allseeing-i.com/ASIHTTPRequest/How-to-use#sending_a_form_post_with_ASIFormDataRequest).
451,792
I am using Survival Analysis to analyse a data set, but i'm having a bit of trouble. The data consists of everyone who has/has not been terminated from employment within a 4 year period. The aim of the analysis is to uncover the median time to termination. The data includes 400 people who has experienced the event a...
2020/02/28
[ "https://stats.stackexchange.com/questions/451792", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/237783/" ]
Median survival here is the time at which 50% of your participants would still be non-terminated. The lower the risk (hazard) of an event (in your case being "terminated"), the longer it will take to get to the point where 50% of participants have had that event. An example: simulate data similar to yours: ``` set....
69,224
I have this metric: $$ds^2=-dt^2+e^tdx^2$$ and I want to find the equation of motion (of x). for that i thought I have two options: 1. using E.L. with the Lagrangian: $L=-\dot t ^2+e^t\dot x ^2 $. 2. using the fact that for a photon $ds^2=0$ to get: $0=-dt^2+e^tdx^2$ and then: $dt=\pm e^{t/2} dx$. The problem is tha...
2013/06/26
[ "https://physics.stackexchange.com/questions/69224", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/26299/" ]
If your solution is not a null geodesic then it is wrong for a massless particle. The reason you go astray is that Lagrangian you give in (1) is incorrect for massless particles. The general action for a particle (massive or massless) is: $$ S = -\frac{1}{2} \int \mathrm{d}\xi\ \left( \sigma(\xi) \left(\frac{\mathrm{...
72,924,818
I've been trying for a long time to write the results to my file, but since it's a multithreaded task, the files are written in a mixed way The task that adds the file is in the get\_url function And this fonction is launched via pool.submit(get\_url,line) ``` import requests from concurrent.futures import ThreadPoo...
2022/07/09
[ "https://Stackoverflow.com/questions/72924818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19518180/" ]
You can use [`multiprocessing.Pool`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool) and `pool.imap_unordered` to receive processed results and write it to the file. That way the results are written only inside main thread and won't be interleaved. For example: ```py import requests i...