INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Why is this MySQL query case sensitive? I am trying to do a query on my MySQL database. I want it to be case insensitive. If "RED" exists in the database and I search for "red", I want the result to show. Unfortunately, this query is being case-senstivie and I dont know why: $color = "red"; $size = "large"; $query = mysql_query("SELECT * FROM items WHERE color = '$color' OR size = '$size'"); while ($row = mysql_fetch_array($query)) { if ($color == $row['color']) { echo "The color exists in the database"; } if ($size == $row['size']) { echo "The size exists in the database"; } } Using this example, "RED" exists in the database, but it's not being found. What's wrong with the query?
Because the collation of you column is case sensitive
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "php, mysql" }
Opposite operation for explode in pandas for several columns at once I have a pandas dataframe with 150 columns and 5000 rows. I want to select only those rows with a given condition, i.e. df[df['first_column] == 1]. Then, I want to convert all the columns of this selection to a single row, where each column is a list. i.e.: print(df[df['first_column] == 1]) first_column second_column third_column ... 1 2 A 1 4 B 1 6 A I want this to be: first_column second_column third_column ... 1 2, 4, 6 A, B, A where in each column either is a list or a dataframe. Which approach should I use to avoid for loops?
Simple check df.groupby('first_column').agg(','.join)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, pandas" }
where is my Grub? Where is my GRUB located?? I want to install BURG now so i want to know where GRUB is. This is my partition table.Plz help. !enter image description here I tried The boot info script but cannot understand anything from its output.. The output is- Boot Info Script 0.61 [1 April 2012] > ============================= Boot Info Summary: =============================== > > => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of the same hard drive for core.img. core.img is at this location and looks for (,msdos8)/boot/grub on this drive.
In your case, the software 'grub' is located in /dev/sda8 /boot/grub For configuration see /etc/default/grub Probably grub is started in your master boot record of the harddisk /dev/sda
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 2, "tags": "12.04, grub2, partitioning, burg" }
Where to store Auth0 domain and client id? I'm trying to understand how to securely store Auth0 DOMAIN and CLIENT ID. Looking at this example app < seems like they had it stored somewhere else. Would appreciate if someone can give me some insights.
The example you have given wants you put your credentials there. You can tell that by the quotes: domain: '{DOMAIN}', clientId: '{CLIENT_ID}', So, you will put your credentials like: domain: 'some domain here', clientId: 'some client id here', Then those credentials are being imported by Auth.js file. They don't import them anywhere as you you thought, they just don't need to hide them since domain and client id does not need to be kept as secret. You can find a good answer here explaining why they are not `secrets` for frontend.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "reactjs, oauth, oauth 2.0, single page application, auth0" }
angularjs amount of method calls in in-include with ng-repeat We need to render a tree structure with angularjs. We are doing it with recursive templates, and it works before we have more than 100 items in the tree. What I noticed it that `getTemplate` method is called multiple times. I know that its ok for angular to do that, but as for me it is too much. In this simple example `getTemplate` method is called 9 times, I don't believe that this won't hurt the performance. In our real case with recursive template amount of get template is just insane and can reach 100 for 3 items in tree. Is there any way to optimize ng-include somehow? Sample: <
This part of the code gets reevaluated everytime there is a new digest cycle, to check if anything has changed : <ng-include src="itemTemplate(i)"></ng-include> That's why you got so much calls. I think the best solution is to put all your tree data in a data structure like an array, put in on the scope, and only then, render it. Example here on plnkr
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, angularjs, angularjs ng repeat" }
javascript chinese/japanese character decoding I created a JSONP function on the server and returns a UTF-8 encoded json object like this applyLocalization({"Name":"%E5%90%8D%E5%89%8D","Age":"%E5%B9%B4%E9%BD%A2"}); on my javascript on the client side, i want to convert the garbled part to their original state like {"Name":"", "Age":""} I tried $.parseJSON() but it doesnt work
You can use `decodeURIComponent` to decode urlencoded strings like yours decodeURIComponent('%E5%90%8D%E5%89%8D'); //result: ''
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 2, "tags": "javascript, utf 8, decode" }
PHP IPC with geth Ethereum I have setup geth Ether testnet. I want to communicate over IPC PHP with the client. Im on Ubuntu. This is my current code: $myValType = NULL; $msg = ""; ($key = ftok("/home/john/.ethereum/testnet/geth.ipc","=")); $queue = msg_get_queue($key); msg_send($queue, 1, '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":1}'); msg_receive($queue,0,$myValType,2048,$msg); dd($msg); # (Die and Dump, Laravel) This is the IPC File(FIFO?): srwxrwxrwx 1 john john 0 Jun 17 01:30 geth.ipc= This is working fine echo '{"jsonrpc":"2.0","method":"rpc_modules","params":[],"id":1}' | nc -U geth.ipc I'm not sure how to actually communicate with the client. There is no response from it when sending. On `msg_receive` it just returns the initial sent message. Someone hase expirience and be so kind and give me a proper solution?
Update: I found out how it works. I used PHP Sockets $sock = socket_create(AF_UNIX, SOCK_STREAM, 0); socket_connect($sock, "/home/john/.ethereum/testnet/geth.ipc",1); $myBuf = null; $msg = "{\"jsonrpc\":\"2.0\",\"method\":\"rpc_modules\",\"params\":[],\"id\":1}"; socket_send($sock, $msg, strlen($msg), MSG_EOF); socket_recv ( $sock , $myBuf , 100 ,MSG_WAITALL ); Instead of using MSG Queues I could make it work with simple PHP Socket to the IPC File!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, laravel, ipc, ethereum" }
How to type "any object" type? I know I can type a "object" with `object` keyword, but how to type it as "any object" without using the `any` keyword? (because `any` will allow any primitive types like string or number). let a:object; a.foo // error: Property 'foo' does not exist on type 'object'.
You can use an index type, like `{[key: string]: any}` which says "an object with property names that are strings, whose values are `any`" or `{[key: string]: string | number}` which says the property names will be strings and the values will be strings or numbers. This does remove a lot of TypeScript's functionality for that object, though, since it can't tell you whether you're using properties that won't exist...
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "typescript" }
Does stripe in Selle Italia saddles form a channel? **NOTE** \-- I am NOT asking about saddles with hole (cutout). Some saddles from Selle Italia have very distinctive stripe, take for example Selle Italia SL: !enter image description here **The question is** \-- does such stripe form some kind of channel? I.e. is the area softer (here it is denoted by black) than the rest of the saddle (here in white)? Or maybe it is embedded (the surface is lower than the rest of the saddle)?
To answer your question, no. The leather/lorica/covering has no bearing on the shape of the saddle. They make a lot of versions of each design specifically for bike manufacturers with custom designed coverings in addition to their standard covering design. They make quite a few saddles with grooves, without grooves, with and without cutouts. It's not entirely clear which model this is from your image or description as they do not have an "SL" model on their current product listing. They do have an "SLR" line and the shape appears to be of the "SLR monolink" variety which has both a non groove and groove model within it. As stated above in the comments, it's best to go to your local shop and ask that if they do not have the item in stock, that they order one for you. Most will oblige because they can send items back if they are in unused condition. Some will ask for a deposit as a "holding" fee to ensure that you don't ask them to order a bunch of stuff and never come back.
stackexchange-bicycles
{ "answer_score": 4, "question_score": 2, "tags": "saddle" }
Проблемы с видимостью классов В коде ругается на строчку private ArrayList<QuizCard> cardList; пишет следущую ошибку: > QuizCardBuilder.java:10: cannot find symbol symbol : class QuizCard > location: class QuizCardBuilder > private ArrayList<quizcard> cardList; сам код примерно такой: import java.util.*; public class ClassTest{ private ArrayList<QuizCard> cardList; public static void main(String [] args){ ClassTest test = new ClassTest(); test.go(); } public void go(){ .... cardList = new ArrayList<QuizCard>(); } // и так далее..... } объясните пожалуйста, в чём суть проблемы??
Так ведь в ошибке чётко сказано > QuizCardBuilder.java:10: **cannot find symbol** > > symbol : **class QuizCard** Стало быть, нет никакого QuizCard. И ни при чём тут ArrayList
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "java" }
Inserting space/gaps between floating tables I am using float in css to display multiple tables vertically next to one another however float puts them without any spacing in between. How can I insert some gaps betwen these tables? table{ float: left; border:none; border-collapse: collapse; }
you shall use the margin property table { margin:0 10px; } For info, the 0 corresponds to the above and under margin, and the 10 for the left and right margin. You could also write it like margin(0 10px 0 10px); which stands for up - right - bottom - left
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css" }
need help in proving $\sum_{p^n \leq x, n\geq 2} \frac{\log p} {p} =O(1)$. This question is a part of merten's formula and I am struck on this particular equation and need help. > Prove that $\sum_{ p^n \leq x, n\geq 2 } \frac{\log p} {p} =O(1)$, where $O$ is big O notation. I am sorry but I am unable to get any intution, although question seem to be easy and maybe that's why no explanation is given. A hint would be sufficient. Thanks.
You've asked to prove that $$ \sum_{p^n \leq x, n \geq 2} \frac{\log p}{p} = O(1). $$ This is false. The sum is bounded below by $$ \sum_{\substack{p \\\ p^2 \leq x}} \frac{1}{p} = \sum_{p \leq \sqrt{x}} \frac{1}{p} \gg \log \log (\sqrt {x}).$$ It is necessary to go about your proof of Merten's formula in a different way.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "number theory, analytic number theory" }
Limit return size of GAE url_fetch get method? I'm trying to grab the Id3 info out of Mp3 files stored online without grabbing the whole file and from a lot of googling the best method seems to be grabbing the first couple kb of the file then getting it from that. Is there a way in googles app engine (python) to get just the start of a file from it's URL? Something like rpc.size_limit = 4096 rpc = urlfetch.create_rpc(deadline=10.0) urlfetch.make_fetch_call(rpc, url, method=method, headers=headers, payload=payload, allow_truncated=True) return rpc Thanks for any help in advance.
Found it! You can just put a range in the headers if the website accepts the header as follows headers["Range"] = "bytes = 0-4096" Or you can use the something like the following if the website doesnt like the range header (so far the few I've tried all have) host = ' req = urllib2.Request(host, headers={'User-Agent' : "Magic Browser"}) response = urllib2.urlopen(req).read(4*1024) Hopefully this saves some time to someone in the future!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, google app engine, urllib2" }
Illegal CSS Selector I want to use this CSS selector with Selenium webdriver #coordinatonTable .odd:not(:has(.dataTables_empty)) I get an "An invalid or illegal string was specified" error. I tried the jquery selector test from w3schools. Also this service show me "illegal selector". If I shorten the selector it works #short .odd:not(:has(.dataTables_empty)) #coordinatonTable .odd:not(:has(.short)) #short .odd:not(:has(.short)) Looks like the selector is to long. But this can not really be true. Any suggest? The structure of the html part is like this: id="coordinatonTable" class="odd" class="dataTables_empty" class="odd" class="something" class="odd" class="somethingelse" ... I want get all odd element if they has no empty child.
`:has` is not a valid CSS selector. It is a jQuery extension and will be invalid in any CSS file. I have no idea why your other examples didn't cause an error. They do for me.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "css, selenium, css selectors" }
To sort out atoms first and then sublists from a list in LISP I have this homework in LISP where I need to sort out atoms and then sublists from a list. I'm sure this is supposed to be easy task but as I'm not much of a programmer then this is really taking quite a while for me to understand. I have this list of numbers: (5 -1 (2 6 1) (8 7 -3) (0 (9 4)) -6) And if I understand correctly my task then I should get something like this: (5 -1 -6 (2 6 1) (8 7 -3) (0 (9 4))) So far all I found out is how to count atoms and/or sublists but I don't need that. (DEFUN ATOMNUMBER (L) (COND ((NULL L) 0) ((ATOM (CAR L)) (+ 1 (ATOMNUMBER (CDR L)))) (T (ATOMNUMBER (CDR L))) )) Also that function should work correctly even when there are only sublists, only atoms or just empty list. Maybe someone can give me any examples? Thanks in advance!
I am more used to Scheme but here's a solution that works in Lisp: (defun f (lst) (labels ((loop (lst atoms lists) (cond ((null lst) (append (reverse atoms) (reverse lists))) ((atom (car lst)) (loop (cdr lst) (cons (car lst) atoms) lists)) (T (loop (cdr lst) atoms (cons (car lst) lists)))))) (loop lst '() '()))) (f '(5 -1 (2 6 1) (8 7 -3) (0 (9 4)) -6)) Basically you iterate over the list, and each element is either appended to the atoms list or the lists lists. In the end you join both to get your result. **EDIT** The remove-if version is way shorter, of course: (let ((l '(5 -1 (2 6 1) (8 7 -3) (0 (9 4)) -6))) (append (remove-if-not #'atom l) (remove-if #'atom l)))
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "lisp, common lisp, difference lists" }
How to decode this little endian(int32) message? I have a task to do. I get lot of data and my job is to decode it. Every piece I get is written in readable string of hex numbers. For example: "8a fd ff ff" I tried with `struct.unpack('<l', "8a fd ff ff")` and I also tried a lot of way to decode and it would be too long to list. Only thing I know that this should give me -630 as a result. I don't know how the data was transformed to this form. data = "8a fd ff ff" aa = np.array(list(data)) print(aa) struct.unpack('<l', aa) > struct.error: unpack requires a buffer of 4 bytes so the result should be -630. I tested it with an online hex decoder.
A find the first answer good, but a more intuitive, and easier to remember is following. Given that all of your data is given as a space separated string of hex numbers you can use : data = "8a fd ff ff" bytes_data = bytes.fromhex( data.strip() ) struct.unpack("<l", bytes_data) In this example we first load the data, remove all the whitespaces, convert to binary hex representation and read it out. Output is as you expect it to be.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python, arrays, string, hex" }
Unable to deduce type parameters in global function I’m trying to wrap a heavily templatized C++ library that uses classes and global functions acting on them. I would like to know why, in the following example, the Cython compiler gives me the error “Unable to deduce type parameters” in `get(c, 1)` whereas I get no complaints about the line preceding it: cdef extern from "file.h": cdef cppclass Container[T]: pass T get_firstT T getT cdef Container[int] c get_first(c) get(c, 1) The contents of `file.h` are not relevant since the message is emitted by the Cython compiler, which does not look at the file (it only generates an `#include` statement for it). The problem can be reproduced without even the file existing. _This question has also been posted to the Cython users mailing list on July 1st._
This looks like a bug in Cython. Cython is unable to deduce the type parameters for that function call because the type of the second argument is different (`size_t` vs `long`). It should implicitly convert the argument as C++ does while searching for (templated) overloads, but it aborts template deduction when the type of the non-template `size_t` argument doesn't match. To make the template deduction succeed, you can write `get(c, <size_t>1)` (or store the second argument in a variable of type `size_t` before passing it to `get()`). To specify the desired template yourself and skip template deduction entirely, you can do as DavidW said and write `getint` I've posted the technical details to the Cython users mailing list.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "python, c++, templates, cython" }
Excel Files Temporary Exist? I need to find out where an Excel workbook exists BEFORE it is ever saved? I've searched for it using the time and date of creation but wondering if creation really means first save? Appreciate the help.
These files are saved under your user profile's temporary file folder. Excel also cleans these files up, so it's likely you data is deleted if you haven't saved it or Excel has been closed since then.
stackexchange-superuser
{ "answer_score": 0, "question_score": -1, "tags": "microsoft excel 2007" }
Change title of the Ant Design table depending on state value I need a bit of help here, In an Ant Design table, I need the title of a table should change depending on the state value. In the given sandbox example the column title `surname` should change to `Second Name` where the switch in on, else it should show `surname` only. Reference: < Thank you.
You can change title based on `surNameShow` render() { const { dataSource, surNameShow } = this.state; const columns = this.columns; // check and set title here // If you want to change the second column you can use index 1, if you want it to be dynamic just loop through columns array update column you desire if (surNameShow) { columns[1].title = "Second Name"; } else { columns[1].title = "Surname"; } return ( <div> <p className="mr-3"> Change Surname to Second Name</p> <Switch onChange={() => this.handleChnage()} /> <Table bordered dataSource={dataSource} columns={columns} pagination={false} /> </div> ); } Codesandbox demo
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "reactjs, state, antd" }
"На смехотворной зарплате" (осталась), - предлог годится? > Престарелая дама, что служила здесь смотрительницей до самой смерти, в какой-то момент **осталась единственным сотрудником на смехотворной зарплате** и махнула рукой на эту гору работы. На окладе - да, со смехотворной - да, а тута как?
Даже не знаю... Как будто бы и не очень смотрится, но и не просторечно. По крайней мере, приемлемо в связи с нашей современной действительностью. Ведь говорим же мы "перевести на меньшую зарплату"? Значит, можно и "сотрудник на зарплате". По-моему, в бытовом смысле допустимо, здесь же не книжная речь - разговорная.
stackexchange-rus
{ "answer_score": 1, "question_score": 1, "tags": "грамотная речь, предлоги, выбор варианта" }
What if the seeds sown outdoors are covered by a transparent cover in the initial stage? I recently started _Echinacea angustifolia_ from seeds indoors, and I noticed an incredible speed and reliability of germination achieved just by covering the seed tray with transparent plastic sheet (the seedlings appeared in just 5 days, germination rate 70%-80%). The cover was removed after 5 days, when seedlings appeared en masse. Can a similar method be applied if the seeds are sown outdoors, directly in the garden? I mean, covering the area where the seeds are sown with some transparent cover for few days, or until germination? Or perhaps I don't see some bad side effects of doing that?
I'm not sure. On seedling pots, the plastic will increase the humidity (and constant humidity), so seeds germinate earlier. Outdoor, the principle it is the same, but you have much more soil, so water could go down. The soil is also more "lively", so you can have more damages from animals (because it is wet) and more fungi. But I think it depends on soil. Try and test the method. ADDENDUM: For sure it will help the seeds not be be eaten by birds. Plastic is also used in later phases, to keep soil more moist (less evaporation). Personally, I think it will have some effect, but not as large as in seedling bed/pots.
stackexchange-gardening
{ "answer_score": 4, "question_score": 4, "tags": "germination, sowing" }
Increment and while loop Following is the code I'm executing in IDLE for Python 3.5.2 on Windows 10: spam = 0 while spam < 5: print('Hello, world.') spam = spam + 1 I can see Hello World printed 5 times however when entering spam in IDLE, I can see the integer 5. Shouldn't this be logically int 6 since while loop will stop as soon as the spam is incremented by 1 from 5 and spam variable is passed with the incremented int? Thank you!
`spam < 5` can be read as spam is less than 5, so it'll only increment from 0 to 4. In the 4th (last) iteration, `spam = 4` so it prints 'Hello, world' and then `spam + 1 = 5`. At that point it will attempt another iteration, but `spam < 5` is no longer true and therefore will exit the loop. For reference: `<` means less than, `<=` means less than or equal to. Any particular reason you think you'd get 6?
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "python, python 3.x" }
Redirect single page http to https I'm trying to redirect a single page from http to https using .htaccess, but I keep getting a redirect loop error. Code: Redirect /secureform.html However, I keep getting a "this webpage has too many redirects" error. How do I keep this from happening?
Try this : RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^secureform\.html$ [L,R=301]
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 14, "tags": ".htaccess, http, redirect, https, http redirect" }
ContainsKey returns True False Sample data: Name Value ---- ----- updateresult 0 updatetime 1564046484 $newList.ContainsKey("updateresult") True False I was wanting to check a key exists before I start working on it, unfornately the containsKey seems to give a result for every line rather then how I would expect contains to work and say True if found at all or false if not found at all. I thought I could loop the keys and say if true, break. But wonder if there was a better way.
your `$NewList` is NOT a hashtable ... it is a _collection of hashtables OR dictionary items_. [ _grin_ ] the 2nd item in the collection does not have that key. here's an example ... $NewList = @( @{ UpdateResult = 0 UpdateTime = 1564046484 }, @{ ThisAintIt = 666 } ) $NewList.ContainsKey("updateresult") output ... True False
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 0, "tags": "powershell" }
Can $11^{13}-1$ be divided exactly by 6? Can $11^{13}-1$ be divided exactly by 6? **My solution:** $$11^2 \equiv 1 \pmod 6$$ $$11^{12} \equiv 1 \pmod 6$$ $$11^{13} \equiv 5 \pmod 6 $$ Hence, $(11^{13}-\mathbf{5})$ can be divided exactly by 6. However, according to the solution on my book, $11^{13}-\mathbf{1}$can be divide exactly by 6. What's wrong?
It is already not divisible by $ 3 $; notice that \begin{align} 11^{13} - 1 &\equiv (-1)^{13} - 1 \\\ &\equiv -1 - 1 \\\ &\equiv -2 \\\ &\equiv 1 \\\ &\not\equiv 0 \, (\text{mod} \, 3). \end{align} **Note** $ 11 \equiv 2 \equiv -1 \, (\text{mod} \, 3) $.
stackexchange-math
{ "answer_score": 4, "question_score": 4, "tags": "number theory" }
Is there a proof of (non)existence of a proper universal combinator? It is a well-known fact that all combinators can be derived from the two fundamental combinators K and S. It seems only natural to also ask whether there is a single universal combinator, but I can’t find much information on the topic. The only examples of universal combinators I can find are improper ones that refer to other combinators in its definition, such as Chris Barker’s U combinator. I also found a discussion about the same question, but no definitive answers are offered there. Is there a proof of (non)existence of a proper universal combinator, one that can be defined purely in terms of its own variables?
You are looking for _Craig's theorem_ , which states that that there is no single proper combinator that is a basis for combinatory logic. (Craig's theorem is not any more general than that.) One reference is A new proof for Craig's theorem by Patrick Bellot. I have not been able to find the entire paper online, only the abstract; if I find a better reference I will add it here. (Unfortunately, it seems there is a much better-known Craig's theorem in mathematical logic which is completely unrelated. I have written to Bellot for details.) Addendum 2016-03-09: The Bellot proof is only one page long, and is now available from JSTOR for free online viewing. The citation given by Bellot is: > H.B. Curry and R. Feys (with two sections by W. Craig), _Combinatory Logic_ , Vol 1, North-Holland, Amsterdam, 1958. but he says that this proof “was shown to be incomplete by André Chauvin”.
stackexchange-math
{ "answer_score": 6, "question_score": 7, "tags": "combinatory logic" }
How to store in a register the address of an element of an array in asm? #include <stdio.h> void main() { //Variables char string[] = "This is a string"; _asm { XOR EAX, EAX XOR EBX, EBX XOR ECX, ECX MOV EAX, [string] } What I'm trying to do is store the memory address of the first element of string in EAX but I get "Operand size conflict" . I'm guessing the syntax for dereference is wrong since both eax and the memory adress should be 32 bits, but I can't find anything about it on stack overflow this is on visual studio done with _asm in C
MOV EAX, [string] is not going to work because char is 8 bit and eax is 32 bit register just use LEA load effective address: LEA EAX, [string] NOTE: what LEA does is converting var to offset so the compiler see it like this: `LEA MOV, [offset point to address]`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "assembly, x86, inline assembly" }
How to show an icon in a TButton? My main form has a TActionList component connected to TImageList. The problem is that the TImageList was moved recently in a DataModule. Now when I assign an action to a TButton, the image associated to that action does not appear in the button. How to fix this, while keeping the image list in the data module?
It works for me. Of course, the DM's unit must be included in the form's unit (in a `uses` list), and the `TButton`'s `Images` property must be (re)set to the image list.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "user interface, delphi" }
Some trouble with subclass constructor Let say I have this example: class A : SomeAbstractClassWithProperties { public A(string id, int size) { this.Name = "Name1"; this.Something = new SomethingElse(id, size); } //...some stuff } class B : A { public B(string id, int size) { this.Name = "Name2"; this.Something = new SomethingElse(id, size); } } Ok this is not gonna work: Inconsistent accessibility: base class A is less accessible than class 'B' 'A' does not contain a constructor that takes 0 arguments But as we see the constructor of **Class A** and **Class B** are almost the same. Just **this.Name** is different. How could I rewrite **class B**? Any suggestions? Thank you
Please update your code class B : A { public class B(string id, int size) : base(id, size) { this.Name = "Name2"; } } The case is you B constructor tries to call A() default constructor which desn't exists.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "c#, .net, inheritance, constructor" }
How to highlight text based on regions--not regular expresions When font-lock-mode is enabled I cannot get custom faces to stick with add-text-properties or set-text-properties. I've looked through libraries like hi-lock.el, but they all seem to be regexp based. I want to highlight by points; (point) to (point-max) for example. How can I highlight text (similar to hi-lock) by regions?
First, you can get highlighting to "stick" by using property `font-lock-face` instead of property `face`. Second, you can do what you want (using either property) with library **`highlight.el`**. You can use command **`hlt-highlight`** to highlight or unhighlight the region, or to highlight or unhighlight a regexp throughout the region, depending on the prefix argument. It combines the behaviors of commands `hlt-highlight-region`, `hlt-unhighlight-region`, `hlt-highlight-regexp-region`, and `hlt-highlight-regexp-region`.
stackexchange-emacs
{ "answer_score": 3, "question_score": 7, "tags": "font lock, highlighting" }
Laravel 5.4 Error 405 Method Not Allowed Error I have Laravel 5.4 and VueJs application. When I run it in Localhost it was worked but now. I host in a server it gives the error GET > 405 Method Not Allowed Error. But GET requests are work fine. But this function I'm not using GET request. I using POST. But I giving this error. I have Installed CORS also. What can I do? This is my POST Request in VueJS this.$http.post("api/sendbooking",this.booking) .then(function (response){ console.log(response) }) This is api.php Route::post('/sendbooking',[ 'uses' => 'BookingController@setBooking' ]);
You're attempting to make a request that is unauthorized or otherwise not configured correctly. 405 means unauthorized HTTP verb in the request. Double check your route files that you can POST to the route you want to reach. Anytime I see this is when I accidentally try to use GET on a POST route or similar. And since you mentioned CORS, make sure all the required verbs are listed as allowed.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "php, laravel, vue.js" }
java.util.concurrent im trying to kick off a Runnable classes run method however i keep getting a NullPointerException, Im using WebSpheres commonj.workmanager to get an instance of executorService.this is the code im using. executorService.execute(new Runnable() { public void run() { System.out.println("Inside run ()method.."); } }); ANY IDEAS?
Are you checking whether `executorService` is null before calling `execute()`? If not, it sounds like you need to check the WebSphere docs.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "java, websphere, executorservice, commonj" }
Создание пользователя в postgres Мне дали доступ к машине, на которой стоит `CentOS 8`. На машине есть постгрес. У меня есть root-права. Зайти в саму БД я не могу. В БД не создан пользователь. Как решить этот вопрос?
Следует зайти в БД следующей командой sudo -u postgres psql Затем, в самой базе следует создать нужные права и пользователей: CREATE USER your_user with encrypted password 'your-password'; Убедимся, что пользователь появился: \du
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "postgresql" }
Is there anything comparable to many-body localization in classical physics? I've only just started looking into many-body localization, so this question may come off as a little vague. But my understanding is that it relates to how some quantum systems do not thermalize, as in equilibrium statistical mechanics, because of how information is stored within local degrees of freedom or in subsystems. Is there a similar concept in classical physics, where classical systems fail to thermalize due to this kind of memory in certain degrees of freedom? Or is the general idea behind many-body localization somehow irreducibly quantum mechanical? Thanks.
Probably the best place to start classically is with integrable systems. A crude physicist definition is that these are systems that have, in the words of Nandkishore et al, "an infinite set of extensive conserved quantities that are sums of local operators" (1). Roughly speaking, such systems will never approach an equilibrium because none of these conserved quantities can change. A trivial example is a system in which particles are (classically or otherwise) confined to particular sites. Then the number of particles on each site is a locally conserved quantity, and will never reach a thermal distribution unless it was initialized that way. MBL states are similar- one can construct an extensive set of locally conserved operators for them (2). The difference is that integrable models are generally 'fine-tuned,' in the sense that they lose their integrability if small non-idealities are turned on, while MBL seems to be a robust phase.
stackexchange-physics
{ "answer_score": 1, "question_score": 2, "tags": "quantum mechanics, statistical mechanics, many body" }
UINavigationController in combination with UITableView = wasted memory? I'm wondering: if I have a folder strucure in my model and want to view it on the PC, I'd go for a tree control. Expanding a node would lazy-load the child controls. On the iPhone however I'm stuck to one level at a time and I want to use a navigation controller to allow the user to go one level up. But what is good design here? Push a new UITableViewController whenever a subfolder is entered? If the hierarchy is deep enough, one will end up with a lot of stacked controllers. Or is it better to "fake" the navigation controller and alway repopulate the table with the current child nodes and update the "back" button with teh parent node's name? René
Figured out myself. It really is thought to push controllers all the time. The controller however can be the same. The views get unloaded automatically by the OS. So no need to fake navigation.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "xamarin.ios" }
How to create a spotlight search for all files inside a folder? In Lion, you have `All My Files` to search _everything_ in your home folder. However, when you activate finder's spotlight, via `command + F` you can start searching only by first typing something. How can I search for everything in one particular folder (say, external HDD) without specifying a search token?
After some more research, it reminds me that finder's spotlight had boolean UI since OS X 10.5. You can filter for "not a folder" !all my files for All My Files experience, or with a little bit more filter !all files for "all files". It feels a bit hack-y though.
stackexchange-apple
{ "answer_score": 5, "question_score": 4, "tags": "finder, spotlight" }
textbox text changed event to check the user existed in our database or not I have to validate the text box with username, if the username is not existed in our database it has to display one error message. i want to do it with using java script. I have tried with using auto post back method. I don't have any idea, how to use java script for this, pls do help
check it out. $.ajax({ url: "script.aspx", type: "POST", data: { id : menuId }, sucess: funxtion(ispresent){if(ispresent) {alert('data is present'); } else{alert('data is not present'); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, javascript, asp.net" }
Converting a Windows .cpp file for Unix system? I have a .cpp file that I wrote on my Windows 8 computer and I am trying to paste its code into my schools Unix based system via Putty SSH client. The editor that is used on the Unix machines is the Vi editor. When I copy all the code from my .cpp file in my Windows computer and right click on the Vi editor and paste, the code shows up but its all over place and I can't even read it(I am pretty sure it wouldn't compile either). Is there a way to fix it so the code maintains its formatting in the Vi editor ? Thanks for any help !
There is usually a unix utility called dos2unix and one called unix2dos which will convert your file to dos or unix format. If you have those it should just be a matter of: dos2unix myfile.cpp myfile.cpp Also, instead of pasting it into your editor try using pscp to copy the file to your target machine. pscp myfile myname@hostname:/mydirectory/myfile
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "windows, unix, copy paste, vi" }
Python/Django: Are there any decorators to tell that input is not none? * I am new to Django and come from Java/Spring background. * I am wondering if there are decorators something like following that can be done in Django or Python? **Want** def addToList(@not_none a, @not_none b): # so that I do not check for nullity explicitly do_things_with_a(a) do_things_with_b(b) * Since this is something which is pretty easy to get in Java, just looking if Python/Django has it
One doesn't typically constraint data-types in Python. Also, decorators can only be applied to classes and to methods/functions. Although, you shouldn't really be doing this, this is how you would. (You could amend this to accept argument names to enforce constraints on with a little work). def not_none(f): def func(*args, **kwargs): if any(arg is None for arg in args): raise ValueError('function {}: does not take arguments of None'.format(f.__name__)) return f(*args, **kwargs) return func @not_none def test(a, b): print a, b
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "python, django" }
Manipulating spinner of another class's xml layout I have a spinner with id `spinner1` in Xml layout with id `layout1` **layout1.xml is inflated by Class1.java**. I want to manipulate it from another class ( **say Class2.java** ) which does not inflate layout `layout1` having `spinner1`. Also, can I populate that spinner from `Class2` database column `column1` ?
Well, yes you can if you pass the `Spinner` off to the second activity in the `Intent`. However, I am not sure if that would be a good idea (as a beginner, that's my intuition). As for the populating with data, you can create a singleton instance of data that is shared among both the activities. Let it include an `ArrayList<>` which you use as the data for your spinner. You can then manipulate the data in the `ArrayList<>`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, sqlite, spinner" }
How can I access the admin object's data in a Sonata Admin form I want to access the object being edited within a sonata admin edit form. Something like: {% for prop, value in admin.getDatagrid(object.id) %} <li>value</li> {% endfor %} How can I access the object's data?
I had to do this: {% for item in object.items()%} <li>{{item.id}}</li> {% endfor %} 'object' accesses the entity directly and I have a getItems method on the entity
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "symfony, sonata admin" }
submit form after user logs in The work flow I design for voting a poll is like: The user can vote no matter if he logged in or not . If the user logged in, simply the form is submitted. If the user didn't log in, a modal showing up to ask user to log in with facebook to finish the vote. After he logged in, the form with the choice he voted before would be submit. I am implementing with rails and seems after creating a session, the page is redirected. Even if back to the same page, How can I submit the form with the choice he chose? Thanks!
Onemethod would be remmber what the person chose by, 1) sending the values as GET parameter while logging with facebook 2) other would be to store in a cookie and retrieve it back while posting
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery, html, ruby on rails" }
Alternatives to Membrr add-on? We have been users of Membrr and OpenGateway for a few years now and been generally happy with it. Today I ran into an issue and went to access the < site and got a notice that the domain has expired. There have recently been reports that Electric Function has been unresponsive to emails and support. Concerned I started to do some Googling and found this blog post from Brock made back in March. Looks like the new owners of Electric Function might be simply dropping the company and products and walking away? As a customer I was not warned or notified at all and I find this very disturbing to say the least. Is anyone else who is using Membrr concerned? What path(s) are you planning on taking moving forward? For anyone who was a Membrr user and migrated to something else what do you recommend and do you have any advice to make transitioning easier?
I'm the developer of Charge so this is obviously biased. Charge works great for member subscriptions. The focus with Charge is to keep it as simple and rock solid for the developer and customer as possible. To that end - it's tied directly to using Stripe as the payment gateway. Understandably that's not going to be perfect for every project. I'm in the process of adding lots of new subscription features, and it's in constant development. I've helped quite a few devs move their client sites off Membrr to Charge, and keeping the whole thing invisible to the customers. If you need a hand, or see any missing features, just drop me a line, and I'd be happy to help.
stackexchange-expressionengine
{ "answer_score": 4, "question_score": 5, "tags": "add on, payment gateway, subscriptions, membrr" }
Normalizing the joint probability density I computed the kernel estimators for the copula density for two random variables using: library(kdecopula) kde.fit <\- kdecop(u) As the values of density can be greater than one I was wondering if I can normalized values by the maximum magnitude and call it normalized joint probability density? Here is the bivariate copula density and the normalized bivariate copula density Bivarite copula density: ![enter image description here]( Normalized bivarite copula density: ![enter image description here]( Thanks in advance for any helps.
In literature, normalization means integrating to $1$, not having a max value equal to $1$. So, joint or univariate densities are already normalized. For the nomenclature, for the function you have, I think max-normalized joint density would be a better name for it. However, what you do is just scaling your joint PDF so that it hits $1$ at its maximum. Since both in your new function and the original density, these values can't be associated with probabilities, I see no use in doing so. It's not as much different as than multiplying your density with e.g. $5$.
stackexchange-stats
{ "answer_score": 2, "question_score": 1, "tags": "probability, density function, joint distribution, copula" }
How can i upgrade libboost 1.54 to 1.58? I have two Ubuntu 14.04 Server 64 bit machines. When i use "sudo apt-get install libboost-all-dev" on both machine, machine 1 gets libboost1.54 and machine 2 gets 1.58. Why is that? I want to use machine 1 to compile a programm for machine 2 but since machine 1 uses libboost 1.54 i always `get error while loading shared libraries: libboost_system.so.1.54.0: cannot open shared object file: No such file or directory` on machine 2, which uses 1.58, when trying to run the compiled program. I tried to create a link with `sudo ln -s /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0 /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.54.0` but that doesn't help either. Any ideas?
You can: 1. download and build Boost yourself. It can be a bit tricky because of language-standard-version-related switches (see this question specifically), but it's not terrible. Do this on both machines 2. Link your binary statically, so you won't need Boost installed on your target machine. As for your question regarding why you get one version here and another version there - I'd guess it's an APT sources configuration difference but I'm not sure, plus that's off-topic for this site (try < or <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "ubuntu, dependencies, ubuntu 14.04" }
How to transform this time series data? !enter image description here !enter image description here !enter image description here Given in these plots above is the US unemply. Data since 1948 till recently a month back. I tried using a log and difference transform to make the data look more stationary. This is what I get as the final result. This looks more squished in a bit more stationary looking. But the model I end up getting is much more complicated than wanted. Is there are possibilities I may look into to see if I can come up with a better model? I need to keep the data as is meaning I do not want to get rid of portions. Thanks. !enter image description here
Given the shocks that are apparent in the time series, I don't think differencing, log-differencing and similar simple transformations will be of use. You'll likely need more complicated econometric models. A quick search reveals many papers dealing with this very topic, e.g. (Ghosh, 2008) or (Hutton, 2009) might be good starting points.
stackexchange-stats
{ "answer_score": 1, "question_score": 1, "tags": "time series" }
Changing eigenvalues/eigenvectors of a symmetric matrix. Suppose we have some symmetric matrix $A\in \mathbb{N}^{n\times n}$. By already done calculations we know that $A$ has some eigenvalues say $\lambda_1, \lambda_2, \ldots, \lambda_n$ (since $A$ is symmetric we know we have a full set of eigenvalues). Consider the following term where $I$ is the identity matrix. \begin{align} Z=(A-\lambda_iI) \end{align} My question is: What is achieved by this term concerning eigenvalues and eigenvectors?
The eigenvalues of $Z$ are exactly $0$, $\lambda_1 - \lambda_3$ and $\lambda_2-\lambda_3$. The eigenspaces associated to the eigenvalue $\lambda_i - \lambda_3$ is exactly the eigenspace of $A$ associated to the eigenvalue $\lambda_i$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "linear algebra, matrices, eigenvalues eigenvectors" }
Udev - How to change device group? By default, all hard drive and usb drive devices belong to group "disk". I want to change usb drives to group "adm". I verified the ID_BUS $ udevadm info -q all -n /dev/sdb | grep ID_BUS E: ID_BUS=usb I created the file /etc/udev/rules.d/70-persistent-usb.rules and insert the following # Enable admin controls on all usb devices. ID_BUS=="usb", GROUP="adm" Lastly, I disconnected my usb drive and reconnected it. It is still showing $ ll /dev/sdb brw-rw---- 1 root disk 8, 16 Apr 14 19:31 /dev/sdb The drive group is not "adm"? What am I doing wrong?
In the `udevadm info` output, you see the `E` prefix which is used for environment variables. You can match against it with: ENV{ID_BUS}=="..." If you are trying to make just USB devices writable, see this recent question on Unix.SE: * Writing raw images safely to USB sticks
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 3, "tags": "usb, permissions, udev, devices" }
Javascript remove key and value array knowing value I have an array: arr[1234]='foo' arr[2345]='bar' arr[6253]='cho' I want to be able to delete the key => value pair when I know the value in one of the pairs, `bar` (for-instance). So, if I deleted `bar` the array would then equal: arr[1234]='foo' arr[6253]='cho' So, it would maintain both key and value in each remaining pair, and remove the key and value of the one whose value is specified. Is there an easy way to achieve this? Thanks in advance.
Find property by its value in loop and use `delete` operator: for (var key in arr) { if (arr[key] === "bar") { delete arr[key]; break; } } Check the demo. var arr = {}; arr[1234] = 'foo'; arr[2345] = 'bar'; arr[6253] = 'cho'; for (var key in arr) { if (arr[key] === "bar") { delete arr[key]; break; } } document.write(JSON.stringify(arr, null, 4));
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript" }
Display rows via comma values in MySQL I have a comma delimited list like this saved in a mysql table: ----------------- |id | list | ----------------- | 4 |12,45,65,4 | Each number in "list" corresponds with an ID in another table. Is there a way so I can query the other table based on theses IDs and bring up those rows associated with the numbers in "list"?
Not any efficient way with your current schema. The correct and most efficient way to do it is to change the schema to hold multiple rows like this: ----------------- |id | list | ----------------- | 4 | 12 | | 4 | 45 | | 4 | 65 | | 4 | 4 | Then you use `JOIN` operations to connect `4` to every related row in your other table. This is called database normalization and is a very important topic in database design. Relational database systems are built to handle just this types of problems in an efficient manner.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
Add Web Reference option missing in VS2008 I'm trying to add a Web Reference to a VS2008 .Net 3.5 Console Application but the option's not there. The options to "Add Reference" and "Add Service Reference" are there.
Kirk Evans blogged about that very issue Here Basically, you just add a service reference. A web reference is just one type of service you can add.
stackexchange-stackoverflow
{ "answer_score": 31, "question_score": 30, "tags": "visual studio 2008, console application" }
Finding all partitions (2 elements per subset) of a set composed of an even number of elements I'd like to find all the partitions (each subset of a partition should contain 2 elements) of a set composed by an even number of elements. For example, given $A=\lbrace 1,2,3,4,5,6 \rbrace$, I'd like to see the partitions: $$ \lbrace \lbrace 1,2 \rbrace, \lbrace 3,4 \rbrace, \lbrace 5,6 \rbrace \rbrace \\\ \lbrace \lbrace 1,3 \rbrace, \lbrace 2,4 \rbrace, \lbrace 5,6 \rbrace \rbrace \\\ \ldots $$ etc.
Too complex ,but work. result6 = Sort /@ (Map[ Sort] /@ (Partition[#, 2] & /@ Permutations[Range[6]])) // DeleteDuplicates result6//Length Grid[result6, Dividers -> {False, All}] > `15` ![enter image description here]( result8 = Sort /@ (Map[ Sort] /@ (Partition[#, 2] & /@ Permutations[Range[8]])) // DeleteDuplicates; reslut8//Length Grid[Partition[result8, 3], Dividers -> {All, All}] > `105` For general `n=2k`,the answer should be `(n-1)!!`,but I don't know how to list it in a simple way. Table[(2 k - 1)!!, {k, 1, 5}] > `{1, 3, 15, 105, 945}`
stackexchange-mathematica
{ "answer_score": 2, "question_score": 3, "tags": "list manipulation, education, partitions" }
sports tournament draw formula Suppose we have a sport tournament with direct elimination. The original number of players is a perfect power of 2, say n. Each player is attributed a draw position, between 1 and n. The tournament's first round is organized in the following way: * match 1: 1 vs 2 * match 2: 3 vs 4 * ... * match n/2: n-1 vs n Matches are numbered in order from top to bottom for each round. Given a particular match, how can we express the range each player draw position can be from the round number and the match number ? e.g: * Round 2, match 1: * P1 is in [1,2] * P2 is in [3,4] Round x, match m: P1 is in ? P2 is in ? Thank you
Round X, match m: P1 is in $[(m-1)2^X+1 , (m-1)2^X +2^{X-1}] $ P2 is in $[(m-1)2^X +2^{X-1}+1 , m 2^X] $
stackexchange-math
{ "answer_score": 1, "question_score": -1, "tags": "combinations" }
Installing google analytics code on wordpress blog There are many ways suggested on the internet to install google analytics code on wordpress blog and I would like to clear my doubts. When I copy the analytics code to the footer.php * Will this be available for all pages & post? * after theme update, will the custom analytics code still remain What is the advantage of using google tag manager? Which is the best way and why?
Since your question is about installing the google analytics code in Wordpress, I will highly recommend you to install the **UA-XXXXXX-X tracking code** before the closing head tag "`</head>`". Just edit the theme header.php file. You don't need to create a child theme unless you are using someone else's theme that could potentialy be updated or ask you for an update from which your tracking code will be deleted.
stackexchange-wordpress
{ "answer_score": 2, "question_score": 2, "tags": "google analytics" }
The integral of an hadamard product and a nonlinear point wise function How do you compute L, the function whose partial derivative with respect to W is as below? ![enter image description here]( Where B and W are matrices, and e and h are vectors. f is a pointwise nonlinear, but differentiable function. I am pretty new to matrix calculus, but I couldn't find anything in The Matrix Cookbook that I could directly use.
For convenience, define the variables $$\eqalign{ x &= Wh \cr y &= Be \cr Y &= {\rm Diag}(y) \cr g=g(x) &= f^\prime(x) \cr \cr }$$ Now reformulate the differential of $L$ $$\eqalign{ dL &= \frac{\partial L}{\partial W}:dW \cr &= Ygh^T:dW \cr &= Yg:dWh \cr &= Yg:dx \cr &= y\odot g:dx \cr &= y:g\odot dx \cr &= y:df \cr }$$ Now we can integrate $$\eqalign{ L &= \int dL \cr &= y:\int df \cr &= y:f \cr &= y^Tf \cr\cr }$$ We can pull $y$ out of the integral because it is independent of $(W,h,x)$. In some of the steps, we made use of the fact that the elementwise/Hadamard product (denoted by $\odot$) and the inner/Frobenius product (denoted by $:$) commute with themselves and each other. For complete generality, we should include a constant of integration $$L = y^T(f+c)$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "integration, derivatives, matrix calculus, hadamard product" }
Custom progress dialog How would I do a custom "loading" dialog during an `AsyncTask` like the one in the Bank of America app, for instance? See: !enter image description here I basically don't want the popup `ProgressDialog` but instead one that is embedded into the layout.
It's not a `ProgressDialog`. It's just a `ProgressBar`. Put it on your layout and make it visible when it's necessary.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "android, dialog, android progressbar" }
The interpretation of the word “pry” Can the word "pry" be interpreted negatively (offensively)? For example, “to pry into other people's affairs” or is it still possible to interpret the meaning just as “curious”? I am interested in the attitude to this word English native speakers. I am not English native speakers. Or for example: "be pry" equals "be curious"? I relied on these sources. The question was inspired by the observation that no one uses the word "pry" for commercial purposes (marketing), for example slogans, headings, etc. Google Translate, Yandex Translate, Multitran, Reverso
_Pry_ in the sense of "ask for information" is almost always negative in connotation. _Pry_ in the sense of "use a stick or bar to open something" is neutral in connotation, and is a shortening of _prise/prize_. (This usage of _pry_ is a verb, so one can't say "be pry" in the way one can say "be curious".)
stackexchange-english
{ "answer_score": 5, "question_score": 2, "tags": "american english, british english" }
CFCHART Title dynamically populated I'm using CFCHART to generate awesome charts on the fly. It would be nice to dynamically change the title of the chart based on selection criteria.... and I've been attempting to do that by setting a string, graphTitle, that conditionally populates based on selections. All I want to do is simply start a new line for each criterion. For instance: Suppose I have a chart that has a large number of selection criteria in it. I would want the chart title to look like this: (Break, of course, indicates the end of a line) Fiscal Year 2006 to projected 2013 (Break) Hires of African American Heritage candidates (Break) Whom are Female From New Mexico, California, Texas and Colorado (Break) With an Age of 29+ (Break) With a breakdown of Degree Achievement: I tried using the `<SPAN>` and `<BR />` tags in the title. With no luck. Any other ideas?
If you mean you want to add line breaks into the chart title so it "wraps" you might try adding ascii coded line breaks like so... <Csfet linefeed = chr(10) & chr(13)/> Then your variable would be <cfset mytitle = "fiscal year 2006 to projected 2012 #linefeed# Hires of..."/> And so on - you get the idea. Note: you might need "just" chr(10) or you might need both. you'll need to experiment. I don't "know" that this will work. If it were me and I wanted something that complex to decorate the chart I think I would draw a plain "undecorated" chart with only x and y axis labels present and then set up my title outside the chart using HTML. I would have better control that way. Anyway if that doesn't work try fiddling with the "style" attribute. You can provide an XML () var with all sorts of options - but it is not well documented I'm afraid. Ray has some stuff on his blog regarding this.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "coldfusion, cfchart" }
Why "return o" in this simple example? <html> <body> <script type="text/javascript"> function createPerson (name){ var o = new Object(); o.name = name; return o; }; var person1 = createPerson ("Nicholas"); alert(person1.name); </script> </body> </html> Why do we have to > return o ? What does "return" mean?
`return` is a JavaScript keyword that causes the _function_ it's placed in to exit with the specified value (called the "return value"). In this case, it causes the `createPerson()` function to come to an end, returning the `o` object to the _caller_ of the function. The `o` object, once returned from `createPerson()`, then gets assigned to the `person1` variable. So the net result is that control flow starts here var person1 = createPerson ("Nicholas"); then jumps into the `createPerson()` function, which creates a new object representing a person with the name "Nicholas", then returns it, which brings the execution back to that line, with `person1` getting the newly created person that the function returned.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, return" }
Amazon S3 for Social Networks? < is really useful for uploading/viewing files for personal viewing. I was wondering if there was something good for social networks (using Amazon s3 or something similar), where it will only show the subset of files uploaded by a specific user (for example, limit access to the user's specific bucket). Can s3fm be adapted to this solution? or is there something else out there?
Chris, thanks for bringing this up. Next version of S3fm will allow just that: sharing files and "folders" with your friends and colleagues using your own S3 account. A bucket owner will be able to use his or her credentials to create new (non-AWS) "accounts" and assign different permissions for each user. Then s/he will be able to select files to share or "folders" for uploads for each of those users. A secure authentication method has been developed on top of regular Amazon S3 API so no 3rd party service will be required for that purpose. In fact, your newly created account credentials are not even accessible to anyone but you and you users . On the flip side, if you loose them - they are gone, we wont be able to restore them. :) This version was expected this coming Fri (Aug 9, 2009), but apparently will be delayed another week or so. Happy to help, feel free to follow up with questions or ideas,
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, amazon s3" }
How detect mathquill editor to write equation I am currently making rich text editor with maths equation writing. ![enter image description here]( As per above image you can see yellow marker which is `mathquill-editable` span. and i made button with containing some maths symbols. What I want!! When user click button than equation should be print at cursor location. I selected `mathquill-editable` span with class. example `$('#classname')` for write equation from button. Its works fine but problem comes when I add another `mathquill-editable` span. When multiple span are there than every time when i click button than their value printed in every class at same time. How I detect particular span is active and value will print on cursor's span only.
This is my little efforts to find just one element from all class. $(document).ready(function(){ /* when the page has loaded... */ $('.mathquill-editable').click(function(){ /* ...bind click event to .boxSet elements */ $('.mathquill-editable').removeClass('hilite'); /* On click, remove any 'hilite' class */ $(this).addClass('hilite'); /* ...and add 'hilite' class to clicked element */ }); }); **DEMO HERE**
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, jquery, text editor, mathquill" }
Access to the national vulnerability Database I want to know How i can get access via java code to the National vulnerability Database (NVD) ( is there any predefined functions. Thanks you in advance
They provide data feeds which you can find here Since it's regular RSS it should be easy to fetch it using Java
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -4, "tags": "java" }
Somehow it's not copying Sub GetTW_Data() ThisWorkbook.Activate 'start in THIS workbook Sheets(1).Select 'switch to data import sheet 'Opens source file (this filename never changes) Workbooks.Open Filename:="C:\Test 1\1 eBay BrandProgress.xls", ReadOnly:=True Workbooks("1 eBay BrandProgress.xls").Activate 'switch to source workbook Sheets(1).Select.UsedRange.Copy 'switch to source data sheet ThisWorkbook.Activate 'Return to THIS workbook [B5].PasteSpecial Paste:=xlPasteValues 'paste data to import start cell [a1].Select 'cancels highlighted paste region Workbooks("1 eBay BrandProgress.xls").Close 'source data workbook End Sub
You need to avoid using Select and Activate. Set the workbooks, worksheets and ranges to variables and use them. Also when pasting just values avoid the clipboard for speed. Sub GetTW_Data() Dim tWb As Workbook Dim ebayWb As Workbook Dim tWs As Worksheet Dim ebayWs As Worksheet Dim rng As Range Set tWb = ThisWorkbook Set tWs = tWb.Sheets(1) Set ebayWb = Workbooks.Open(Filename:="C:\Test 1\1 eBay BrandProgress.xls", ReadOnly:=True) Set ebayWs = ebayWb.Sheets(1) Set rng = ebayWs.UsedRange tWs.Range("B5").Resize(rng.Rows.Count, rng.Columns.Count).Value = rng.Value ebayWb.Close End Sub
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -5, "tags": "vba, excel" }
android.location.locationlistener is already defined in a single-type import Edit: slightly different as I was getting a request location update error that resulted in the extra import issue. I am getting a strange error that my locationlistener is already defined in a single type import.![is already defined in a single type import]( Not sure what I have done incorrectly? I was fixing another error where requestLocationUpdates is not recognised. ![can not resolve method requestlocationupdates]( Here is my class implement line: public class MapPage extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, android.location.LocationListener {
This error happened because in your class your import both import com.google.android.gms.location.LocationListener; import android.location.LocationListener; Consider to use only one **or** you can use `LocationListenr` without import like private com.google.android.gms.location.LocationListener googleLocationListener; private android.location.LocationListener androidLocationListener;
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "android, google maps" }
trying to find control which is inside gridview which happens to be inside a repeater. So I have a repeater which has a gridview in it. I need to find a hyperlink field that is inside the gridview. I am able to find the gridview using the following code, but then when I try to find the hyperlink inside that gridview, my program crashes. protected void CompletedRepeater_DataBound(object sender, RepeaterItemEventArgs e) { Repeater rpt = (Repeater) sender; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { GridView gv = (GridView)e.Item.FindControl("CompletedGridr"); if (gv != null) { } } } With the above code I am able to find the gridview. I want to find the hyperlink inside the if (gv != null) { block. Any ideas on how I can achieve this?
Do something like this: foreach(GridViewRow row in gv.Rows) { HtmlGenericControl linkTag= row.FindControl("linktag") as HtmlGenericControl; } or you can do like this if you are using `<asp:HyperLink>` : HyperLink myHyperLink = row.FindControl("myHyperLinkID") as HyperLink;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, gridview" }
Compare 2 tables in sql I have two tables, A1 and A2. I want to compare these two tables. I tried inner join but it doesn't give the required result. These are the data in these tables, **Table A1** No. Address 1 abc 1 abc 1 def 1 def **Table A2** No. Address 1 def 1 abc 1 abc 1 def These two tables can only be joined by using `No.` column. So if I use INNER JOIN it gives 16 rows. I don't want that, I want only 4 rows to be displayed. This should be the output: No. Address eq 1 abc # 1 abc * 1 abc # 1 abc # Last column is displayed if address in A1 is equal to A2
Search for records that exist in A1 table but not in A2 table: SELECT * FROM A1 WHERE NOT EXISTS (SELECT * FROM A2 WHERE A2.Id = A1.Id)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "sql, sql server 2008, sql server 2005, sql server 2008 r2" }
Elasticsearch.net - Range Query I'm trying to query an Elasticsearch index from C# via Elasticsearch.net (not NEST). Specifically, I need to get all documents with a status of "success" that have been created since a specific date. In an attempt to do this, I have: var query = new { query = new { match = new { field="status", query="success" } }, range = new { ? } }; I'm not sure what to use for the `range` part. In fact, I'm not even sure if my syntax for the `query` is correct. I don't really understand how the C# syntax maps to the Query DSL in Elasticsearch. Any help is appreciated. Thank you!
Something like this should do: var query = new { bool = new { must = new { match = new { field = "status", query = "success" } }, filter = new { range = new { createDate = new { gt = "2018-12-01T00:00:00.000Z" } } } } };
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 12, "tags": "c#, elasticsearch" }
Making a simple, no-frills website with minimal headache I'm just finishing the first numbered release of my open source project, and I want to build a simple website for it. I'm looking for a sort of "websites for dummies" service that lets you build a website by a web WYSIWYG interface. Like Google Sites, except I haven't explored it enough and also I don't know whether it has any interesting alternatives, which is why I'm asking here. I should be able to host the site directly on my domain (< I also want the service to require minimal maintenance on my side. It doesn't have to be powerful, I just want to be able to log in to change content easily, like a Word document. Is Google Sites good enough? Are there any other services like that which might be better?
If you'd like to do some SEO work or have a nice design then Wordpress is your best bet but you'll have to get your hands dirty on the design unless you purchase a template (which there are tons if you google for it). Google Sites is very nice for a internal wiki or documentation but if you are trying to do a pretty site for users you will be pretty limited. Wordpress would require that you host it. Weebly is very cool and easy to maintain (you can point a domain to it as well). But at some point you might run into something that you need to host elsewhere for capability sake. But if content is all you need and you don't wanna host the site on a server of your own then that might be the way to go because you can change the design of the site and manage the content a little easier than Google Sites I believe.
stackexchange-serverfault
{ "answer_score": 1, "question_score": 1, "tags": "website, wysiwyg" }
having trouble with wrapper height hi i am haveing trouble with height.. please tell me friends how can i resolve this issue. Please check here to check the website this is the link of my website. and Rates page .. i am having trouble with height. i wrappered all the content in #wrapper { background: url("images/wrapper_bg.png") repeat-y scroll left top transparent; margin: 0 auto; padding: 0 10px; width: 960px; } but #main { height: 100% !important; width: 960px; } is not responding for the internet height. please help me
Try putting `overflow:auto;` in your `#main` The main issue is the elements inside of `#main` are floated. So the height of the floated elements won't cause the height of `#main` to expand **OR** put `clear:both;` on the `#footer`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css" }
str_c to build a quotation-wrapped comma separated vector `iris %>% select(where(is.numeric)) %>% colnames() %>% str_c(., collapse = '","')` Output: "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width" It gets me close to what I want (I don't really care about the space missing after the comma) but I can't remove the backslash afterwards with `str_remove_all` because it doesn't recognize the escaped backslash Ideal: "Sepal.Length","Sepal.Width","Petal.Length","Petal.Width" ` iris %>% select(where(is.numeric)) %>% colnames() %>% str_c(., collapse = '",') str_remove_all(., "\\")` output: `Error in stri_replace_all_regex(string, pattern, fix_replacement(replacement), : Unrecognized backslash escape sequence in pattern. (U_REGEX_BAD_ESCAPE_SEQUENCE)`
You can use : library(dplyr) iris %>% select(where(is.numeric)) %>% colnames() %>% sprintf('"%s"', .) %>% toString() #[1] "\"Sepal.Length\", \"Sepal.Width\", \"Petal.Length\", \"Petal.Width\"" The backslashes are not part of actual string, that is how R displays double quotes. To see the actual string you can use `cat` : iris %>% select(where(is.numeric)) %>% colnames() %>% sprintf('"%s"', .) %>% toString() %>% cat #"Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "r, stringr" }
Is there any benefit to doing stunt jumps and barnstorms? I only recently discovered that there are stunt jumps and barnstorm challenges in this game, for making your car fly and your planes nearly crash, respectively. There's no achievement that tracks these, they aren't in the Saintsbook, and they aren't marked on the map to make them easy to find. Is there anything that you get from doing all/some portion of these that makes them worth doing? Some of the challenges/missions have crazy rewards, so I don't want to miss out on something awesome here. If it's worth pursuing, is there any way to make this easier? Say, a map with the locations marked?
In terms of the "reward", there is none. You get some cash and respect, but otherwise completionism is the only incentive. As for a map, people are saying theres one in the game's official strategy guide, but I've neither found that image online or have the guide myself, so take that with a grain of salt.
stackexchange-gaming
{ "answer_score": 5, "question_score": 4, "tags": "saints row the third" }
Mathematica notebook directing link to an empty page In a notebook that I'm created with a Hyperlink, Mathematica directs me to my google home page upon clicking of that link. Is this a bug or a user problem? Any help is appreciated Edit: In Wolfram Language input , Hyperlink[" results in a new browser appearing but does not direct me to the designated site in the hyperlink. The same issue is also seen in Plain text form where I have the link "< typed in the notebook.
The problem is Google Chrome on OSX. You could have verified that it is indeed not a problem of Mathematica by using your Mail app and clicking on one of the links from your emails. You will experience the same bug. The solution is as simple: You should see a small indicator in the top right corner of Chrome that tells you it really really would like to be updated. Once updated and restarted, the issue is gone.
stackexchange-mathematica
{ "answer_score": 4, "question_score": 2, "tags": "mac os x, hyperlink" }
Where is ClaimTypes.IdentityProvider? Using .Net 4.5 RC and Azure Access Control Service, the primary claims I am interested in are the IdentityProvider and the NameIdentifier. System.Security.Claims.ClaimTypes contains constants for well-known claims, and it has ClaimTypes.NameIdentifier, but it appears to be missing ClaimTypes.IdentityProvider. I was really surprised not to find it there. Of course, I can just use the string representation " in one of my own constants, but given Microsoft's push towards the cloud, I would expect to find it in with the standard ClaimTypes. Is this is just oversight? Is there a good reason for it's absence? Is it in some other namespace?
I would venture that the IdentityProvider claim is not part of the standard set of WIF claim types because the IdentityProvider is already a required field present in the issued security token, separate from the set of claims. ACS on the other hand sits as a federation provider between the relying party application and the 3rd party identity provider. Note that ACS does not use the ActAs or OnBehalfOf mechanisms, but the RP might like to know what IP the user is coming from so ACS issues the IdentityProvider claim for this purpose.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 12, "tags": "wif, .net 4.5, claims based identity, acs" }
I can't drag'n'drop UI-Elements from the Scene-hierarchy into a public field (Unity 5) I just watched this Video < and tried to drag'n'drop the UI-Elements on the matching script, just like they did. But this is not working for me. If I hover the public field Unity shows up an error icon and I can't drop it there. If I set this UI-Element as prefab I can place it there, but it does not update the Element which is in the Scene when the Code is live. The Elements just gets an update after each restart. Can anybody explain to me why I cannot drag'n'drop my Object from the hierarchy to the public field? !enter image description here !enter image description here !enter image description here
Instead of creating a regular game object, create a UI Image ( New >> UI >> Image/slider/etc.). The new Unity UI system has specifics that aren't available to normal game objects, so when you make them public they need an exact type to be dragged onto them. This has been my experience at least, hope it helps.
stackexchange-gamedev
{ "answer_score": 1, "question_score": 4, "tags": "unity, gui, objects, hud" }
What is the Difference between onclick and href="javascript:function name? Is there any difference between 1 : <a href="javascript:MyFunction()">Link1</a> and 2 : <a href="#" onclick="MyFunction()">Link2</a> ? Would one affect the page performance by any means ?
If your element is not actually supposed to link the user someplace, _don't make it an anchor element_. If you're using `<a>` tags just to get the underline/cursor change - don't. Use CSS on a `<span>` (or other element) instead. span.link { text-decoration: underline; color: blue; cursor: pointer; } Keep your HTML semantic and use anchor elements only when you want to link the user somewhere.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 5, "tags": "javascript" }
Split a Dataframe row into 2 rows if a cell value is a list I have a DF, which looks like this: id value country 215 x, y UK 360 z Spain I'd like to split it into this form: id value country 215 x UK 215 y UK 360 z Spain So, I want to duplicate the rows for each row where df['value'] has more than one value split with comma. I know I have to split it into a list: df['value'] = df['value'].apply(lambda x: x.split(',')) What do you do next to duplicate the row the way I want to?
This should work. It uses the str.split functions on the ['value'] Series: import pandas as pd df = pd.DataFrame({'ID': [215, 360], 'value': ['x, y', 'z'], 'country': ["UK", "Spain"]}) df["value"] = df["value"].str.split(pat=",") print(df.explode("value")) Result: ID value country 0 215 x UK 0 215 y UK 1 360 z Spain
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, pandas, dataframe, split" }
Magento2: How to get product collection by attribute or category id? How to get product collection by multiple attributes? Magento 2.0
You can use > Magento\Catalog\Model\ProductFactory; to get product collection and filter by multiple attribute like this: $productCollection = $this->_productFactory->create()->getCollection()->addAttributeToSelect('*')->addFieldToFilter('sku',array('eq' => $styleCode)); Use "Dependency Injection" method to implement this, Please reply if need more clarification,
stackexchange-magento
{ "answer_score": 2, "question_score": 1, "tags": "magento2, product attribute, collection, attribute set" }
Using modproxy to get around China's Great Firewall I'm using WIX service and I like it very much. However, one big problem is that some of my colleagues are in China but their IP is blocked. I'm wondering if modproxy can help me. I would like to setup a clean server (not blocked by the stupid Chinese government). Pointed the DNS cname to it and have modproxy get the page in background and send the page to viewers in China. Will it work? If yes, can anyone post any examples? Thanks a million
In fact, modproxy is the solution. Here's what I have done: 1. Set up Wix site to a dummy URL (both in wix and in your DNS), e.g. `www.dummy.com` 2. Set up an Amazon EC2 instance, in `/etc/httpd/conf/httpd.conf` <VirtualHost *:80> ServerName www.real.com ProxyPass / </VirtualHost> 3. point `www.real.com` to your EC2 4. restart service httpd
stackexchange-webmasters
{ "answer_score": 3, "question_score": 2, "tags": "apache, proxy" }
Confusion related to smoothness of a function I just found this thing that $\operatorname{trace}(AB)$ where $A$ and $B$ are two matrices, it is a smooth function. I didn't understand how it is a smooth function. Any suggestions?
A smooth function has derivatives of all orders. In this case, trace$(AB)$ is a product and sum of entries. The partial derivative with respect to any of the entries is again a product and sum of entries, hence well-defined. Example as requested: Let $A=[x], B=[y]$. Then $AB=[xy]$ and $tr(AB)=xy$. $\frac{\partial}{\partial x} tr(AB)=y$, and $\frac{\partial}{\partial y} tr(AB)=x$. Further partial derivatives will be constants, then zero, so all partial derivatives exist of all orders.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "linear algebra, functions, derivatives" }
Rotation of a vector around a rotation axis Is there an easy way (like a defined function) in Mathematica to rotate a direction vector around a rotation axis for θ degrees? For instance: rotate `[3,4,5]` around `[1,1,1]` for `30` degrees.
You can play with Viewpoint and ViewAngle to get better view of this. The black arrow is the vector `{3,4,5}` and the red one is `{1,1,1}` stretched a little to make it easier to see. This is done using ![enter image description here]( !Mathematica graphics Manipulate[ r = RotationMatrix[theta Degree, 5 {1, 1, 1}]; Graphics3D[ { {Arrow[{{0, 0, 0}, r . {3, 4, 5}}]}, {Red, Line[{{0, 0, 0}, 5 {1, 1, 1}}]} }, Axes -> True, AxesLabel -> {"x", "y", "z"}, BaseStyle -> 14, PlotRange -> {{0, 6}, {0, 6}, {0, 6}}], {{theta, 45, "theta"}, 0, 360, 1, Appearance -> "Labeled"}, TrackedSymbols :> {theta} ] ![enter image description here](
stackexchange-mathematica
{ "answer_score": 4, "question_score": 0, "tags": "physics, rotation" }
Rails helper for encode input value Is it possible, to encrypt input value to some encrypting as here: But do this in view, so that view has not to much logic, maybe do as helper? But how? for example change such string <input name="person" value="1" /> to <input name="c4ca4238a0b923820dcc509a6f75849b" value="1" /> So, how to encode input name in rails? Also please do not ask me why i need to do this... Have answer? Give it...
Try to generate helper, and put there module EncryptorHelper def encrypt_string(name) secret = Digest::SHA1.hexdigest(name) a = ActiveSupport::MessageEncryptor.new(secret) b = a.encrypt("parts") b end end then you can just call ecnrypt_string(123) in your's input
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ruby on rails, encryption, input, helper" }
How to prevent multiple Alerts in React Native? Is there a way to tell if there was an Alert.alert() already on the screen before sending another one? I have this function: CheckInternet(){ if(this.props.json.undefined){ Alert.alert("Check your internet connection"); } } ComponentDidUpdate(){ this.CheckInternet(); } The thing is that I have other things being done inside that function, I just wrote the relevant code, so I cannot take the `CheckInternet` function outside `ComponentDidUpdate`. The problem is that the component updates twice after getting the `json`, therefore, sending that alert twice. I would like to prevent having two alerts at the same time by using a condition that would let me know if there is an alert on the screen already or not. I don't seem to find anything like that in the Alert documentation. Any ideas?
Try this: CheckInternet(){ if (!this.alertPresent) { this.alertPresent = true; if (this.props.json.undefined) { Alert.alert("", "Check your internet connection", [{text: 'OK', onPress: () => { this.alertPresent = false } }], { cancelable: false }); } else { this.alertPresent = false; } } } ComponentDidUpdate(){ this.CheckInternet(); }
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 11, "tags": "javascript, react native, lifecycle, alerts" }
Initialize and assign values to list of ints without a loop is there a shorter way to do this: List<int> mins = new List<int>(); for(int i = 0; i<60; i++) { mins.Add(i+1); } Functional version also appreciated if available in c#, also f# version appreciated.
F#: open System.Collections.Generic let r = new List<_>( [1..60] ) C#: var r = new List<int>(Enumerable.Range(1, 60));
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 1, "tags": "c#, f#" }
How to draw elliptical gradient in cocoa? Is it possible to get this kind of gradient in cocoa ? !enter image description here I can use simple `CGContextDrawRadialGradient` with clip made by `CGContextAddEllipseInRect` but the effect will slightly different. Is it any posibility to draw exact this shade/gradient?
I would use a radial gradient, and then apply a scale trasnformation such that the y coordinate is squiched, and the x remains. There is an advanced topic where you can define your own gradients providing an callback that calculates the color or so. Ist stated in Core Graphics docu.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "objective c, cocoa, quartz graphics" }
The correct syntax for a T-SQL subquery and a possible join What would be the correct syntax and join (if any) of a subquery that would return all of the employees first and last name from the employee’s table, and return their department name from the department table, but only those employees who more than the average salary for their department? Thanks for your answers
This query should give you what you are looking for. select firstName, lastName, departmentName from Employees e join (select departmentID, departmentName, AVG(salary) AS averageSalary from Department d join Employees e ON e.departmentID=d.departmentID group by departmentId, departmentName) ds on ds.departmentID=e.departmentID where e.salary>ds.AverageSalary (PS: I agree with the comment above. It's SO etiquette to post what you have tried so far. You were lucky this time! :-)
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 0, "tags": "sql, mysql, sql server 2005, tsql" }
How to split a item in array to two item with conditional? I have an example above. Have array like: array[0] = TODO 06:15PMJoin Michael array[1] = WakeUp array[2] = Going to schools I want it become like: array[0] = TODO 06:15PM array[1] = Join Michael array[2] = WakeUp array[3] = Going to schools In this example, I split item have content `TODO 06:15PMJoin Michael` to new two item. Have two separate questions here: How to create a role for creating a new item in an array? I tried with my code: `var splitList = words.SelectMany(x => x.Contains("AM") || x.Contains("PM"))` But I don't know how to split from text `AM` or `PM` to the new item in `arrays`.
You can try finding `AM`/`PM` and get substrings: String[] array = new String[] { "TODO 06:15PMJoin Michael", "WakeUp", "Going to schools" }; var result = array .SelectMany(line => { int p = line.IndexOf("AM"); if (p >= 0) return new String[] { line.Substring(0, p + "AM".Length), line.Substring(p + "AM".Length) }; p = line.IndexOf("PM"); if (p >= 0) return new String[] { line.Substring(0, p + "PM".Length), line.Substring(p + "PM".Length) }; return new String[] { line }; } ); //.ToArray(); // if you want to have array representation // Test Console.Write(String.Join(Environment.NewLine, result));
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "c#, arrays" }
Scala XML performance vs. Java XML I would appreciate if anyone could point me in the direction, or inform me of some benchmarks, which is comparing how Scala's XML library does compared to the typical solution in Java. I'm thinking on measurements of parsing and selecting XML elements. Thanks in advance. Regards Stefan
These benchmarks from the "Anti-XML" team are a good place to start, and other parts of the site highlight some of the problems with the current `scala.xml` approach.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 7, "tags": "java, xml, performance, scala" }
Why isn't this variable expanded with eval? I have a question about the following makefile. I use GNU Make v4.1. define code foo:=hello bar:=${foo} endef $(eval ${code}) default: #${foo} #${bar} `${foo}` echoes `hello`, but `${bar}` echoes nothing. Why is this happening? I expected `${bar}` to echo `hello` too, because I think this is equivalent to the following makefile: foo:=hello bar:=${foo} default: #${foo} #${bar}
Add `$(info ${code})` to see what's going on. `${foo}` was expanded when the definition of `code` was build, so `code` contains foo:=hello bar:=${foo} If you want `${foo}` to be expanded when you run `$(eval ${code})`, which is what makes `eval` useful, then you need to make the value of `code` contain a dollar sign. define code foo:=hello bar:=$${foo} endef In this case, you could achieve the same result by making `bar` a late-expansion definiton: bar=${foo} foo:=hello default: #${foo} #${bar} `eval` is useful in more complex cases, especially when string being eval'ed is built dynamically.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "makefile, gnu make" }
Swift handle action on segmented control I have a HMSegmentedControl with 4 segments. When it is selected, it should pop up view. And when the pop up dismissed, and trying to click on same segment index it should again show the pop up. By using following does not have any action on click of same segment index after pop up dissmissed. segmetedControl.addTarget(self, action: "segmentedControlValueChanged:", forControlEvents: UIControlEvents.ValueChanged)
You set your target to fire just when the value change, so if you select the same segment the value will not change and the popover will not display, try to change the event to TouchUpInside, so it will be fired every time you touch inside the segment segmentedControl.addTarget(self, action: #selector(segmentedControlValueChanged(_:)), for: .touchUpInside)
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 46, "tags": "ios, swift, uisegmentedcontrol" }
How to add = to request body to call rest api I've figured out that when calling my API from Angular, the API process inserts a blank row in the database. I made testing with Fiddler and the local API and I was able to insert successfully a row in DB. I had to add a '=' at the beginning of the JSON (request body) in Fiddler and everything worked as expected. FiddlerView My question would be, how can I add the '=' to the request body from Angular to have this working. The code from my service.ts Service.ts Any help would be appreciated... Thanks in advance...
The problem is your content type. You are sending a JSON string in the request body, but you are identifying the content type as "application/x-www-form-urlencoded". You need to change your Content-Type header value to "application/json". Do not use the "=" in the request body, as it is not valid JSON.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angular, rest" }
Unix Command to get file path without basename I have following file in unix directory /home/files/myfiles/good.txt I need to extract the file path alone **Expected output** : `/home/files/myfiles` **Note** : I can not use cut operations as the file path is dynamic. I am getting the filename and filepath as single user input to the shell script
Try $ dirname /home/files/myfiles/good.txt
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 5, "tags": "linux, bash, shell, unix" }
value stored as text after update data userform after update sheet with data, the value has been entered through the user form stored as text, however, the number is entered through textbox, which makes an error on the formula that depends on that number cell format change after sending data, however, change the format to number every time update data Dim ws As Worksheet Set ws = Worksheets("Module") ws.Cells(2, 39).Value = TextBox4
I'm not sure that I get exactly your Problem, but when you want to use your textbox-values for functions you need to convert the textbox-Content as a number-format otherwise you'll get an error in Excel-Functions. Try `Worksheets("Module")ws.Cells(2,39).Value=CLng(Textbox4)` \--> CLng for Long.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "excel, vba" }
How does Tumblr implement their global navigation? Every blog on Tumblr has these two buttons at the top right corner of the page: !Tumblr This global navigation is inside an iframe which points to tumblr.com. **How does Tumblr implement this feature securely**? Tumblr themes can contain untrusted scripts and tumblogs can run on a custom domain (i.e not just *.tumblr.com). I assume Tumblr takes measures to ensure that the navigation iframe's session cookie is not exposed to the blog in which it is embedded. What are those measures? Additionally, does Tumblr whitelist the domains where the navigation iframe can be embedded?
the iframe solution seems to be the only possible way to go, otherwise it wouldn't be possible to carry the Tumblr session cookie, in the case of custom domain blogs. also, there's not much to think about in terms of security. the browser doesn't allow any scripts to access the iframe's contents, since the domains are different.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "javascript, security, iframe, xss, tumblr" }
What managers write while their team is playing I always wonder what football (club) managers write on their notepad while their team is playing. In today's games we are presented with all sorts of statistics of both individual and team performances, so what kind of information they keep on scribbling and how does that help them?
As @Don_Biglia mentioned, there's no way of knowing what a manager writes on his notepad. But some intelligent guesswork would suggest he/she is keeping a note of certain points about the game. It could be anything from a list of things to say at half time to individual advice to be given to certain players. Of course for all we know he/she could just be doodling as well, probably a technique to keep oneself calm. Many managers do not write anything, leaving that job to one of his/her assistants. Basically, it's up to the individual manager to do what he/she wants during a match, as long as he/she stays within the technical area and does not engage in any unsportsmanlike behaviour.
stackexchange-sports
{ "answer_score": 2, "question_score": 5, "tags": "football, coaching" }
Error: foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.ListItem' I am trying to move multiple selected item from one ListBox to another ListBox using this code protected void imgbtnMoveRightListBox_Click(object sender, ImageClickEventArgs e) { foreach (var item in lstboxSkill.SelectedItem) { lstBBoxSkill2.Items.Add(item); } } but it shows an error > foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.ListItem' because 'System.Web.UI.WebControls.ListItem' does not contain a public definition for 'GetEnumerator' I don't know why this error occured. Please help me to fix it
!Snap shot of the page where I am using this Please check this snap shot I have created and its working fine. and the code behind code is given below: protected void Page_Load(object sender, EventArgs e) { lstboxSkill.Items.Add("ASP.Net"); lstboxSkill.Items.Add("C#"); lstboxSkill.Items.Add("AJAX"); lstboxSkill.Items.Add("JavaScript"); lstboxSkill.Items.Add("HTML"); lstboxSkill.Items.Add("HTML5"); lstboxSkill.Items.Add("JQuery"); } protected void imgbtnMoveRightListBox_Click(object sender, EventArgs e) { foreach (ListItem Item in lstboxSkill.Items) { if (Item.Selected == true) { lstBBoxSkill2.Items.Add(Item); } } }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c#, asp.net" }
Jquery update variable through $.GET page var p = 1; var flag = 0; $(window).scroll(function(){ if(flag == 0){ if($(window).scrollTop() == $(document).height() - $(window).height()){ $.get('/fetchMore.php?page=' + p, function(data){}); p++ } } }); I have a page, when scroll down, page will use $.get to fetch more data into it. in my fetchMore.php I have set up if no more data, $flag==1, I need out put javascript to update var flag, so scroll function will not fetch anymore My question is how to update var flag from fetMore.php page?
You cannot change javascript variable directly from php called by ajax. You can probably pass an empty data when no more data is available and check if data is empty in javascript and assign flag to 1 When flag is assigned 1, it will never fetch any more. var p = 1; var flag = 0; $(window).scroll(function(){ if(flag == 0){ if($(window).scrollTop() == $(document).height() - $(window).height()){ $.get('/fetchMore.php?page=' + p, function(data){ if(data == {} || data == [] || data == "") { flag = 1; } }); } } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery" }
How to write a MySQL before insert trigger to insert data in a table? I need to create a trigger for when I insert data in the first table to be able to insert in the second some data related to the first one. CREATE TRIGGER test1 ON Telegramas BEFORE INSERT AS BEGIN INSERT INTO Dispositivos SET Dispositivos.GrupoOrigen = Telegramas.GrupoOrigen; END; I have created that but there is a syntax error that I can not see. Some help? or another way to make the relationship easier?
You have to change the delimiter, like this : delimiter | CREATE TRIGGER test1 [...] END | delimiter ; But there is a problem in your trigger : delimiter | CREATE TRIGGER test1 BEFORE INSERT ON Telegramas FOR EACH ROW BEGIN INSERT INTO Dispositivos SET GrupoOrigen = NEW.GrupoOrigen; END | delimiter ;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "mysql, database, triggers" }
redirect to a specific page from php Hello I am using following code to open a page in PHP header('Location :login.php'); but the problem is that this is doing inside the div of page, when I clicking on that the page is being loaded inside the DIV not on the fill screen, what should I write here to solve the problem? edit I am loading the page like this javascript, in main.php var div = document.getElementById('content'); var url = 'my.php'; div.innerHTML = '<iframe style="width:100%;height:100%;" frameborder="0" src="' + url + '" />'; and I give a link to logout in my.php, here I need to open a login page and destroy the main.php page
Instead of returning a redirect (which redirects only your frame) like you do now, you'll have to have the top frame redirected. Since your code gets loaded in an `IFRAME`, you'll need to change the TOP frame position, instead or returning a header, return the following javascript: <script type="text/javascript"> window.top.location = " </script> The trick is to use `window.top` instead of `window`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php" }
ASP.NET Pages Pages With CMS System For the last two weeks I have been searching for a subject... I'm an ASP.NET C# developer and I want to create a website that allows the use of CMS systems + .net pages, I have seen some CMS like dotnetnuke, kentico, wordpress, MOTO, and so on... Now, what is the best way to incorporate these two together... ASP.NET Pages (I create those) and some pages where I want the user to be able to use a CMS system to modify them. Some people say I can use Wordpress site on one domain, then in the same hosting I create another to host my ASP.NET application... and use links to navigate to each others... Is this the best way? I'm completely confused on what to decide.
In Kentico CMS you can benefit from wide range of development models. List of those you could be interested in follows: 1. Portal engine - pages are completely controlled by Kentico (design, content, properties, etc.) 2. ASPX - you develop ASPX pages in Visual Studio and use them in Kentico as they are. You can still edit their general properties (regarding urls, security, caching, etc). 3. Mixed \- you create your pages in Visual Studio and use Kentico (server/user) controls which will allow you to edit design & content in Kentico UI.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net, wordpress, content management system" }
What lost bible commentary did St. Thomas Aquinas want more than an entire kingdom? I've heard it claimed that St. Thomas Aquinas desired to obtain a manuscript of a biblical commentary (by St. John Chrysostom?) more than he desired to posses an entire kingdom. What is the source of this story?
G. K. Chesterton, _St. Thomas Aquinas_ (1933) ch. 4: > As he entered Paris, they showed him from the hill that splendour of new spires beginning, and somebody said something like, “How grand it must be to own all this.” And Thomas Aquinas only muttered, “I would rather have that Chrysostom MS. I can’t get hold of.” Brian Davies, O.P., _The Thought of Thomas Aquinas_ (2015) p. 7: > According to one story he is said to have been asked if he would like to be lord of Paris. He is supposed to have replied that he would not know what to do with the city and that he would rather have the (presumably lost) homilies of St John Chrysostom (c.347–407) on the Gospel of St Matthew.29 > > * * * > > 29\. Cf. Ferrua, _Thomae Aquinatis …_, 318.
stackexchange-christianity
{ "answer_score": 0, "question_score": 2, "tags": "reference request, saint, st thomas aquinas, manuscript, bible commentary" }