INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How to get file extension from OpenFileDialog? I want just get Image(`.JPG`,`.PNG`,`.Gif`) File from my `OpenFileDialog` How can I get file extension from `OpenFileDialog`? Is it impossible?
To filter only certain types of file use Filter Property OpenFileDialog1.Filter = "Image Files (JPG,PNG,GIF)|*.JPG;*.PNG;*.GIF"; To get the file extension use the Path helper GetFileExtension if (OpenFileDialog1.ShowDialog() == DialogResult.OK) string ext = Path.GetExtension(OpenFileDialog1.FileName);
stackexchange-stackoverflow
{ "answer_score": 59, "question_score": 34, "tags": "c#, openfiledialog" }
Как обработать команду бота с эмоджи в тексте? C# При нажатии на KeyboardButton отправляется сообщение с эмоджи в чат, как мне обработать данное сообщение в конструкции switch case.![введите сюда описание изображения](
Долго я думал над этой проблемой, но всё же нашёл решение. Берёте текст сообщения из ТГ вместе с эмоджи, и кидаете в обработчик команд. ![введите сюда описание изображения]( Но не все эмоджи читаются, как это было у меня
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, telegram bot, telegram" }
Extract R Summary Using sed I want to convert the standard output of R's data.frame summary into a CSV using sed. Let's say I have 5 columns of information that are separated by commas, and one of them is called duration. ..., duration , ... ..., Min. : 0.000 ,... ..., 1st Qu.: 2.000 ,... ..., Median : 5.000 ,... ..., Mean : 6.004 ,... ..., 3rd Qu.: 9.000 ,... ..., Max. :15.000 ,... ..., NA's :18711 ,... How can I use sed to extract only the information contained after the colon and before the subsequent comma for each line? (Alternatively, substitute all the information between the colon and preceding comma with a blank spance). Thank you!
With `awk` you can try something like: awk -F, '{split($3,ary,/:/); print ary[2]}' input Where you'll need to change `$3` with the column number of your duration column.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "regex, r, bash, sed" }
SQL query giving repetitive results I have two tables and I want to fetch select columns from the tables. table 1 is `sfpinventoryinfo` and table 2 is `opticalportinfo`. Both have `NEID` as common. SELECT sfpinventoryinfo.NEID, sfpinventoryinfo.SlotNumber, sfpinventoryinfo.PortNo, sfpinventoryinfo.PortType, sfpinventoryinfo.`Type`, sfpinventoryinfo.SN, sfpinventoryinfo.GenDes, sfpinventoryinfo.ApplicationCode, opticalportinfo.ChannelFrequency FROM sfpinventoryinfo JOIN opticalportinfo ON sfpinventoryinfo.NEID = opticalportinfo.NEID; But I am getting weird results: ![enter image description here]( As shows above result, Slot no 4 should have only 1 entry for port instead of 5
It's likely your `opticalportinfo` has six rows with the value 13 in `NEID`. So, your join produces all six rows in your result set. It's hard to guess the "right" way to choose which of those six rows to use without knowing more about your application. You can hack around the problem with SELECT DISTINCT if you must. But it's a hack.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -3, "tags": "mysql, sql, join" }
Scaling data in scikit-learn SVM While libsvm provides tools for scaling data, with Scikit-Learn (which should be based upon libSVM for the SVC classifier) I find no way to scale my data. Basically I want to use 4 features, of which 3 range from 0 to 1 and the last one is a "big" highly variable number. If I include the fourth feature in libSVM (using the easy.py script which scales my data automatically) I get some very nice results (96% accuracy). If I include the fourth variable in Scikit-Learn the accuracy drops to ~78% - but if I exclude it, I get the same results I get in libSVM when excluding that feature. Therefore I am pretty sure it's a problem of missing scaling. How do I replicate programmatically (i.e. without calling svm-scale) the scaling process of SVM?
You have that functionality in `sklearn.preprocessing`: >>> from sklearn import preprocessing >>> X = [[ 1., -1., 2.], ... [ 2., 0., 0.], ... [ 0., 1., -1.]] >>> X_scaled = preprocessing.scale(X) >>> X_scaled array([[ 0. ..., -1.22..., 1.33...], [ 1.22..., 0. ..., -0.26...], [-1.22..., 1.22..., -1.06...]]) The data will then have zero mean and unit variance.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 13, "tags": "python, svm, libsvm, scikit learn" }
Where is the Primefaces 3.2 Client Side API docs? I downloaded Primefaces 3.2 but I cant find the javadocs for the client side API. They say it has rich client side api so I'd could take a look at it also. Thanks.
Everything about PrimeFaces is here <
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 5, "tags": "jsf 2, primefaces" }
Check GetStreamAsync status Grabbing an image via `GetStreamAsync`, how do I determine status? HttpClient OpenClient = new HttpClient(); Stream firstImageStream = OpenClient.GetStreamAsync("imageUrl.jpg").Result; Sometimes this will give an error (403 or 404 typically) and I simply want to skip processing those results. All I can find says to use the `StatusCode` property or `IsSuccessStatusCode`, but those seem to only work on `HttpResponseMessage`, which is from GetAsync, which does not give me the `Stream` I need to process the image.
The stream doesn't have the response status code. You'll need to get the HttpResponseMessage first, check the status code, and then read in the stream. HttpClient OpenClient = new HttpClient(); var response = await OpenClient.GetAsync("imageUrl.jpg"); if (response.StatusCode == System.Net.HttpStatusCode.OK) { Stream stream = await response.Content.ReadAsStreamAsync(); }
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "c#, stream, http status codes, getasync" }
Замена части массива numpy на другой массив Есть массив формой `a = (5, 1)`. Я беру часть массива `b = a[0:4]`. Изменяю его, и у меня получается массив `b = (8, 1)`. Теперь массивом b нужно заменить элементы, которые я брал у массива а. a[0:4] = b - таким способом не получается.
Это точно numpy-массивы? Тогда так: import numpy as np a=np.array([1,2,3,4,5]) b=np.array([8,7,6,5,4,3,2,1]) a=np.hstack((b,a[4:])) print(a) Результат: [8 7 6 5 4 3 2 1 5]
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, массивы, numpy" }
io.popen():lines() ignores first non-empty line I have a shell script that has an output like this: 1 Space Cruise (Title) Ben Prunty Music FTL 46.4 Now I want to map the lines to an array like this: mymplayer = { track="", title="", artist="", album="", time="" } So I'm using io.popen() like this (for testing purposes): function get_data() local fh = io.popen("bin/mplayerout.sh") for l in fh:lines() do print(l) end end The problem is that this has the following output: Space Cruise (Title) Ben Prunty Music FTL 46.4 Now, if I make my script's output start with a newline, the output is like this: <empty line> Space Cruise (Title) Ben Prunty Music FTL 46.4 What am I doing wrong?
Alright, I found the issue. When doing the same in Python, I got the first line - but as 3281 null bytes (`'\x00'`) followed by `'\x02\n'`. Looks like the problem is in the script...
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "lua, popen" }
SPARQL Query with filtering over an integer I am writing a very straightforward sparql query that filter an integer value. I figured it out through this tutorial I know that Wikipedia Id = 856 is for apple_inc but this query doesn’t give any results, I don’t know what I am missing. Any help would be appreciated. select ?uri where {?uri < ?id. FILTER regex(?id, "856"^^xsd:integer, "i")}
You should write it like this: select ?uri where {?uri < ?id. FILTER (?id=856)}
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sparql, wikipedia api" }
What happens to Eureka and Renton at the end of "Eureka seven"? At the end of _Eureka Seven_ , Eureka and Renton came out of the Command Cluster, then Nirvash and some other Corals moved to another dimension to maintain Limit of Life. But Eureka and Renton no longer returned to their home i.e. Bellforest though their names are mentioned in the Thurston family chart along with Maurice, Maeter, and Linck as a part of Thurston family. What actually happens to them? Did they abandon them? Also there is no mention of Maurice, Maeter, and Linck in the sequel _Eureka Seven AO_.
According to Wikia, > In the original Japanese version, the final scene of the episode revealed a colored picture of Renton and Eureka with Axel and the children, which confirms that they have returned to Bellforest as promised. ![last episode's end card]( which is actually an _end card_. However, end cards are usually not considered as canon, so just interpret this picture personally. As for why the children didn't appear in the sequel, most of the staffs who worked on the sequel are different from the original, including Dai Sato (the chief writer for the original). This thus resulting in many plotholes. Some fans, to some extent, also disregard the sequel as canon due to this.
stackexchange-anime
{ "answer_score": 1, "question_score": 2, "tags": "eureka seven" }
Mathematical operations on columns specified by vector in R I need to replace specific values in a subset of columns in my dataframe. Specifically, I need to replace the value 1 in this subset of columns with 0.9999. I created a vector containing the column names of columns where replacement is needed. These columns must be subset by name and not column number. peaches <- c( 0, 1, 0, 1) bananas <- c( 0, 1, 1, 1) apples <- c( 1, 1, 1, 1) oranges <- c (0, 0, 0, 1) fruits <- data.frame(peaches, bananas, apples, oranges) vector <- c("apples", "bananas", "peaches") My first attempt looked like this: fruits[vector][fruits[vector] == 1] <- 0.9999 While it works for this small dataset, it is not transforming values in the large dataset I'm working with. Anyone know why?
Tidyverse solution library(tidyverse) peaches <- c( 0, 1, 0, 1) bananas <- c( 0, 1, 1, 1) apples <- c( 1, 1, 1, 1) oranges <- c (0, 0, 0, 1) fruits <- data.frame(peaches, bananas, apples, oranges) vector <- c("apples", "bananas", "peaches") fruits %>% mutate_at(vector, ~ replace(., . == 1, .9999)) #> peaches bananas apples oranges #> 1 0.0000 0.0000 0.9999 0 #> 2 0.9999 0.9999 0.9999 0 #> 3 0.0000 0.9999 0.9999 0 #> 4 0.9999 0.9999 0.9999 1 Created on 2020-01-14 by the reprex package (v0.3.0)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "r, replace, subset" }
Autolayout Constraints Priority I have 2 `UILabel` `labelA` and `labelB` and a width of 320 px. I created constraints `H:|-[labelA]-(>=4)-[labelB]-|` Unfortunately, `labelA` and `labelB` can sometime be big and would not fit without truncation. I would like to make sure that no matter what, `labelB` will not get truncated. (`labelB` will not go over 160 px). However, I would like to use the available space for labelA as much as possible so fixing labelB to half is just a waste of space. **Question:** How do I put a priority such that `labelB` always retain its intrinsic size? Where as `labelA` can get truncated.
You set the content compression resistance to high on label B: [labelB setContentCompressionResistancePriority: UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; This means that B will try not to be compressed below the intrinsic size given by the text. To make it also be as small as possible, you may also want to set the `contentHuggingPriority`\- this will make it try to match the size of the text.
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 11, "tags": "ios, autolayout, nslayoutconstraint" }
Magento 2 Import: Escaping HTML and quotes In my CSV, some of the fields have double quotes and single quotes. Whenever I try to import products with said file, it breaks. Now, I've tried changing single quote with `&#39;` and double quote `&#34;`, but it didn't help. I have also tried changing it those to `\'` and `\"`, respectively, but that didn't help either. What's the proper way to escape single and double quotes for CSV product import for Magento 2? FWIW, my fields are not wrapped with double quotes, so I left Enclosure option in Magento 2 Import unchecked.
As it turns out, if your enclosure is double quote, and you check option `Field enclosure` during import. you don't need to escape double quotes. That being said, you need to escape single quotes, and the best way to do it is to use ASCII HTML code for single quote: `&#39;`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "csv, magento, magento2, magento2.2" }
How do I solve for Ksp The problem gives that the solubility of Silver dichromate is $8.3\times10^{-3} g/100mL$. I need to find $K_{sp}$ which is supposed to be $2.8\times10^{-11}$. $K_{sp}$ is $\ce{[Ag+]^2[Cr2O7^{2-}]}$ I changed the $8.3\times 10^{-3}$ from g/mL to mol/L and got $1.9\times 10^{-8}$. Silver dichromate breaks into 2 Ag and one dichromate. So that would be $(2 \times 1.9\times10^{-8})^2 \times ( 1.9\times10^{-8})$ That's what I did but it's not giving me the right answer. Where am I going wrong here?
> The problem gives that the solubility of Silver dichromate is $\mathrm{8.3\cdot10^{-3} g/100\,mL}$. > > […] > > I changed the $8.3\cdot10^{-3}$ from g/mL to mol/L and got $1.9\cdot10^{-8}$. > > […] Were am I going wrong here? Was the solubility given in $\mathrm{g/100\,mL}$? $$\mathrm{8.3\cdot10^{-3} g/100\,mL = 8.3\cdot10^{-2}\,g/L = \frac{8.3}{431.72}\,mol/L = 1.92\cdot10^{-4}\,mol/L}$$
stackexchange-chemistry
{ "answer_score": 2, "question_score": 0, "tags": "solubility, solutions" }
FMJ not working on initial download I've written some application code using JMF, but would like to switch to FMJ to make delivery easier. Unfortunately, on my Windows 7 laptop (where JMF works fine once installed), I downloaded fmj-20070928-0938.zip, uncompressed it, and ran fmjstudio.bat. As soon as I click on the webcam icon, I get errors which start with "WARNING: com.lti.civil.CaptureException: java.lang.UnsatisfiedLinkError: C:\Temp\fmj-extracted\native\win32-x86\civil.dll: Can't find dependent libraries" Any suggestions?
Although it is probably not a complete answer, a partial answer is that FMJ uses 32-bit libraries. I am fairly sure I was using a 64-bit java. On a different Windows 7 computer I successfully got fmjstudio to run using a 32-bit java. Next step is getting it to recognize the camera for my own app rather than fmjstudio.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "windows 7, fmj" }
Ajax not showing £ sign I am trying to show the British pound sign but it is not working. I have try using the html codes for pound signs still nothing. **I have try this** var price = '£' + parseInt($('#pricetag').text(),10) * qty; **Jquery** <script> $(document).ready(function() { $('#selected').hide(); $('#button').click(function() { var qty = $('#Qty').val(); var price = '£' + parseInt($('#pricetag').text(),10) * qty; $('#sprice').text(price); $('#selected').slideDown(); }); }); </script>
To quote Douglass Crockford via JSLint: > There are characters that are handled inconsistently in browsers, and so must be escaped when placed in strings. \u0000-\u001f \u007f-\u009f \u00ad \u0600-\u0604 \u070f \u17b4 \u17b5 \u200c-\u200f \u2028-\u202f \u2060-\u206f \ufeff \ufff0-\uffff I highly suggest you use the unicode escape for £ `\u00A3` that should fix the issue.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "jquery, ajax" }
How to connect 2 (and more) PCBs together to make them semi-modular? So, I want to design PCBs with some LEDs on them and connect them together. The PCBs are about 2 cm wide and connection has got to be on this sides of the PCBs. I've tried some connectors but ones I used are too big and despite my research I couldn't find anything that fits. I want to make the connections tight so it won't "fall off" while being used. Could someone give me any ideas as to what kind of connector I need to use?
The solid state lighting (LED) industry developed a series of connectors specifically for your application. For example from Digikey. < Source, AVX through Digikey ![AVX Solid State Lighting Connectors](
stackexchange-electronics
{ "answer_score": 1, "question_score": 0, "tags": "pcb, pcb design, connector, pcb assembly" }
How do I prove $d\omega = \frac{1}{p!}(\partial \omega_{i_1 \ldots i_p}/\partial x^j) \,dx^j \wedge dx^{i_1} \wedge \ldots \wedge dx^{i_p}$? How do I prove $d\omega = \frac{1}{p!}(\partial \omega_{i_1 \ldots i_p}/\partial x^j) \, dx^j \wedge dx^{i_1} \wedge \ldots \wedge dx^{i_p}$ for $$\omega = \frac{1}{p!} \omega_{i_1 \ldots i_p} dx^{i_1} \wedge \ldots \wedge dx^{i_p} \text{?}$$ I can use the following: a) $d(\alpha + \beta) = d\alpha + d\beta$ b) $d^2 = 0$, c) $df = \frac{\partial f}{\partial x^j} \, dx^j$, d) $d(f\omega) = df \wedge \omega + f \, d\omega$, e) $d(dx^{i_1} \wedge \ldots \wedge dx^{i_p}) = 0$;
I think that factorial is off. By linearity which is your property $(a)$, it suffices we show this for a form of the form (heh) $\omega = f dx^{i_1} \wedge \cdots dx^{i_n}$. If $n=0$, this is property $(c)$. So assume that $n>0$, and write $\omega = f dx^{i_1} \wedge \cdots dx^{i_n}=f\eta$. Then $(d)$ means that $d\omega = df\wedge \eta + f\wedge d\eta$ and by property $(e)$ we have that $d\eta = 0$, so that $d\omega = df\wedge \eta$. Again property $(c)$ gives you what you want.
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "differential geometry, differential forms, exterior algebra" }
Is this laptop good enough for Visual Studio? For HP 2133 Mini: * 1.2 Ghz CPU * 1 GB RAM * Windows XP * 5400 RPM HDD I'm planning to install Visual Studio 2005 (assuming it's faster than 2008). I've seen < question so I'll take those into the account. But do you think Visual Studio 2005 is going to work in an acceptable speed with this hardware?
Would be a bit sluggish when compiling, but otherwise should be OK. I'd suggest a bit more RAM though. It's cheap these days and upgrading from 1GB to 2GB will really have an effect, especially if you're also running other programs in the background. Plus, then you might consider this.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "visual studio, performance, hardware" }
Python: Import list from other module If I import a list from another module, do I get a reference or a deep copy of that object? So if I change it in the importing module, will it affect the variable in the module it got imported from?
Lists are mutable. So yes, changing it in the other file would change it in original as well. If you want a copy, you need to make it yourself. import copy from other_file import mylist mylist = copy.deepcopy(mylist) # provided all objects are indeed "deep-copyable".
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, python import" }
How to control aggregation in Analytic Grid - Dashboard Designer I have an analytic grid created in Dashboard Designer for SharePoint 2010 as shown below. The percentage values are shown in month wise and when they are rolled up to a year, they are summed up. I would like to have it averaged instead. I don't know where I can control it. !enter image description here
I figured it out. We have to change the AggregateFunction of the related Measure from "Sum" to "AverageOfChildren" in Analysis Service. !enter image description here
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ssas, average, performancepoint, rollup" }
change to string url php How are you? I want to change the link of my site , because it is very ugly , I want it to be like wordpress , I didn't know how can change it , so I ask you to help me please ` => ` how can change it to: ` => ` thanks
You can do it with like this, RewriteEngine on RewriteRule ^post/(\d+) index.php?id=$1 [L] RewriteRule ^category/([a-zA-Z0-9]+) index.php?category=$1 [L] I also recommed using php frameworks. They make it easy to use beautiful urls. You can begin with codeigniter. Also, this is a good article for beginners: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "php, mod rewrite" }
Exporting list of lists in Google Earth Engine ![list of list]( I have a list of lists (you can see on the pic), and would like to export it as .csv. I tried to convert it into feature collection, and then run the following lines: var feature = ee.Feature(null, lossperyearperelevation1); var featureCollection = ee.FeatureCollection([feature]); Export.table.toDrive({ collection: featureCollection, description: 'exportTableExample', fileFormat: 'CSV'}); it gives the following error: _Error: Feature, argument 'metadata': Invalid type. Expected type: Dictionary. Actual type: List <List<Dictionary>>._ I am confused if it is a list of list, and how to export it in .csv. How can I solve this problem? the link for the sample code is here: <
The grouped reducer output are always a bit messy. Here is a way to rework your output to a feature collection: // rework output var featureCollection = ee.FeatureCollection(lossperyearperelevation1.map(function(element){ element = ee.Dictionary(element); // cast var list = ee.List(element.get('groups')); var feats = ee.FeatureCollection(list.map(function(listEl){ var dict = ee.Dictionary(listEl); return ee.Feature(null, dict); })); return feats })).flatten(); As there are not so many comments in your code, it is hard to understand what your goal is. Link code
stackexchange-gis
{ "answer_score": 3, "question_score": 3, "tags": "google earth engine, export" }
Koa2: how to write chain of middleware? So in express, we can have a chain of middleware, copies an example: middleware = function(req, res){ res.send('GET request to homepage'); }); app.get('/', middleware, function (req, res) { res.send('GET request to homepage'); }); What's the equivalent way to write this in koa2 please ? I'm thinking of using it for the route, for each route i want to have a middleware to check if user is already logged in. Thanks !
If you're simply interested in making sure a middlware runs for _every_ route, all you have to do is register the middleware before you register your routing middelware. app.use(middleware); As long as you call this _before_ you 'use' your router, it will be called for every request. Just make sure you call the next function. This is how your middleware might look like: function middleware(ctx, next) { // Authenticate user // Eventually call this return next(); }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "node.js, koa, koa2" }
How to get the label values for list fields in Twig? I'm trying to fetch the label of the list and display it on the twig template. Using `node.field_list.value` outputs the key value. I tried using `node.field_list.label` but it returns empty. I tried using `node.field_list.title`, `node.field_list.0.label` or `node.field_list[0]['#markup']` but it still returns empty on the twig template
There are a few ways: It calls List allowed values and it stores in the field configuration. When field cardinality is 1 <div> {% set list_value = node.filter_list.value %} {{ node.filter_list.getSetting('allowed_values')[list_value] }} </div> When field cardinality is more than 1 <div> {% set allowed_values = node.filter_list.getSetting('allowed_values') %} {% set list_values = node.filter_list.getValue() %} {% for list_value in list_values %} <div> {{ allowed_values[list_value['value']] }} </div> {% endfor %} </div> In case when your template is node.html.twig you can render it based on field formatter in your view mode. <div> {{ content.filter_list }} </div>
stackexchange-drupal
{ "answer_score": 5, "question_score": 4, "tags": "theming" }
Escape characters from echo -e I have the following in my `.bashrc` file I use for a log: function log(){ RED="\e[0;31m" RESET="\e[0m" echo -e "${RED}$(date)" "${RESET}$*" >> "$HOME"/mylog.txt } But when I do something with an apostrophe in it, it comes up with some sort of prompt and does not log it properly. How do I escape all the text being input into the file? Example: $ log this is a testing's post > hello > > ^C $ Thanks.
The problem you have has nothing to do with `echo -e` or your `log()` function. The problem is with apostrophes: > `log this is a testing's post` The shell (bash, in your case) has special meanings for certain characters. Apostrophes (single quotes) are used to quote entire strings, and prevent most other kinds of interpolation. **bash expects them to come in pairs,** which is why you get the extra prompt lines until you type the second one. If you want a literal single quote in your string, you need to tell bash, by escaping it via `\'`, like so: log this is a testing\'s post Again, `log` is beside the point. You can try this out with plain old `echo` if you like: echo this is a testing\'s post See Which characters need to be escaped in bash for more info.
stackexchange-unix
{ "answer_score": 7, "question_score": 3, "tags": "bash, quoting, escape characters, echo" }
Sending contents of a data extension to Salesforce We have a Data Extension for product catalogues downloaded done by one lead. How can we sync that information to sales cloud? We'd like to create a campaign for each download associated to the lead record.
I would use Server-Side JavaScript. You would first have to Retrieve the contents and pass the array to a to make a POST call to the Salesforce Update Object API
stackexchange-salesforce
{ "answer_score": 1, "question_score": 0, "tags": "marketing cloud" }
how to correct nginx conf with strapi what's the problem of this `nginx.conf`? I had to change somewhere but still not working .. upstream strapi { server localhost:1337 max_fails=1 fail_timeout=5s; } server { # Listen HTTP listen 80 default_server; listen [::]:80 default_server; server_name sh**rk.app; # Proxy Config location / { try_files $uri $uri/ @strapi; } location @strapi{ proxy_pass } }
ok you can configure with this way that is a good way deploy strapi on ubuntu server
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "strapi" }
How can I place a dot before the last three digits in a terminal output What is the best way to place a dot after the last three dots in a terminal output? I want to get from this: `10902MB/88%` to this: `10.902MB/88%` Currently I have this command for that: df -m /dev/sda8 | grep -Eo '[0-9]* [0-9]*%'| sed 's/ */MB\//g' ### Edit The output of `df -m /dev/sda8 is Filesystem 1M-blocks Used Available Use% Mounted on /dev/sda8 90349 74910 10828 88% / I need only the `Available` and `Use%` values.
You are trying to get values of " _Available_ " and " _Use%_ " sections from `df` command output for a certain mounted file system. Use the following `sed` approach: df -m /dev/sda8 | sed -En 's~.* ([0-9]+)([0-9]{3}) +([0-9]+%).*~\1.\2MB/\3~gp'
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "regex, linux, sed, terminal" }
Installed Ubuntu on partition. Can't Boot windows 7 anymore I am running Windows 7 on my computer since I built it but a few days ago I was inspired to also try out Ubuntu. I managed to get Ubuntu installed a seperate partition and its running fine. The problem is on boot-up my computer instantly goes into Ubuntu and I have no option to choose between the two. I tried looking into my BIOS but there's nothing there either to choose between the two OS. And I've effectively 'lost' Windows 7, even though its still on the Drive. How do I repair my boot-loader as of now I am able to boot in to Ubuntu only?
If you don't see any boot leader and Ubuntu starts directly then you have to edit your grub file. Follow these steps. Press Crtl+Alt+T to open Terminal or search Terminal from dash. Then enter following command : sudo gedit /etc/default/grub Change following lines as (Remove comment (#) before any of the lines given below,change values as below wherever necessary): GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=false GRUB_TIMEOUT=10 Then save the file (`Crtl`+`S`) and run following command in terminal. sudo update-grub Reboot your system and it should work fine.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 0, "tags": "boot, dual boot, windows, boot partition" }
Masked textbox mask causes data type mismatch I have a masked textbox with a mask for zip codes(00000-9999) and an access database field with long type. When I enter a zipcode like 27101 the entry is added(though in access it is -27101), but it works. If I add a full zip like 27101-1111, I get a data type mismatch error. I tried removing the mask and entering 271012222 and it is added to the database. ?? myCommand.Parameters.AddWithValue("@Zip", mskZipCode.Text);
You have a type mismatch not because of the fact that you are masking but because you are entering invalid characters for a long type. > I add a full zip like 27101-1111, I get a data type mismatch error. I tried removing the mask and entering 271012222 and it is added to the database. ?? This is your problem. Your type in Access is long but you are entering a non numeric character '-'. The reason that you are able to enter 271012222 is because you avoided entering the '-'. If this is going to be a zip code field and you want the full zip code, I suggest changing the type of the field in Access to be varchar(10) (or the Access equivalent).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, winforms, ms access 2010" }
How to move the x-axis labels on a datetime scale further from the edges? I have this chart: < I would like the plot and x-axis labels to have some padding from the left and right edges (one of the reasons is that the last x-label is not even fully visible right now), similarly to how a chart with ordinal scale is rendered. For the plot I managed to do this with: series.left(30); series.right(30); But I can't find a solution for the x labels. What I've tried: // This doesn't work because it moves both first and last label chart.xAxis().labels().offsetX(-30); // This doesn't work because it moves all the labels, even the ones in the middle chart.xAxis().labels().padding().left(50);
are you looking for this setting: chart.left(20); chart.right(20); < ?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "anychart" }
Material-UI Dropdown overflowed in Dialog I'm trying to use a dropdown select inside of a `Dialog` (modal). However, the options get cut off by the bottom of the modal. How can I get the options to continue further down past the bottom border? I'm using MUI v5. <Dialog open={open}> <DialogContent> <Autocomplete disablePortal id="combo-box-demo" options={options} // getOptionLabel={(option) => option} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Numbers" />} /> </DialogContent> </Dialog> (extreme) example: Code Sandbox
Remove or set the `disablePortal` prop to `false` in your `Autocomplete`. If you use portal in the dropdown list. The dropdown's real DOM element will be attached outside of the Dialog hierarchy (you can use inspect element to confirm it), so its size isn't constrained by the layout of the dialog. ![Codesandbox Demo](
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "css, reactjs, material ui" }
Remove page content except for table using .replace() I've been trying to extract a table from the page (queue.htm) that i loaded through .ajax(). I wanted to use .replace(regex) to remove everything else aside from the table i need but i don't know exactly how to do it. $j.ajax({ url: 'queue.htm', cache: false, success:handler= function(data) { //use .replace here to extract table from data //split extracted table into array } }) I tried using .load("queue.htm #tableId) before to get only the table from the page. It works but it's not giving me the result i want as i intended to split that table to an array. Is there a way i can just extract the table from the page and at the same time, i will be able to manipulate the extracted table in the js? Thank you very much!
var str = '<html><table><table>test</table></table></html>"'; str = str.match(/(<table>.*<\/table>)/g); console.log( str );
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, html, regex, replace" }
Get clicked date(s) in FullCallendar Good morning, I am using FullCalendar in list view, with daily recurring events, the problem is that when I press the event, I need to somehow tell me what day it is, and pass that in a link to be able to show the history of that day
This will give you the dates (start and end) of the clicked event. eventClick: function(info) { console.log(info.event.start); console.log(info.event.end); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "listview, fullcalendar" }
GTM CSS selector to extract text I am having a problem with extracting text after a form is successfully submitted. I want to extract the boxed text and add it to a dom element I am using Chorme Console for checking. As shown below, this is the max i can traverse. Could you please help me reach the boxed text as shown in the diagram? **document.querySelector( "body > div.body > div > section > div > div > div.col-md-12.main-content > div.alert.alert-success.fade.in > a")**
Select the parent element: el = document.querySelector("body > div.body > div > section > div > div > div.col-md-12.main-content > div.alert.alert-success.fade.in"); Then extract the text only by thetext = el.innerText; and removing the 'x' (a more sophisticated solution would find the text of the a element, not relying on it being 'x', and removing that from the string). Of course you are relying on knowing that there isn't additional text in there at some point as you don't have control over the HTML you are traversing, so if some other text was inserted you would get that too - but that's unavoidable.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "css, google tag manager" }
NSPredicate to retrieve all objects whose attribute in an 1:n relationship is not NIL I would like to build the **NSPredicate** for a **Core Data query** which should retrieve all IBEstPeriod managed objects whose 1:n relationship estType.consHistory.consType <> NIL *. Unfortunately I have not found any clue on how such a NSPredicate should look like. Do you have any idea or suggestion? Thank you!
Use "ANY" for to-many-relationships in predicates: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; [fetchRequest setEntity:[NSEntityDescription entityForName:@"IBEstPeriod" inManagedObjectContext:context]]; [fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"ANY estType.consHistory.consType != nil"]]; NSArray *fetchResult = [managedObjectContext executeFetchRequest:fetchRequest error:nil];
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "objective c, ios, core data, nspredicate" }
Как ловить ошибку в таком примере Rx2 Вот есть такой код return Observable.just(new Date())// .map(// iEndDate -> { Date latestDate = (Date) mEmployeeCallsByDate.keySet().toArray()[mEmployeeCallsByDate.size() - 1]; if (latestDate.after(iEndDate)) { return latestDate; } return iEndDate; }// )// .blockingFirst(); Как как тут ловить ошибку? Допустим налпоинтер Если использовать `subscribe()` вместо `blockingFirst` то там можно на эррор подписаться, а тут как?
Вот, примерно так. Observable.just("") .map { //тут просто произошло что-то плохое throw RuntimeException() return@map "" } .onErrorReturn { //пишем в лог и подсовываем что захотим Timber.e(it) return@onErrorReturn "" } .blockingFirst()
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "android, rxjava, rxandroid, rxjava2" }
sorting tuples in python with a custom key Hi: I'm trying to sort a list of tuples in a custom way: For example: lt = [(2,4), (4,5), (5,2)] must be sorted: lt = [(5,2), (2,4), (4,5)] Rules: * b tuple is greater than a tuple if a[1] == b[0] * a tuple is greater than b tuple if a[0] == b[1] I've implemented a cmp function like this: def tcmp(a, b): if a[1] == b[0]: return -1 elif a[0] == b[1]: return 1 else: return 0 but sorting the list: lt.sort(tcmp) lt show me: lt = [(2, 4), (4, 5), (5, 2)] What am I doing wrong?
I'm not sure your comparison function is a valid one in a mathematical sense, i.e. transitive. Given `a, b, c` a comparison function saying that `a > b` and `b > c` implies that `a > c`. Sorting procedures rely on this property. Not to mention that by your rules, for `a = [1, 2]` and `b = [2, 1]` you have both `a[1] == b[0]` and `a[0] == b[1]` which means that _a is both greater and smaller than b_.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 8, "tags": "python, sorting, tuples" }
Probability Question: Round table meeting Six delegations have a round table meeting. The meeting organization randomly arranges the seat for them. It is important to consider who is sitting to the left or right for each delegation. How many ways to arrange the seat? (A) $720$ (B) $120$ (C) $60$ (D) $30$ I used a cyclic permutation to answer this question, $(6-1)!=120$. Is this correct?
You have $6$ spots: _, _, _, _, _, _. In the first spot, there are $6$ choices, any of the $6$ can fit, then in the next spot, there are only $5$ choices since one of the $6$ is at spot $1$. In the end, you will have $6 \times 5 \times 4 \times 3 \times 2 \times 1 = 720$ choices. * * * Ignore what I have above, those are for non-round table problem. Your answer is correct.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "probability, combinatorics" }
Pandas: a Loop across all Rows I'm stuck on this and I really appreciate any help, I have this dataset dataframe= pd.DataFrame(data={'col1': [True, True,True,False,True,False], 'col2': ['a', 'b','c','d','e','f']}) I want to change every `False` value from col1 with it's equivalent from col2 so i tried this for x, y in zip(dataframe['col1'], dataframe['col2']): if x == False: dataframe['col1']=dataframe['col1'].replace(x, y,regex=True) I expected this col1 col2 0 True a 1 True b 2 True c 3 d d 4 True e 5 f f but instead, I got this col1 col2 0 True a 1 True b 2 True c 3 d d 4 True e 5 d f
you don't need a loop and can use `where` to replace the `False` by `nan` that are then filled with the second column. dataframe['col1'] = dataframe['col1'].where(dataframe['col1'], dataframe['col2']) print(dataframe) col1 col2 0 True a 1 True b 2 True c 3 d d 4 True e 5 f f or the same result with `replace`: dataframe['col1'] = dataframe['col1'].replace(False, dataframe['col2'])
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "python, pandas" }
Should we always favor polymorphism over enums? After watching: The Clean Code Talks -- Inheritance, Polymorphism, & Testing I checked my code and noticed a few switch statements can be refactored into polymorphism, but I also noticed I only used switch statements with enums. Does this mean enums are "evil" in OO-design and should be eliminated with polymorphism?
It's not that enums are evil, it's switch statements. There's a long discussion of this in the C++ FAQ Book, but the gist is this: except for limited areas --- for example the interpretation of data coming in from a register on a device --- a big switch comb suggests that you're using data to distinguish among subtypes. In place of that, you ought to just use subtypes, gaining the compiler's help in keeping it correct, and also meaning the compiler will automatically add new cases when you (inevitably) change the set of cases.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 23, "tags": "oop, enums, polymorphism" }
Your binary is designed for iPad Pro. Upload iPad Pro screenshots for a better App Store experience warning After submitting the app to app store for review, I got below alert in iTunes Connect. I don't see the option to upload iPad Pro screenshots in iTunes Connect.![enter image description here]( Please let me know what can be done here.
Yes, this is an error at Apple's side. I have submitted my app with this error and Apple approved the app.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 7, "tags": "ios, ipad, app store, app store connect" }
Convergence of $\Sigma_{k=1}^{\infty}(\frac{z}{k}+\log(1-\frac{z}{k}))$ I would like to prove that $\Sigma_{k=1}^{\infty}(\frac{z}{k}+\log(1-\frac{z}{k}))$ converges for every complex $z$. I know that $\log(1-x)=\Sigma_{n=1}^{\infty}-\frac{x^n}{n}$, but I stuck on the double summation here so maybe it is not the right approach. Any help is appreciated and thanks in advance!
Fix $z \in \mathbb{C}$ and let $N$ be a positive integer such that $N > 2|z|$. For all $k \geqslant N$ we have $|z|/k < 1$ and $\log(1 - z/k)$ is analytic in the disk $D(0,N/2)$, whence $$\log \left(1 - \frac{z}{k} \right) = -\sum_{n=1}^\infty \frac{z^n}{nk^n}. $$ Hence, $$\left|\frac{z}{k} + \log \left(1 - \frac{z}{k} \right)\right| \leqslant \sum_{n=2}^\infty \frac{|z|^n}{nk^n} \leqslant \frac{|z|^2}{k^2} \sum_{n=0}^\infty \frac{|z|^n}{N^n} = \frac{|z|^2}{1 - |z|/N}\frac{1}{k^2} < \frac{2|z|^2}{k^2}.$$ The last inequality follows from $|z|/N < 1/2$ and $1 - |z|/N > 1/2$. Hence, we have $$\left|\frac{z}{k} + \log \left(1 - \frac{z}{k} \right)\right| < \frac{2|z|^2}{k^2}.$$ Therefore, the series converges by the comparison test.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "calculus, complex analysis" }
What is the best way for authenticating and authorizing Web Api for multiple consumers? We have a large asp.net mvc website that we are planning to break down into multiple micro sites. we also have an api which is used by external customers. we would like to authenticate the requests from our websites and the api consumers of our web api. ideally we would like to do this without having to make major changes in the authentication mechanism. since the site is being broken into multiple asp.net mvc solutions would we be able to use the same asp.net forms authentication on our web api layer or do we have to use authentication tokens? !enter image description here
I would recommend using JWT tokens where it will simplify this, you can read my detailed post here
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net mvc, asp.net web api" }
Separate Source Control binding for project in Visual Studio with SourceSafe I have added my solution to SourceSafe using Visual Studio. Then in the SourceSafe client I have Shared(and branched) one of the project folders. Now, back in Visual Studio, I want to change the source control location for that project to the branched source location. But when I select Change Source Control, I can't select that one project in the list: no matter what project I select, all the projects in the solution show as selected, and if I try to change the location for that project, it complains that I'm trying to set the source control folder for the SOLUTION to an invalid folder. What do I need to do to separate the source control down to project level such that source control folder mappings can be done on a project level?
Yup, it turns out I had to unbind my solution from source control. Then use the Change Source Control dialog to bind each project of my solution individually.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "visual studio, visual sourcesafe" }
Why does /^[\s]* not work how I expect? I use `vim` as my `$MANPAGER`. I will often use `:/^[ ]*-F` (for example) to quickly jump to a flag and read up on it. However, the equivalent `:/^[\s]*-F` doesn't return the same results. Why not?
The character classes such as `\s` for spaces or `\d` for digits do not work inside a `[ ]` collection in the Vim flavor of regexp. So `[\s]` is actually matching either a backslash or a lowercase "s". But in your case, you don't need a `[ ]` collection anyways, because the `\s` is the only thing you're matching there. So this should work just fine: /^\s*-F One alternative is to use a full character class expression (not one using the `\`-letter shorthand notation, but the `[:class:]` one), in which case `/^[[:blank:]]*-F` is what you want here (`[:blank:]` is the one matching a space or a tab, same as `\s`.)
stackexchange-vi
{ "answer_score": 4, "question_score": 1, "tags": "regular expression" }
Non-english letter in BufferedWriter I've written a simple HTTP server in Java. I've a problem with returning data to the browser. This write a returned content: this.writer = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream(), Charset.forName("UTF-8").newEncoder())); ... writer.write(this.getResponseLine() + "\n"); writer.write("Content-Type: " + this.contentType + "; charset=utf-8\n"); writer.write("Content-Length: " + this.body.length() + "\n"); writer.write("\r\n"); writer.write(new String(this.body.getBytes(), "UTF-8")); writer.flush(); writer.flush(); Method _this.body.getBytes()_ returns "Witaj świecie", but in the brower is only "Witaj świeci" (missing the last letter). Where is the problem?
My guess is: `this.body.length()` is the _character_ count, not the byte count. With one UTF8 character in there, the `Content-Length` header will be too small by one byte, letting the browser stop reading from the socket before the HTTP message body actually ends.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "java, http, bufferedwriter" }
Implementing preemptive microthreads using signal handlers and setjmp/longjmp I want to implement POSIX compliant microthreads in Linux environment. Basic idea is as follows: 1. Using technique described here, assign new stack space for each fiber. 2. Using setitimer, create timer that will send signals in constant time interval. Signal handler for this timer will act as a scheduler and switch between fibers. The problem is, that doing longjmp in signal handler, won't terminate the handler, so kernel will wait for it's termination, instead for delivering new signals. This makes switching contexts impossible, because there are no signals to initiate the switches. One solution would be to unblock SIGALRM, so many signals can execute the handler at the same time, but this will cause race conditions problems. What is the best and simplest way to implement preemptive microthreads ? All examples I found on Google were not preemptive.
The solution is to use sigsetjmp / siglongjmp, intstead of setjmp/longjmp. sig* versions preserve signal masks :)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "setjmp, fibers" }
How to use grep output as a path for cd? How can I pipe `grep` output as an argument to the `cd` command? For example: [root@xxx xxx]# pip install django | grep '/usr.*' Requirement already satisfied (use --upgrade to upgrade): django in /usr/lib64/python2.7/site-packages Here `/usr/lib64/python2.7/site-packages` is highlighted and I want to pass this string to `cd`.
Use Bash's command substitution `$()`, you also need `-o` with grep to only select the matched portion: cd "$(pip install django | grep -o '/usr.*')" Note that although you will get away in this case but you should always enclose the command substitution with double quotes so that the shell does not perform word splitting on whitespaces (by default space, tab and newline, depends on the `IFS` variable in case of `bash`).
stackexchange-askubuntu
{ "answer_score": 19, "question_score": 10, "tags": "command line, bash, directory, grep" }
Holomorphic function on an open subset of the complex upper-half plane Let $f:\mathbf{H}\to \mathbf{C}$ be a holomorphic function on the complex upper-half plane and let $U$ be a bounded open subset in $\mathbf{H}$ contained in $$\\{\tau \in \mathbf{H}: \mathrm{Im}(\tau) > 1\\}.$$ Suppose that $f$ does not vanish on the closure of this open subset in $\mathbf{H}$. Is the absolute value of $f$ bounded from below by a positive constant on $U$? I'm thinking this should follow from applying the maximum-principle to $1/f$.
Since $U$ is contained in $\\{z \in \mathbf{H}: \mathrm{Im}(z) > 1\\}$, the closure of $U$ in $\mathbf{H}$ is equal to the closure of $U$ in $\mathbb{C}$, and so is compact. Thus $|f|$ takes a minimum value on the closure of $U$, which by hypothesis is not $0$ and so is strictly positive. All we need to assume about $f$ is that $|f|$ is continuous; the complex analysis in the question is irrelevant.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "complex analysis, riemann surfaces, hyperbolic geometry" }
Change the default light grey background color By default, every screen I created in react-native project use a very light grey color as its background color. As you see here: ![enter image description here]( I wonder instead of I set `backgroundColor` for each screen of my project, is there a global place in react-native project that I can set the `backgroundColor` once for all screens in my project? For example, I would like all my screens use blue color as background color.
As you are already using react-navigation it has a theme provider which you can provide a custom theme, the code would be like below, import * as React from 'react'; import { NavigationContainer, DefaultTheme } from '@react-navigation/native'; const MyTheme = { ...DefaultTheme, colors: { ...DefaultTheme.colors, primary: 'rgb(255, 45, 85)', background:'red' }, }; export default function App() { return ( <NavigationContainer theme={MyTheme}>{/* content */}</NavigationContainer> ); } You can have a look the documentation for more information
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 5, "tags": "react native, react native navigation" }
Are Periodic Grandpa Voter Errors To Be Expected? We have been losing anywhere from one to three nodes at a time with Grandpa Voter Errors at random block numbers ranging from 1600 to over 183K. Thus far we have not found any configuration in the JSON or in the node subcommands, or in the hardware that solves it. **This is my question: is it simply a fact of blockchain life that Grandpa voter errors will sometimes take your node down?** I am asking this because right now we are focused on solving the issue (see this question to track us working the issue) but perhaps we should be focused on mitigation instead, i.e. how to get the node back up and running quickly when it strikes.
After some great insight from the Web3 Foundation folks on the Polkadot Discord, we have found that Grandpa Voter errors are NOT at all normal or to be expected and we have found some potential solutions! Closing this question out now to focus on the solutions. Details on solutions will be posted on How To Prevent "Grandpa Voter Error" And Randomly Deleted Keystore
stackexchange-substrate
{ "answer_score": 1, "question_score": 0, "tags": "error, grandpa, babe, nodes" }
Twistd socket ownership I have a daemon which listens to a socket in `/var/run`. I start the daemon using an init script (as root, obviously), and I'm using the `twistd` `--uid` and `--gid` options to drop privileges to an unprivileged user. The socket, however, is still owned by `root:root`. A second daemon, which runs as the same unprivileged user, needs to have access to the socket. I now change the socket ownership to `daemon:daemon` in the init script, but this doesn't strike me as a very elegant solution. Is there a way make the socket owned by `daemon:daemon` in the `tac` file?
No, currently there isn't. It's an open issue in Twisted, it's also the case with PID and log files. See blog describing the issue, and open issues: * < * <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, twisted, unix socket, twistd" }
STS reports error in bean config for java.sql.Date property I have a bean class with a property setter like this: public void setDueDate(java.sql.Date dueDate) I also have an instance of this bean configured in XML like this: <property name="dueDate"> <bean class="java.sql.Date"/> </property> STS marks that config with an error: `No constructor with 0 arguments defined in class 'java.sql.Date'` Well, that's true, `java.sql.Date` has no no-arg constructor. But this app works fine so obviously Spring is smart enough to create a `Date` instance without a constructor. Question is, why is the STS editor/builder complaining, and is it possible to convince it that this is not an error or warning?
At this time, I can only see 3 situations where the code "would work", in the order of their likeliness to happen: 1. the parent bean where the property is injected is defined with `scope="prototype"` or `lazy-init="true"` and is not accessed at all 2. the runtime classpath contains an implementation of `java.sql.Date`shadowing the original 3. that particular context xml is not used in the application Otherwise, Spring should issue a nice: Could not instantiate bean class [java.sql.Date]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.sql.Date.<init>()
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "eclipse, spring, spring tool suite" }
Finitely generated module with a submodule that's not finitely I am going to Find Finitely generated module with a submodule that's not finitely generated.please help me!
Take any non-Noetherian ring as a module over itself.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "abstract algebra" }
How to use paginate in the model::list method for combo in laravel? I would like to know what is the way to paginate my combo of charges; it comes from my database description column, with all rows but I just want to show some of them. Below is the method I'm using for that purpose: // VIEW TO REGISTER USERS public function VistaRegistraUsuario() { $id_franquicia_usuario = Session::get('id_franquicia'); $charges = charges_users::lists('descripcion', 'id'); // COMBO OF CHARGES return view('auth.register', compact('charges', 'id_franquicia_usuario')); }// END VIEW What am I doing wrong and how can I achieve this?
Basically it's a question of `pagination` I assume as you need to show some of the "Combo of Charges" in other words `pagination` use `list` with Laravel's out of the box `pagination` like this public function VistaRegistraUsuario() { $id_franquicia_usuario = Session::get('id_franquicia'); $charges = charges_users::lists('descripcion', 'id')->paginate(15); // IF YOU NEED TO RENDER 15 COMBO OF CHARGES ON FIRST PAGE return view('auth.register', compact('charges', 'id_franquicia_usuario')); } Refer: docs
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, laravel, laravel 5.1" }
Versione femminile di alcuni nomi/aggettivi come "invasore" Ieri mentre leggevo un testo in inglese ho trovato "the invading army". Non volendo usare _esercito_ ("l'esercito invasore" sarebbe la traduzione più immediata) ma _orda_ per ragioni di contesto (vedi commenti), come potrei traslare al femminile l'aggettivo? Giacché non credo (potrei sbagliarmi) che "invasrice" esista, mi chiedo se esiste però un modo per rendere l'aggettivo al femminile senza usare una perifrasi per esprimere il concetto. Chi mi aiuta?
Penso tu possa tradurre come: > * L'invasione armata o l'armata che invade. > Il femminile di invasore e' invaditrice, ma non e' di uso comune.
stackexchange-italian
{ "answer_score": 3, "question_score": 3, "tags": "word choice, adjectives" }
OpenCV Background Substraction c++ I've create a background Subsctractor (MOG) and now, I want to change some parameters: Ptr< BackgroundSubtractor> pMOG, pMOG2; pMOG = new BackgroundSubtractorMOG(); pMOG.set("varThreshold",5); //does't work pMOG->operator()(inputImage, outputImage); //works, but the output is not enought "sensitive" Has anyone an idea how I could deal with this? I want to change the threshold value, because it returns an mask, that does not always detect my moving objects (e.g. if their color is nearly the backgrounds color). Thanks!
That's because `BackgroundSubtractorMOG` doesn't have a parameter named `varThreshold`. You probably wanted to set this parameter on `BackgroundSubtractorMOG2`. The parameters for `BackgroundSubtractorMOG` are: "history" "nmixtures" "backgroundRatio" "noiseSigma" while for `BackgroundSubtractorMOG2` are: "history" "nmixtures" "varThreshold" "detectShadows" "backgroundRatio" "varThresholdGen" "fVarInit" "fVarMin" "fVarMax" "fCT" "nShadowDetection" "fTau" You can find these info in video_init.cpp (checked for OpenCV version 2.4.9). * * * You can also set some parameters directly into the constructor, which is probably the safest way.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "c++, opencv, background subtraction" }
Find sides of a right triangle given hypotenuse c and area A (no numbers given) I've solved couple of these, but I have no idea how to solve it without any numbers provided. I've tried using $A=\frac{ab}{2} \Rightarrow 2A=ab \Rightarrow 4A^2=a^2b^2$ and incorporating $b^2=c^2-a^2$, but I don't know what to do next... $$c^2=a^2+b^2$$ $$b^2=c^2-a^2$$ Then we proceed as: $$A=\frac{ab}{2}$$ $$2A=ab$$ $$4A^2=a^2b^2$$ $$4A^2=a^2(c^2-a^2)$$ $$4A^2=a^2c^2-a^4$$ $$a^4-a^2c^2+4A^2=0$$ ... what do I do next?
You already noted $A = \frac{ab}{2} $ and $a^2+b^2 = c^2$. Now note $ab = 2A$ and $$(a+b)^2 = a^2+2ab+b^2 = c^2+4A$$ $$\Rightarrow a+b = \sqrt{c^2+4A}$$ Can you go from here?
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "geometry, analytic geometry, triangles, area" }
How to fetch all the values in a big map using taquito? Per the BigMapAbstraction Taquito API docs, there isn't a way to fetch all the values in that map. Is the suggested way to fetch all of values in the map by doing batch queries on it then? Or what's the recommended way to fetch these values?
You have 2 solutions for this problem: * Use an indexer to get the values contained in the big map; * Use an off-chain view to paginate the values if they can be accessed sequentially **Off-chain example:** Code with tests: Explorer: < ![enter image description here]( ![enter image description here]( Always use `big_map` over `map` when you will have many items. Otherwise, your contract will get gas locked easily.
stackexchange-tezos
{ "answer_score": 1, "question_score": 1, "tags": "smart contracts, taquito, storage, bigmap" }
What is the most efficient way of training data using least memory? This is my training data: 200,000 Examples x 10,000 Features. So my training data matrix is - 200,000 x 10,000. I managed to save this in a flat file without having memory issues by saving every dataset one by one (one example after another) as I generate the features for each example. But, now when I use Milk, SVM _light_, or any other Machine Learning Algorithm, everything tries to load the whole training data into memory instead of training it one by one. However I just have 8 GB RAM, so I cannot proceed this way. Do you know of anyway I could train the algorithm one dataset by one dataset? I.e., so that at any instant I just have one dataset loaded into memory, while training.
I believe the term for this type of learning is out-of-core learning. One suggestion is vowpal wabbit, which has a convenient R library, as well as libraries for many other languages.
stackexchange-stats
{ "answer_score": 4, "question_score": 11, "tags": "machine learning, dataset, algorithms, python" }
Loop the array and fill value in dynamic textbox in jquery Here splitValues contains array and .split is a class in multiline texbox which is generated dynamically now i want fill the textbox with this array. I have done this much but not getting further? function InsertItems(splitValues) { $(".split").each(function () { if (splitValues != "") { $(this).val(splitValues);// } }); }
change this: $(this).val(splitValues);// to this: $(this).val(splitValues.join());// ### Updates: $(".split").each(function (i, elem) { $(this).val(splitValues[i]);// }); ### Updated Demo as suggested by _`Milind`_.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, jquery, arrays" }
control to the next statement after running eval command I have written a bash script to run a service in background and exit from the script to command line. But after running the eval command, control does not go the next statement. COMMAND="nohup java -jar jenkins.war" echo "starting service" eval $COMMAND echo "service running" exit echo "service running" and exit never happens. I want to run the process in the background, and return to the command prompt while the service is still running. How do I do this?
Please, don't put a command with its arguments in a _string_. Put your command and its arguments in an _array_ (and don't use upper-case variable names, that's a terribly bad practice), and **do not use`eval`**. `eval` is evil! command=( nohup java -jar jenkins.war ) echo "starting service" "${command[@]}" 2> /dev/null & echo "service running" The `&` is to have the command running in background.
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 10, "tags": "bash" }
Change Camera Distance of Cinemachine in script In my (2D) game, I am making a function that zooms out the camera, and I'm using cinemachine. Is there a way to do it in the script? I looked at the documentation and everywhere but didn't find anything. Only how to change the field of view (that can't work for me). !!\[enter image description here]1 Thanks in advance!
What I would suggest is creating a new virtual camera with your desired distance and position and disabling its GameObject to begin. Then, from a script, you can change the current camera to the new camera by disabling the current camera and enabling the new camera. Cinemachine will automatically handle the transition to the new camera. Here is a method I use to manage multiple cameras in this way. public GameObject[] Cameras; public void ActivateCamera(int index) { for (int i = 0; i < Cameras.Length; i++) { if (i == index) { Cameras[i].SetActive(true); } else { Cameras[i].SetActive(false); } } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "c#, unity3d" }
VB6 Check if Excel Workbook is Open I am working on a project in VB6 (No, I cannot migrate to .NET) that involves opening an Excel File and writing to it. This all works nice and well without much problem, however if the user closes the Excel file, I get the following Error: > Run-time error '1004' > > Method 'Rows' of object '_Global' failed The code for this error is: Public Sub LogValues() Dim rowNum As Integer Dim tempNum As Integer rowNum = sheet.Cells(Rows.Count, 1).End(xlUp).Row + 1 tempNum = sheet.Cells(Rows.Count, 2).End(xlUp).Row + 1 'Other stuff End Sub Obviously, the error comes form the excel workbook being closed and no longer existing in memory. Finding the solution to this issue is my current problem. How do I go about checking to see if the workbook is still open, and in the case that it isn't open, open it?
Try to use the workbook and catch the error if it is closed. sub workOnWb() on error goto not_open with workbooks("mybook1.xlsx") on error goto 0 'work with it end with exit sub not_open: if err.number = 1004 then workbooks.open("c:\mybook1.xlsx") resume else debug.print err.number & ": " & err.description end if end sub There is a lot more that you can do but this covers the basics for your generalized inquiry.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "excel, vb6" }
How can I change touch animation radius Can I change the radius of button . in my current app I am using Icon button but when I click the button It take a big area I mean the clickable area is too big normalsize button How can I change the radius witouth changing button size Thanks for your help
You can use `padding` and `splashRadius`. IconButton( padding: EdgeInsets.all(0), splashRadius: 16, onPressed: () {}, icon: Icon( Icons.ac_unit_outlined, ), ), or you can choose `InkWell` like InkWell( customBorder: CircleBorder(), onTap: () { print("tapped"); }, child: Padding( padding: EdgeInsets.all(6), child: Icon(Icons.ac_unit), ), ),
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "flutter, dart" }
Время сервера Снимаю VPS. В ispmanager изменил часовой пояс на Europe/Kiev (+3), а дата и в php и в mysql не та. Должно быть: Tue, 27 May 2014 19:35:09 +0300 А выводит: Tue, 27 May 2014 15:20:09 +0300 Помогити нестроить сервер, я в этом чайник! Очень нужно!
Попробуй использовать date_default_timezone_set('[timezone]'); Например: date_default_timezone_set('Asia/Yekaterinburg');
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "настройка, php, сервер, vps, mysql" }
How to determine the greatest value in a collection of items? Using the following simple Item class: class Item { public int Value { get; set; } } And this list of items: var items = new List<Item>(); items.Add( new Item() { Value = 1 } ); items.Add( new Item() { Value = 2 } ); items.Add( new Item() { Value = 3 } ); How to tell the greatest value in all items? How to determine which Item in the list has the greatest value?
Using LINQ items.Max(v => v.Value) Items containing greatest value var max = items.Max(v => v.Value); var x = items.Where(v => v.Value == max); However, MaxBy extension method suggested by devdigital will iterate the collection only once
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 0, "tags": "c#, linq" }
Shell variable issue when trying to mkdir Any ideas what is wrong with this code? CLIENT_BUILD_DIR="~/Desktop/TempDir/" if [ ! -d $CLIENT_BUILD_DIR ] then { mkdir $CLIENT_BUILD_DIR } fi I get the error: mkdir: ~/Desktop: No such file or directory. Obviously the directory is there and the script works if I replace the variable with ~/Desktop/TempDir/
The quotes prevent the expansion of ~. Use: CLIENT_BUILD_DIR=~/Desktop/TempDir/ if [ ! -d "$CLIENT_BUILD_DIR" ] then mkdir "$CLIENT_BUILD_DIR" fi
stackexchange-stackoverflow
{ "answer_score": 28, "question_score": 18, "tags": "linux, bash, shell, variables" }
Create a sliding div on click I want to create a div that float on the right side of the screen. When you click on it, it slides and you can see the content. I tried to look on the web for this but I didn't know the keywords. How can I create this effect? !enter image description here
Try this, will it work for you? < var width; $('#content').click(function(){ if($(this).hasClass('open')){ $(this).removeClass('open'); width = "10px"; } else { $(this).addClass('open'); width = "300px"; } $(this).animate({ width: width }, 200, function() { }); });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -4, "tags": "jquery, html" }
Fetching a list from a website using beautifulsoup in a dataframe column I am trying to fetch the keywords from the article website. The website keywords look like this: `This is the link:` ` ![enter image description here]( I am using this to fetch the keywords: Article_Keyword = bs.find('div', {'class':'ListTags'}).get_text() and this is how what i am getting: Themen Bundesgerichtshof Amazon Verband Sozialer Wettbewerb Kundenbewertung Tape dpa I need to get it by separating each keyword by comma. I can do it by RE but some keywords are with more than one word so i need that as one keyword. is there any way to get each keyword by separating with comma?
I used a child class element to Identify each element separately. I hope the below code helps. from bs4 import BeautifulSoup as soup from requests import get url = " clnt = get(url) page=soup(clnt.text,"html.parser") data = page.find('div', attrs={'class':'ListTags'}) data1 = [ele.text for ele in data.find_all('a',attrs={'class':'PageArticle_keyword'})] print(data1) print(",".join(data1)) Output: >> ['Bundesgerichtshof', 'Amazon', 'Verband Sozialer Wettbewerb', 'Kundenbewertung', 'Tape', 'dpa'] >> Bundesgerichtshof,Amazon,Verband Sozialer Wettbewerb,Kundenbewertung,Tape,dpa Make sure you approve the answer if usefull.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, beautifulsoup, web crawler" }
Force an array to be an array of array Using Powershell, I would like to declare array of array. Basically, if I write this code: $array1 = ("AA", "BB") $array2 = ("CC", "DD"),("EE", "FF") $array1[0][0] + $array1[0][1] $array2[0][0] + $array2[0][1] $array2[1][0] + $array2[1][1] I expect to get : AABB CCDD EEFF But the actual output is AA CCDD EEFF This is due because of the first array is detected as a simple string array, and not an array of array of string. Is there any way to "force" `$array1` to be an array of one array ? I tried: $array1 = [string[][]]("AA", "BB") $array1 = (("AA", "BB")) $array1 = @() $array1+=(@("AA","BB")) $array1 = [array]::CreateInstance([array],1) $array1[0] = @("AA","BB") $array1[0][0] + $array1[0][1] but none of these works
Try in this way: $array1 = ,("AA", "BB") the comma is the 'array operator' in powershell.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "powershell" }
When do new sites appear in reputation leagues? When do new sites appear in reputation leagues? I am on Lifehacks.SE, which is currently in private beta. It is not present in SE reputation leagues. ### When do new sites appear in reputation leagues?
Leagues for a new SE site is created when this site enters the public beta phase. Once lifehacks.se will enter the public beta, the link to its rep leagues will work. Now, when lifehacks.se is in private beta, the above link, which can be found at the bottom of /users... > !enter image description here ...leads to the fallen panda (this happens to every site in private beta).
stackexchange-meta
{ "answer_score": 3, "question_score": 6, "tags": "support, reputation leagues" }
Add lines of transparent pixels to image using command line I have a few 15x15 PNGs that I need to convert to 18x18 PNGs. However, I don't want to simply scale the entire image up. What I want is basically keep the exact old image, but "pad" it with lines of invisible/transparent pixels. So let's say the original image looked like this (imagine the `X`s are pixels): XXXX XXXX XXXX XXXX I want to turn it into something like this (`X` being pixels of original image, `T` being new transparent pixels): XXXXT XXXXT XXXXT XXXXT TTTTT Is this possible using command-line tools (so that this can be automated), perhaps with something like imagemagick?
This will do the job: convert input_file -background transparent -extent '18x18' output_file
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "macos, image, bash, imagemagick" }
Save Machine Learning Model progress for later How do you save the progress an ML model has made and start from that point later? Its kind of a vague question, but this is an example of what I am talking about: Say, hypothetically speaking, if I just trained a really, really good machine learning model, like 99% testing and training accuracy. The problem is it took me 8 hours to get to that point and I would like the model to START from that point without having to retrain it when I am using it for the future, how would I save that progress? I am currently messing around with TensorFlow and would like to know how to save progress for a NN I've been training with it.
checkpoints are the solution, every deep learning frameworks has this option, keras, tensorflow or pytorch.
stackexchange-stats
{ "answer_score": 0, "question_score": 2, "tags": "machine learning, train, weights" }
Multixterm - "can't find package Expect" I am attempting to open multixterm on my desktop machine, but I end up with the error: `usr:~> multixterm can't find package Expect while executing "package require Expect" (file "/usr/local/bin/multixterm" line 6")` Any help would be appreciated. I've tried running multixterm on my laptop and on a friend's machine, and there is no issue there. Both Expect and multixterm exist in the `/usr/local/bin/` directory. Update: I've also found that neither kibitz nor autoexpect will run. I now assume that there is an issue with where the programs are looking for Expect. Does anyone know how I can verify/check that?
First, run `ldd /usr/local/bin/expect` to find out where the _Expect_ library (`libexpect`) is. For example: % ldd /usr/bin/expect | grep libexpect libexpect.so.5.45 => /usr/lib/x86_64-linux-gnu/libexpect.so.5.45 (0x00007f230f348000) % Then, export the `TCLLIBPATH` var with the `libexpect` directory. For example (seems like you're using csh): % setenv TCLLIBPATH /usr/lib/x86_64-linux-gnu Then run your `multixterm` command.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "linux, ubuntu, tcl, expect, xterm" }
Getting data from SQL Server (serverside) to JavaScript (clientside) I have been looking for good newbie-advice on how to efficiently read data from an SQL Server to use in a JavaScript based timeline. Please consider that I have never done anything like this before. I have basic oop knowledge and would like to use json, I have written small java apps, but never used javascript (although I suppose it won't be very hard to get into the basics of it after java). So really what I'm asking is for someone to help me get an overview over what steps need to be taken to make this happen; what do I need to know, how do I use it and in what order. The database will contain from around fifty thousand to over a million entries, this is a lot of gps coordinates, year numbers and short strings. Any help would be greatly appreciated. Please keep in mind I am fairly new, so nothing is too basic! :]
What about having a mediator that sits on the [web] server that your javascript interacts with and asks for additional information from the SQL Server as it is needed. If you were to use ASP.Net then Page Methods might be a good option or even calling plain old web services directly might be a suitable alternative. Both of these options might be something that you could use rather than loading up all of your DB entries in a single JavaScript file. Just a thought.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql server, timeline" }
Properties of Logarithms (evaluate) use $\log 4= 0.602$ and $\log 12=1.079$ to evaluate the logarithm 1. $\log 3$ I'm very confused on how I will evaluate this one I've tried other things but I'm not sure
$\log(12) - \log(4) = \log\left(\frac{12}{4}\right) = \log(3)$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "logarithms" }
How get output like this using talend I have the dataset like this ![dataset]( and want out put like this how can I do that![output]( image description here]( Here is sample dataset ID COMP_ID CAR_ID ENGINE COLOR CC 1 c1 car3 xyz blue 2500 2 c2 car4 xyz white 1000 3 c1 car6 xyz green 3500 4 c2 car1 xyz black 4500 5 c3 car5 xyz green 4000 6 c1 car2 xyz red 3000 7 c2 car3 xyz gray 1500 8 c3 car4 xyz silver 2000
You can try a tJavaRow something like : output_row.foo=input_row.row1+"\n"+input_row.row2; foo must exist in your Output Schema and row1 and row2 in your Input Schema Else, you can concatenate them in a TMap in the same way.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "data warehouse, talend, business intelligence, tmap" }
Combining two SQL query commands I want to query two databases. I want all fields from db1 and one more field from db2. The command is like this: select name from db2 where id in (select id from db1 where date > '2018-1-1') Then I need to query db1 for all the fields again. select * from db1 date > '2018-1-1' How to combine these two queries?
Try This One select AA.*, BB.Name from db1 AA Left Join db2 BB On BB.id = AA.id Where AA.date > '2018-1-1'
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql" }
data comes in a string, inserting into postgresql with java, what's most efficient way to break up the data? I am writing a program in Java that uses the JDBC driver with Postgresql. I am using an API which when called, returns data in a string like so: id=-870229851 date = finished-20130501 15:13:07-20130502 15:13:07 open=-1.0 high=-1.0 low=-1.0 close=-1.0 volume=-1 count=-1 WAP=-1.0 hasGaps=false Most of these names are a column in my Postgresql db (and I can make all of them a column if necessary), but I was wondering what is the most efficient way to insert this into Postgresql? Before I write a function to parse each title / value, I'm hoping that Postgresql has some way of handling data like this efficiently. Can someone please shed some light? my Postgresql version is 9.2 and my Java is 1.7
Postrgre doesn't have a way to do this natively (that I know of anyway), however, you can use Java's string tokenizer like this: StringTokenizer st = new StringTokenizer(sourceString, "= "); while(st.hasMoreTokens()) { String key = st.nextToken(); String valuse = st.nextToken(); // Do something with the keys and values (i.e. build and execute insert statements. } Where sourceString is your data string. This will delimit the string based on both the equals sign and the space between the name value pairs. Assuming that no spaces occur in the name or values in the string. If they do, then you are going to have to do some regex magic on the string before tokenizing it, depending on that can occur on the left and right hand side of the equals sign. Then you can generate insert statement strings to be executed by the database engine.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, postgresql, jdbc" }
Chunk-encoded HTTP response before POST HTTP chunk-encoded request complete I was wondering if it is possible to begin a chunk-encoded HTTP response while still receiving an HTTP request which is also chunk-encoded? It could be useful to do some processing on-the-fly on large amount of data. I've made some tests with AsyncHttpClient, Jetty and Servlet-3.0's AsyncContext, but it did not work well: I can process the request on-the-fly and append calculation to the response but everything is displayed only once the request has been entirely consumed. Do you have any idea? Thanks!
That's exactly why WebSockets exist! HTTP/1.x is synchrone so it's not possibe without that.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, http, chunked encoding" }
Making a particular text of a TextView linkable in android > **Possible Duplicate:** > Hyperlink in Android I want to make a link on a particular text of a Textview. How it is possible in android ? Please help me.
Yes, its Possible. Use `Spannable String` with `Clickable Span.` Refer this link.. This is a good example for `clickable Span`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, hyperlink, textview" }
OpenCV - Metric representation in `reprojectImageTo3D()` On my left camera, right camera and stereo calibration; I've indicated the size of the square `0.025 (25 millimeters)` So I get the points in 3D using `reprojectImageTo3D(disp, Q)` disp = stereo.compute(dstL, dstR).astype(np.float32) / 16.0 disp = abs(disp-min_disp)/num_disp I got Q from `stereoRectify` I took a picture of a box 2.5 - 3 ft away from the stereo camera and retrieved the `xyz` coordinates of a point lying on it. Its `Z` value is `140.8764` How should I interpret that? My `Q` looks like this |1, 0, 0, -454.05216408| |0, 1, 0, -231.55072975| |0, 0, 0, 816.20826814 | |0, 0, 13.79730561, -0 |
Having used units consistently within all respective calibration functions (in this case metres), then the output from `cv::reprojectImageTo3D` should have similar units (here again metres). In `Q`, the value at (3,2) is the inverse of the camera baseline value (here `0.0725 m` which makes sense). Values at (0,3) and (1,3) are the principal point's xy-coordinates (roughly the middle of the image; again making sense) and (2,3) is the relative focal length (with respect to the image width). Don't scale the disparity. So comment this line: #disp = abs(disp-min_disp)/num_disp
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "opencv, image processing, camera calibration, stereoscopy" }
Configuring sbt project to include external Main methods in "sbt run" It's very common for me to create an sbt project that depends on an external jar and is intended to be run with a Main method from the external jar. At the moment, I just run it using "run-main xxx" but I'd much prefer to be able to include the Main method in the list of run() options provided by sbt. Is there an easy way to do this? Or is the best option to include an sbt task that serves as an alias for run-main xxx?
The list of main classes is collected in `discoveredMainClasses` and you can transform that to add your own explicitly: discoveredMainClasses in Compile += "org.example.Main"
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "scala, sbt" }
Confused about session management between Apache httpd and Tomcat using mod_jk I am confused about session management between Apache httpd and Tomcat using mod_jk. I know that Apache is typically used for serving http pages, and Tomcat is used as instructions for handling different types of web requests. So when an application using both of these receives a request, does Apache create a session where within that session a Tomcat session is created? I am asking this because none of the changes I make to sessions in my apache httpd.conf file seem to take affect, but the changes I make to my Tomcat config files do affect my application.
Apache httpd is - especially when mod_jk is in the game - a reverse proxy for Tomcat. It typically does little more than forwarding requests and responses. If a tomcat-based web application requires a session, Tomcat will create the session and handle it typically with a cookie. This session information is part of the proxied content, which Apache httpd neither creates, deletes or manipulates (unless you _explicitly_ configured it to do so, in which case you'd knew that you did). _In case_ Apache httpd has some other components (e.g. PHP based) that require sessions, this part of session handling would be subject to the PHP application. Tomcat sessions behave the same, no matter if they're proxied or not. So, Apache httpd has (unless you cause it to) _no_ effect on Tomcat sessions.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, apache, tomcat, httpd.conf, mod jk" }
Alternate for Request.RawUrl in javascript/jquery? I was using a `Request.RawUrl` to get the URL after localhost. i.e if my url is `localhost:52482/something/somethingelse`, then this used to return `/something/somethingelse`. I accessed this in a base controller(MVC3).But i found out that if there are some entries made in the page ,say some textbox and other selections, this would return a query string kind of value. How do I solve this? I was thinking about perform this operation in javascript to see if i can get just the URL without query string. Let me know how should I proceed here? Thanks, Adarsh
< // testsite.com/test.html?q=blah var urlWithoutQS = window.location.host + window.location.pathname alert(urlWithoutQS); // testsite.com/test.html alert(urlWithoutQS.split('/')[0]); // testsite.com alert(urlWithoutQS.split('/')[1]); // test.html
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, jquery, asp.net mvc 3, request, rawurl" }
whats the best way to disable a link during ajax call . i have this code to show a loading image when i run an ajax call: $('.event').live('click', function () { var spinner = $("<img src='/content/images/ajax-loader.gif' />").insertAfter(this); the issue is that since its an async call, if you click a link multiple times, it will show up with multiple spinners. Obviously this is just the sympton as i dont want to allow another ajax call before the first one returns. What is the best way to "disable" a link or a button during the window of an existing ajax call?
Nice thing about `.live()` is that it is selector based. Because the handler is triggered for elements with `.event` class, just change its class, and the handler won't fire anymore. $('.event').live('click', function () { $( this ).toggleClass( 'event event_clicked' ); var spinner = $("<img src='/content/images/ajax-loader.gif' />").insertAfter(this); This will remove the `event` class, and replace it with `event_clicked`, so subsequent clicks on the element won't trigger the `live()` handler. To restore functionality, just swap the classes again.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "jquery, ajax" }
Swift correct break multi-layer switch I'm rewriting a code from java to swift and need to break a multi-layered switches right way. In Java it looks like : block0 : switch (topSwithch) { case one: { switch (innerSwitch) { case insideCase: { if (something){ break block0; } // etc So, I'm breaking one switch from another. How do I do it in swift ?
This is what it'd look like in Swift. I did this in a playground with hardcoded values for the variables: let topSwitch = 1 let innerSwitch = 4 let one = 1 let insideCase = 4 let something = true block0 : switch (topSwitch) { //first switch labeled "block0", switching on topSwitch case one: //topSwitch is 1, one is 1 switch (innerSwitch) { // switching on innerSwitch case insideCase: // both are 1 if (something){ // if true break block0; // break from "block0" } default: break // else } default: break // else }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "swift" }
Google Chrome showing weird character !weird character is showing in Google Chrome Whenever I am trying to open some sites and also sending messages in LinkedIn it showing something weird.
Those weird characters is actually the file content that is not rendered correctly in your browser. Along with each response received from a website for each resource (html, images, stylesheets, javascript, etc) there is a 'Content-type' header, which tells the browser what resource type is it. In your case it might be a browser extension that is altering the headers, a bug in the browser, an antivirus or something else. Try to use a different browser or update the current one.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "windows, google chrome" }
Facebook & html validation error: meta tags in body this is not a duplicate, I put meta tags in head element but facebook see it in body element, btw: I'm using utf-8 without BOM and I am obliged to, cause if I don't use it a PHP error will appear telling me HEADER already sent this is facebook view of my code <
I found the problem in my code, there was a php include function, that include function somehow generated a "paragraph tag" the paragraph tag inside the head forced the head to be closed and the body to start, which made the rest of the elements that was writen after than include goes to body element
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "php, html, facebook, facebook graph api" }
Dbpedia does not return full results Beginner in DBPedia/SPARQL/Semantic data. I ran following queries to "find out the sport for each athlete" select ?athlete ?sport where { ?athlete rdf:type < #query1 ?athlete dbpedia2:sport ?sport #query2 } It does give results but not the full set that I am looking for. "query1" by itself returns more athletes but combined with "query2", I get a lot less resultset. Please explain the discrepancy. Am I missing something? Whats the alternative? Regards
Your query selects all athlete nodes which have _both_ rdf:type and dbpedia2:sport properties. You can use `optional` clause to retrieve nodes even if some property isn't bound. For example: select ?athlete ?sport where { ?athlete rdf:type < #query1 optional {?athlete dbpedia2:sport ?sport} #query2 } Better way to get sport: select ?athlete ?type where { ?athlete rdf:type < optional { ?athlete rdf:type ?type. ?type rdfs:subClassOf < } }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "sparql, dbpedia" }
error in mysql query - for retriving data using date i want a count for a specific month's data from my table tbl_itunes_report. table structure is id int pimary key provider_country varchar(50) title varchar(50) product_type_identifier varchar(50) begin_date varchar(50) This is my query SELECT title, sum(CASE WHEN MONTH(begin_date)= '05' THEN 1 ELSE 0) as june FROM tbl_itunes_report WHERE `product_type_identifier` = '1T' group by title but this query does'nt worked for me. there is an error showing that #1064 - 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 ') as june FROM tbl_itunes_report WHERE `product_type_identifier` = '1T' group' at line 3 if any one can help me, please. thanks in advance
You are missing the END keyword at the end in CASE statement SELECT title, sum(CASE WHEN MONTH(begin_date)= '05' THEN 1 ELSE 0 END) as june FROM tbl_itunes_report WHERE `product_type_identifier` = '1T' group by title
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "mysql, mysql error 1064" }
Как лучше всего создавать глобальный объект? Как лучше всего создавать глобальный объект? Если в объекте создается переменная для которой нужен загруженный DOM Если DOM загруженный не нужен, то можно так photoFunc = { obj_size: 'eclipse' } А если нужен то так ? document.addEventListener('DOMContentLoaded', function(){ photoEl() }, false); function photoEl(){ return photoFunc = { obj_size: document.getElementById('eclipse') } }
Глобальный объект создаётся так: window.globalObject = {}
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript" }
min and max value from php array $array = [0,1,2,3,4,5,6]; $min = min($array); $max= max($array); * I want min as 1 and max as 6 i don't want to consider 0 as min with php array.
Use array_filter to filter the zero out of the array $a = array(0,1,2,3,4,5,6); $a = array_filter($a); $min = min($a); $max = max($a);
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 0, "tags": "php, arrays" }
VBA Call Method based on a string value If I declared an array of strings, and the strings are each a Sub name, how can I call the Sub of that name without needing an `if` statement? **Example pseudo code:** Set String Array = {"sub1","sub2","sub3"} for each String str in Array call str 'where str is a Sub next str I do know how to create an array and call Subs; I just don't know how to call a Sub using a string value.
Try this: Application.Run (str) I just learned about this by doing something similar. You can also pass a variable to that sub by doing: Application.Run (str, "YourValue")
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "vba" }
Jquery validation not working for special characters I am writing jquery validation to make a strong password. I wrote condition for special characters and it is not working. I am trying as below. "regex": /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$])[0-9a-zA-Z]{8,}$/, "alertText": "*Password should contain atleast one special character,one number and one upper case letter", I am having trouble with `(?=.*[!@#$])` part of code. If I remove this regular expression will work but it will not validate special characters. If I put `(?=.*[!@#$])` nothing it will validate. Always I am getting an error popup. I am not sure about `(?=.*[!@#$])` this part.
Your consuming character class at the end of the pattern (`[0-9a-zA-Z]`) does not match the special chars that you require with the `(?=.*[!@#$])` lookahead. Add those `!@#$` chars there: "regex": /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$])[0-9a-zA-Z!@#$]{8,}$/ ^^^^
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "javascript, jquery, regex, client side validation" }
See items that match in two list lest say I have two lists List1: "Tom", "Frank", "Lacey" List2: "Frank", "Tom" what would be the query needed to show that Tom and Fran are being repeated? The lists that I am trying to compare are very big and if I do something like: var q = from a in List1 from b in List2 where a.Name == b.Name select a; this takes a long time.
To see what values are duplicated across lists, you can use var results = list1.Intersect(list2); If you were otherwise interested in matching the items and doing something with each, you could use `Join` var results = from item1 in list1 join item2 in list2 on item1 equals item2 select new { // include what you want here }; In your case, since you are dealing with a list of strings, `Intersect` seems like the appropriate course of action. If you were dealing with matching lists of objects on a common key, you might opt to join the lists and project the results.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c#, linq, iequalitycomparer" }