INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
"Legally compliant" se traduce "con validez legal" Quisiera confirmar si de verdad la traducción de "legally compliant" en castellano es "con validez legal" en vez de "legalmente conforme". Muchas gracias.
"Legally compliant" significa "complying with law" (en cumplimiento de la ley/de la normativa). En el contexto mencionado, "legally compliant digital signature", me parece que "firma digital con validez legal" es una buena traducción. Si algo cumple con la ley, tiene validez legal o es válido desde el punto de vista legal. En otros contextos, "legally compliant" podrá traducirse como "que cumple(n) la normativa / en cumplimiento de la normativa", por ejemplo: * legally compliant policies (políticas que cumplen la normativa/en cumplimiento de la normativa)
stackexchange-spanish
{ "answer_score": 4, "question_score": 1, "tags": "traducción" }
Can a universal catalytic converter be legally fitted to my Prius in California? My 2006 Toyota Prius with 280k miles is throwing the P0420 code, which means that it (probably) needs a new catalytic converter. I live in California, which makes life much more difficult to replace a cat. The direct fit CARB-compliant catalytic converter cost about $1500 in the Toyota dealers (from I could search, still didn't asked to one directly), which is way too expensive compared to welding a universal catalytic converter (about $300). Will it still pass smog with a universal catalytic converted welded in?
**In short: no.** To pass smog in California (and other CARB adopting states) the catalytic converter must be the one from the dealership or one that is in the Aftermarket Catalytic Converter Database. The catalytic converter must be one of those listed for the Toyota Prius, but unfortunately there is none for the Prius. For now the only possibility is to try other solutions like using a catalytic converter cleaning additive, washing the catalytic converter or make a tune up in the hope that one of those will help. **Edit** For those curious with the end of my ordeal, after months of poke and hope, I changed spark plugs, poured Cataclean and more recently poured Seafoam and it worked! At least long enough to me go to smog and have the car certified. After 3 miles it came back again :-(
stackexchange-mechanics
{ "answer_score": 6, "question_score": 5, "tags": "obd ii, catalytic converter, prius" }
Sum one column based on similarity of other column values in Python I want to sum one column based on similarity of other column. I tried the below code, but it gives me error, and It docent bring all the column. can anyone help me please? df ["sum"]=df.groupby(['id']).agg({'duration': sum}).reset_index() df df x. y. m. n. duration id xx. rr. 1.1. 4.4 66 2 xx. rr. 1.1. 4.4 66 2 xx. rr. 1.1 4.4 66 2 tt. uu 2.2 4.4 10 3 tt. uu 2.2 4.4 55 3 What I want is: x. y. m. n. duration id xx. rr. 11 4.4 sum(66+66+66) 2 tt. uu. 22. 4.4 sum(10+55) 2
If need first rows by `id` use `GroupBy.transform` with `DataFrame.drop_duplicates`: df["sum"] = df.groupby('id')['duration'].transform('sum') df1 = df.drop_duplicates('id') Or aggregate by all columns: df2 = df.groupby(['x.','y.','m.','n.', 'id'], as_index=False)['duration'].sum()
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, pandas, dataframe, group by" }
In metric spaces, is a function uniformly continuous iff $\delta$ depends on $\varepsilon$? Most book examples end with an expression for $\delta$ that depends on $\varepsilon$ when proving uniform continuity. What I am wondering is whether a function can be uniformly continuous as long as the distance between any two elements of the domain of the metric space is within some number that does not depend on $\varepsilon$ or the where we "fix" the domain.
There exist bounded, non uniformly continuous functions, so the answer is no. One example of such a function is $f(x)=\cos(x^2)$, for $x\in\mathbb R$. Then, for all $x,y\in\mathbb R$, you have that $|\cos(x^2)-\cos(y^2)|\leq 2$, but $f$ is not uniformly continuous on $\mathbb R$.
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "real analysis, continuity, uniform continuity" }
Memory allocation of Integers Let's say I have a UInt16 made up of 2 UInt8s (upper bits and lower bits) Is this statement correct? > As long as the value of the UInt16 is less than 256, all of the memory will exist in the lower bits and the upper bits will be 0
All of the set bits will be in the lower byte when the value is treated as a 16-bit unit, however if you cast the address of your variable to a char * you may find that the 'low byte' precedes the 'high byte' in memory. This is called little-endian storage and is true, for example, on intel x86 based processors.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c, memory, memory management" }
Do I need a php mysql connection in each function that uses database? I am creating a php restful API and currently I have the database connection information in each function. //Connect To Database $hostname=host; $username=username; $password=password; $dbname=dbname; mysql_connect($hostname, $username, $password) OR DIE('Unable to connect to database! Please try again later.'); mysql_select_db($dbname); mysql_query($sqlApiAccess) or die('Error, insert query failed'); What is the best way of doing this, Can I have one database connection per php file? Or do I need to do it per function that uses the database.
Create a config.php And add the code: `config.php:` $hostname = 'host'; $username = 'username'; $password = 'password'; $dbname = 'dbname'; $conn = mysqli_connect($hostname, $username, $password) OR die('Unable to connect to database! Please try again later.'); mysqli_select_db($conn, $dbname); Then in any file you wish to use mysql, add the following: `script2.php` <?php require_once 'config.php'; mysqli_query($sqlApiAccess) or die('Error, insert query failed'); ?>
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 11, "tags": "php, mysql" }
VB.Net load JS file if file exists I'm trying to do this on a DotNetNuke site with multiple portals, so I want to do this server-side VB loads a javascript file if it exists. Any ideas?
<% 'If the portal.js exists, insert %> <% if System.IO.File.Exists(Server.MapPath(PortalSettings.HomeDirectory & "portal.js")) then %> <script src="<%= PortalSettings.HomeDirectory %>portal.js"></script> <% end if %>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".net, asp.net, vb.net, visual studio" }
Avoid simultaneous job modifications in Jenkins I am using the Jenkins Job DSL Plugin to create template jobs. There is a problem when two or more users are modifying the same template job (or any other job) simultaneously. The configuration of the last user to save or apply the modifications are registered and the modifications of the other user are removed because the two users were working on the same configuration version. For example: Recently, I had to add a user to the global authorization matrix in a template job. I did that and i saved and build it. However, another user was modifying the same template job all day and he saved it at the end of the day and my changes were removed. Is there a way to avoid this simultaneous job modifications by locking the configuration of a job for other users when that user is currently updating it?
Not currently available in core. Full Answer
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "jenkins, configuration, locking, dsl" }
property setter in __init__ method? I have this hypothetical situation where I need to check if a `Phone` instance is being created with price less than 100 and, if it is, then I have to warn the user that price cannot be less than 100. I am using the below for this example: class Phone(object): def __init__(self,v): self._cost = v @property def cost(self): return self._cost @cost.setter def cost(self,value): if value < 100: print("Cost cannot be less than 100") else: self._cost = value s8 = Phone(98) But this code is not letting the user know that a phone cannot be created with price less than 100. What is the use of having a setter function for a property in Python if we cannot check the values when we are initializing the object? Am I doing anything wrong here?
You're not actually calling the property setter. You're directly setting the "private" variable. If you want to warn the user, you need to do: def __init__(self,v): self.cost = v Remember, a property allows you to abstract away internal implementation details (`cost`, in this way, is the public interface for `_cost`). However, if you directly manipulate `_cost` yourself, then your interface will not warn the user during initialization.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "python, properties" }
What is an effective way to invest in electric car industry? I am looking to diversify my savings and following the current trends in the automobile industry I am thinking of potentially investing in the electric car industry. The problem is I am unsure of an effective way to go about doing this. Are there any mutual funds which concentrate on the electric car industry? And if there isn't what would be the next best bet?
At this time I would say that the electric car industry _as a whole_ is too new to be able to invest in it as a sector. There are only a handful of companies that focus solely on electric cars to create a moderately diverse portfolio, let alone a mutual fund. You can invest in mutual funds that _include_ EV stocks as part of an auto sector or clean energy play, for example, but there's just not enough for an EV-only fund at this point. At this point, perhaps the best you can do if you want an _exclusively_ EV portfolio is add some exposure to the companies that are the biggest players in the market and review the market periodically to see if any additional investments could be made to improve your diversification. Look at EV-only car makers, battery makers, infrastructure providers, etc. to get a decent balance of stocks. I would not put any more than 10% of your entire investment portfolio into any one stock, and not more than 20% or so in this sector.
stackexchange-money
{ "answer_score": 1, "question_score": 1, "tags": "mutual funds, electricity" }
Detect when application becomes active In MDI application which event can the child Form class use to detect when the application becomes active? I tried Form.Acivated event but it occurs only when the form is activated and doesn't when the application gets focus.
It is the MDI parent form that gets the Activated event. You can subscribe to the event in your child form's Load event. Be careful, you have to make sure you unsubscribe the event when the child gets closed or you'll leak the child form instance. Make it look like this: protected override void OnLoad(EventArgs e) { var main = this.MdiParent; main.Activated += main_AppActivated; this.FormClosed += (o, ea) => main.Activated -= main_AppActivated; } void main_AppActivated(object sender, EventArgs e) { // Etc... }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "winforms" }
Can I develop high quality games for Android/iOS using libGDX? All I wanna know is, "Can I develop high quality games for Android/iOS using libGDX or game engines like Unity3D would be needed?"
Unity3D is much more than a library (like libGDX). You get a very good editor, that allows you to see your game objects and make debugging a dream compared to building something without a visual aid. Unity3D has another major advantage in its asset store. Whenever I want to do something new, I look into the asset store first, and usually someone else has done it, with much better quality than what I'd achieve in a small time frame. I did this game in Unity3D: < and while I could have done it in many other engines, it would have taken me much longer.
stackexchange-stackoverflow
{ "answer_score": -3, "question_score": 0, "tags": "unity3d, frameworks, libgdx, game engine, 2d games" }
Can I set Tag code in a Javascript file, to be Linted with the CommonJS standards I am writing some Common JS. This is causing problem because I'm working in ES6 so while the word LET will compile fine when I'm running my tests it needs to be VAR in CommonJS. Is it possible to use a esLint tag or something to say check certain block of code with different rules.
You can tag specific files with /* eslint-env commonjs */ used as a comment in the file
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "eslint, commonjs" }
How to enable the ps -ux option on busybox? I have stripped down busy box for my embedded linux.Currently the busy box supports only ps -w option. I need to sample an application for its CPU and Memory usage and the sample should be atleast 5 per sec. Top command gives 1 sample per sec. I am currently using ps -ux to get the CPU and Memory usage for this particular process and using vmstat and meminfo to get the overall CPU and memory usage. I am straightaway redirecting the info obtained from "ps -ux" ,"meminfo","vmstat" to a file and later on I will parse this file to see the trend for this particular process with respect to overall CPU and Memory Usage thats how I am getting 3-5 samples per second. The problem is I am not able to enable the "ps -ux" on my busy box. How to enable the ps -ux option on busy box which has a stripped down linux version?
The only solution I see here is to build a needed version of _ps_ from source code. Of course, do not forget that you need to cross-compile it as it's for embedded system that I assume runs on ARM or other non x86 architecture. After that simply replace binary on your embedded system with the newly built one (don't forget backup, just in case).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "busybox" }
jquery validate need to set the max of a range at run-time I have an order page where the customer needs to only be able to order from 1 up to the number in stock. $(document).ready(function() { $("#AddToCartForm").validate({ rules: { quantity: { required: true, range: [1, $('.size_max').val()] } } }); }); Even though there is a hidden field with the id "size_max" and a value of 5, this returns Please enter a value between 1 and NaN when any number is put in the quantity field. How can I set the upper bound of the range dynamically?
You've mentioned that you have a hidden field with an id, but you are using a class selector in your code. Try changing `$('.size_max')` to `$('#size_max')` in your code.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "jquery, jquery validate" }
Conditionally remove comments and post meta in functions.php I'm new to Wordpress and am coming from the point and click world of Joomla! what was easy there now involves some solid php knowledge to replicate in Wordpress ;) I'm try to conditionally remove post-meta and comments from 3 categories using functions.php I'm using Woothemes Canvas and my own child theme. I can remove post-meta globally by using an empty function: function woo_post_meta() {} This works fine but I only want it to work for 3 categories I know I need to somehow use is_category butI'm not sure of the syntax, I tried if ( is_category(4,5,6) ) { function woo_post_meta() {} } but that doesn't work, i'm not sure how to correctly write a function within a function. Then how do i also remove comments from those categories? or should I make custom content type to do all this?
Here are some ideas: **a)** Instead of is_category(4,5,6) which checks if a category archive page is being displayed (see here), you can try in_category(4,5,6) or in_category( array(4,5,6) ) that checks if the current post is assigned to any of the specified categories (see here). **b)** You could also try function woo_post_meta() { if ( in_category(4,5,6) ) { return ""; }else{ // the original woo_post_meta() code here. } } **c)** If the original `woo_post_meta()` contains an output filter, than we could add a custom filter with the above category check. **d)** If you write your own child theme, you could replace the template tag: woo_post_meta(); with if ( !in_category(4,5,6) ) { woo_post_meta(); }
stackexchange-wordpress
{ "answer_score": 1, "question_score": 0, "tags": "php, child theme, conditional content" }
DateTime.ParseExact not working at all, why? I am attempting to parse the following `String` into a `DateTime` object in c#: DateTime.ParseExact("20101108 230125", "yyyyMMdd hhmmss", null) although the value looks correct the `ParseExact` method just keeps giving me the following: > String was not recognized as a valid DateTime. Can anybody tell me why and how I can parse the above string without having to do it the manual way? Isn't `ParseExact` supposed to be for this kind of occasion?
You got the format for hours wrong, should be uppercase: DateTime.ParseExact("20101108 230125","yyyyMMdd HHmmss", null) Lowercase `hh` specifies that the time uses a 12-hour clock (with AM/PM). Uppercase `HH` is a 24 hour clock time. For detailed info, check the documentation of custom DateTime format strings.
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 6, "tags": "c#, .net, datetime, date format, datetime parsing" }
A differentiation almost everywhere problem Let $f: \mathbb R \to \mathbb R$ be a continuous function, and there exists a $k>0$ such that for each $y \in \mathbb R$, there are at most $k$ distinct $x$ with $f(x)=y$. Prove that $f$ is differentiable a.e. My approach is trying to show $f$ is absolutly continuous, but need a hint to make a start. Thanks.
It's enough to show $f$ is locally of bounded variation. Let $I$ be a compact interval. Then $f$ achieves a maximum and minimum value on $I.$ Let $m^+,m^-$ be these values, respectively. Try to show the variation of $f$ on $I$ is bounded by $k(m^+ - m^-).$
stackexchange-math
{ "answer_score": 4, "question_score": 5, "tags": "real analysis, measure theory" }
Prove that for any integer with $n>2$, I can find n distinct positive integers such that the sum of the reciprocals is equal to 1. Prove for any integer $n > 2$, one can find n distinct positive integers, such that the sum of their reciprocals is equal to 1. Is there any non-complicated way to do this? Induction doesn't seem to work, and neither does proof by contradiction. Writing out the first couple of $n$ hasn't seemed to lead me anywhere.
$$ \frac{1}{k} = \frac{1}{k+1} + \frac{1}{k^2 + k} $$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "summation, fractions" }
is it possible to have a module run in a different module? is it possible to have something like def Number(): N = random.randint(1,20) return N and then have this run in something like 'def numReroll()'
If you mean `function` not `module`, then one function can call another function - import random def Number(): N = random.randint(1,20) return N def numReroll() number1 = Number() number2 = Number() number3 = Number()
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python" }
How to catch exception on a page while running automated tests I am doing automation testing of a web application using selenium. While running automation testing of web application you encounter application errors. Is there any way to detect those exceptions. Specially exceptions that are on the page which causes the page to hang up as it is not finding the element it is looking for or page stays on the same page and waitforpage() function keeps running. How can I solve it. Please help
You'll need to put in screen-scraping code, where you search the page for various messages.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "vb.net, visual studio 2010, testing, selenium, automation" }
Alternatives to the term "about me" I'm looking for an alternative to the term "about me". It's for a navigation entry on a website and I'm tired to see "about me" everywhere on the web. As I'm not native speaking english (german) it is quite difficult to find another term. Even though in german it is not easy to find one. Any ideas? **EDIT** The question mentioned in the "This is a duplicate" section "Another word for the “about” section of a personal website" is different. What I'm looking for are synonyms, other words for the meananing of "about me". I just mentioned the website navigation to make clear that it's not used in a entence or text.
I have seen the following as alternatives to “about me”: profile, biography, bio, my story, portrait, resume Rather than just having one page, I have also seen some of these grouped together into subpages. For example, a master “bio” page with subpages including: about, resume, projects, client comments. It will depend on what kind of content you want to create, what information you want to share, the online format in which you wish to share it.
stackexchange-english
{ "answer_score": 5, "question_score": 1, "tags": "vocabulary, synonyms" }
On the common compact support for a convergent sequence Let $f\in L^1$. I guess it is true that there are $f_n$ s.t. $f_n\rightarrow f$ in $L^1$ and $\mathcal{F}(f_n)$ has compact support for each $n$. Can I conclude somehow that there is a compact set $K$ s.t. $supp {\mathcal{F}(f_n)}\subset K$ for all $n>N$ for some N? Here $\mathcal{F}$ denotes Fourier Transform.
Let $g$ be defined on $\mathbb R$ by $$ g(x) = e^{-x^2}, \quad \forall x\in \mathbb R, $$ and let $f$ be the inverse Fourier transform of $g$. Since $g$ is in the Schwartz space $\mathscr S(\mathbb R)$, we have that $f$ is also in $\mathscr S(\mathbb R)$ and, in particular $f$ lies in $L^1(\mathbb R)$. We will show that there is no sequence $\\{f_n\\}_n$ converging to $f$ in $L^1(\mathbb R)$, and such that the support of all the Fourier transforms $\hat f_n$ lie in a single compact set $K$. Assuming otherwise, we have that $\hat f_n\to \hat f$, at least pointwise, so one concludes that $\hat f$ vanishes off $K$. However $\hat f=g$, which vanishes nowhere, giving a contradiction.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "functional analysis, fourier analysis, lebesgue integral" }
Quitar borde de celdas excel Estoy realizando una aplicación de consola que lee un excel protegido y lo vuelca en una base de datos, el problema surge que dicho excel tiene marcado los bordes de las celdas en todas las lineas. Excel.Application xlApp = new Excel.Application(); Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(item); Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[2]; Excel.Range xlRange = xlWorksheet.UsedRange; ![introducir la descripción de la imagen aquí]( y dichas celdas las lee como si fueran dato. Como puedo evitar que lea los bordes como dato de dicho excel, el archivo excel no lo puedo editar.
Estimado, en `xlRange`, puedes guardar el rango a leer que solo contenga datos, igual cuando haces un ctrl+fin para ubicar la última fila con datos. En el siguiente código, podrás almacenar dicho dato y recorrer el Excel hasta la última fila con datos: Excel.Application xlApp = new Excel.Application(); Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(item); Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[2]; int fin = xlWorksheet.Rows.Count; int ultima = xlWorksheet.Cells[fin,1].End(Excel.XlDirection.xlUp).Row; Excel.Range xlRange = xlWorksheet.Range["A1", "última columna a leer" + ultima]; Espero que te sirva, saludos
stackexchange-es_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#" }
On a SP Community want alert for specific Category (not all) In SharePoint when I go to set alerts, even if I filter down to a specific Category it gives alerts on ALL Categories or Discussions
This is because you have a filtered _view_ , but the alert works for new/changed _data_. I'm afraid, the alerts will work for the whole discussion only. You could split the discussion into several ones and set alert for each one.
stackexchange-sharepoint
{ "answer_score": 0, "question_score": 1, "tags": "alert, community site, community, categories" }
Replace \" with " in string I have a string: var a = "some text \""; I want to replace `\"` with `"`. `a.Replace("\"", '"');` => _The best overloaded method match for 'string.Replace(string, string)' has some invalid arguments_ `a.Replace("\"", """);` => _Newline in constant_ finally I want to obtain `"some text"`
You need to escape your string, you are looking for: a.Replace("\\\"", "\""); That should do it! **NOTE** Please note - just calling replace creates a NEW STRING VALUE it does not edit the original string. If you want to use this string you can do the replace inline or you can assign back to the original value like so: a = a.Replace("\\\"", "\""); That could also be another issue you are having!
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 0, "tags": "c#, string, replace" }
VPython time measurment. Counting passed seconds How should I measure number of seconds passed in a infinite loop? I'm using Vpython, and in my loop i change a position of some elements etc. The thing is that i have to change color of lights(sphere) every X seconds and it all happens in infinite loop. while True: #some stuff 'here i have to count those seconds' #some other stuff
You could determine the elapsed time by calling `time.time()`, and taking the difference. > i have to change color of lights(sphere) every X seconds Say you last changed the colour at time `T`. Keep calling `time.time()` inside the loop, and change the colour again when `time.time() - T` exceeds `X`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "python, time, measurement, vpython" }
Lua Pattern Matching a pattern My problem is this. I have a string containing let's say local mystring = "ASD_ASDDFS_SDF_ASDASD as8d76 na879yd" I want to take the part of the string that has the capital letters with the underline. Now normally this would be easy but right now this string can change from time to time. So the string could be say local mystring = "ASD_ASDDFS_SDF as8d76 na879yd" or local mystring = "ASD_ASDDFS_SDF_YUIOY asaasd na879yd" Now the letters always start out as capital and are always connected using an underscore. And it's only this part I want to capture. I thought of doing something like local capitalpart = mystring:match("%u*%_%u*(%_%u*)+")) So that it captures an underscore followed by capitals repeadedly. But this didn't work.
You can use the following pattern: [%u_]+
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "lua, string matching, lua patterns" }
How can I get the total number of pages on Spring Data? I have an Angular app that shows a list of entities and I have a 'show more' button that increments page number and uses this method: Page<myEntity> result = myRepo.findByAttr(attr, page); I format this `result` and send it via REST's JSON. I want to disable 'show more' button if there's no further pages to get. There's a 'frameworkie' specific way to retrieve this number or I should use `findAll()` and count through this list?
This is the source code of `Page` interface public interface Page<T> extends Slice<T> { /** * Returns the number of total pages. * * @return the number of total pages */ int getTotalPages(); /** * Returns the total amount of elements. * * @return the total amount of elements */ long getTotalElements(); /** * Returns a new {@link Page} with the content of the current one mapped by the given {@link Converter}. * * @param converter must not be {@literal null}. * @return a new {@link Page} with the content of the current one mapped by the given {@link Converter}. * @since 1.10 */ <S> Page<S> map(Converter<? super T, ? extends S> converter); } You have `getTotalElements()` to get the total number of matching element. `getTotalPages()` will give total number of pages.
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 14, "tags": "java, pagination, spring data jpa, repository" }
Generate event, Swing How can I generate event `MouseWheelEvent` for some `Object`?
MouseWheelEvent mwe = new MouseWheelEvent(...); component.dispatchEvent( mwe );
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "java, swing, events, event handling" }
Equivalent definitions of connection on a vector field Let $X$ be a nice variety resp. a manifold over the complex numbers. One defines a connection on a vector bundle $V$ on over $X$ as a $\mathbb C-$linear sheaf homomorphism $\nabla : V\rightarrow V\otimes \Omega^1$ which satisfies the Leibniz rule. I have read that this is equivalent to giving for each local vector field $Y\in Der_{\mathbb C}(\mathcal O_X)$ a $\mathbb C-$ linear sheaf homomorphism $\nabla_Y : V \rightarrow V$ with (1) Leibniz rule (2) $\nabla_{fY+gZ}=f\nabla_Y+g\nabla_Z$ for $f,g \in \mathcal O_X$ and $Y,Z$ local vector fields. I can prove that each connection in the first sense implies a connection in the second sense. But I don't see how you get from the datum of thhe $\nabla_Y$ a connection in the first sense. Remark: By a vector field I understand a linear derivation of the structure sheaf into itself.
Using the fact that $\Omega^1$ is $\mathcal{O}_X$-locally free and dual to the sheaf of vector fields you should be able to prove $Hom_{\mathcal{O}_X}(\Theta_X,\mathcal{E}nd_\mathbb{C}(V)) = Hom_\mathbb{C}(V,V\otimes_{\mathcal{O}_X} \Omega^1)$. In local complex coordinates $(x_1,\ldots,x_n)$, $\\{\nabla_Y\\}$ is mapped to $\nabla: V \to V\otimes \Omega^1$ defined by $$ \nabla(v) = \sum_{i=1}^n \nabla_{\partial_i}(v) \otimes dx_i $$ (This the analogue of $df = \sum_i \frac{\partial f}{\partial x_i} dx_i$). Condition (2) ensures that this formula does not depend on the choice of coordinates.
stackexchange-math
{ "answer_score": 3, "question_score": 7, "tags": "algebraic geometry, differential geometry" }
Using an AngularJS Filter in HTML I am learning about filters in AngularJS. Currently, I have the following in a controller: var myApp = angular.module('myApp',[]); myApp.controller('MyController', ['$scope', function($scope) { $scope.people = [ { id:1, name:'Bill' }, { id:2, name:'George' }, { id:3, name:'Jerry' }, { id:4, name:'Elaine' }, { id:5, name:'Kramer' } ]; }]); I am trying to display all of the people whose name contains 'i'. I know how to display the names. I just don't know how to filter them. Currently, I'm displaying them using the following: <div ng-controller='MyController'> <div> People with names that have an "i": <span ng-repeat="person in people">({{person.id}}) - {{person.name}} </span> </div> </div> How do I add a filter in the markup such that only those people whose name contains an 'i' appears? Thank you!
That should work, you can specify the property where you want the filter to be applied <span ng-repeat="person in people | filter:{ name: 'i' }"> ({{person.id}}) - {{person.name}}) </span>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, angularjs" }
Microwave Oven Operating Frequencies I have read that industrial microwave ovens operate at 900 MHz rather than the more common 2.4 GHz ovens found in most homes. Why is this? Some examples of this claim: Continuous Microwave Processing for Heating Materials Comparing Microwave to Conventional Heating & Drying The latter link claims "[The 900 MHz] range allows more efficient penetration of the microwave through the material." Though I don't know why that would be.
"Oven" is probably the wrong word to use. Industrial microwave heating systems are used in many manufacturing processes that may not have anything to do with food preparation. Industrial heating systems may be much larger than a residential oven, or may not resemble a residential oven at all. They may be part of a continuous manufacturing process (think of an assembly line). The longer wavelength (lower frequency) may provide more even heating in larger spaces than shorter wavelengths (fewer "hot spots").
stackexchange-cooking
{ "answer_score": 1, "question_score": 1, "tags": "equipment, microwave" }
Adding User-specific classes dynamically I noticed that some wordpress themes ('Thematic' for example) adds user specific classes to the body element so you don't have to retort to CSS browser hacks, for example: wordpress y2010 m02 d26 h05 home singular slug-home page pageid-94 page-author-admin page-comments-open page-pings-open page-template page-template-home-php mac firefox ff3 So it automatically figured out the day, month, year, os, browser and browser version besides several other wordpress specific details and added them as classes to the body. Is it possible to do the same using jQuery only (no PHP) on static pages? Thanks!
You could set an onload event on the body tag that calls a function that does something like this: if($.browser.safari){ $('body').addClass("safari"); }​ These links might help: * < * <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, javascript, jquery, css, dynamic" }
What does Walt mean by 'Inertia'? Towards the end of 508 _Gliding Over All_. Walt and Jesse are awkwardly reminiscing about their times cooking in the RV. At one point, Jesse brings up the point of how much money they had made at that point and wonders why they didn't buy a newer, more reliable vehicle. Walt replies with one word: > Inertia Inertia in it's simplest is one of Newton's laws stating: > An object in rest tends to stay at rest, an object in motion tends to stay in motion. What does Walt mean by implying inertia kept them from buying a new RV?
They were already moving forward (not necessarily literally, even though they were in an RV) with making the drugs in their current lab. Getting a new RV would have meant stopping that progress, taking a good chunk of money and spending it on something new, and starting over with a new lab in the new RV. Starting with a new lab would mean losing time in making the drugs... getting the new lab set up, getting used to the new setup, etc. _The comment about Inertia refers to the fact that it was easier to keep moving forward, than to stop and start over again._
stackexchange-movies
{ "answer_score": 39, "question_score": 27, "tags": "breaking bad" }
Converting a word doc to pdf using Syncfusion DocIO and saving to disk I am using the Syncfusion DocIO library to try and convert a word doc to a pdf. I am following this simple example: At the bottom of the example they are doing: PdfDocument pdfDocument = render.ConvertToPDF(wordDocument); //Releases all resources used by the Word document and DocIO Renderer objects render.Dispose(); wordDocument.Dispose(); //Saves the PDF file MemoryStream outputStream = new MemoryStream(); pdfDocument.Save(outputStream); //Closes the instance of PDF document object pdfDocument.Close(); I need to save the pdf file to the disk instead. How can I take the outputStream and save it to disk? I believe the example is just saving it to memory.
You can use a `FileStream` to write the file to disk: using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { pdfDocument.Save(fs); } You don't need to use the `MemoryStream` if you don't want to. You can write directly to the `FileStream`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "c#, asp.net core, asp.net core mvc, syncfusion" }
Creating a crc8 function with lua Is there a simple algorithm to create a crc8 checksum from a table in lua? Polynomial should be x^8+x^5+x^4+1 (0x31) This algorithm will be used to check the UID of the DS28CM00 UID-chip. Here you can find a table returned by the chip (LS-byte last) : table = {112,232,9,80,1,0,0} Thanks for any help
For Lua 5.3+ local function crc8(t) local c = 0 for _, b in ipairs(t) do for i = 0, 7 do c = c >> 1 ~ ((c ~ b >> i) & 1) * 0x8C end end return c end print(crc8{112, 232, 9, 80, 1, 0, 0}) --> 219 print(crc8{2, 0x1C, 0xB8, 1, 0, 0, 0}) --> 0xA2 as in example from AN-27 * * * For Lua 5.2- local function crc8(t) local c = 0 for _, b in ipairs(t) do for i = 0, 7 do local c0 = c % 2 local b0 = b % 2 c = (c - c0) / 2 b = (b - b0) / 2 if c0 + b0 == 1 then c = c + 0x80 + (c % 16 < 8 and 8 or -8) + (c % 8 < 4 and 4 or -4) end end end return c end
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "lua, crc, crc8" }
named_scope and .first? I can return a collection of objects, with only one (:limit => 1) but is there a way to return the .first() object only, like not within a collection? named_scope :profile, :conditions => {:association => 'owner', :resource_type => 'Profile'}, :limit => 1 # => collection of 1 profile but I want the profile only NOT in a collection or array the workaround is simply to apply .first() to the results, but I'd just like to clean up the code and make it less error prone.
You'll probably need to create a class method instead: def self.profile where(:association => 'owner', :resource_type => 'Profile').first end Note that with Rails 3 you should be using the `where(...)` syntax, and that when doing `.first`, you don't need to specify the limit.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "ruby on rails 3, named scope" }
Merge Search Index (SharePoint 2013) We are using SharePoint 2013 with 2 WFEs and 1 Application server. I have noticed that one of the WFE is running out of space and found out that there is a lot of folders with merge that are big and was wondering how long will it take to merge the search index? the **%default** folder is around 400 GB compare to the other WFE which is currently around 140 GB The location for the folders: **D:\Program Files\Microsoft Office Servers\15.0\Data\Office Server\Applications\Search\Nodes\1004C9\IndexComponent1\storage\data\SP35f31f197c7b.1.I.0.0\ms\%default** Here is a screen shot of the folders !enter image description here
That's not normal. Is the search service running and healthy on that server? You may want to try changing your topology so that the search service is forced to clean up a bit. Try moving the index location. It may help. <
stackexchange-sharepoint
{ "answer_score": 1, "question_score": 1, "tags": "sharepoint enterprise, enterprise search" }
I have defined my pointer image and pointer location for my google map. Why is it not displaying? This is my code: < On line 25 I have defined the image of my pointer. On line 32 for the second argument of function GMarker I have defined the point of my marker. Why is my marker not showing up? Am I missing something? I'm entirely new to using Google Maps. I apologize for not pasting the code here, but I don't understand the indentation rule. I even indented all of my code in sublime and pasted it here directly but it was only "code-blocking" some of it.
Looks like you're mixing Version 2 and Version 3 code. Use the Version 3 code for markers, since V2 will not be supported anymore: var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(-34.397, 150.644), icon: " shadow: " }); About the indentation, what I do is highlight the whole pasted code and click the `{ }` icon in the toolbar. Anything that's four or more spaces indented will appear as code. There's probably a better way of doing the indentation, though
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, google maps, google maps api 3" }
Pass by reference using pointer and dereference pointer Which one is better: _Pass by Reference_ using `void increment(int& x)` or _Pass by Pointer_ using `void increment(int* x)`? 1. void increment(int& x) { x=x+1; } int main() { int n= 2; increment(n); cout << "Value of n is " << n << '\n'; return 0; } or 2. void increment(int* x) { *x=*x+1; } int main() { int n= 2; increment(&n); cout << "Value of n is " << n << '\n'; return 0; }
None is better. The advantage of using pointer is that it makes explicit in the calling code that the argument is passed by pointer, since the argument is preceded with `&`. The advantage of using reference is that it is more natural in the calling function code, without all `*` dereferences. Internally the are normally implemented in the same way, so there should be no speed advantages.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c++, pass by reference, pass by pointer" }
「まだ要る」いけません?なぜですか? > > "Do you still need that?"
> > \-- > \-- > > \-- > \-- > > \-- > \-- > >
stackexchange-japanese
{ "answer_score": 5, "question_score": 3, "tags": "adverbs, collocations" }
Internal piping with awk Let say i have input line: input: {x:y} abc det uyt llu how to process it, to get expected output: output: {x:y} abc%det%uyt%llu Question is how to concatanate fields 2-end of line, and in that string change space with % where separator is space I need fixed first part {x:y} and implementing pipe for fields 2-end of line
You can use this awk: s='{x:y} abc det uyt llu' awk '{printf "%s%s", $1, OFS; for (i=2; i<=NF; i++) printf "%s%s", $i, (i==NF)?RS:"%"}' <<< "$s" {x:y} abc%det%uyt%llu Another awk: awk '{printf "%s%s", $1, OFS; OFS="%"; $1=""; print substr($0, 2)}' <<< "$s" {x:y} abc%det%uyt%llu
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "awk" }
How to make Category Links noindex Is there a way to make all my categories to be "noindex"? (Plugin or even better default joomla way) Right now crawlers find the category URLs and thus create duplicate content on search engines. Would be great to have one central config for all categories.
Having the same problem I went down to the database. with this SQL you can update **ALL** categories to noindex and to nofollow for search engines (google, bing, yandex) UPDATE `jos_categories` SET `metadata`='{"author":"","robots":"noindex, nofollow"}' WHERE `extension`='com_content' you need to find out your table prefix, in the above example jos_ is the default prefix of joomla. If your table prefix is xzhw_ of course your SQL would be UPDATE `xzhw_categories` SET `metadata`='{"author":"","robots":"noindex, nofollow"}' WHERE `extension`='com_content' **be careful** if you use categories for displaying other content in e.g. a category blog, **DO NOT USE THE SQL**. Instead you should eiher select your categories in the WHERE clause or even better you go manually through the categories in the backend of joomla and you edit under Publish-tab the Robots to noindex, nofollow
stackexchange-joomla
{ "answer_score": 1, "question_score": 1, "tags": "url, seo, category" }
svn blame without author and version number info I want to see who is responsible for some code and in which version, could use `svn blame` to accomplish this, e.g. svn blame com/foo/web/action/order/CustomerCreateOrderAction.java | grep 'queryArtisanCond.setSelectOnlyId(true);' 7943 wenshuang queryArtisanCond.setSelectOnlyId(true); it's ok, but sometimes I found below output no version number and author, e.g. svn blame com/foo/web/action/order/CustomerCreateOrderAction.java | grep 'ArtisanConstant.ARTISAN_DATEVERSION_NEW' - - if (ArtisanConstant.ARTISAN_DATEVERSION_NEW.equals(artisanVo.getDateVersion())) { So why is so?
This happens if the file has local modifications that were not yet committed or if there were commits but no call to `svn up` since then.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "svn" }
Application crashes on different similator I know it sound stilly but this is what happening with my code, On simulator; application works on iPhone SE, iPhone 7 but all other device gives me an error. I don't understand. If the code is wrong then why it works on my different device on simulator func startTimer (){ timer = Timer.scheduledTimer(timeInterval:TimeInterval(timerBetweenNumbers) , target: self, selector: (#selector(PlayViewController.randomInt)), userInfo: nil, repeats: true) } ERROR : 2017-03-23 14:27:15.984926 Anzan[3249:129679] [aqme] 255: AQDefaultDevice (1): skipping input stream 0 0 0x0 fatal error: unexpectedly found nil while unwrapping an Optional value I am using Xcode 8 and Swift 3 Thanks in advance for help
Thanks a lot for help Also I found the issue with my App. "TimerBetweenNumbers" value was suppose to be read from DataCore. I didn't know that in Xcode, each simulator device has his own DataCore. I thought DataCore was similar to SQL DataBase and no matter what device you use, they all read the same Database.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "ios, swift" }
HTML Tables - How to make IE not break lines at hyphens I have some table cells containing dates formatted like this: 2009-01-01. I.E 7 seems to be breaking these into two lines at the hyphen. Is there any way to turn this off?
You are looking for the `white-space` property, which affords you control over how white space and line-breaks affect the content of your element. To collapse white space sequences, but prevent line-breaks, you can use the `nowrap` value: .dates { white-space: nowrap; } <td class="dates">2009-01-01</td>
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 14, "tags": "html, css, html table, internet explorer 7, line breaks" }
Difference between Squeel and Arel? Can anyone explain the difference between the two very similar looking gems 'Arel' and 'Squeel' for a rails newbie. < Vs < I am looking forward to building a simple Query builder where user will be given certain UI blocks it can used to construct SQL queries. Which gem out of the two will be more appropriate and why? Similar Question: SQL query builder in rails
In this case comparison is incorrect. Squeel is built on Arel and has own DSL for constructing queries. Nothing special. I think this can be done with any of the gems.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "ruby on rails, arel, squeel" }
How to get Customizable Options of a simple product in magento 2 $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); $customOptions = $objectManager->get('Magento\Catalog\Model\Product\Option')->getProdu ctOptionCollection($product); print_r($customOptions); I have created a customizable option, Option Title named as Colors and used the above code, but it didn't return any value.
Got the correct answer.. In your phtml page, $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product foreach ($product->getOptions() as $options) { $optionData = $options->getValues(); foreach ($optionData as $data) { print_r($data->getData()); echo $optionPrice[] = $data->getPrice(); echo $optionDuration[] = $data->getTitle(); } }
stackexchange-magento
{ "answer_score": 4, "question_score": 2, "tags": "magento2, product, adminhtml, custom options, simple product" }
In a class, there are 15 boys and 10 girls. Three students are selected at random. The probability that 1 girl and 2 boys are selected, is: > Then, n(S) = Number ways of selecting 3 students out of 25 = 25C3 = 2300. > > n(E)= (10C1 x 15C2) = 1050 > > P(E) = n(E)/n(s) = 1050/2300 = 21/46 I know the above method of obtaining answer using formula. > But without applying the formula, trying to solve it , gives me a different answer. Probability of selecting girl = 10/25 Next, Probability of selecting 1 boy = 15/24 (24 because 1 girl is already selected) Next, Probability of selecting another boy = 14/23 (23 because 1 boy and 1 girl were already selected) (14 because 1 boy was already selected before) So, > P(E) = n(E)/n(s) = (10x15x14)/(25x24x23)=2100/13800=21/138= **7/46** why am i getting 7/46 ?
Since we are selecting $2$ of $15$ boys, $1$ of $10$ girls, and $3$ of $25$ total people, the probability is $${{15\choose{2}} {10\choose{1}}}\over{{25\choose{3}}}$$ $$= \frac{21}{46}$$ Your second method is incorrect because you are assuming we select a girl, a boy, and then another boy in that particular order. In reality, it can be any order $gbb$, $bgb$, $bbg$, giving $3$$7\over{46}$ $=$ $21\over46$
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "probability" }
Get two string from a multilines data in javascript I tried to get 2 string from multilines data. I used Reguler Expression to match the string that I want. First string is just one line, but the second is multipleline. This is my RegEx function const RegExp = /\/Data first:(.*) second:(.*\n.*)/ const first = RegExp.exec(text)[1] const second = RegExp.exec(text)[2] I have the following string /Data first:this first must include second:this second and third fourth . . . and so on must include But it's not working as I expected. What I got is like this first: this first line second: this second third But I need to get result is like this first: this first line second: this second third fourth . . . and so on I tried a lot of things, but I can't figure it out.
You can try this `\/Data first:(.*) second:(.*[\s\S]*)`. I tested with your data and it's working as your requirement. You can try this playground. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, regex" }
How to create models without ActiveRecord? My web app uses MongoDB and because the data isn't relational or complex I rather not use any of the MongoDB ODMs like Mongoid. Also the MongoDb driver is supposed to be many times faster than it's available ODMs. Does ActiveRecord provide things that I can utilise in a basic Model or should I just create a basic class that knows how to access MongoDB and define some methods for accessing the data? I found this article by Yehuda Catz who suggests to use ActiveModel in order to bering ActiveRecord goodness to your custom models. It sounds logical to me. Is this the right way?
Yes your are right ActiveModel is the way too go if you dont intend to use ActiveRecord for a tableless model As of Rails 3+ ActiveModel has been one of the prominent feature . ActiveModel has all the nicety to get started with a tableless model. Most of the ActiveRecord Validation and Callback mostly inherit from ActiveModel . As per using MongoDB ( **MongoId** ) one of the mongodb adapter leverage the advantage of ActiveModel for validation check the validations files here
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, ruby, ruby on rails 3" }
How to run an external file from within the scala interactive interpreter (REPL)? I have a file with several lines of scala code -- imports, list value assignments, etc. that I often use to initialize some things when using the REPL. Currently I just open up the file in a text editor and copy-and-paste it into the REPL, but is there a way to do it by calling the external file in a more direct manner so I don't have to copy-and-paste every time? In some interactive database tools like SQL Plus, it is done by typing `@filename` at the prompt. Is there something similar in the Scala REPL? Preceding the filename with `@` doesn't work, `eval` doesn't work either.
Type: :help and you see, that :load <path> load and interpret a Scala file solves your problem. In some circumstances, pasting the code might be preferable though, but then :paste might be your friend then. It helps inserting a whole block without feedback, line by line, until you hit ` Ctrl` \+ ` D`. In some cases this is significant for the code interpretation.
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 16, "tags": "scala, interpreter, read eval print loop" }
How do I import existing project into SVN repository? I've been following this guide for installing SVN in Ubuntu. I'm using Ubuntu 14.04. I have an existing java project in my workspace: /home/plattens/workspace/jguids30ma I've created a repository for the project: svnadmin create /svn/repository/jguids30ma But so far all my attempts to import the existing project into the repository have failed. svn import /svn/repository/jguids30ma/ file:///home/plattens/workspace/jguids30ma -m "Initial check in" Resulting in: svn: E180001: Unable to connect to a repository at URL 'file:///home/plattens/workspace/jguids30ma' svn: E180001: Unable to open an ra_local session to URL svn: E180001: Unable to open repository 'file:///home/plattens/workspace/jguids30ma' Where have I gone wrong?
Try to launch `svnserve` like this: svnserve -d -r /svn/repository/jguids30ma From svn book: > Once we successfully start svnserve as explained previously, it makes every repository on your system available to the network. A client needs to specify an absolute path in the repository URL. For example, if a repository is located at /var/svn/project1, a client would reach it via svn://host.example.com/var/svn/project1 So you should try to use svn protocol instead of file like this: svn import /svn/repository/jguids30ma/ svn://[IP of your server]/home/plattens/workspace/jguids30ma -m "Initial check in"
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 0, "tags": "svn" }
Help with formulating an implication I have a binary variable $y$ and a set of binary variables $x_i$, where $i\in I$. My problem requires that $$\sum\limits_{i\in I}x_i = b.$$ What I want to formulate is the following implication: if $\sum\limits_{i\in \tilde{I}} x_i \leq b-1$ then $y=1$ where $\tilde{I}\subseteq I$, but I can't seem to figure out how. I have been able to find a formulation that says if $\sum\limits_{i\in \tilde{I}}x_i=m$ then $y=0$ by the inequality $\sum\limits_{i\in \tilde{I}}x_i + y \leq m$ but that is not exactly what I want. Any help is greatly appreciated!
$x_i \le y$ for $i\in I \setminus \tilde{I}$
stackexchange-or
{ "answer_score": 12, "question_score": 7, "tags": "modeling, binary variable" }
Data structure for equivalence classes Let $E$ be an equivalence relation defined over a set $S$. The access to $E$ is only via queries of the form $M(s_1,s_2) = 1$ if $s_1$ and $s_2$ are in the same class and $0$ otherwise. Computing $M$ is expensive (say, $O(n^2)$). I am looking for an efficient data structure $D$ that supports queries of the form "given $s$, does $D$ contain an element $s'$ in the same equivalence class as $s$"? A naive approach is to search element by element in $D$ and test, but is there other solution?
The best you can do is keep track of all currently known equivalences using a Union-Find data structure. Initially, each element is in own group. Whenever you find that two elements are equivalent, you merge their groups (via a Union operation). Then, the best you can do to answer the query you list is to enumerate over all the groups (other than the one containing $s$), find a representative $x$ for each such group, and test whether $s$ is equivalent to $x$.
stackexchange-cs
{ "answer_score": 2, "question_score": 1, "tags": "algorithms, data structures, search algorithms" }
Are eigenfunctions of $E$ also eigenfunctions of $p$? Given that $\hat{H}\Psi = \hat{E}\Psi$ and that $E=\frac{p^2}{2m}$ Assuming a non-relativistic, system, does this mean that any eigenfunction of Energy is also an eigenfunction of momentum? Or does it work the other way and every eigenfunction of momentum is an eigenfunction of Energy? If not, where does this break down? It seems reasonable to me that two particles with the same Kinetic Energy and mass would have the same momentum. Even if the momentum is in different directions I think those would be degenerate states and not strictly count. Although I don't really understand why degenerate states are a problem yet. The point is that any wavefunction of definite energy sounds like it would also have a definite momentum, or vice versa, and I can't think of a way that doesn't make sense.
Since you don't specify $\hat H$, the general answer is a resounding no. If there is a potential, say: $$ V(x) = -\frac k r $$ then the energy eigenstates are definitely not momentum eigenstates. Any potential other than $V(x) = c$ breaks translational invariance, so that eigenstates of energy cannot have definite momentum. Note that $ V(x) = -\frac k r $ is spherically symmetric (it's the hydrogen atom), and in that case, the solution _are_ angular momentum eigenstates.
stackexchange-physics
{ "answer_score": 1, "question_score": 2, "tags": "quantum mechanics, energy, hilbert space, operators, momentum" }
Hardware virtualization? > **Possible Duplicate:** > Enabling hardware virtualisation BIOS; anything to beware? I have an processor option in BIOS: **"Hardware assised virtualization"** It's turned off by default. Do I get some benefits if I turn it on?, if so what benefits. also for what is it used?
Qouted from wikipedia: "hardware-assisted virtualization is a platform virtualization approach that enables efficient full virtualization using help from hardware capabilities, primarily from the host processors". Hardware-assisted virtualization reduces the maintenance overhead of paravirtualization as it reduces (ideally, eliminates) the changes needed in the guest operating system. Hardware-assisted virtualization requires explicit support in the host CPU, which is not available on all x86/x86_64 processors. Plenty of articles on the net, please do some basic research and please read FAQ.
stackexchange-serverfault
{ "answer_score": 0, "question_score": -6, "tags": "virtualization" }
SQL how to avoid grouping by columns where not wanted I have a table consisting of the following columns: 1. HouseID - INT 2. HouseType - INT 3. Location - Int 4. DateBuilt - Datetime Basically I dont want to group on anything but HouseType but im being forced to as I dont need to aggregate certain columns. SELECT [HouseType], COUNT(*), YEAR([DateBuilt]) AS YearBuilt, MONTH([DateBuilt]) AS MonthBuilt FROM HouseTable GROUP BY HouseType, DateBuilt Can anyone help me workaround this? * * * ## Sample Data 1. HouseID - 1, 2, 3 2. HouseType - 1, 1, 2 3. Location - 1, 2, 1 4. DateBuilt - '2016-12-23', '2017-02-02', '2017-01-19',
You can `group by` the functions you are using instead: select HouseType , count(*) , year(DateBuilt) as YearBuilt , month(DateBuilt) as MonthBuilt from HouseTable group by HouseType , year(DateBuilt) , month(DateBuilt) If you wanted to keep some version of a date format, you could use `dateadd(month, datediff(month, 0, DateBuilt), 0)` as an alternative, or add it to the above query: select HouseType , count(*) , dateadd(month, datediff(month, 0, DateBuilt), 0) as YearMonthBuilt from HouseTable group by HouseType , dateadd(month, datediff(month, 0, DateBuilt), 0)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "sql, sql server, sql server 2008 r2" }
onclicklistener is not triggering on existing layout So I have a TableLayout with TableRows with images in them. After creation, I have to run through the images and put a clicklistener on them. But for some reason that listener is completely ignored. What am I missing (new to android). Ive tried waiting with putting them as contentview, but it makes no difference. View vg = tableRow.getChildAt(cell); vg.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Log.v("clicked", "yeah"); clickSquare((ImageView)view); } });
Did you also make the row clickable? Consider adding this: vg.setClickable(true);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, onclicklistener" }
Can Conceal be used to sneak past someone? The description of the free skill, Conceal, seems to imply that it only works when hiding a person if they are stationary. Also, there doesn't appear to be a different stealth-based skill that would cover sneaking around. Am I missing something here, or do characters need to take a specific, different skill to be stealthy when moving around?
You're not missing anything. Conceal does not give you the ability to sneak. You would need to take a do-it-yourself (ie, not-free) skill to do so. Note: the section "Do-It-Yourself Speed Skills" includes "Move Silently" which may be of use to you.
stackexchange-rpg
{ "answer_score": 3, "question_score": 3, "tags": "unknown armies" }
Matlab: Replace NaN element values by value of the precious row I'm trying to replace all my matrix's NaN values by the value of the element in the previous row. How can I do that? This is what I tried (for the first column only) but somehow it doesn't work... for i=1:1935 %number of rows if RSPB0916v05NEW5(i,1)==NaN RSPB0916v05NEW5(i,1) = RSPB0916v05NEW5((i-1),1) end end Thanks so much for your help, much appreciated! Best, Michael
Assuming you do not have `NaN` in the first row, and remembering that NaN is never equal to NaN: for ii=2:size(RSPB0916v05NEW5,1)%number of rows idx=find(isnan(RSPB0916v05NEW5(ii,:))); % find the index of NaNs RSPB0916v05NEW5(ii,indx)=RSPB0916v05NEW5(ii-1,indx); % replace them from the previous row end Note that if the first row has `NaN` values, you need to handle it separately.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "matlab, matrix, replace" }
Dynamic rows & columns for Gridview I have a scenario where I have 3 tables (`Employees`, `Tasks`, `EmployeeTaskTimes`) I need to generated a gridview in c# with list of `Task` on the vertical scale (rows), and `Employees` on horizontal scale (columns) and fill in the values from the `EmployeeTaskTimes`. basic layout for the tables is: > _Employees:_ IdEmp; Name; > > _Tasks:_ IdTask Title; > > _EmployeeTaskTimes:_ IdEmpTaskTime; IdTask IdEmp; TimeTaken; I have run into three headaches that I need suggestions: 1. Creating columns based on the dataset from `Employees`. (dynamically?) 2. A reasonable query(s) to generate a dataset consumable by the gridview 3. bind the values to the grid. Any suggestions are appreciated
I think you need to use Pivot msdn article on PIVOT and UNPIVOT
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, sql, gridview" }
Updating Wordpress Permalinks I have created a plugin that uses custom posts. To get these to display the permalinks need re-saving, no need to change anything, they just need re-saving. There must be a way to do this using a hook but I can't work out how to do this. The function flush_rules looks like it might do the job but it doesn't seem to work. Sample code here: <
Ok solved it. You just have to add the flush to the custom post registration: `register_post_type('custompostname',$args); flush_rewrite_rules(false);` So simple really, just took me a while to find it.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "wordpress, custom post type, permalinks" }
Change Package Name Bower Is it possible to change the name of a bower package after you register it? I have created a package and pushed up, but I have made a typo. Can I change this information in a later version?
Unfortunately there is currently no way for package publishers to interact with the Bower registry, that includes unregister / rename. You can make a request for a manual edit here: < However this will be available in the future once registry rewrite is done: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "bower" }
How to create a new function on window or self(which has assigned interface Window by lib.d.ts)? obviously I am trying to get facebooks async init working. Doing it, I need to create a function on object window called "fbAsyncInit". I am having simillar problem, when writing web workers, because there I want to use self.postMessage but self is once again having as its interface interface Window. However I try to do it, the typscript compiler is not happy with me adding a field to window which is not specified in Window interface. I tried to do it like this at first: interface WindowFB extends Window { fbAsyncInit: ()=>any; } declare var window: WindowFB; that didn't help so I tried some other things and managed to get type checker happy, but it seems like it is just bugged(because for the solutions it is not happy 100%). Does anybody know what the right solution for this might be?
The 'Window' interface is open. You can just write: interface Window { fbAsyncInit: () => any; } window.fbAsyncInit(); Due to some bugs around lib.d.ts, this won't quite work in the TypeScript Playground, but the command-line compiler should be able to accept this.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "facebook javascript sdk, web worker, typescript" }
If $u = e^{x+y} + \ln (x^3+y^3-x^2y-xy^2)$, find the value of - If $u = e^{x+y} + \ln (x^3+y^3-x^2y-xy^2)$, find the value of $$x^2 \dfrac{\partial^2u}{\partial x^2} +2xy \dfrac{\partial^2u}{\partial x \partial y} +y^2 \dfrac{\partial^2u}{\partial y^2} + x \dfrac{\partial u}{\partial x} + y \dfrac{\partial u}{\partial y} $$ * * * Is Euler's theorem applicable here ? $u$ doesn't look homogeneous and working the partials looks like a pain. Is there any smart way ?
If, as commented by Neeraj Bhauryal, you write $$u=e^{x+y} + \ln (x^3+y^3-x^2y-xy^2)=e^{x+y}+\ln (x+y)+2\ln(x-y)$$ and take into account the "symmetry", the problem of partials is quite simple $$u'_x=e^{x+y}+\frac{1}{x+y}+\frac{2}{x-y}$$ $$u'_y=e^{x+y}+\frac{1}{x+y}-\frac{2}{x-y}$$ $$u''_{xx}=e^{x+y}-\frac{1}{(x+y)^2}-\frac{2}{(x-y)^2}$$ $$u''_{yy}=e^{x+y}-\frac{1}{(x+y)^2}-\frac{2}{(x-y)^2}$$ $$u''_{xy}=e^{x+y}-\frac{1}{(x+y)^2}+\frac{2}{(x-y)^2}$$ and, after a few simplifications, the expression just write $$e^{x+y} (x+y) (x+y+1)$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "multivariable calculus, partial derivative" }
MySQL retrieve count of pairs I have a table with two fields: ID_From, ID_To. Now the fields are populated like this: ID_From ID_To 1000 2000 2000 1000 1000 5000 3000 2000 4000 3000 5000 1000 What I would like is to query the database the ID of 1000 and then make it return, how many pairs there are. In this case it would return 2. Quering with ID 2000 would return 1. ID 3000 and 4000 would return zero. Hope I have made it clear enough. Thanks in advance, Fischer.
SELECT COUNT(*) FROM myTable a JOIN myTable b ON a.ID_To = b.ID_From AND a.ID_From = b.ID_To WHERE a.ID_From = 1000 ;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
Scala XML template skipping elements I have this code: val list1 = Seq("One", "Two", "Three") val list2 = Seq("Four", "Five", "Six") val xml = <Root> { list1.map { item => <Item>{item}</Item> } list2.map { item => <Item>{item}</Item> } } </Root> It is creating an XML document like this: <Root> <Item>Four</Item> <Item>Five</Item> <Item>Six</Item> </Root> But my intention is to generate this document: <Root> <Item>One</Item> <Item>Two</Item> <Item>Three</Item> <Item>Four</Item> <Item>Five</Item> <Item>Six</Item> </Root> How can I do this?
To answer my own question, it appears that a {} block in an XML template can only return one NodeSeq value. So, I need to wrap each iteration in a separate {}. val list1 = Seq("One", "Two", "Three") val list2 = Seq("Four", "Five", "Six") val xml = <Root> { list1.map { item => <Item>{item}</Item> } } { list2.map { item => <Item>{item}</Item> } } </Root>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "xml, scala" }
Closed form for $a+ar^nq+ar^{n-1}q^2+\cdots+ar^2q^{n-1}+arq^n$? I know that the formula for a geometric series $$a + ar + ar^2 + \cdots + ar^n$$ is $a(\frac{1-r^{n+1}}{1-r})$, but I am trying to solve a different type of series which "combines" two geometric series together: $$s = a + ar^nq + ar^{n-1}q^2 + \cdots + ar^2q^{n-1} + arq^n$$ Would this require a more advanced solution? I've tried to multiply by $q$ such that $$qs = aq + ar^nq^2 + ar^{n-1}q^3 + \cdots + ar^2q^n + arq^{n+1}$$ and subtract it from the original sum, but it doesn't neatly cancel out like a regular geometric sum.
Divide the sum by $r^{n+1}$ and compute the resulting geometric sum.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "sequences and series, algebra precalculus" }
Cartesian Product of Compact Set and Non-Compact Set is Non-Compact **Theorem:** _Let $A$ be a compact set and $B$ be a non-compact set. Then $A\times B$ is non-compact._ I know that if $B$ is non-compact, then there exists an open cover $O$ of $B$ that does not have a finite sub-collection that also covers $B$. How can I use this to construct a cover of $A\times B$ that does not have a finite sub-collection? Thanks!
HINT: If $\mathscr{U}$ is an open cover of $B$ with no finite subcover, consider $\\{A\times U:U\in\mathscr{U}\\}$.
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "calculus, general topology, analysis, manifolds, compactness" }
Problemas con comando getLineNumber en Android Studio para Android 9.0 Necesito comando getLineNumber para obtener el numero de teléfono de la SIM, IMEI e IMSI en Android Studio 3.2 para versiones de Android 9.0 y 8.0. No se si se necesitan permisos especiales. Me funciona en Android Studio hasta Android version 6.0 pero no superior.
Efectivamente no te va a funcionar ya que a partir de la versión 6 (Android Marshmallow) tienes que solicitar al usuario que introduzca los permisos manualmente. Te dejo este enlace a la documentación oficial de cómo solicitar permisos Android Espero que te sirva, si no lo consigues puedo escribirte el código que necesitar para obtener los permisos del usuario Un saludo
stackexchange-es_stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "android" }
Views Contextual Filters: Using node's URL alias as a conditional filter I have Drupal content whose nodes have URL aliases; /node/1 routes to /bar I also have a View which passes a NID as a contextual filter: WHEN THE FILTER VALUE IS NOT AVAILABLE: [selected radio] Provide default value TYPE [selected dropdown] Raw value from URL PATH COMPONENT: [selected dropdown] 1 [checked] Use path alias View's Path is set for /foo/% So: /node/1 returns node /bar returns node /foo/1 returns view /foo/bar returns a white screen How do I allow the View to access the node's URL alias as a conditional filter? Thank you ![enter image description here](
Maybe the View Url Path Arguments module. I am seeing it recommended in this thread, but I'm really not sure if that's your issue or not. Alternatively, you can implement hook_views_pre_view and alter the argument passed to the view based on the value in the url, i.e. do the conversion from alias to id manually. If you have an issue when your alias contains a `/`, an alternative may be to use a query string for the contextual argument.
stackexchange-drupal
{ "answer_score": 1, "question_score": 2, "tags": "7, views" }
How to run Docker to listen on a specific port to integrate with Jenkins I am trying to use `Jenkins Docker plugin`. Unfortunately I am not able to run Docker on RHEL to listen on a specific port yet. I know I have to add: DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock" But in my RHEL installation dont find the `/etc/init/docker.conf` file. So which file to modify?
Try to edit `/etc/systemd/system/docker.service` like below. ExecStart=/usr/bin/docker -H fd:// -H 0.0.0.0:4243 -d
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "jenkins, docker, boot2docker, dockerpy" }
Doubt on the geometry of "quantum phase space" In Jose & Saletan's "Classical Dynamics", they show the global structure of Hamiltonian mechanics: you then have a $Q$ manifold (configuration space), and the phase space structure is precisely the cotangent bundle $T^{*}Q$. Even more, if we take the phase space functions $f(T^{*}Q)$ together with the Poisson brackets $\\{\cdot ,\cdot \\}$, we build the lie algebra for all classical mechanics. In Berndt's "Introduction to Symplectic Geometry" in Section 5.5 on page 129, the phase space is said to be replaced by the projective space $\mathbb{P}(\mathcal{H})$, where $\mathcal{H}$ is the hilbert space. This sounds strange since $\mathcal{H}$ isn't a manifold. My question is: **what is quantum phase space geometrical structure?**
Berndt is talking about geometric quantization. In the simplest model the quantum Hilbert space ${\cal H}=L^2(Q)$ is the space of square integrable wavefunctions on the classical configuration manifold) $Q$. (More generally, if one instead starts from the notion of classical phase space, i.e. a symplectic manifold $(M,\omega)$, one needs to introduce a polarization, and the quantum Hilbert space ${\cal H}\subset L^2(M)$.) The projective Hilbert space $\mathbb{P}({\cal H})$ is the corresponding ray space. References: 1. N.M.J. Woodhouse, _Geometric Quantization,_ 1992.
stackexchange-physics
{ "answer_score": 3, "question_score": 1, "tags": "quantum mechanics, differential geometry, mathematical physics, hamiltonian formalism, quantization" }
How to check text is number or not in ipad? I have implement one client server base application for ipad (sdk 3.2). I have one field price in which user enter price value.But user can enter some alphabetical text by mistake so i want to check this text is numeric or not then how it possible please give me some idea about that. Thanks in advance.
Try this: - (BOOL) isNumeric:(NSString *)aoInputString { NSCharacterSet *decimalSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."]; NSString *decTrimmed = [aoInputString stringByTrimmingCharactersInSet:decimalSet]; if (decTrimmed.length > 0) { return NO; } else { return YES; } }
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "iphone" }
Outlook 2016 and 2013 stuck at updating folder We have a few clients who have a strange problem. These clients belong to companies that are different and not related to one another. One company uses Office 2013 Home and Business. The second company uses Office 2016 Pro. They were both connected to office 365, when suddenly one day it said "updating inbox" and that's it. Restarting the computer, reinstalling office, creating new profiles - nothing works, it's working for some time, suddenly it's stuck. What could cause this behavior?
Several reasons are listed below (although yours might not be one of them): * Outlook is uploading or downloading large amounts of data. Try to wait, as this might take hours. * Conflicting add-ons. Try starting Outlook in safe mode : `outlook.exe /safe` (full path might be required). Sometimes just entering safe mode is enough to fix the problem. * MTU conflict with the Exchange server. Try setting the MTU on the router to 1390. * Turning off Cached Mode may help. In Outlook, go into Account settings, select the email account and click "Change", then "More Settings...", then "Advanced" tab, where you can untick "Download shared folders".
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "microsoft outlook, microsoft office, office365, microsoft outlook 2016" }
why could dict.get('',None) return a list in Python? I am reading a sourse code and get some doubt.The 'config' here is a dict. server_port = config.get('server_port', None) why could config.get('server_port', None) return a list ? if server_port: if type(server_port) == list: for a_server_port in server_port: config['port_password'][a_server_port] = config['password'] else: config['port_password'][str(server_port)] = config['password']
Because "server_port" is the key for a list that is stored in the dict. The "None" just specifies a default value in the case of a non-existent key- value pair.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python" }
trying to load ticket using ajax i am trying to load ticket.htm from holiday.html using ajax. when i click on "Get Ticket" it is supposed to slide the para from ticket.htm but i am getting nothing .All i can see is a button.so far my script went like this.. <script> $(document).ready(function() { $("#button").on('click','#submit',function() { $.get("ticket.htm",function(response) { $('#content').html(response).slideDown(); }); }); }); </script> <body> <div id="button"> <input id="submit" type="submit" value="Get Ticket"/> </div> <div id="content"> </div> </body> ticket: <p class="button-para">Flight Details: Air Asia<br> Schedule: 20-01-2015 (10:15 AM)<br> Gate C </p>
$('#content').html(response).slideDown(); // appending response to the newly added div <body> <div id="button"> <input id="submit" type="submit" value="Get Ticket"/> </div> <div id="content"></div> // Added a new div with id content </body> EDIT: This issue was due to calling xmlhttp request (AJAX) without using a webserver. Once the xampp (apache,php,mysql) is installed the problem solved
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "javascript, jquery, ajax" }
Why is my integer increasing by multiples of 4? I have an if statement like this @property (nonatomic) NSUInteger *theScore; if (hint.hidden) { theScore += (2); } else { theScore += (1); } NSLog(@"Score changed"); score.text = [NSString stringWithFormat:@"%d", theScore]; But instead of theScore increasing by 2 or 1 it's increasing by 8 or 4 Any ideas?
Because it's a pointer to the integer, not the integer itself. The 4 is the SIZE of the integer. Change it to NSUInteger theScore, without the *.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "xcode, nsuinteger" }
How can I post different articles on different pages on a wordpress website? For exemple, if my website has a page named "Gadget" I would like to post things about gadgets on it and on another page like "Cars" i would like to post things about cars.
You can create categories and when posting an article, assign a category to it. In your pages display the posts from a certain category. You can also use tags to separate your articles.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "wordpress" }
Angular 2 get routes params How I can get params this way: mydomain.com/?token=MY_TOKEN&some=test How I can get the `token` and the `some` from the URL to my angular 2 component? I tried: this.route.params .subscribe((params) => { this.token = params['token']; this.some = params['some']; });
This are query params you are looking for this.route.queryParams .subscribe((params) => { this.token = params['token']; this.some = params['some']; });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "angular, angular2 routing" }
How do you make many files private in Google Cloud Storage? I have researched a lot and unable to come up with a solution for this. Here is the code i am using to make all the files public in GCP: def make_blob_public(bucket_name, blob_name): """Makes a blob publicly accessible.""" storage_client = storage.Client() bucket = storage_client.get_bucket(bucket_name) blob = bucket.blob(blob_name) blob.make_public() The above method works but when i write blob.make_private() to make all files private i get the error: AttributeError: 'Blob' object has no attribute 'make_private' At this link: < i can find both make_public() and make_private() but only make_public() works.
`make_private` was added in the 1.10 version of the Storage client library. Check which version are you using with `pip list`, as you must be using a different version, and upgrade if possible. Nonetheless, if you can't upgrade (let's say that your development environment is 'tied' to this version of the library), I tested this with a different version that I have in one development environment (version 1.8.0) , and if you follow the source code for `make_private` and do those two lines in the code, it works. So, like this: #blob.make_private() is basically: blob.acl.all().revoke_read() blob.acl.save(client=blob.client)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "python, google cloud platform, google cloud storage" }
How do I change the order of screens in byobu? I'd like to bind `Shift` \+ `←` and `Shift` \+ `→` to move my current screen left/right in the ordering of screens. How can this be done? These are the versions I'm using: $ byobu -v byobu version 2.68 Screen version 4.00.03jw4 (FAU) 2-May-06
You can easily bind actions to _shift-left_ and _shift-right_ , using: bindkey "^[[1;2D" prev bindkey "^[[1;2C" next Note that Byobu 5.12 uses these bindings by default for _shift-left_ and _shift-right_. And you can easily move a window from one window number to another by pressing: ctrl-a :number [SOME_NUMBER] However, GNU Screen does not support SOME_NUMBER to be a relative value, like +1 or -1. Rather, it must be an absolute window number, like "8" or "2". Byobu _also_ supports **tmux** as a backend, in addition to **screen**. Tmux does have support for this feature, and it can be accomplished by highlighting the window you want to move, and pressing `Ctrl-Shift-F3` to move it left, and `Ctrl-Shift-F4` to move it right.
stackexchange-superuser
{ "answer_score": 24, "question_score": 17, "tags": "gnu screen, byobu" }
MigraDox C# Checkboxes - Wingdings Not Working I am needing to simulate a checkbox in a PDF I am generating using the MigraDoc library. I stumbled across two sources that offer essentially the same solution (here and here) However, I am not getting the expected results. Instead I am getting þ for boxes that are supposed to be checked, and ¨ for those that are to be unchecked. What might the issue be? Snippet of my code para = section.AddParagraph(); para.Style = "ListLevelOne"; para.AddFormattedText("1 ", "Bold"); para.AddFormattedText(IsQ1Checked ? "\u00fe" : "\u00A8", new Font("Wingdings"));
MigraDoc does not use the font "Wingdings", instead it uses a default font (could be MS Sans or so) and therefore you see the characters from a standard font, not the Wingdings symbol. The problem is somewhere outside the code snippet you are showing here. Make sure the font Wingdings is installed on the computer.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, fonts, migradoc" }
php - PDF of images - get dimensions in pixels of each page I have a task where I want to extract the dimensions in pixels of each page. The pages of this pdf are all images. I tried to use pdfParser but this does not give the details per page. Is there a way around this?
You can use Imagick <?php $im = new Imagick(); $im->readImage( "test.pdf[<< page number>>]" ); ?> <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, pdf" }
Java - Convert a Signed int into a Signed Byte Array and Back I would like to convert a _signed_ int into a _signed_ byte[] array, and later convert it back into a signed int. However, ByteBuffers (The usual int->buffer->byte[] array) are too slow for this case. Can this be done using basic operations? I've seem many attempts, but I haven't seen one that works in all cases. (Usually, they fail for negative numbers.) I am working in Java, so it is not possible to use unsigned values, even in intermediate steps.
private void writeInt(int val, byte[] data, int offset) { data[offset ] = (byte)(val >>> 24); data[offset + 1] = (byte)(val >>> 16); data[offset + 2] = (byte)(val >>> 8); data[offset + 3] = (byte)val; } private int readInt(byte[] data, int offset) { return (data[offset] << 24) | ((data[offset + 1] & 0xFF) << 16) | ((data[offset + 2] & 0xFF) << 8) | (data[offset + 3] & 0xFF); }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, arrays, type conversion, bit shift" }
Are "could" and "would be able to" always interchangeable? Example sentence: > At first, I thought of writing a note. But then I figured that with a recording, you **could/would be able to** lie down and close your eyes. Maybe I'm wrong but _could_ sounds more "pushy" than _would be able to._ But again, maybe I'm wrong and they mean exactly the same?
The word **_could_** indicates **possibility** , and the phrase **to be able to do something** means to have the **power and skill to do something**. **To me this sounds as if this person would only be able to lie down and close her eyes if she listened to your recording, your recording would give this person the power to do it.** > At first, I thought of writing a note. But then I figured that with a recording, you would **be able to** lie down and close your eyes. **Now, this sounds a little different it sounds that with a recorded message this person would have the option, the possibility to lie down, relax, close their eyes and listen to your recording.** > At first, I thought of writing a note. But then I figured that with a recording, you could lie down and close your eyes.
stackexchange-ell
{ "answer_score": 1, "question_score": 1, "tags": "word choice, phrase choice" }
3.8 GPA, but 3 Fs and 1 D on transcript So here's a funny thing: I have 3 Fs and 1 D on my transcript, but my GPA is ~3.8, which is "high" because I double majored in math and computer science. The reason for those 4 bad grades is that I had 2 bad semesters where I suffered from depression; I didn't drop the classes before the deadline so I ended up failing the classes. However I retook the classes and got As in them (hence my GPA), and in fact got A/A-s in all subsequent classes (quite an improvement). I plan to apply to a master's for computer science, and eventually a phd. However I know the admission officers eyes will bleed when they see my transcript, despite my GPA, because my school keeps ALL grades on transcripts, even if the grades were replaced by retaking classes. Do I still have a chance at top-10 graduate school for computer science even with these grades (which were retaken and then aced)?
In my (rather extensive) experience with graduate admissions, admissions committees understand that people have semesters in which life interferes with school. If you've retaken the classes and received high marks in them, this very clearly signals that something was interfering with your performance during those two semesters and that the bad grades have nothing to do with your underlying ability. Those grades won't go unnoticed -- but nor will they hurt you the way they would had you not repeated and aced those courses. It would help further if you have a trusted mentor who could mention and--to the degree that you comfortable, explain--this issue in his or her letter of recommendation. Don't count on cruising through the application process, but also don't lower your ambitions based on these grades.
stackexchange-academia
{ "answer_score": 58, "question_score": 38, "tags": "graduate admissions" }
Add degree symbol to label I want to add degree symbol to this label in xaml.Please tell me how to do it? <Label Content="{Binding CelsiusTemperature}" />
You can use the `ContentStringFormat` for `Label`: > Gets or sets a composite string that specifies how to format the `Content` property if it is displayed as a string. Example: <Label Content="{Binding Path=CelsiusTemperature}" ContentStringFormat="{}{0}°" />
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "c#, wpf, xaml" }
Redefine \middle| to insert space before and after itself I want to use \middle| inside of brackets like this. \documentclass{article} \begin{document} \begin{equation} \left\{\frac{1}{n} \middle| n>0\right\} \end{equation} \end{document} \end{document} But this examples lacks space before and after the mid |. I don't want to write every time: left\{\frac{1}{n} \;\middle|\; n>0\right\} How can I redefine the \middle| command to mean \;\middle|\;? I tried \edef{\middle|}{\,\middle|\,} and \let\originalmiddle\middle \renewcommand{\middle}{\;\originalmiddle\;} but neither works. What is the difference between both commands and why do they not work with \middle?
The symbol needs to come after the `\middle` so \let\originalmiddle\middle \renewcommand{\middle}[1]{\;\originalmiddle#1\;} Although redefining primitives always breaks something, somewhere so I would suggest instead \newcommand{\xmiddle}[1]{\;\middle#1\;} and use `\xmiddle` (or any other name you wish)
stackexchange-tex
{ "answer_score": 8, "question_score": 6, "tags": "spacing, brackets, syntax" }
Difficulty in understanding linear regression with multiple features Let's say price of houses(target variable) can be easily plotted against area of houses(predictor variables) and we can see the data plotted and draw a best fit line through the data. However, consider if we have predictor variables as ( size, no.of bedrooms,locality,no.of floors ) etc. How am I gonna plot all these against the target variable and visualize them on a 2-D figure?
The computation shouldn't be an issue (the math works regardless of dimensionality), but the plotting definitely gets tricky. PCA can be hard to interpret and forcing orthogonality might not be appropriate here. I'd check out some of the advice provided here: < Fundamentally, it depends on what you are trying to communicate. Goodness of fit? Maybe throw together multiple plots of residuals.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, linear regression, data analysis" }
Explanation of the IMAP protocol? Im looking for information about how the IMAP protocol works. Google yields only high level information, but not enough to understand the details. I'd like to know enough to be able to create my own implementation. I found a c library which does it, but is poorly documented. Some basic questions are: what are the IMAP uid's and what are their guaruntees? For example, will an id ever change? will it be reused if deleted?
This looks like a good starting point: < In general, the keyword you want when searching for details on an internet protocol is "RFC". Add that to your search along with the name of the protocol and you should get off to a good start.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "c, imap" }
jquery error in IE6 my jquery code not run with IE6 but runs all others including IE7. It errors **"JQuery is undefined"** .
Try changing: <script src=" In to: <script type="text/javascript" charset="utf-8" src=" You should also check the charset.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "jquery" }
Android: java.lang.NoSuchFieldError: android.os.Build.SERIAL In android, I have the following error thrown: java.lang.NoSuchFieldError: android.os.Build.SERIAL It happens only on certain devices, for instance: "sec_smdk6410" or "sdkDemo". I have tried to catch the exception but it ignores the try/catch block. try { return android.os.Build.SERIAL; } catch (Exception e) { return null; } Is there anyway I can detect if this error will be thrown in order to adapt my code ? Thanks.
The documentation states it is only available for API level 9. You could check the API level by using: if(Build.VERSION.SDK_INT >= 9) // safe to use else // ignore Untested, but I would give it a go
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "android" }
Bubbling up div width in nested divs How can I cause a parent div to grow according to the size of nested div? e.g. I have three nested divs and I need the grand-parent div to have `min-height:80px` and let it grow until`max-height:120px`\- as the grand-children text grows... Please look at the following fiddle p.s. I'm using Firefox.
The problem is the `position:absolute;` for your `#dynamictext` In this update of your jsfiddle: < I changed it to `position:relative;` and it worked fine.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css" }
Get an element in random from RDD How can I efficiently select an element at random from an RDD of string?
You'll need to use `takeSample`. Example : val data = sc.parallelize(Range(1,100)) // data: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[9] at parallelize at <console>:27 data.takeSample(false,1) // res9: Array[Int] = Array(38) data.takeSample(false,1) // res10: Array[Int] = Array(72) data.takeSample(false,1) // res11: Array[Int] = Array(93) In case you wanted to fetch the same "random" element you can fix the seed : data.takeSample(false, 1, seed = 10L) // res14: Array[Int] = Array(62) data.takeSample(false, 1, seed = 10L) // res15: Array[Int] = Array(62)
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 3, "tags": "scala, apache spark" }
Big Subview to Fit in Another Small Subview Im trying to create a secondary view to my main view. This subview needs to be of small height and it needs to fit another big UIView with a label in it. Problem is that when I'm using UIView addSubview, the third UIView will be shown out of bounds of secondary UIView. For ease of understanding my situation, I have created those Subviews using Interface builder with the photo and the result on simulator with the photo. Any help would be much appreciated. Thanks 1. Interface Builder < 2. Simulator <
You need to activate the clip to bounds property of some of those views. fooView.clipsToBounds=YES; That should solve your problem. Just set the appropriate views to clip to their bounds.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ios, uiview, uilabel, subview" }
Sqlalchemy: Latitude and Longitude Float Precision? I'm using Sqlalchemy to define my tables and such and here is some code I came up with: locations = Table('locations', Base.metadata, Column("lat", Float(Precision=64), primary_key=True), Column("lng", Float(Precision=64), primary_key=True), ) I read somewhere that latitude and longitude require better precision than floats, usually double precision. So I set the precision manually to 64, is this sufficient? Overkill? Would this even help for my situation?
It depends on what you are using your data for. If you use a float it will be ok if the you only need it down to about the meter level of detail. Using the data in graphically applications will cause a jitter effect if the user zooms in to far. For more about jitter and see Precisions, Precisions. Hope this helps.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 9, "tags": "database, database design, geolocation, sqlalchemy, pylons" }
Is there a way to disable the right button in the topbar? Is there a way to disable the right button like here in the contacts app? ![iOS Contact app](
Set the `enabled` option to false. rightButtons: [ { id: 'fertigBtn', text: 'Fertig', enabled: false } ]
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "react native navigation, wix react native navigation" }