INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
I'm trying to change the style of the <% and %> denotation in Visual Studio, where are the referred to in the settings? Currently the **_< %_** tags in my VS editor show a bright yellow and I wanted to change the setting under tools->options. What are they called under settings?
Tools->Options->Environment->Font Colors->HTML Server Side Script
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "visual studio 2010" }
Why does my JSON array turn into an object? I am trying to unset a value from test_bots.json and save it back, but somehow the data format is being changed in the process. test_bots.json contains this JSON array: ["John","Vladimir","Toni","Joshua","Jessica"] My code looks like this: $good = 'Toni'; $good_arr = file_get_contents('test_bots.json'); $good_arr = json_decode($good_arr); if(in_array($good, $good_arr)){ $key = array_search($good, $good_arr); unset($good_arr[$key]); $good_arr2 = json_encode($good_arr); file_put_contents('test_bots.json',$good_arr2); } The output that's saved is: {"0":"John","1":"Vladimir","3":"Joshua","4":"Jessica"} but I want the output to look like: ["John","Vladimir","Joshua","Jessica"] I tried to unserialize the array before saving it, but it's not working. Why is this happening?
In order for `json_encode` to convert a PHP array with numeric keys to a JSON array rather than a JSON object, the keys must be sequential. (See example #4 in the PHP manual for `json_encode`.) You can accomplish this in your code by using `array_values`, which will reindex the array after you have removed one of the items. $good_arr2 = json_encode(array_values($good_arr));
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "php, json, unset, file put contents" }
How to connect ElephantSQL with TypeORM? In documentation is only example showing connection with local database: 'ormconfig.json' { "type": "mysql", "host": "localhost", "port": 3306, "username": "test", "password": "test", "database": "test" } I want to connect with online-based ElephantSQL and I can not find solution.
I was able to connect, and here is my solution. { "name": "default", "type": "postgres", "url": <URL>, "synchronize": true, "logging": true, "entities": ["src/entity/*.*"] } URL is the url string something like "postgres://xxxxx:5432/xxxx"
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "sql, database, postgresql, cloud, typeorm" }
If $u$ is real valued function on $\Omega \subset \Bbb R^n$ then what is meant by $D^{\alpha} u$? If $u$ is real valued function on $\Omega \subset \Bbb R^n$ such that $u \in C^{\infty} (\Omega)$ then what is meant by $D^{\alpha} u$ where $\alpha$ is a multi-index.I need this in order to understand Cauchy's estimate.
Let $\alpha := (\alpha_1,\alpha_2, \cdots , \alpha_n)$. Then $$D^{\alpha} := {\frac {{\partial}^{\alpha_1}} {{\partial} {x_1}^{\alpha_1}}} {\frac {{\partial}^{\alpha_2 }} {{\partial} {x_2}^{\alpha_2}}} \cdots {\frac {{\partial}^{\alpha_n}} {{\partial} {x_n}^{\alpha_n}}} = \frac {{\partial}^{|\alpha|}} {{{\partial} {x_1}^{\alpha_1}}{{\partial} {x_2}^{\alpha_2}} \cdots {{\partial} {x_n}^ {\alpha_n}}},$$ where $|\alpha| = \alpha_1 + \alpha_2 + \cdots + \alpha_n$, $\alpha_i \in \Bbb N$ for $i= 1,2, \cdots , n$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "multivariable calculus, partial differential equations" }
Problems with URL shortening (Symfony) I have a problem, I don't know if it's a routing problem. This is the adress to my symfony project: And it works. When clicking on a link to module1 <a href="<?php echo url_for('module1/index'); ?>">module1</a> the browser shortens the adress to 192.168.10.10/module1 and gives a not-found error. When I add index.php manually (so that the adress is 192.168.10.10/index.php/module1) it works and the right page is shown. Why? Where is the problem?
Either set no_script_name: false in your `app/frontend/config/settings.yml` Or check if your Apache has mod_rewrite enabled (assuming that you're using Apache).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "symfony 1.4" }
How to find the files being written between a time range in java in unix I have several files in a directory , I want to find the files which were written between a time range. As I know its not possible to get create time of file in linux. I can work out with sorting files with last modified time , is there any simpler way to do this ?
**In case you mean implicitly for java solution:** In Java, you can use the `File.lastModified()` to get the file’s last modified timestamps. This method will returns the time in **milliseconds** (long value, from epoch time), you may to format it with `SimpleDateFormat` to make it a human readable format. So all you need to do is something like this: File folder = new File("your/path"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { if(listOfFiles[i].lastModified() > FROM && listOfFiles[i].lastModified() < TO){ doSomething(); } } } **NOTE** : `FROM,TO` are of type long and represent a time stamp.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "java, unix" }
jquery/javascript function within string concatenation i want to concatenation string having some calculated values in between, so i tried the code below: var html = '<tr>' + function () { var tds = '' array.each(function (i, ele) { tds += '<td>' + i + '</td>' }); return tds; } + '</tr>'; But its not working. The function i used in concatenation as treating like a string itself !. Is there any way to do that ? Thank you
You need to use an immediately-executing function: var html = '<tr>' + (function () { var tds = '' array.each(function (i, ele) { tds += '<td>' + i + '</td>' }); return tds; })() + '</tr>'; But you don't need this function, you can use existing functions to do what you want: var html = '<tr>' + array.map(function(i, ele) { return '<td>' + i + '</td>'; }).join() + '</tr>';
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "javascript, jquery" }
How to remove a log filter/formatter I have the following logging filter: class LogFilter: """ Print all messages that do not equal hello.""" def filter(self, record): print ('@@@@@@@ Filter', record) if getattr(record, 'msg') == 'Hello': return False return True def __repr__(self): return 'LogFilter' And then: import logging handler = logging.StreamHandler() handler.addFilter(LogFilter()) logger = logging.getLogger(__name__) logger.addHandler(handler) How would I remove this filter? For example when I try: >>> handler.removeFilter(LogFilter()) >>> handler.removeFilter(LogFilter) >>> handler.removeFilter('LogFilter') # ???? >>> handler.filters [LogFilter] # filter is still there. I still have the filter. What is the correct way to remove a Filter (or Formatter as well)?
If you look at the source code for `removeFilter` def removeFilter(self, filter): """ Remove the specified filter from this handler. """ if filter in self.filters: self.filters.remove(filter) You see that you need the actual `filter` object in order to remove it. A quick fix would be to do import logging handler = logging.StreamHandler() LF = LogFilter() handler.addFilter(LF) logger = logging.getLogger(__name__) logger.addHandler(handler) And then, when you want to remove the filter >>> handler.removeFilter(LF) >>> handler.filters []
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "python, python 3.x, logging" }
Function in R: Use list argument as character string I am writing a function that uses a list argument. Within this function, I am converting the list into a data frame using `stack()`. Now, my question is, how can I rename the column of the resulting data frame (or of any other, as would be needed for the real function) with the name of the list which I use in the function argument? My function : stack_and_rename <- function(list) { stacked_list <- stack(list) names(stacked_list)[names(stacked_list)=='ind'] <- 'list' stacked_list } A dummy list: fields <- list(A = c(2:4, 12:16, 24:28, 36:40, 48:49), B = c(6:10, 18:22, 30:34, 42:46)) But calling `stack_and_rename(fields)` obviously returns a data frame with the columns 'values' and 'list', although I would like to get 'values' and 'fields'. I must be making some referencing errors, but I just can't get the solution. Thanks!
We can use `deparse(substitute` from `base R` stack_and_rename <- function(list) { nm1 <- deparse(substitute(list)) stacked_list <- stack(list) names(stacked_list)[names(stacked_list)=='ind'] <- nm1 stacked_list } stack_and_rename(fields) * * * Or with `dplyr` library(dplyr) stack_and_rename <- function(list) { nm1 <- quo_name(enquo(list)) stacked_list <- stack(list) stacked_list %>% rename_at(vars('ind'), funs(paste0(nm1))) #or #rename(!! nm1 := ind) } stack_and_rename(fields) %>% names #[1] "values" "fields"
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "r, function, arguments" }
RestTemplate only get data I care about A RestTemplate request I am making gives a JSON request of a large data type. For example it responds with a channel object, a user object, and a preferences object. I only need the information that relates to a channel object. Is there any way to have the responseType only deal with the channel object even though the response contains more than that? I am only asking because I feel like it is pointless to create DTOs that contain fields that I don't care about and will never use.
You can create a pojo with channel object and mark pojo to ignore unknown properties , @JsonIgnoreProperties(ignoreUnknown = true) public class Myclass { Channel channel; ... } In rest template , restTemplate.exchange(url, HttpMethod.POST, entity, Myclass .class);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "spring, resttemplate" }
Bug trying to add two strings with snprintf I'm trying to add two strings with snprintf but apparently i dont know what i'm doing. Here is the code block: char * filename = NULL; (void)snprintf (filename, sizeof(filename), "%s/%s", PATH, FILE); I also tried: char * filename = NULL; (void)snprintf (filename, sizeof(PATH)+sizeof(FILE)+1, "%s/%s", PATH, FILE); PATH and FILE are header defined strings. Occassionally, this code works, occassionally it does not. I'm sure it's some kind of memory issue, what have I done wrong? EDIT: My issue was for some reason thinking that snprintf allocated memory for you. I'm accepting the answer that cleared that up, since it was my real issue, but I've decided to go with the compile time string concatenation since that is a really nice trick.
You should allocate memory first. char * filename = NULL; filename = malloc(sizeof(PATH) + sizeof(FILE) + 1); snprintf (filename, sizeof(PATH) + sizeof(FILE) + 1, "%s/%s", PATH, FILE);
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "c, string, memory management" }
how to add list of floats within a list of floats in c#, unity? I have a forloop that loops through an array and converts the array into a list of float. private List<Single> xfloats; for (int i = 0; i < DataServerManager.instance.x.Count; i++) { xfloats = DataServerManager.instance.x.Select(str => (ok: Single.TryParse(str, out Single f), f)).Where(t => t.ok).Select(t => t.f).ToList(); } I have another list of floats called 'tempList' and I want to add the results from 'xfloats' into the tempList. But I am getting the error: **error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.List' to 'float'** List<float> tempList = new List<float>(); tempList.Add(xfloats); **How do I add a list of floats into a list of floats?**
It sounds in the question text like `tempList` will already have some data in it, but in the code samples like it looks like a new empty list. Those two situations call for different answers. If `tempList` already has data: var xfloats = DataServerManager.instance.x.Select(str => (ok: Single.TryParse(str, out Single f), f)).Where(t => t.ok).Select(t => t.f); tempList.AddRange(xfloats); If it does not already have data: var xfloats = DataServerManager.instance.x.Select(str => (ok: Single.TryParse(str, out Single f), f)).Where(t => t.ok).Select(t => t.f); var tempList = xfloats.ToList(); In both cases, `xfloats` will be an **`IEnumerable<int>`** rather than a List. This will help performance and memory use.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, list, unity3d" }
How does Caffe handle non-integer convolution layer output size? I am studying a project which someone did in Caffe where input image is 400 by 400 pixels and first layer is convolution with kernel_size: 11 and stride: 4. Then according to my calculations, output image size = ((400-11)/4) + 1 which is 398.25 which is not an integer. So in this case, what would the output size be? The following is the prototxt with these values: name: "RP" input: "data" input_dim: 32 input_dim: 3 input_dim: 400 input_dim: 400 layers { bottom: "data" top: "conv1" name: "conv1" type: CONVOLUTION convolution_param { num_output: 64 kernel_size: 11 stride: 4 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 }
It should be `floor((input + 2*pad -filter) / stride) + 1`, which in your case is `floor((400-11)/4) + 1 = floor(97.25) + 1 = 98`. ref: caffe source code also see this answer
stackexchange-stats
{ "answer_score": 1, "question_score": 2, "tags": "machine learning, deep learning, conv neural network" }
Getting the authenticated username to a function view in django Im trying to modify the current user's data but with no sucess, need some help. def account_admin(request): if request.method == 'POST': mod_form = ModificationForm(request.POST) if mod_form.is_valid(): user = User.objects.get(request.user) user.set_password(form.cleaned_data['password1']) user.email = form.cleaned_data['email'] user.save return HttpResponseRedirect('/register/success/') else: mod_form = ModificationForm() variables = RequestContext(request, { 'mod_form': mod_form }) return render_to_response('registration/account.html', variables)
Your issue is here: user = User.objects.get(request.user) Ideally, it would have been user = User.objects.get(id=request.user.id) You dont need a query to retrieve the user object here, since `request.user` evaluates to an instance of the logged in user object. user = request.user user.set_password(form.cleaned_data['password1']) user.email = form.cleaned_data['email'] user.save() Should work Also, make sure you have the `@login_required` decorator to the `account_admin` method
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, django" }
Compare two hashes and create new hash or change existing hash with new key/values My situation: hash1 = { "344"=> "QTC-2", "343"=> "QTC-1" } hash2 = { "QTC-1"=> 1, "QTC-2"=> 1, "QTC-3"=> 2 } I want to compare hash1 and hash2. I want to loop through the hashes and: If hash1 value matches hash2 key (QTC-1 == QTC-1), then the new hash should become: new_hash3 = { "344"=> '1', "343"=> '1' } (Or change hash1 values instead of making a new_hash3 or change hash2 keys)
hash1 = {"344"=>"QTC-2", "343"=>"QTC-1"} hash2 = {"QTC-1"=> 1, "QTC-2"=> 1, "QTC-3"=> 2 } new_hash3 = hash1.each_with_object({}) {|(k,v), h| h[k] = hash2[v] if hash2.has_key?(v) } # => {"344"=>1, "343"=>1}
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -2, "tags": "ruby, hash" }
Komodo Edit - code-completion for Django? I've been using Komodo Edit for a small project in Django. The code completion features seem to work pretty well for standard python modules, however, it doesn't know anything about Django modules. Is there any way to configure Komodo Edit to use Django modules for autocomplete as well?
By sure Django is on your python path and Komodo should pick it up. Alternatively you can add the location of Django to where Komodo looks for its autocomplete.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "python, django, ide, code completion, komodo" }
Trying to identify source of error shown in Chrome JavaScript Console I'm using the latest version of Chrome (14.0.x) to debug my javascript (latest jQuery) as well as manipulate CSS. As of a few versions ago of Chrome, I am always getting the following error in the JavaScript Console. Does anyone have any idea how I can track down the source of this error in my code? Error in event handler for 'undefined': TypeError: Cannot call method 'replace' of undefined at handleGetResources (chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/ContentScript.js:12:70) at chrome/RendererExtensionBindings:239:13 at [object Object].dispatch (chrome/EventBindings:181:28) at Object.<anonymous> (chrome/RendererExtensionBindings:141:22) and the file it points to is "chrome/EventBindings:183" Thanks in advance
I found the issue. It isn't in my code, but in one of the Extensions I installed. I disabled all the extensions and saw that the error went away, then started adding the extensions in one by one. FYI, the offending Extension was "SiteAdvisor - Version: 3.31.137.7"
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "jquery, debugging, google chrome" }
Can a Hyper-V machine be made slower and/or emulate a slow network connection? I need to reproduce an issue with a client-server asynchronous communication (a bunch of JavaScript AJAX vs. an OData api), seemingly caused by some race condition in the calculations when the server and/or the network connection slow down. Now, the test environment I have is a local Hyper-V machine, so it's all shiny and fast ... I need it to _slow down_ to verify it. Is there any known method to (basically) make a LAN Hyper-V machine to behave like a remote server reached though a crawling internet connection ?
The best method I have found for simulating a crapy internet connection is to put a pfsense router between the server and my test PC and setup the Limiter features. < This can be used to emulate a slow network, latency or even introduce packet loss to see how your applications react to adverse network conditions. pfsense can run inside a hyperv virtual machine. So you can set it up then change the webserver network settings to be behind pfsense. If you don't like pfsense you can use any BSD distro that supports Dummynet. <
stackexchange-serverfault
{ "answer_score": 4, "question_score": 3, "tags": "networking, performance, hyper v" }
How to show list of phone contacts that are using same app as me? I am creating a custom app for planning events. It has a SMS based authentication. Now I want to create a list of people who are already using the app (like the list of contacts in WhatsApp). Is there any way to do this in Android?
If I get you right, you can do this in 3 steps: 1. When a user registers on your app, save the user in say "ActiveNumbers" database on your server. 2. Ask contacts permission from users. 3. Do a join of the contacts and ActiveNumbers table, list the valid contacts in the people section of your app. Does it solve your problem?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android" }
Open Source Robotic Saw I know that there are several opensource printers, i.e. RepRap. Are there any similar projects for robotic woodworking saw or other instruments?
I don't believe there are many common computer controlled saws except for custom-built, highly specific machines. However, there are three common machines that are more general purpose that can probably do the job you need: * Computer controlled routers * Computer controlled laser cutters * Computer controlled high-pressure waterjet cutters. There are many open source and custom built, as well as commercial CNC routers. As for the other two, I think those remain mostly commercially built. There are also many companies that operate these machines that will cut things for you, for a fee.
stackexchange-woodworking
{ "answer_score": 2, "question_score": 1, "tags": "tools" }
How do I put an already-running process under nohup? I have a process that is already running for a long time and don't want to end it. How do I put it under nohup (that is, how do I cause it to continue running even if I close the terminal?)
Using the Job Control of bash to send the process into the background: 1. `Ctrl`+`Z` to stop (pause) the program and get back to the shell. 2. `bg` to run it in the background. 3. `disown -h [job-spec]` where [job-spec] is the job number (like `%1` for the first running job; find about your number with the `jobs` command) so that the job isn't killed when the terminal closes.
stackexchange-stackoverflow
{ "answer_score": 1519, "question_score": 1063, "tags": "bash, shell, job scheduling, nohup, interruption" }
Resilience pattern for a long run task My application is hosted in a container, and in the real environment, there are 3 containers deployed. Let me say, they are A, B and C. The application needs to execute long run tasks. So, this time, A starts a long run task. And, if A is down, I want either B or C to resume that task. My current solution is, when A starts the task, A writes a timestamp, task status and an executing flag record to DB. I have a timeout setting, for example, 2 hours. B and C constantly query the database to find tasks whose statuses are not `finished` and `currentTime - the written timestamp` is more than 2 hours. They then start to resume the tasks. The solution has a problem. For example, `task1` in DB meets the query status, and both B and C get to know `task1` needs to be resumed. How should I only let either B or C to pick up the task?
A simple solution could be to implement a locking mechanism. E.g. an optimistic locking approach could look like this: B & C both try to pick up Task 1. They will have to write a lock to the database stating that they are the current owner. A was the previous owner. B writes a record with B as the current owner. C, by checking when writing whether the record still contains A as current owner can see that their request is outdated and C will give up.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, distributed computing" }
Find names similar to a given name in a large data set I'm trying to find a 'similar' name to every item in a list nearName[name_, namesList_] := Module[{lista, pos}, lista = EditDistance[ToLowerCase[name], ToLowerCase[ToString[#]]] & /@ (namesList); pos = Flatten[Position[lista, Min[lista]]]; If[Length[pos] > 1 || Min[lista] > 3 , Missing["NotAvailable"], namesList[[pos]]]] The problem is that with a very large input (`nameList` contains about 400k items and I make about 1k calls to `nearName`), `nearName` is using a lot of CPU. Is there any way I can make this faster?
I'd think this more efficient: names = {"rob", "joe", "jack"}; find = Module[{nf = Nearest[#2], res}, If[EditDistance[#, res = First@nf[#]] <= 3,res, Missing["NotAvailable"]]] &; find["boc", names] find["franny", names] (* "rob" Missing["NotAvailable"] *) Do `Lowercase` conversion if case matters, and if you plan on many repeated look-ups, probably best to generate the nearest function `nf` once and re-use it. Re-reading your OP, I think this better fits the question (based on my interpretation of the code): find = Module[{nf = Nearest[#2], res}, If[EditDistance[#, First@(res = nf[#])] <= 3 && (Length@res == 1 || EditDistance[#, res[[1]]] != EditDistance[#, res[[2]]]), First@res, Missing["NotAvailable"]]] &
stackexchange-mathematica
{ "answer_score": 4, "question_score": 2, "tags": "pattern matching, string manipulation" }
How to fix "error:assignment to expression with array type"? I'm getting an error: > error:assignment to expression with array type in this program, which should print words that have 4-8 letters: #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char rec[300]; int zbroj1=0, br=0, zbroj2=0; while((rec=getchar()) != '\n') { zbroj1++; } if(zbroj1>=4 || zbroj1<=8) printf("Nova recenica je: %s", zbroj1); return 0; } How can I fix this?
Below is the code to print words of size >= 4 and <= 8 #include<stdio.h> int main(void) { char rec[9]; //you may need to adjust the buffer according to the size of the words int br=0, zbroj2=0; while((zbroj2=getchar()) != '\n') { if(br < 8) rec[br] = zbroj2; // we are not going to store the words having length more than 8 br++; if(zbroj2 == 32){ if(br>4 && br<=8){ rec[br] = '\0'; printf("Nova recenica je: %s\n", rec); } br = 0; } } if(br>=4 && br<=8){ // This check is to catch the last word rec[br] = '\0'; printf("Nova recenica je: %s\n", rec); } return 0; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c" }
Web pages download to desktop instead of load? I am in the middle of migrating a Magento site over to a new server. I followed instructions provided in this video to a T- < However, now when I try to access the transferred site, any pages just download to my desktop instead of displaying in browser. I have _never_ encountered this before. Have you? Does anyone know what this could be? I apologize if this is too broad, but I'm wondering if maybe it's something I have to change in a file like .htaccess or something Help!
As I suspected- it was the .htaccess file. I fixed the issue by deleting the file altogether, though I'm sure I want only able to get away with that because I migrated everything into a subdirectory to begin with rather than the root. I am unsure if this will still be a viable solution for those experiencing the same problem in a root directory.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "magento, migration" }
Can't build Boost 64 bit dynamic libraries, only static I have recently acquired Visual Studio 2010 through Dreamspark, so I can now compile 64 bit applications and libraries. I then compiled the Boost 1.47 libraries with Bjam using the following line for input. .\b2 -a -d 0 -q -j 4 -d 0 --variant=debug,release --link=shared,static --threading=multi --address-model=32 --toolset=msvc-10.0 When I do, I get 4 of each library (static-debug, dynamic-debug, static-release, dynamic-release). After they are compiled, I move them into another directory called win32libs. I then use the exact same line to compile the 64 bit versions, but switch the address model to 64 (I know they are almost identical because I copy and past from the same text document I made to make compiling them easy). When I go into my stage directory after the 64 bit compilation, I only see .lib, no .dll. Is this an issue with what I'm doing, or is in some way, 64 bit dlls not supported? Thanks
The options that change how Boost is compiled (as opposed to those that just control b2's execution) are called "features" and must not be preceeded by dashes on the command line. In your example the features are: * variant * link * threading * address-model * toolset The libraries it generates will be named according to the library naming scheme for Boost on Windows. lib*.lib are static libraries; other*.lib are the import libs for the corresponding DLLs.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "c++, boost, dynamic, static" }
Как создать typescript type definition (d.ts) файл для typescript umd библиотеки Есть библиотека, написанная на typescript. < Собирается при помощи gulp+webpack в umd бандл. Нужно создать type definition бандл или просто корректное множество d.ts файлов. Чтобы была возможность использовать эту библиотеку в typescript проектах. Хотелось бы чтобы библиотека добавлялась в typings/global и подключалась как-то так: import * as Survey from 'surveyjs'; при этом всё, что будет доступно в Survey.* описано например тут: < Попытки собирать bundle при помощи: < и < не увенчались успехом, если кто-то поможет с конфигурацией этих проектов,тоже буду рад.
Ответ был получен тут: < Посоветовали использовать `declaration flag`. Я создам ещё два вопроса, более точных про создание **bundle.d.ts** И про **webpack-stream**
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "typescript, webpack, ecmascript 6" }
Can't connect to dBase files from web app I have a web app, written about 10 years ago (VB.NET/ASP). It uses the following connection string to connect to dBase 5 files: Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=[SOURCE_PATH]; This has been working great for years. Now we are moving this app to a 64 bit server, and this connection is now giving me ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified I've read numerous suggestions in numerous threads, including changing the above connection string to Microsoft.Jet.OLEDB.4.0; or Microsoft.Jet.OLEDB.12. but that didn't do anything. I also tried setting Enable 32-Bit Applications settings on the application pool on the web server to TRUE, but that resulted in HTTP Error 503. The service is unavailable Can somebody point me in the right direction please??
Try to change your connection string from Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=[SOURCE_PATH]; to Driver={Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[SOURCE_PATH];Extended Properties=dBASE 5.0;} You also have to change your code from ODBC objects (DataSet, etc), to OLEDB objects.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "asp.net, vb.net, odbc, jet, dbase" }
Ставится ли тут запятая? Предложение типа: "Так что(,) я пойду один" - нужна тут запятая или нет?
Конечно, хорошо бы увидеть предыдущее предложение. Если я заменю на "стало быть", "значит" - смысл не изменится? Тогда, вероятнее всего. это вводное слово (указывает на отношения между частями высказывания) и запятая ставится.
stackexchange-rus
{ "answer_score": 0, "question_score": 0, "tags": "пунктуация" }
How can I run different projects from a script in windows? I have two visual studio projects (for different purpose... they act on two different hardware) and also, I have a Java project that have control on something else. I am working in windows. My question is that how can I write a script (like shell script) to control different projects from a single program. More specifically, suppose I want to do something like this: execute project 1 with parameters x1,x2,...,xn, then execute project 2 with parameters y1,y2,...,yn, then execute project 1, then project 3, & so on... Is there any tutorial or short description that I can follow to implement my concept?
There's a myriad of options/scripting languages/... to achieve this, but if you just want to run a bunch of exes then a simple windows batch file will do just fine: @echo off set my_exe=c:\path\to\my.exe set my_other_exe=c:\path\to\my_other.exe %my_exe% a %my_exe% a b c %my_other_exe% x %my_other_exe% x y z pause Save this with your favourite editor with a `.bat` extension and run by double-clicking. The lines with `set` create variables so you don't have to paste the full path to your exes the whole time. The lines referring to those variables will invoke the executables aith the argumenst that come after it. Search the internet for 'batch file examples' or something like that and you will quickly find all the info needed.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, windows, visual studio, scripting" }
Is it possible to reach The Lighthouse in Destiny only by buying Favors of Osiris? Trials of Osiris in Destiny is a special PVP playlist. 3 losses and you're done, but as you win more the rewards significantly increase. At 9 wins and 0 losses you're able to enter a special social area that has additional rewards. This is easier said than done. The associated vendor offers an item that "adds one win to your trials passage". If I purchase enough of these (9), will I be able to reach The Lighthouse?
No, that is not possible. The reason being that your trials passage card can only be used with one boon of each type. So basically, the best you can get is to skip your first loss, start with a free win, and hopefully get a two for one win on your first match. But after that, you are spent. The card cannot have any more boons and in order to purchase another boon you will need to purchase a new card first.
stackexchange-gaming
{ "answer_score": 1, "question_score": 1, "tags": "destiny" }
Setting Culture / Language in RichTextBox WPF Hi there is possible to set a default language or set a new one in RichTextBox, i want to set it in "es-PE" for spellchecker propouses Thanks!
It would seem to be possible setting the xml:lang as in the code below: <StackPanel> <RichTextBox SpellCheck.IsEnabled="True"/> <RichTextBox SpellCheck.IsEnabled="True" xml:lang="es-PE"/> </StackPanel> The first box checks in the default culture and the second in the specified one ("es-PE"). The documentation also suggests you could add this attribute to a parent control such as a panel and it will be inherited by the child controls.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "wpf, wpf controls, richtextbox, culture" }
how to map through an array of objects in react redux I am trying to access the users via redux const mapStateToProps = state => ({ user: state.user.userdata }) and when I do console.log(this.props.user) I get an array of two objects data and status data: Array(2) 0: {id: 1, name: "kayondo"} 1: {id: 2, name: "syphat"} length: 2 __proto__: Array(0) status: 200 but when i try to map through the data key by this.props.user.data.map(x => (<div>{x.name}</div>} i get an error `undefined` in the console `? How can I solve this`
You aren't using the right syntax to map. Try using this one: this.props.user.data.map(x => (<div>{x.name}</div>));
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, reactjs, redux" }
attr_accessor vs attr_reader & instance variables could anyone please tell me the difference (if there are any) between class Car attr_accessor :engine def initialize(engine) self.engine = engine end end and class Car attr_reader :engine def initialize(engine) @engine = engine end end Or are they practically the same?
`attr_accessor` defines `getter` and `setter`.`attr_reader` defines only `getter`. class Car attr_reader :engine def initialize(engine) @engine = engine end end Car.instance_methods(false) # => [:engine] With the above code you defined only `def engine; @engine ;end`. class Car attr_accessor :engine def initialize(engine) self.engine = engine end end Car.instance_methods(false) # => [:engine, :engine=] With the above code you defined only `def engine; @engine ;end` and `def engine=(engine) ;@engine = engine ;end`.
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 8, "tags": "ruby" }
Does unbinding bubble in jQuery? If I bind an event to an element in jQuery, do I always have to unbind it from the exact same element I bound it to? Can I unbind from a child or a parent? I am also using an event namespace - does this have any bearing on the situation? <div id="id1"> <div id="id2"> <div id="id3"> hello </div> </div> </div> $("#id2").bind("click.mynamespace", function() { alert("hi!");}); $("#id1").unbind("click.mynamespace"); //will this work? $("#id3").unbind("click.mynamespace"); //will this work? It doesn't seem to be mentioned anywhere in the jQuery documentation.
No, it is not an event and thus does not bubble. All event-related functions will act on _exactly_ the elements in the jQuery object. If you want this behaviour, simply select all elements: // element and its children $('#id1').find('*').andSelf().unbind('click.mynamespace'); // element and its parents $('#id3').parents().andSelf().unbind('click.mynamespace'); On a side-note, `.bind()` and `.unbind()` are kind of deprecated as of jQuery 1.7 - better use `.on()` and `.off()` instead (same arguments in your case).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "jquery, jquery events" }
Do these three sentences have the same meaning? "I didn't ask about this", "I didn't ask this question", "I didn't ask this" - do these three versions have the same meaning amd are correct in a situation when I want to say that it wasn't me who asked that question, but someone else?
You could use any of those sentences to express the meaning you have stated. However, your later comment in the text is actually the most clear: > It wasn't I who asked that question. This makes it explicitly clear that the question was asked, but by someone other than you. The other three sentences might be used to clarify that the speaker did ask question, but a different question. However, the context of the situation would probably make your original intention clear. Emphasis would also make the meaning clear, especially in spoken dialog. > _I_ didn't ask this question. The emphasis on "I" implies that someone else asked the question.
stackexchange-ell
{ "answer_score": 3, "question_score": 0, "tags": "word choice, syntax" }
MySql: Update more than one column **My timetable table looks like this:** id period mon mon_tch tue tue_tch wed wed_tch -- ------ --- ------- --- ------- --- ------- 1 prd1 4 5 8 7 6 3 2 prd2 6 3 4 5 8 7 **My teacher-subject table:** id tchr subject -- ---- ------- 1 5 4 2 7 8 where values in `mon` is the subject_id and `mon_tch` is the `teacher_id` and so on. When admin changes the subject of a teacher in the 'teacher-subject' table via a form (example: subject of teacher with id 5 is changed from 8 to 9), I want to update my timetable table with the new subject assigned. ( **consider the subject field in the teacher-subject table will be updated somehow** ).
A normalised design might look like this... period day subject teacher -------------------------- 1 mon 4 5 1 tue 8 7 1 wed 6 3 2 mon 6 3 2 tue 4 5 2 wed 8 7 ... where (period,day) constitutes a compound PK. That said, there may still be some redundancy here.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, mysql" }
What does it mean when matlab can't find the locale database? I have a C++ program that uses the matlab interface on linux. When I run the C++ program, I get an error relating to the locale database: MATLAB:I18n:LocaleDatabaseNotFound - Cannot find the MATLAB locale database. The MATLAB process default locale is set to "en_US.US-ASCII". What does this mean? Will this error result in serious numerical problems, or is it just a minor warning?
In plain English, this error message means that Matlab usually tries to speak the language of the user, so the user interface is in English for English users, in French for French users and so on. This is done by assigning a number to each text string that needs translation and pulling the translated stings out of a database (the 'locale database'). In your case, Matlab cannot find the translations for your language settings and falls back to English messages. This has no impact on your numerical calculations and is only cosmetic in nature. Maybe there could be problems with import/export formatting of ASCII data (decimal point vs decimal comma, thousand separator as ', comma or space, date as y/m/d or d/m/y or d.m.y is another aspect of the locale information).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c++, linux, matlab, locale, matlab engine" }
How to change Windows 10 console screen buffer beyond 9999? The hard limit for the legacy Windows console was 9999. I'm surprised to see that, in the new console's dialog box, MS have still set a limit of 4 figures (therefore 9999) for the maximum screen buffer size. Is this a technical limitation or just the UI refusing to let you go beyond this? If it's not a technical limitation, how can I increase it beyond 9999?
The technical limitation of backscroll buffer in Windows (not only Win10) is not a 9999 but 32766. You can't change it via console window properties but you may write small program which calls `SetConsoleScreenBufferSize` and set it to desired value. Or just use alternative terminals like ConEmu.
stackexchange-superuser
{ "answer_score": 6, "question_score": 5, "tags": "windows 10, console" }
how to check the div value in javascript How to set the div CSS styles using javascript? I have a problem with getting the value of class name. Please help if anyone know it. <div class="this_is_i_want_to_set_the_background_color" id="divname"></div> <div class="test" id="divname"></div> var className = $('.divname').attr('class'); var t = 'divalue'; if(className == t){ $('.divname').css('background', '#0962ae'); }
You may use `.hasClass` method: $('.divname').each(function() { if ($(this).hasClass('divalue')) { $(this).css('background', '#0962ae'); } }); But there is one simpler way to do this: // an element with class 'divname' also has class 'divalue' $('.divname.divalue').css('background', '#0962ae');
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "javascript, html" }
ValueError: zero length field name in format in Python2.6.6 I use this python shell to generate a string: >>>':'.join("{:x}\n".format(random.randint(0, 2**16 - 1)) for i in range(4)) When I run this shell in Python2.7.5, everything goes okay. But it occurs `ValueError: zero length field name in format` when Python version is `2.6.6`. What should I run this shell fine when Python version is `2.6.6`?
In Python versions 2.6 or earlier, you need to explicitly number the format fields: ':'.join("{0:x}\n".format(random.randint(0, 2**16 - 1)) for i in range(4)) # ^ You can read about this in the docs: > Changed in version 2.7: The positional argument specifiers can be omitted, so `'{} {}'` is equivalent to `'{0} {1}'`.
stackexchange-stackoverflow
{ "answer_score": 80, "question_score": 49, "tags": "python, format" }
To-do list words I'm learning Chinese, and trying to use it more in my daily life, e.g. by making to-do lists in Chinese. What's the Chinese term for a to-do list, and what are words you might use if you finish something on your list? In English, I would say 'tick', but might also say 'finished' or 'done'. Would you say or or maybe something else?
There's no exact word-to-word translate in Chinese. Generally we refer things like to-do list as (tasks to be finished) or (list of tasks). Just as @Khahoe Tan said, I recommend using or to mark as `completed`.
stackexchange-chinese
{ "answer_score": 6, "question_score": 3, "tags": "word choice" }
Help needed on contains() Here is the HTML code of a radio button <input type="radio" class="grgrgrtgxxxxfeegrgbrg"> I am trying to check whether radio button's name is having xx. Here is my jquery code i have written if($(this).prop('class').contains('xxxx')) { alert("Yup"); } Please tell me the Syntax mistake in it.
`contains` is a jQuery method that works with elements not with strings so you must use string methods: if($(this).prop('class').indexOf("xx")>-1) { alert("Yup"); } But as someone else said you can use hasClass: if($(this).hasClass("xx")) ...
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "jquery" }
How to display multiple headers I am trying to display multiple headers all on the same horizontal line. So far, I am able to display two of them, but the third keeps falling down a line. The following is an image of the what it currently looks like: current display The current code to display the headers: <header> <h1 class="text-sm display-3 font-weight-thin " style="text-align:center;float:left;" >Amazon</h1> <h1 class="text-sm display-3 font-weight-thin " style="text-align:center;float:center;">BestBuy</h1> <h1 class="text-sm display-3 font-weight-thin " style="text-align:right;float:right;">Target</h1> <hr style="clear:all;"/> </header>
By Using Float left and defining the width we can easily display the Headers without much complexity of code. <header> <h1 class="text-sm display-3 font-weight-thin " style=" width:30%; text-align:left; float:left;" >Amazon</h1> <h1 class="text-sm display-3 font-weight-thin " style=" width:40%; text-align:center; float:left;">BestBuy</h1> <h1 class="text-sm display-3 font-weight-thin " style="width:30%; text-align:right;float:left;">Target</h1> <hr style="clear:all;"> </header>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "html, vue.js" }
How can I iterate between columns with v-slot in Vuetify data-table where I've dynamic columns So, I have dynamiccaly changing columns in data-table. For example an S1, S2, S3-value column. And I'd like to put checkboxes in the cells, but not to the all, because I've name value. How can I made dynamically the `<template v-slot:item.S1="item">` and `<template v-slot:item.S2="item">`... Thanks in advance for the reply!
The only solution is the v-slot:item and v-data-iterator.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "vue.js, vuetify.js, v data table" }
storing upvotes/downvotes in mongodb I have a collection of `Posts` and `Users` where users can upvote/downvote each post. What would be the best way to store this in a mongodb database to make sure that users cannot vote for a given document more than once? The simplest nosql-ish solution I came up with is storing an array of user_ids who voted inside each `Post` document (or even array of `(user_id, vote)` where `vote` is +1 or -1 so that users will be able to change their vote). Is it a good idea from the performance standpoint given that each post can have thousands of votes? What about really popular websites like Reddit where top posts can have hundreds of thousands of votes?
MongoDB documents are currently restricted to a maximum of 16MB, so assuming Gilbert's calculations are accurate, you wouldn't be able to store all 6 Million `user_id`s in the `Post` document. However, you could consider storing the votes in the `User` document instead (i.e. the `post_id`s that the particular user voted for). It is much less likely that a user votes on 6 million different posts, so this way you won't reach the size limit as quickly. Another way to handle this: If you expect that many votes for a particular post, you may want to store the votes outside the `Post` documents in a separate collection and do an additional query, similar to a many-to-many JOIN table in SQL fashion: user_votes { user_id: ObjectId(...), post_id: ObjectId(...), vote:-1 } and create a compound index on (user_id, post_id).
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 11, "tags": "mongodb, database design" }
Subquery to find the 3rd highest cost of the products sold i have been trying to find the 3rd highest cost of the product sold. from table tblproducts.i am using mysql server 5.6. i used the below query: select name from tblproducts where cost IN (select distinct top 3 cost from tblproducts order by cost desc); but when i run the query it shows the below error: **ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3 cos t from tbbproducts order by cost dec)' at line 4** ..................... someone kindly help me with the syntax to correct this error. thankyou.
SELECT t1.name FROM tblproducts t1 WHERE (3) = ( SELECT COUNT(t2.cost) FROM tblproducts t2 WHERE t2.cost >= t1.cost ) **Demo here:** # SQLFiddle **Update:** The above query works fine so long as there is no possibility for products with duplicate costs in `tblproducts`. If there be the chance for cost duplicates, then we can modify the query as follows: SELECT t1.name FROM tblproducts t1 WHERE (3) = ( SELECT COUNT(t2.cost) FROM (SELECT DISTINCT cost FROM tblproducts) t2 WHERE t2.cost >= t1.cost )
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "mysql" }
How to save Element as string in UTF8? I convert org.w3c.dom.Element to String in this way: StringWriter writer = new StringWriter(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.transform(new DOMSource(node), new StreamResult(writer)); String result = writer.toString(); But when I use it later I get an exception: **io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence** which says about wrong encoding.
In fact, it's completely unnecessery. I needed it for serialization nodes and further export them to different formats (xml, html, test). So I found out that it's better to share **org.w3c.dom Documents**. From Document you can get any information you need.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, xml serialization, type conversion" }
Proof of true or false statement Deciding whether this is true or not. I believe the statement is true just based of the definitions of what $A \cup B$ and $A \cap B$ mean. But I'm not sure how to prove this. > For any sets A and B, if $(A \cup B)$ \ $(A \cap B ) = ∅$ , then $A = B$
Proof by Contradiction: Assume $A \not = B$ Then either there is something $x$ in $A$ that is not in $B$, or vice versa, but either way $x$ will be in $A \cup B$ but not in $A \cap B$, hence $(A \cup B) \setminus (A \cap B) \not = \emptyset$. Contradiction!
stackexchange-math
{ "answer_score": 2, "question_score": -1, "tags": "elementary set theory" }
Is it possible to apply a read filter on a .pcap file using tshark based on the interface? Can I do something like : `tshark -r filename.pcap -R -i wan0` ? Where `filename.pcap` is the packet capture file being analysed and `wan0` is the interface for which I need to apply the filter?
The normal pcap format as used by tcpdump does not contain information about the interface name where a packet was captured. The pcapng format as used by tshark or wireshark by default does have this information. With pcapng one could apply a display filter like this: tshark -r file.pcapng -Y 'frame.interface_name == "wan0"' Of course, this makes only sense if the pcapng file contains packets captured on multiple interfaces. Otherwise this filter would just result in no packets or all packets. Specifically it will not help to capture on the `any` pseudo-interface since the pcapng will not contain the names of the various interfaces on the system but just show all packets captured on the single `any` pseudo-interface.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "wireshark, pcap, packet capture, tshark" }
USB video capture adapter with syntek chipset driver for windows 7 I need driver for Windows 7 for syntek stk1150 USB Video Capture Device. Any good place I can look for it? I need 64 bit driver!
Apparently the Syntek STK1150 is used in EasyCap devices. I have found a few links on the internet for Windows 7 x64 drivers: MediaFire MegaUpload It looks like EasyCap doesn't provide very much direct support for these devices.
stackexchange-superuser
{ "answer_score": 3, "question_score": 1, "tags": "windows 7, drivers, video capture" }
Why is breakthrough voltage of a TVS-diode decreasing when in parallel with an inductance in our lab we are testing a circuit which has an inductance and a TVS-Diode in parallel. The task is it to determine the breakthrough voltage of the diode. The test works like this: We apply a voltage of 24V to the circuit and then instantly switch off the supply voltage via a relay. We then measure the induced voltage of the circuit. You can see the voltage in the picture below. ![The Graph shows the induced voltage over time]( My Question now is: Why is the cut-off not horizontal (for example constant -48V). Instead you can see a change in voltage from -50V to -48V. We assume that the time response of the diode has something to do with it. The TVS-Diode used is this one: < I hope someone can elaborate on the phenomenon. Thank you in advance. ELWI
TVS device clamping voltage is proportional to clamping current. This excerpt from the datasheet shows this: ![TVS data]( The highlight in red is the nominal break-over voltage at a specific test current (1mA in this case). The orange highlight is the maximum peak current and the blue highlight is the voltage across the device at that maximum clamping current. Note that the clamping voltage can be as high as 70.1V for a nominal 51V device. When you switch your circuit off, a large current flows which will decrease exponentially; with this variation of current, you will see a variation of clamping voltage. Your plot is perfectly normal for this device.
stackexchange-electronics
{ "answer_score": 1, "question_score": 0, "tags": "diodes, inductance" }
Maclaurin series problem I can't seem to understand the full solution Why did they post x=0.2? !enter image description here thanks in advance
The reason they plug $0.2$ into the function is because that is what gives them the answer they seek. If you define $f(x) = \sqrt{1 + x}$, then $f(0.2) = \sqrt{1+0.2} = \sqrt{1.2}$, as desired.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "sequences and series" }
Distributing a library built with Spring I'm building a library that uses Spring 4.2.4 and am planning to bundle Spring with the library, to make a self sufficient jar with all dependencies included because some of my clients don't use Maven. However, some of the clients using the library could be using a different version of Spring already in their applications, some as old as Spring 2.5. In this case, they would exclude the bundled version of Spring. Then how do I handle feature compatibility issues? For example, Spring 4 can have multiple PropertySources, and this is not supported in earlier versions.
Only if you really need to, you can bundle the libraries you want in your library and alter their packages to make sure that no collision or class loader conflicts happens in scenarios such as what you describe happens. If Maven is your build system, you could use the Shade plugin to accomplish this. Such an approach is taken in such popular libraries as Jersey 2 where the guava library classes are included in the distribution with modified package name.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "java, spring" }
Difference of repo sync repo init toward git clone and git pull Based on my understanding that when I try to clone the changes of my branch I would.`repo init -u ssh://[email protected]:1234/Folder1/course.git -b my_branch -g IT`then `repo sync`.I discovered that some people also use `git clone -b my_branch ssh://[email protected]:1234/Folder1/course.git` then `git pull origin my_branch` .What is the difference between these 2 sets of command ? Both are basically the same right ?
Google's Repo is designed to manage Android codebase which is usually composed of over 400 git repos. The git repo url following -u is a git repo for Repo's manifests only. It stores manifests that describe a snapshot of all the git repos of some Android codebase. `repo sync` then parses the manifest and clones each git repo and checkouts each revision. The git commands are for a more general purpose. Repo commands are packaged git commands to manipulate multiple repos.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "git, github" }
angularjs $anchorScroll sometimes refresh all page I have an app with angularjs routing, but on some view i want to scroll to some specific div and i use anchorScroll but sometimes (not all times) it refresh all page even i stop event propagation. Did anyone had this issue? $scope.redirectTodiv = function(divname,event) { event.stopPropagation(); event.preventDefault(); $location.hash(divname); $anchorScroll(); };
Try like this $scope.redirectTodiv = function(divname,event) { var id = $location.hash(); $location.hash(divname); $anchorScroll(); $location.hash(id); };
stackexchange-stackoverflow
{ "answer_score": 21, "question_score": 3, "tags": "javascript, angularjs" }
Use .data() function to iterate over every nth data member I have the following code var dataArray = [100, 200, 300, 350, 150]; g.selectAll("bar") .data(dataArray) .enter().append("rect") .attr("class", "bar") .attr("x", function(d) { return xScale(d[0]); }) .attr("y", function(d) { return yScale(d[1]); }) .attr("height", function(d) {return height - yScale(d[1]);}) .attr("width", xScale.bandwidth()); I want the `data` function to iterate over each alternate value in `dataArray`, not each value in `dataArray`. Is that possible without creating a deep copy of `dataArray` with only the required elements? To make the question more generic, is it possible to iterate over each nth member of dataArray.
You might use the filter() method of a d3 Selection. g.selectAll("bar") .data(dataArray) .enter() .filter((d,i) => i % 2 == 0) ... (DISCLAIMER: I haven't tested it) However, my recommendation is that you change your data structures to better align with the visualization that you want. It will make your life much easier.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "d3.js" }
how can i get the size of my vector in C? I have this function: void receive_message(int sock, char buffer[]) { int test = recv(sock, buffer, strlen(buffer), 0); buffer[test] = '\0'; } the third argument of the function `recv()` is not working. apparently i cannot use `strlen()` because the buffer don't have a `\0`. `sizeof()` didn't help me either. i'm wishing i can do this without passing a third argument to my function `receive_message()`. thank you.
You're hoping in vain; C arrays don't have that much structure. You need to pass the size yourself.
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 1, "tags": "c" }
Click on invisible button on webpage (google maps) ![enter image description here]( I try to click on plus by xpath. But this plus becomes visible after the mouse cursor on it and my code can't click on this. driver.find_element_by_xpath('/html/body/div[3]/div/div[5]/div[3]/div[12]/div[2]/div[2]/div[1]/div/div/div/div/div[2]/div/div/div[3]').click() Is there any way in selenium webdriver to click on invisible elements
Hi please do it like below (code sample) < menu = driver.find_element_by_css_selector("") hidden_submenu = driver.find_element_by_css_selector("") ActionChains(driver).move_to_element(menu).click(hidden_submenu).perform()
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, selenium, xpath, selenium webdriver" }
What is Double Brace initialization in Java? What is Double Brace initialization syntax (`{{ ... }}`) in Java?
Double brace initialisation creates an anonymous class derived from the specified class (the _outer_ braces), and provides an initialiser block within that class (the _inner_ braces). e.g. new ArrayList<Integer>() {{ add(1); add(2); }}; Note that an effect of using this double brace initialisation is that you're creating anonymous inner classes. The created class has an implicit `this` pointer to the surrounding outer class. Whilst not normally a problem, it can cause grief in some circumstances e.g. when serialising or garbage collecting, and it's worth being aware of this.
stackexchange-stackoverflow
{ "answer_score": 378, "question_score": 382, "tags": "java, initialization, double brace initialize" }
Reverse Crosstab Query in Access In Access 2013, my table has the following structure: Name |City |Q113 |Q213 Peter |London |20 |30 Sandra |Paris |40 |50 I want to "reverse a crosstab query", getting the following: Name |City |Period |Value Peter |London |Q113 |20 Peter |London |Q213 |30 Sandra |Paris |Q113 |40 Sandra |Paris |Q213 |50 I tried a Union query, using SQL: SELECT [Name], [City] ,'Q113' AS [Period], [Q113] AS [Value] FROM [Database] UNION ALL ORDER BY [Name] , [City] , [Period] However, it isn't working, I keep getting the error: "Invalid SQL statement expected; 'DELETE','INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE' Googling this error didn't help much, so I guess there is something wrong with the code above? Please help.
You are missing the query after your `UNION ALL`: SELECT [Name], [City] ,'Q113' AS [Period], [Q113] AS [Value] FROM [Database] UNION ALL SELECT [Name], [City] ,'Q213' AS [Period], [Q213] AS [Value] FROM [Database] ORDER BY [Name], [City], [Period] You need to add the second part of your query and then place the ORDER BY last.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "sql, ms access" }
MySQL Select where rows are not in another table I have two tables - `forum_topics` and `topics_posts`. I want to select rows from `forum_topics` which have no posts in the `topics_posts` table, but cannot figure out how to. Does an SQL statement like this exist: select from * `forum_topics` where have no rows in `topics_posts`
I think you want something like that: select * from forum_topics t where not exists ( select * from topics_posts p where p.topic_id = t.id ); Although using an outer join, might be a bit faster than the subquery: select * from forum_topics t left outer join forum_posts p on t.id = p.topic_id where p.id is null;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
How to define that only one field is written to a particular node? example: if a user is an admin and is not a company, I want the roles node to only have admin: true (and I do not want another child with company: false) or if the user is a company, true (not admin: false) { // BAD { "roles": { "$key": { "admin": true, // or admin: false "company": false // or company: true } } } // GOOD (but how to make?) { "roles": { "$key": { "admin": true, // or company: true } } } }
You'll need to add a catch-all rule to reject unmatched child nodes: { "rules": { "roles": { "$key": { "admin": { ".validate": "newData.isBoolean()" }, "$other": { ".validate": false } } } } So with the above rules, each `role` can only have an `admin` property with a boolean value. If a client tries to write any other properties, that write will be rejected.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "firebase, firebase realtime database, firebase security" }
Do exit immigration officers care if you’re heading to a country you are obviously not allowed to visit? In countries with exit controls where you must clear immigration/passport controls when leaving the country, what happens if you try to leave to go to a country that you are obviously not allowed to visit? For example, some countries, including Malaysia, do not allow Israeli citizens to visit them. What would happen if an Israeli citizen attempted to cross the land border between Singapore and Malaysia? Would the Singaporean immigration officials refuse exit or would they not care? **Edit** One comment said Israelis are actually allowed to visit Malaysia, just with special visas. Then a better example would be, what would happen if an Israeli national tried to cross the border from Turkey to Syria or Iran? There are both countries where Israeli citizens are not welcome. Would Turkish immigration officials stop them and/or remind them they might be refused entry?
As a rule, **immigration cares only about the country you're in** , what you do afterwards and whether you can enter the next country is not really their problem. You _might_ get a nice officer who tells you if they have concerns if they notice something, but they have zero legal obligation to do so and you really can't count on it. It's highly unlikely they would stop you from leaving, although I vaguely recall a case of this happening on Travel.SE for somebody trying to exit from Poland to Belarus (IIRC) without a visa. Note that this is quite different from how flights work: airlines will check your documentation on departure, but only because _they_ get stuck with the bill and any fines if you're not allowed in.
stackexchange-travel
{ "answer_score": 14, "question_score": 9, "tags": "visas, customs and immigration, passports" }
Accessing parent query variables in sub query I have a mysql query that look likes this select s.id, sum(history.virality) from spreads s , ( select ( ( (sum(t.likes)) + ( sum(t.comments)) ) * ( 1 / ( 1 + s.created_at / 3600000 ) ) )as response from spreadstimeline t where t.spread_id = s.id group by DATE_FORMAT(t.created_at,'%Y-%m-%d %H') ) as history group by s.id Mysql return an error "Unknown column 's.created_at' in 'field list'" is there a possible way to get s to appear in the subquery, or should i start thinking of a different query.
Perhaps something along these lines: select s.id, sum_virality, ( ( (sum_likes) + ( sum_comments) ) * ( 1 / ( 1 + s.created_at / 3600000 ) ) )as response from spreads s inner join (select t.spread_id, DATE_FORMAT(t.created_at,'%Y-%m-%d %H') created_date, sum(t.virality) sum_virality, sum(t.likes) sum_likes, sum(t.comments) sum_comments from spreadstimeline t where t.spread_id = s.id group by created_date) as history group by s.id
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "mysql, database, subquery, relational" }
u_char (*)[10] & char (*)[10] format specifiers in C I have to correct an existing C file which has a bunch of format specifiers compilation errors. Can anyone tell the correct format specifiers for the following cases: 1. `u_char(*) [10]` (I tried %s, but didn't work) 2. `char(*) [10]` (I tried %s and %c, but didn't work) Thanks.
Both are pointers to arrays, so you can dereference them to become arrays, which decay to pointers-to-first-element: char arr[10]; char (*pa)[10] = &arr; printf("%s", *pa); // or &((*pa)[0]) To spell it out: the type of `pa` is `char(*)[10]`, and the type of `*pa` is `char[10]`, and the latter decays to a `char*` of value `&((*pa)[0])` (equal to `&(arr[0])`).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "c, format specifiers" }
Saying ジャパニーズ instead of 日本の I recently came across a sentence mentioning ''. What would be the difference between calling something verses ?
There are various reasons to use katakana or loanwords (see other answers), but in this case, I think the reason is very close to why is sometimes written as or why is written in katakana. The intentional use of the katakana version of a word can make it sound modern and/or internationalized. For example, is a plain word for ninja, but written in katakana suddenly makes people imagine that stereotypical ninja enjoyed by western people. Likewise, while is the normal way to say "Japanese design", can be intentionally chosen to give the impression of "that stereotypical Japanese design appreciated internationally" or "contemporary Japanese design as opposed to universal or traditional ones".
stackexchange-japanese
{ "answer_score": 24, "question_score": 10, "tags": "japanese to english, style" }
RunSynchronously may not be called on task that was already started I am having an issue with a c# class I created for unit testing my application, in particular the issue is around a System.Threading.Tasks.Task object. I have a list of such objects and on them I want to execute each synchronously. I call the following: myTask.RunSynchronously(); When I do such, I am always getting the following error and I dont know why are how I can fix it. > System.InvalidOperationException: RunSynchronously may not be called on task that was already started. Anyone got any ideas?
The problem is that you _started_ the task when you call `TaskFactory.StartNew` \- I mean, it's even in the name of the method that you are starting the task. `StartNew` creates the task, then calls `Start` on your behalf. =D If you want, you can either `Wait` on the task, like @Peter Ritchie said, or you can create the task manually like so: var task = new Task(() => { ... }); task.RunSynchronously();
stackexchange-stackoverflow
{ "answer_score": 47, "question_score": 39, "tags": "c#, async await, task parallel library" }
New user with 1,493 reputations and more than 20 badges. Possible or a bug? While I am reviewing some first posts and answers of new users in StackOverFlow, I came across with this strange answer. It is posted by a supposed to be a "new user" but with 1493 reputations with more than 20 badges. Is this possible or it is a bug? !enter image description here **UPDATE:** I encountered this yesterday(on Philippine Standard Time), I am a bit busy at work yesterday so I couldn't post it. Here is the full screen shot. !enter image description here
There's nothing wrong here, you can see the user by clicking their name and navigating to the badges tab in their profile. Most badges (ones awarded for a specific reason, not for doing `n` things) will show you when and what they were awarded for if you click them. Additionally, this was an audit, so yes the user can not strictly fit the criteria in those cases (we wouldn't have much of an audit pool in most sites if that was the case). The point of audits is to see if you're paying attention, you were.
stackexchange-meta
{ "answer_score": 9, "question_score": 13, "tags": "support, stack overflow, reputation, badges" }
Using libraries with SAS University Edition I'm starting with SAS using SAS University Edition, and I'm trying to create a new folder. The code that I'm using is: `libname bee 'C:\JL\B'; run;` It gives me the note: "Library bee does not exist". And when I try to see what is in the library using the code `proc contents data = INNOVA._all_; run;`, it gives me the error: "Library BEE does not exist" even though the word bee appears as recommended by SAS Studio when I am writing it. Does anyone know the answer? I am using the SAS Studio of SAS University Edition.
From what I know about SAS University Edition, it runs inside of a Virtual Machine on your computer. Think of the Virtual Machine as an independent virtual computer. It might not have a C:\JL\B folder on it. So, I would try to figure out if you can setup the virtual machine to map to certain folders and drives on your computer before trying it.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sas" }
hook_menu and Access Denied Why do all of these menu items return "Access Denied" pages no matter how many times I drush cc all and clear cache from admin/config/performance? /** * Implements hook_menu() */ function caplogin_menu() { $items = array(); $items['join'] = array( 'title' => 'Foo settings', 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM, ); $items['join/signup'] = array( 'page callback' => 'caplogin_unified_registration', 'access arguments' => array('access content'), 'title' => 'Request Member Online Credentials', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['join/login'] = array( 'page callback' => 'caplogin_unified_login', 'access arguments' => array('access content'), 'title' => 'Members Login', 'type' => MENU_LOCAL_TASK, ); return $items; }
For the first menu item, you didn't provide any page callback, and `MENU_DEFAULT_LOCAL_TASK` menu items inherited it from the parent menu item. In this case, Drupal returns a 403 error. For the last one, the reason can be one of the following: * The page callback function doesn't exist, or it is defined in a file that is not the module file * The user account doesn't have the permission 'access content'
stackexchange-drupal
{ "answer_score": 5, "question_score": 3, "tags": "routes" }
Is there a function that does the opposite of get_object_or_404() Is there a function like the get_object_or_404 to not display a 404 error? I have this in my views and I would like to display the page regardless if it finds posts: tag = get_object_or_404(Keyword, slug=tag)
No, I think django doesn't have it is because django shouldn't assume what's the default value if the query is not found. Do this: try: tag = Keyword.objects.get(slug=tag) except Keyword.DoesNotExist: tag = None
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "django" }
How to prove the autocorrelation of this random variable is just related to time difference? Assume $X_n$ is an iid gaussian random process with zero mean and variance $\sigma^2$, and $U_n$ be an iid binary random process with $P_r\\{ U_{n}=1\\}=P_r\\{U_n=-1\\}=0.5$, and $\\{U_n\\}$ is independent of $\\{X_n\\}$, now let $Z_n=X_n U_n$. Now,i want to prove the $Z_n$ is WSS, and we know if some random process is WSS, it should satisfy these two properties $1$. Mean is a constant value $2$. Autocorrelation is just related to time difference And i know the mean of $Z$ is zero, and zero is a constant, but how do i prove the second property?
It's easy to see that $Z_n$ has the same distribution as $X_n$, but I leave the argumentation to you (does an equiprobable sign flip change a symmetric PDF?). The autocorrelation of $Z_n$ is thus the same as that of $X_n$, i.e. \begin{align*} R_{ZZ}(m,n) &= R_{XX}(m,n) = \mathrm{E}[X_m X_n] = \sigma^2 \delta_{m,n} \\\ &= \left\\{\begin{array}{ll} \sigma^2 & \text{if } m = n \\\ 0 & \text{otherwise} \end{array}\right. \\\ &= \left\\{\begin{array}{ll} \sigma^2 & \text{if } m-n = 0 \\\ 0 & \text{if } m-n \neq 0 \end{array}\right. \\\ &= \tilde{R}_{ZZ}(m-n) \end{align*} which is a function of $m-n$.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "probability, probability theory, correlation" }
Using ConcatRelated() With 2 Where Criteria I am running this in a query - and it throws an error when I actually run the query > Error 3061 - too few parameters. Expected 1 And this is my syntax: SELECT [ExcelImport].[unitID], [ExcelImport].Department, ConcatRelated('[OrderID]','[ExcelImport]','[unitID] = ' & [unitID] & ' AND [Department] = ''' & [Department]) AS [SID] GROUP BY [ExcelImport].[unitID], [ExcelImport].[Department] ORDER BY [ExcelImport].[unitID]; This is using Allen Browne's ConcatRelated() function <
Quotes and apostrophes must always be in pairs when used as special characters. If you find it difficult to see whether the pairing is correct, use quotes to define the argument parameters and apostrophes for the text delimiters. Need a closing apostrophe delimiter after [Department]: SELECT [ExcelImport].[unitID], [ExcelImport].Department, ConcatRelated("[OrderID]","[ExcelImport]","[unitID] = " & [unitID] & " AND [Department] = '" & [Department] & "'") AS [SID] GROUP BY [ExcelImport].[unitID], [ExcelImport].[Department] ORDER BY [ExcelImport].[unitID];
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql, ms access, concatenation, ms access 2013" }
What library to import for Geocoding with Bing Maps in VB? I'm trying to implement the demo Reverse Geocoding here: in VB < What library can I import, or "add a reference to in VB" so I don't get the following errors: Type 'GeocodeService.Credentials' is not defined. Type 'GeocodeService.Location' is not defined. Type 'GeocodeService.GeocodeServiceClient' is not defined.
If you look up the table of contents on the left hand side of the page, you'll see that page is a subtopic of the Bing Maps SOAP Services. Click on that link to get a list of lots of articles about the service, including a link to SOAP Service Addresses at < which will give you the endpoints for all the services. For this example, GeocodeService should be a reference to <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "vb.net, geolocation, bing maps, geocode" }
How to format a session variable in a bracket part I use tablesorter. in the page before i set a session cookie. tablesorter has this part: $.tablesorter.setFilters( table, ['', 'test' ], true); now i need the session variable where the word 'test' is, but i don't know how to format it... is it like this: $.tablesorter.setFilters( table, ['', ($_SESSION["favcoloor"]) ], true); or like this: $.tablesorter.setFilters( table, ['', '($_SESSION["favcoloor"])' ], true); or like this: $.tablesorter.setFilters( table, ['', $_SESSION["favcoloor"] ], true); or $.tablesorter.setFilters( table, ['', "$_SESSION["favcoloor"]" ], true); i can not get it to work, please help me with the correct formatting.
You need to echo the session variable from PHP into your jQuery code :) $.tablesorter.setFilters( table, ['', '<?php echo $_SESSION["favcoloor"]; ?>' ], true); If PHP shorthand tags are enabled, you can use this: $.tablesorter.setFilters( table, ['', '<?=$_SESSION["favcoloor"];?>' ], true);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, jquery, variables, session, tablesorter" }
Nmap scan what does STATE=filtered mean? When I scanned a host for open ports I came across the following result: PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 139/tcp filtered netbios-ssn 445/tcp filtered microsoft-ds 3306/tcp open mysql What does filtered mean?
_Filtered_ is described in the NMAP Reference Guide, Chapter 15: > Nmap cannot determine whether the port is open because packet filtering prevents its probes from reaching the port. The filtering could be from a dedicated firewall device, router rules, or host-based firewall software. These ports frustrate attackers because they provide so little information. Sometimes they respond with ICMP error messages such as type 3 code 13 (destination unreachable: communication administratively prohibited), but filters that simply drop probes without responding are far more common. This forces Nmap to retry several times just in case the probe was dropped due to network congestion rather than filtering. This slows down the scan dramatically. Long story short - _Filtered_ means you cannot access the port from your scanning location, but this doesn't mean the port is closed on the system itself. _Closed_ on the other hand would mean, you can reach the port, but it is actually closed.
stackexchange-security
{ "answer_score": 11, "question_score": 15, "tags": "nmap" }
Solving for Exponents and Logarithms I was discussing a small experiment with a friend of mine this week. He said, "we can just do 3 trials." I said, "sure, but the subject will have to get all 3 trials right to be better than chance." We discussed it a bit and verified that you would indeed have a 50/50 chance of correctly guessing at least 2 out of 3 coin flips. I started wondering how many trials you'd have to have to get statistical significance. I figured out that the probability of guessing at least $n-1$ correct trials is this formula: $$\frac{(n + 1)}{ 2^n}$$ If I set that equal to $.05$, how do I out how many trials you'd have to have to get a 95% confidence if the subject misses no more than one trial? id est, if $$.05 = \frac{(n + 1)}{ 2^n}\,,$$ what is $n$? More importantly, how did you solve for $n$? Thanks a lot! Patrick
At $7$ rolls the probability is $0.0625$, at $8$ it is $0.035156$. I just calculated them from 2 to 27 in a spreadsheet. There is no algebraic solution without invoking Lambert's W function.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "probability, statistics, logarithms" }
Concept question about entropy of surroundings By Clausius's definition $$dS_{surr} = \frac{\delta q_{rev}}{T}$$ but does this mean $$dS_{surr} = \frac{\delta q}{T}$$ where $\delta q$ is the infinitesimal heat absorbed by the surrounding in any process (may be reversible or irreversible for the system) because the surrounding is always at equilibrium?
In typical developments, constant temperature reservoirs (that make up part of the surroundings) are treated as ideal reversible entities that receive heat at constant temperature and feature no internal irrversibility. This is just an idealization that can be approached in the real world. The reservoir is assumed to have infinite capacity to absorb heat without its temperature changing, and it is assumed to have very high thermal conductivity so that, for a given heat flux, entropy generation from temperature gradients is minimized.
stackexchange-physics
{ "answer_score": 1, "question_score": 2, "tags": "thermodynamics" }
linear-gradient doesn't work in Firefox linear gradient doesn't work in Firefox and IE here is my code: body { height: 100vh; width:100%; background:-webkit-linear-gradient( top, #f1f5f0, #739a65) ; background:-moz-linear-gradient( top, #f1f5f, #739a65); background:-o-linear-gradient( top, #f1f5f0,#739a65); background:linear-gradient(to top, #f1f5f0,#739a65); } Update: I resolved it by using backgound-image:linear-gradient...
It seems you have FF3, and you haven't stated the IE version but linear gradients are/were only supported from FF3.6 and IE from IE10. If possible, I'd suggest you upgrade to the latest version of both. FF3 is _very_ old. **CanIUse.com**
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "css, firefox" }
In ruby, how do I get the subject, issuer etc. after creating an OpenSSL PKCS12 object If I use c = OpenSSL::PKCS12.new data is there something like c.subject or s.expiry to get these attributes?
PKCS#12 is a container format that collects keys and certificates and stores them in a possibly encrypted format. Most of the time, the file is encrypted, so you would "load" the PKCS12 object like this: p12 = OpenSSL::PKCS12.new(data, "password") If the password was correct, you will now have access to the key and certificate: key = p12.key cert = p12.certificate With the certificate, you can now access the subject and expiry using the methods of OpenSSL::X509::Certificate. Note that the expiry is accessed by `#not_after'.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, ruby, openssl, pkcs#12" }
probability of winning in tennis match The probability of **A** winning when **A** and **B** play tennis is $2$ to $1$. Assume **A** and **B** play $2$ matches. What is the probability of **A** winning at least $1$ match?
P(A wins)=$\frac23$,P(B wins)=$\frac13$. There are $4$ outcomes: AA, AB, BA, BB, with probabilities $\frac49,\frac29,\frac29,\frac19$ respectively. P(A wins at least one match)=P(AA)+P(AB)+P(BA)=$\frac89$.
stackexchange-math
{ "answer_score": 0, "question_score": -1, "tags": "probability" }
How do I make Label1 appear if a TextBox has the correct password, and make Label2 appear if it does not? Okay the title states it all, so my current code is this: If TextBox1.Text = ("mypassword") Then Form2.Show() End If Timer1.Start() Threading.Thread.Sleep(5000) If TextBox1.Text = ("mypassword") Then Label1.Visible = True End If How do I make my program check if the TextBox1.text contains "mypassword" and if it does it displays Label1 which contains "approved" and if it doesn't say "mypassword" it = label2 and displays "not approved". Obviously this is dumbed down so the question makes sense.
From what I remember of VBA, this should work: If TextBox1.Text = ("mypassword") Then Label1.Visible = True Else Label2.Visible = True End If But you might want to consider whether you really want to use two labels for this. I'd recommend using one label and changing its .Text value: If TextBox1.Text = ("mypassword") Then Label1.Text = "Approved" Else Label1.Text = "Not Approved" End If
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "vb.net, visual studio" }
Is there a precompiled version of the CRM4 plugin registration tool? Question says it all. Customer needs to register a DLL, doesn't have Visual Studio so can't compile the plug-in tool. I don't have a CRM4 system to link the source code to so I can't compile it either. I just need the plugin tool already compiled to allow the customer to install a plugin DLL.
There is a precompiled version available on the msdn archive site <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "dynamics crm 4" }
$a\begin{pmatrix}1\\4\end{pmatrix}+b\begin{pmatrix}3\\-1\end{pmatrix}=\begin{pmatrix}1\\0\end{pmatrix}$ Find a and b > $$a\begin{pmatrix}1\\\4\end{pmatrix}+b\begin{pmatrix}3\\\\-1\end{pmatrix}=\begin{pmatrix}1\\\0\end{pmatrix}$$ Find a and b I've found the answers to this to be $\frac{1}{13}$ and $\frac{4}{13}$ through google but just wondering, how would I go about working this through and finding the answer myself?
Multiply the two matrices as shown and you will have following equations: 1. $$a+3b=1$$ 2. $$4a-b=0$$ From (2), we have: $$b=4a$$ Putting in (1), we get: $$a+3(4a)=1$$ this implies, $$13a=1$$ So $$a=\frac{1}{13} $$ and $$b=\frac{4}{13}$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "linear algebra, vectors" }
Javascript turns my php var 0000001000 to 512 <a href='javascript:void(0)' onclick='show($ID);'>ID</a> my $ID is 0000001000. what my show() function gets is 512 instead of 0000001000 I have tried cast $ID to string using String() and .toString() but still i do a alert() it returns me 512. i read something about octal mode. how can i prevent or correct this ? i want my function to read 0000001000
You should pass it as a string: echo "<a href='javascript:void(0)' onclick='show(\"" . $ID . "\");'>ID</a>"; Otherwise it is automatically cast from octal to decimal notation as `oct(1000) === dec(512)`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, string, int" }
How to add Azure AD Groups in Azure SQL Server Can someone tell me how can I add Azure Active Directory groups into the azure sql server, I am using server manager tool to do this but cant find any way to figure this out, I can add simple Azure Active Directory user though..What about groups?
All you need to know about how to configure and manage Azure Active Directory Authentication you can find it in this article. Then to connect to SQL Azure using Azure Active Directory authentication please read here.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 13, "tags": "azure sql database, azure active directory" }
How to handle thread returns Ruby I have a ruby script in which I'm parsing a large csv file. Ihave everything handled and working fairly well, except for how to deal with the thread's return values. I have: length = (ses.size/4).ceil ses.each_slice(length) do |x| threads << Thread.new { a,b = splat x } end threads.each { |thr| thr.join } 'splat' returns to temp files that need to appended to the output files out1 and out2. I'm stumbling on where exactly to do that/how to get that information. If someone could point me in the right direction that'd be great.
Two things, first, when you pass the 'x' into the thread, it's safer to make it thread-local by changing this: threads << Thread.new { a,b = splat x } Into this: threads << Thread.new(x) { |x| a,b = splat x } Next, to get the return value out, you join using :value. So here's a quick demo I whipped up: dummy = [ ['a.txt', 'b.txt'], ['c.txt', 'd.txt'], ['e.txt', 'f.txt'], ['g.txt', 'h.txt'], ['i.txt', 'j.txt'], ['k.txt', 'l.txt'] ] threads = dummy.map do |pair| Thread.new(pair) { |val| val } end vals = threads.map(&:value) # equiv. to 'threads.map { |t| t.value }' puts vals.inspect Crib off that and it should get you where you want to go.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "ruby, file io" }
Return value after snapshotChanges().subscribe in firebase list I created the following function in order to get the data from a firebase table, including the record's key: fetchUsers() { this.firebase.list('users').snapshotChanges() .subscribe(res => { this.userList = []; res.forEach(element => { var user = element.payload.toJSON(); user["$key"] = element.key; this.userList.push(user as User); }); }); } how can i return the userList array when the function is called?
You can return an observable of an array and then subscribe to it. fetchUsers(): Observable<User[]> { return this.firebase.list('users').snapshotChanges() .pipe( map(res => { return res.map(element => { let user = element.payload.toJSON(); user["$key"] = element.key; return user as User; }); })); } And then you can subscribe to this method from where ever you calling it. this.usersSubscription = this.dataService.fetchUsers.subscribe(users=> { this.users = users; }); Remember to unsusbscribe on onDestroy. ngOnDestroy() { this.usersSubscription.unsubscribe(); } Checkout this working stackblitz
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "angular, firebase, angularfire2" }
Read a text file between user given starting and ending position in python I have a huge text file from which i want to selectively read a few lines. Using tell() i know the positions i want to read between. Is there a way i can read all the text in the file between the two positions? like file.read(beginPos, endPos) or maybe, read all text between line number containing beginPos and line number containing endPos?
If you now the start point (with `tell()`) and the end point, you could simply do a `file.read(end-start)`, it will read the `end-start` bytes. If you're not at the correct offset on begining, use the seek() method (`file.seek(start)`) first.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "python, text, file io" }
ORA-00907 when trying to create a CHECK constraint I am trying to create a check contraint on a table by executing the following SQL statement: alter table "ApplicationConfiguration" add constraint APPLICATIONCONFIGURATION_CK1 CHECK (ValueType IN ('string', 'int', 'decimal, 'date', 'time', 'datetime', 'binary')) but I get the following error: ORA-00907: Missing right parenthesis I am completely lost. What am I doing wrong? Additional information: * The `ApplicationConfiguration` table exists and has a column of type `nvarchar(32) not null` named `ValueType` * Database is Oracle 10g Express Release 10.2.0.1.0 * I am executing the statement by using the web client (Application Express 2.1.0.00.39) * The database user has DBA rights Thank you!
The Errormessage is right! decimal misses a < **'** > at the End in CHECK (ValueType IN ('string', 'int', 'decimal, ...
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "oracle, oracle xe, ora 00907" }
Class path must be set or restored default I was doing a Hibernate project while creating pojo I am getting this error "Class path must be set or restored default" while doing console configuration I have all the jars which are working with other projects please help me with this
This error mainly appears when some jars or sql drivers is missing. You said that you have added all the jars, but try to check it again carefully. If your jars is placed not in your project so you need to check if they still exist in specified path. It's recommended to copy them to the project folder first and then add them by 'add jar' (if you using eclipse). I hope it helps. But you can give more details to understand what real problem is.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, hibernate" }
Frames in erb Rails I need the information to create frames in erb rails. I need to display the links in a frames instead of provide as link to new window. Eg. a href="taxas?[gm]=<%= prefer.genus_name %>&[sp]=<%= prefer.sp_epithet%>" target="new">Link /a This should be modified as frame href="taxas?[gm]=<%= prefer.genus_name %>&[sp]=<%= prefer.sp_epithet%>"> /frame
so in ERB, you can always put in <frameset cols="25%,75%"> <frame src="frame_a.htm" /> <frame src="<%= url_as_ruby_string %>" /> </frameset> or you can use `<iframe>` too.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, ruby on rails, frames, erb" }
How to set opacity ONLY to the background I have an issue here, I am trying to use a HTML5 select element, I need to set this element to be transparent, but once I put the opacity property, then the letters/content of the select element becomes transparent, like this !enter image description here so all I need is to set that element's background transparent, is there a way to do that, or I need to set the background color of the element as the same blue color on the background of that picture ? select { background-color: get-color(nieve); border: 2px solid get-color(golden-poppy); border-top: 0; color: get-color(night); opacity: 0.4; }
You can specify the background color with `rgba()` element{ background-color: rgba(255, 255, 255, 0.5); } The first three values are the RGB levels, and the last one is the opacity (in this case 50% opaque, the higher the number the less transparent)
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "html, css" }
Pipe input of a variable stored as a command string How can I do this? [root@ipaserver ~]# ls | sed 's/.*/"&"/' "anaconda-ks.cfg" "ca-agent.p12" Like this? [root@ipaserver ~]# !QUOTED QUOTED="sed 's/.*/\"&\"/'" [root@ipaserver ~]# echo $QUOTED sed 's/.*/"&"/' [root@ipaserver ~]# ls| $QUOTED sed: -e expression #1, char 1: unknown command: `'' I've tried all kinds of variations and nested echo command/process substitutions and eval. Is this possible to do for scripting purposes?
One way: QUOTED='sed s/.*/"&"/' ls | $QUOTED
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "bash, sed" }
Latest value in PowerBi from ASA Is it possible to show the latest value that has arrived in PowerBi from Stream Analytics? In the card diagram type for example I imagine having a filter value for a measurementtime field selecting latest value or something?
Best you can do right now is use Q&A to ask a question like "show value in the last 10 seconds". It's a valid request, could you submit an item through support.powerbi.com?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "powerbi, azure stream analytics" }
Configuring Multiple UITableViews In One View? I have been faced with a puzzle I can't answer. I am creating an app that has multiple `UITableView` within a single view. Each `TableView` will need to have different attributes from the other. The `UITableViewDelegate` methods provide generic methods to configure `UITableView`s, but from what I am seeing, this will effect aLL `TableViews` within a View. If I need to control the parameters for each single `TableView` \- how would this be achieved?
That is not correct - you can configure everything with a `UITableViewDelegate`. Take for example: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section You can differentiate the tableviews via the `tableView` variable. For this you need to store a reference to the different tableviews (e.g. via a property). @property (nonatomic, strong) UITableView *myFirstTableView; Now you can do something like this: if (tableView == self.myFirstTableView) {} else {}
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "objective c, xcode, uitableview" }
Insomnia - Assert object where key is empty value I'm using Insomnia to test an API, and in one of the responses, the key has an empty name. Is there a way to validate the value of that key? { "QueryId": "queryid_1", "Succeeded": false, "Errors": { "": [ "The VehicleKey field is required." ] }, "Extras": null } I've tried: expect(body.Errors.''[0]).to.equal("The VehicleKey field is required.") expect(body.Errors.""[0]).to.equal("The VehicleKey field is required.") expect(body.Errors.key[0]).to.equal("The VehicleKey field is required.") but nothing works.
Since in Insomnia you write your expectations in JavaScript, therefore the question here is really how to reach a value in a JavaScript object where the key is an empty string: expect(body.Errors[''][0]).to.equal('The VehicleKey field is required.');
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "json, insomnia" }
Read Inside Text File and Define Each Column as a New Variable I have a text file that contains three columns of data. I need bash to read inside the text file and then define each of the columns as it's own variable that be used farther down in the bash script. I've been trying to use the following code but, it will only read the first line of the text file and then fail after: while read line do site=`echo ${line} | gawk '{print $1}'` lat=`echo ${line} | gawk '{print $2}'` lon=`echo ${line} | gawk '{print $3}'` done < /software/PLOT_SHARE/lamp_city_text Text File Data: KBOS 42.3629 -71.0064 LSC 44.5357 -72.0286
Hope it´ll help you. This way you´ll be able to do it !! As you can see, the variable RES contains the commands that will create the bash variable when you execute the `eval "var=x"`. This way, the bash will recharge the variable value Regards **SCRIPT** echo "BOS 42.3629 -71.0064" >> data echo "LSC 44.5357 -72.0286" >> data while read line do var1=`eval echo $line | awk '{print "res="$1}'` eval `echo $var1 ` echo "RES:"$res echo "VAR:"$var1 done < data **RESULT** RES:BOS VAR:res=BOS RES:LSC VAR:res=LSC Regards!!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "linux, bash, unix, centos, gawk" }
WPF Drill-down GridView to display live data I'm writing a monitoring system that displays real-time sensor data. The sensors are arranged in a hierarchy. Sensor 1 could, for instance, have S1.1 and S1.2 as children, which could in-turn have S1.1.1, S1.2.1, and so forth. I'm looking for a GridView control that allows one to drill-down each parent item, while still refreshing the values in the grid with the live data. It would obviously not be that hard to write such a component oneself, but would rather buy something than spend a week creating such a control.
Telerik has a Grid View which allows rows to be grouped together. This grouping can be recursive, which allows one to drill-down. This should be sufficient for the application I'm writing.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "wpf, gridview, real time" }