INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
C# checking what condition was met in if statement with multiple conditions I am checking for an error exception if some inputs are greater than 7 or smaller than 0: if (number1 > 7 || number1 < 0 || number2 > 7 || number2 < 0){ throw new Exception("Invalid position <pos>"); } catch (Exception e){ Console.Write(e) } how can I print what number was the error? E.g: number1 is 10 but number2 is 3, i want to print "Invalid position <10>"
> I want to know if it's possible to check what condition is met in the if statement without using many if/elseif statements. There is no such way, you'd have to split your if. if (number1 > 7 || number1 < 0 ){ throw new Exception($"Invalid position <{number1}>"); } elseif(number2 > 7 || number2 < 0) { throw new Exception($"Invalid position <{number2}>"); } catch (Exception e){ Console.Write(e) }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, exception, conditional statements" }
In bash shell, how to insert the previous line inside the current line? In bash, how to expand the `!!` in command line while interactively editing the command inside shell? I am working in `vi` edit mode. When typing a new command line, I want to introduce the previous line and expand it. **I would like the expansion to occur before I execute the command.**
You may try to use `Alt-^` in emacs mode (it's similar to `Ctrl-Alt-e`, but it should do _only_ history expansion). If it doesn't work for you (for example, there's no default binding for history expansion in vi mode), you can add the binding manually by placing bind '"\e^": history-expand-line' somewhere in your .bashrc, or "\e^": history-expand-line in your .inputrc **UPDATE.** A couple of remarks: 1. if everything is ok, you should be able to press `Alt-^` to substitute any `!!` sequence with your previous command, for example `echo "!!"` would become `echo "previous_command with args"` 2. if it doesn't work as desired, you can check the binding with `bind -P | grep history-expand` (it should return something like `history-expand-line can be found on "\e^"`)
stackexchange-unix
{ "answer_score": 2, "question_score": 2, "tags": "bash" }
Rounding dates to first day of the month I am using SQL Server 2014 and I am working with a column from one of my tables, which list arrival dates. It is in the following format: ArrivalDate 2015-10-17 00:00:00.000 2015-12-03 00:00:00.000 I am writing a query that would pull data from the above table, including the ArrivalDate column. However, I will need to convert the dates so that they become the first day of their respective months. In other words, my query should output the above example as follows: 2015-10-01 00:00:00.000 2015-12-01 00:00:00.000 I need this so that I can create a relationship with my Date Table in my PowerPivot model. I've tried this syntax but it is not meeting my requirements: CONVERT(CHAR(4),[ArrivalDate], 100) + CONVERT(CHAR(4), [ArrivalDate], 120) AS [MTH2]
If, for example, it is 15th of given month then you subtract 14 and cast the result to date: SELECT ArrivalDate , CAST(DATEADD(DAY, -DATEPART(DAY, ArrivalDate) + 1, ArrivalDate) AS DATE) AS FirstDay FROM (VALUES (CURRENT_TIMESTAMP) ) AS t(ArrivalDate) ArrivalDate | FirstDay 2019-05-15 09:35:12.050 | 2019-05-01 But my favorite is `EOMONTH` which requires SQL Server 2012: SELECT ArrivalDate , DATEADD(DAY, 1, EOMONTH(ArrivalDate, -1)) AS FirstDay FROM (VALUES (CURRENT_TIMESTAMP) ) AS t(ArrivalDate) ArrivalDate | FirstDay 2019-05-15 09:35:52.657 | 2019-05-01
stackexchange-stackoverflow
{ "answer_score": 19, "question_score": 19, "tags": "sql, sql server, tsql, date, sql server 2014" }
Is there a shortcut to insert current datetime as a static value in a cell in Google Sheets? I have a table like this: Expense | Date | What it was for ---|---|--- 120 CZK | 4.5.2021. 12:30 | Pizza coz I'm lazy I use it to log some expenses, not exactly for pizza but that's just an example. I also have similar tables where I really NEED both date and time. I found out that `Ctrl`+`;` inserts current date, but without time. Is there also a shortcut for both date and time?
The shortcut for "insert date and time" is `Ctrl` \+ `Alt` \+ `Shift` \+ `;`. See the keyboard shortcuts help page for more info.
stackexchange-webapps
{ "answer_score": 2, "question_score": 2, "tags": "google sheets" }
Is it possible to create database structure from F# code I am using SQL Provider to work with Access/SQL Server databases: insert and retrieve data. I am just wondering if it is possible to create database structure (tables and indexes) usign F# ?
Entity Framework Code First seems like what you're looking for. Here are a few articles about doing that with F#: < <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "f#" }
Set HTML page title with js and pug Is there a way to add to the page title with js and pug, if I for example have a layout file with pug, which sets the page title to, say Aero - And in the pug file extending the layout file, I want to append a string to that page title with something else, so it would display Aero - The added string. Is this possible with some sort of interpolation? Thanks :)
You can do something like that: title Aero #{addedString} meta(name='description', content="Aero" + addedStringDescription) meta(property='og:title', content= "Aero" + addedString)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "javascript, html, pug" }
Lambda not a property type when passing property I have the following class: public class Errors<T> : Errors { public void Add(Expression<Func<T>> property, string message) { base.Add(((MemberExpression)property.Body).Member.Name, message); } } Which I then try and invoke like this: Errors<User> e = new Errors<User>(); e.Add(x => x.Name, "Name must be entered."); When I attempt to compile, I get the following error: `Cannot convert lambda expression to type 'string' because it is not a delegate type` Where is my definition wrong? The error occurs on the `e.Add` method call, not on the overload.
You've specified `Func<T>` in your overload, which should take no argument and return `T` (in this case, `User`). You're passing a lambda which looks more like `Func<T, object>` \- it accepts a `T` parameter and returns _something_. I imagine your `Errors` base class has a function like this: public class Errors{ public void Add(string propertyName, string message) { // implementation here } } Which is what the error is talking about. It's trying to match your lambda to the parameters of that overload, because it doesn't match the `Func<T>` you specified in your generic class's overload. So, I think your overload should be: public void Add(Expression<Func<T, object>> property, string message)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, lambda" }
How to read output from an application using python Currently trying to record a list of outgoing TCP connections and then compare the present list to the previous list in order to see what connections have been established. However, TCPView.exe seems to be of no luck. I am able to run the application with this: def get_tcp_conns(): process = Popen([r"C:\Users\PC\Downloads\TCPView\Tcpview.exe"], stdout=PIPE, shell=True) for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"): print(line) # Do whatever here However, this is not returning any text. Not for sure where to go with this as I have no idea how to read the TCP information in python
should be something like import subprocess def get_tcp_conns(): process = subprocess.run("C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe './C:Users/PC/Downloads/TCPView/Tcpview.exe' ", shell=True, capture_output=True) print(process.stdout)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, tcp" }
Как найти элемент "массива 1" в частях элементов "массива 2" на javascript? У меня есть _"массив 1"_ , в нем находятся такие элементы: 0:"дерево" 1:"древесина" 2:"лес" есть _"массив 2"_ , в нем есть такие элементы: 0:"wood frog — древесная лягушка" 1:"compressed wood — прессованная древесина" 2:"wood takes a finish — дерево и древесина поддаётся отделке" Мне необходимо, чтобы был найден **_третий** элемент массива 2_, так как в нем присутствует **_первый** элемент массива 1_. И так далее. Как это делается? Единственное о чем я пока думаю, это с помощью оператора for. Так или иначе?
var i; // просто номера var c_end = arr2.length // количество элементов в массиве 2 var d_end = arr1.length // количество элементов в массиве 1 var c = arr2; // словосочетания (3) var d = arr1; // переводы (5) var c_i = 0; // начало для массива с var d_i = 0; // начало для массива d var e; // тут переводы for ( c[c_i] ; c_i < c_end ; c_i++) { for ( d[d_i] ; d_i < d_end ; d_i++ ) { c.forEach( (e, i) => (e.indexOf(d[d_i]) != -1) && console.log("слово >>", d[d_i], "<< присутствует в словосочетание: ", e)) } }; вот я сделал, но мне помогли
stackexchange-ru_stackoverflow
{ "answer_score": -2, "question_score": -2, "tags": "javascript, html, массивы" }
SQL Server Join Query results in error SELECT Bus.BusNumber,Stop.StopName, Bus_time.Time FROM Stop INNER JOIN Bus_time ON Stop.Stop_id = Bus_time.Stop_id INNER JOIN Bus ON Bus_time.Bus_id = Bus.Bus_id WHERE (Bus_time.Bus_id = (SELECT DISTINCT bus_id FROM Bus_time t1 WHERE EXISTS (SELECT * FROM Bus_time WHERE Stop_id = '3' AND bus_id = t1.Bus_id) AND EXISTS (SELECT * FROM Bus_time WHERE Stop_id = '1' AND bus_id = t1.Bus_id))) AND (Stop.Stop_id = '1') This is my query and error is > Msg 512, Level 16, State 1, Line 1 > Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I got the answer, thanks for helping. SELECT DISTINCT bus.busnumber, stop.stopname, bus_time.time FROM stop INNER JOIN bus_time ON stop.stop_id = bus_time.stop_id INNER JOIN bus ON bus_time.bus_id = bus.bus_id INNER JOIN bus_time t1 ON bus_time.bus_id = t1.bus_id WHERE EXISTS (SELECT * FROM bus_time WHERE stop_id = '3' AND bus_id = t1.bus_id) AND EXISTS (SELECT * FROM bus_time WHERE stop_id = '1' AND bus_id = t1.bus_id) AND ( stop.stop_id = '3' )
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "sql server" }
Javascript: sort an array of objects with a first attribute , and when equal sort with another i ve an array which looks like this : let myarray = [{id:1 , name: "mark" , birthday: "1990-08-18"}, {id:2 , name: "fred" , birthday: "1990-08-17"}, {id:3 , name: "franck" , birthday: "1990-08-16"}, {id:4 , name: "mike" , birthday: "1990-08-15"}, {id:5 , name: "jean" , birthday: "1990-08-17"}] i'm sorting thos object by " **birthday** " myarray.sort((a, b) => new Date(b.birthday).getTime() - new Date(a.birthday).getTime()); but sometimes , i ve the same birthday value for two objects (birthday is equal) , in that case **i want that the sort compares those two objects** (not all the objects) **with the higher** " **id** " (which have the higher id is prior) **Suggestions ?**
You need to add a separate case in the `sort` function as follows: let myarray = [ {id:1 , name: "mark" , birthday: "1990-08-18"}, {id:2 , name: "fred" , birthday: "1990-08-17"}, {id:3 , name: "franck" , birthday: "1990-08-16"}, {id:4 , name: "mike" , birthday: "1990-08-15"}, {id:5 , name: "jean" , birthday: "1990-08-17"} ] myarray.sort((a, b) => { let dif = new Date(b.birthday).getTime() - new Date(a.birthday).getTime(); if(dif != 0) return dif; else return b.id - a.id; }); console.log(myarray);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "javascript, typescript, ecmascript 6, ecmascript 5" }
"Filter" a php array based in winner/loser I am trying to create a 'table' with winners/losers from a match; for this I receive the data from an API in json and decode it to an array, this isn't a problem per-se, is just Im curious if is possible to do this, but in a 'better way': $table = array("winner" => array(), "loser" => array()); foreach($matchinfo as $team){ if($team->Win_Status == "Winner"){ array_push($table["winner"], $team); } if($team->Win_Status == "Loser"){ array_push($table["loser"], $team); } } Maybe more 'clean' or with better 'perfomance'.
Well, not much cleaner I think. foreach($matchinfo as $team) { $table[$team->Win_status][] = $team; }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "php" }
Call stored procedure in the Order By clause I have the following query : Select Name, city, ID from company order by NoOfEmployees desc,.... The next criteria I would like to add to the Order by, involves calling a stored procedure (`spGetDependencies`) which takes the `ID` as the parameter and counts the number of dependencies. I need to sort the results by the number of dependencies in descending order. How do I achieve that? edit: Will be using a UDF in the order by clause. Thank you for your help. Thanks
Just add it to the `order by` clause: select name, city, id from company order by NoOfEmployees DESC, dbo.spGetDependencies(id) desc
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql server, tsql" }
Replacing a Stream with a String in a C# program Currently, I have a program that reads a file and uses an XMLTextWriter to write an XML file to disk. Shortly afterward, I read the file and parse it. I am trying to put these two programs together. I want to get rid of the writing to file step. The XMLTextWriter needs a file path or a Stream when it is constructed. Is there a way to make a Stream that will create a string with the output instead of writing it to a file? Thanks
The XmlTextWriter also has a constructor that can take a TextWriter, so you can simply use a StringWriter: string xml; using (StringWriter str = new StringWriter()) { using (XmlTextWriter writer = new XmlTextWriter(str)) { // write the XML } xml = str.ToString(); }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "c#, stream" }
Facebook comments API on Tumblr At the moment, I am trying to place facebook comments on my tumblr posts. I have managed to do so. However, whenever I make a new post, it shares comments with the previous post. I think this has something to do with the URL being the same for each post, but I am not sure. How can I use Facebook comments on Tumblr posts to be unique to each post?
Make sure you are using the permalink for the data-href and not your blog's main URL. Example: <div class="fb-comments" data-href="{Permalink}" data-num-posts="2" data-width="500"></div>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, facebook, api, tumblr" }
I can see her <run><running> slowly 1. I can see her run slowly. 2. I can see her running slowly. What is the meaningful difference between the two sentences above?
Either is fine, however, "I can see her run", would better be used as describing something in the past, such a a dream: "I still see her in my dreams. In them, I can see her run, fast, and away, into the dark". Running would better be used for describing a real time event.
stackexchange-english
{ "answer_score": 0, "question_score": -1, "tags": "meaning, grammar, differences" }
when I add IK, my bone moves out of place in Blender 2.8 please see the picture, after adding IK the bone is moving out of my character, please help.![enter image description here](
Thanks "Serge L" here I did it. I want to show the solution with picture so that if anyone else have this problem it help them as well. When I created my IK bone, I deformed it and also cleared parent but mistakenly moved it away from armature, that was the problem. so as you can see from the picture below, you should extrude a new bone, deform it and clear parent then add ik, but be aware to not move it from its place. ![enter image description here](
stackexchange-blender
{ "answer_score": 0, "question_score": 1, "tags": "rigging, armature, bones, rigify, inverse kinematics" }
Proving a set S is linearly dependent or independent I know that if I want to prove a set is linearly independent, then I should prove that the equation $c_1v_1 + c_2v_2 +...+c_kv_k = 0$ implies $c_1 = c_2 = ... = c_k = 0$. However, if I am asked to determine whether a set S is linearly independent **or** dependent, should I do the same but show that they mustn't all be 0's (i.e. infinitely many solutions) or should I show that I have a vector that is a linear combination of two others?
Both ways are theoretically correct, but _in practice_ , you usually have a basis so you can write every vector $v_i$ as a column of numbers $(b_{1i},\dots b_{ni})^\top$ so that the condition to check linear independence is a single homogeneous system of linear equations $B\,c=0$. Then you get that system solved by your favourite method (Gauss is a good candidate) and you obtain a definite answer: either the only solution is $c=0$ (thus the set is linearly independent) or there are infinite solutions (hence the set is linearly dependent).
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "linear algebra" }
Compiling Android scource code on ubuntu 9.10 I have downloaded the android source code (1.5 Gb and appx. 5 Gb after extracting).My intention is to compile this. 1) Do i need a toolchain for arm ..if yes which one will be suitable. 2) to run simulator and to be able to debug on workstation do i need to have any specific PC -linux toolchain .
1) < explains building the code for the Android Open Source project. 2) < explains how to debug the emulator using eclipse.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android" }
Quantum Channel Decoding Let a quantum channel $\Phi(\cdot)$ between two Hilbert spaces $\mathcal{H}_{in}$ and $\mathcal{H}_{out}$. What is the quantum channel $\Phi_{inv}(\cdot)$ that best reverses $\Phi(\cdot)$ ? $\forall $ states $\rho$, the state $\widetilde{\rho} \equiv \Phi_{inv}(\Phi(\rho))$ should be the best approximation of $\rho$ (according to some appropriate distance measure). If we assume that the input state comes from a known probability distribution, according to the quantum data processing inequality there are cases, depending on the source entropy and the channel properties that allow for perfect decoding. However, how do you perform decoding in cases where perfect decoding is not possible, and in particular if no source distribution is known (so you can't assume that the state has been encoded with an error-correcting code)? I presume somebody has already thought about this, but I can't find it in the literature.
First, your two criteria (that it is a quantum channel and that for all input states, the inverse channel gives the best approximation of the input state) aren't compatible. If they were, then the optimal inverse channel would be independent of whether you choose to optimize the worst-case fidelity or the average-case fidelity. It's not. There are quite a few papers on this question. Here's one Andrew Fletcher, Moe Win, and I wrote. It shows you can use a semidefinite program to optimize the recovery channel when the criterion to be optimized is the entanglement fidelity, and you assume a specific entangled input state and a specific channel $\Phi$. You should be able to find other papers by looking at our bibliography and using some forward citation tool.
stackexchange-cstheory
{ "answer_score": 13, "question_score": 5, "tags": "reference request, quantum computing, it.information theory, quantum information" }
How to resize an image in C++? I have an image which is representative of an Array2D: template<class T = uint8_t> Array2D<T> mPixData[4]; ///< 3 component channels + alpha channel. The comment is in the library. I have no clues about the explanation. Would someone: 1. explain what are the 3 component channels + alpha channel are about 2. show how I could resize this image based on the mPixData
Without know what library this is, here is a stab in the dark: 1. The type definition implies that it is creating a 2D array of unsigned chars (allowing you to store values up to 255. `template<class T = uint8_t> Array2D<T>` 2. Then, mPixData itself is an array, which implies that at each co-ordinate, you have four values (bytes to contend with), 3 for the colours (let's say RGB, but could be something else) and 1 for Alpha. 3. The "image" is basically this three dimensional array. Presumably when loading stuff into it, it resizes to the input - what you need to do is to find some form of resizing algorithm (not an image processing expert myself, but am sure google will reveal something), which will then allow you to take this data and do what you need...
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c++, image, image processing" }
Create Custom Menu showing with each Listbox item Windows phone Please check this link first. I have the following questions : 1. I want to create such menu with each List box items when clicked. How is it possible.? because this is not a Context Menu, I want to Create a Custom Menu. 2. I also want to show effects on pic, so by selecting the image, it should automatically be divided and feed into given effects boxes. I have so many questions more, but meantime, need these one. plz....
Correct me if i'm mistaking, all photos that you want to work with, are displayed on the film line ( that black with wholes thing ). I suggest you make it this way: 1) Create your page like this: !enter image description here In the white space will be stack panel with Horizontal staking, which allows you to place photos horizontaly and scroll them 2) Think out the way to hold focused image on center of the screen 3) Menu (Edit, Save etc. ) can be done useng Custom user control (just a grid with items ) and it will apear on picture tap ( Also can be Visual effects aplied like fade in )
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "windows phone 7" }
Databinding is not working after migrating to AndroidX I have migrated my code to AndroidX. Things are working fine except databinding. I am getting the following error Databinding errors after migrating to AndroidX "Error:Cannot resolve the package androidx.databinding" As of now, I have added the following lines in the Gradle build dataBinding { enabled = true} And in gradle.properties, android.useAndroidX=true android.enableJetifier=true I have gone through a lot of links for the same. But didn't help. Androidx and databinding AndroidX incompatible with DataBinding Android and so on. Is there any solution for this?
Finally, I found answer to my question. My App has 2 modules and I used Data binding in both. After migrating to AndroidX, one of the modules had not been converted to AndroidX (Data Binding import statements only). So this was my issue. Solution: There are Two gradle.properties files if we see properly. 1. Project Structure -> gradle.properties 2. Android Structure -> Gradle Scripts - > gradle.properties I migrated from Android to AndrodX through Refactor--> Migrate to AndroidX. Then following two lines have been added to 2nd gradle.properties(Android Structure -> Gradle Scripts - > gradle.properties). android.enableJetifier=true android.useAndroidX=true So the other module was not converted to AndroidX (Only Data Binding). Then the same 2 lines i have added in 1st gradle.properties (Project Structure -> gradle.properties). Then my project could build successfully. Thanks.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, android databinding, androidx" }
periodic continous function $f$ I have a function $f: \mathbb{R} \longrightarrow \mathbb{R}$ that is continous with $f(x)=f(x+2)$ for all real numbers $x \in \mathbb{R}$. So, I have to show that an $a \in \mathbb{R}$ exists that $f(a)=f(a+1)$. I tried to proof this by using the periodicity of $f(x)$ and so I took a look on: $f_1: [0,2] \longrightarrow \mathbb{R}$ I concluded that this $f_1$ has also uniform continouity. Then I took the definition of uniform continouity $\forall \epsilon > 0\exists \delta> 0 \forall x\in\mathbb{R}, y\in\mathbb{R}: |x-y|<\delta \Rightarrow |f_1(x)-f_1(y)|<\epsilon$ Unfortunately, I don't know what to do next and I am also not sure whether the solutions, that I have done, are right. Can someone help me with that, please?
Let $g(x)=f(x+1)-f(x)$. Let's notice that $g(0)=f(1)-f(0)$ and that $g(1)=f(2)-f(1)=f(0)-f(1)=-(f(1)-f(0))$. Therefore, $g(0), g(1)$ have opposite signs (one negative and one positive. there's a case where they're both $0$, and then we've proven what we want). Therefore according to the intermediate value theorem, the function $g$ must take all values between $g(1), g(0)$ in $(0,1)$ in particular, $0$, and therefore exists $x_0\in (0,1)$ such that $g(x_0)=0$ meaning $f(x_0)=f(x_0+1)$
stackexchange-math
{ "answer_score": 5, "question_score": 2, "tags": "analysis, continuity" }
is it possible to return string in google cloud endpoints python I need to return a string (plain text) and not JSON (class message). here is my code now: @endpoints.method( # This method takes a ResourceContainer defined above. Site_resource, # This method returns an Echo message. Site_response_new, path='test', http_method='POST', name='testsystem') def testsystem(self, request): return Site_response_new(result=data) I want to do : @endpoints.method( # This method takes a ResourceContainer defined above. Site_resource, # This method returns an Echo message. str, path='test', http_method='POST', name='testsystem') def testsystem(self, request): return "awesome string" Thank you<3
No, it's not currently possible.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "google app engine, google cloud endpoints v2" }
Find a 'variable' in a List of json objects Probably a silly question but documentation and search didn't help :( Trying to 'find' an object in a List of JSON objects(list example shown in the comment): /*jsonList = [ { "hide": 2, "name": "namespace", "type": "constant" }, { "hide": 6, "label": "dev", "type": "variable" }, //more json objects ] * */ void searchKeyValueInList(def jsonList, String key, String value) { if(!jsonList) return def dashboardVariable = jsonList.find{variable -> variable.name == value} if(dashboardVariable){ println "Dashboard variable is: ${dashboardVariable}" } } How do I use the variable **key** instead of a hardcoded 'name' or 'label'?
Something like this: def data = [ [ "hide": 2, "name": "namespace", "type": "constant" ], [ "hide": 6, "label": "dev", "type": "variable" ], ] void searchKeyValueInList(List<Map> jsonList, String key, String value) { def dashboardVariable = jsonList?.find { element -> element[key] == value } println "Dashboard value for $key is: ${dashboardVariable}" } searchKeyValueInList(data, 'label', 'deva')
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "groovy" }
Longest code to add two numbers **Task:** I know we can all add two numbers the short way, using `+`. Your task is to create the longest code you can to add two input numbers. **Rules:** * All of the code must be on topic (don't fill it with non-addition code to add length) * The count is in characters, but do not count tabs, spaces, or newlines. * Do not use extraneously long variable names * This is code-bowling, so the longest answer wins!
# C++ MORE THAN 3x10^+618 (WITHOUT WHITE-SPACES,tabs or newlines) This code took more maths than logic! in counting number of bytes **SHORT CODE** #include<iostream> #include<conio.h> long double sumofxandy(long double,long double); int main() { long double x,y; cin>>x>>y; sumofxandy(x,y); getch(); return 0; } long double sumofxandy(long double x,long double y) { ... ... ... if(x==0)if(y==-1)return -1; if(x==0)if(y==0)return 0; if(x==0)if(y==1)return 1; ... ... ... ... if(x==1)if(y==0)return 1; if(x==1)if(y==1)return 2; ...so....on. } ### OUTPUT Really ? seriously! you want to see output? this code would take weeks to write and months to compile!
stackexchange-codegolf
{ "answer_score": 7, "question_score": 41, "tags": "number, code bowling" }
Can I develop iPhone apps in Windows? I would like to develop iPhone apps without using Mac OS X. Is it possible to do this on Windows OS?
Nope, you have to use a Mac. All the tools are on the Mac, as is the simulator program you'll need to test in. Even if you could somehow finagle the whole thing running in Windows you still need a Mac to submit to Apple to get it on the App Store. Cheapest scenario you're looking $699 for a Mac Mini and $99 for the iOS Developer Program (which you won't need until you want to run the thing on a real phone). You can go cheaper on the hardware if you buy it used but something to keep in mind is that it must be an Intel-based Mac running Leopard (10.5) or higher.
stackexchange-apple
{ "answer_score": 11, "question_score": 7, "tags": "iphone, applications, windows, development" }
How do you install all missing packages with NeoBundle? If I've just added a package to my vimrc file, how do I get NeoBundle to install it without restarting vim? `NeoBundleInstall` doesn't work. It tells me all packages are installed.
Since you just changed the plugins in your `.vimrc` file, your changes are not loaded into the vim environment yet. You need to reload the `.vimrc` file. :so $MYVIMRC :NeoBundleInstall
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "vim" }
Can two or more third person conjugated verbs be chained together? Recently I wrote a sentence and came to realize I've chained two third person conjugated verbs like this: > The area of the screen where the expanded toolbar appears occludes a significant part of the screen. **_"appears"_** is taking about one thing (the expanded toolbar), while **_"occludes"_** is taking about an entirely different thing (the area where the toolbar appears). The meaning of the whole sentence seems clear to me, but its the first time I see something like that. Or at least that I'm aware of it. **Is this the right way to write that sentence?** Even when I can't come with a sentence off the top of my head that has three of those verbs chained together, is that acceptable for more that two verbs?
**where the expanded toolbar appears** is a relative clause. You could snip it out to make a valid sentence, though one that omits an important piece of information. > The area of the screen occludes a significant part of the screen. The sentence now looks odd, because the clause contains important information that **defines** which particular part of the screen you are talking about: that means that it's a defining relative clause. You don't use commas to separate a defining relative clause from the rest of the sentence- you just slot it straight in- so your sentence as it stands is correct and, in my opinion, completely understandable.
stackexchange-ell
{ "answer_score": 15, "question_score": 11, "tags": "verbs, third person singular" }
Update package in Ubuntu I just installed the envisag 3.x plugin from the Ubuntu Software Center, My question is, how can I update this to envisage 4.x. I'm using python 2.6 and Ubuntu 10.04 LTS 64bit
For Ubuntu packages, it may not be the latest version for 2 reasons: 1. **dependencies availability** : the dependencies version required is not available in Ubuntu yet 2. **stability** : latest version may not be the most stable version, therefore the most stable version is picked by Ubuntu To manually update certain package to your desired version ( either upgrade / downgrade ), remove the version that comes along with Ubuntu, and download from developer. Follow the instructions to install the package. However, through this method, the package cannot update through `apt-get`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ubuntu 10.04" }
JavaScriptにおけるマーカー認識 JavaScriptAR (3D) jsartoolkit5AR.js #### * Web PCWeb * / (id)`<video>`
jsartoolkit5 `ARController.getUserMediaARController()` `new ARController()` 1 `ARController.process()` `ImageElement` `VideoElement` < <
stackexchange-ja_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript" }
CakePHP ACL-like plugin for Ruby on Rails Is there any CakePHP ACL-like plugin for Rails?
Although I'm not directly familiar with CakePHP's ACL functionality, you might want to check out CanCan by Ryan Bates: > CanCan is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access. All permissions are defined in a single location (the Ability class) and not duplicated across controllers, views, and database queries.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ruby on rails, ruby on rails plugins" }
What is the use of android permission Wake Lock? When and why to use the android permission `<uses-permission android:name="android.permission.WAKE_LOCK" />`. Please provide sample code regarding wake lock.
You can use a wakelock for keeping the screen turned on - you can see an example in this code. If you want more information, you have to specify your question.
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 36, "tags": "java, android, permissions, android manifest" }
Transfer Azure subscription - MSDN to MSDN I need to switch all my ressources from one subscription to another, basically as described here < but in my case both subscription are MSDN subscriptions and the transfer option is not visible. Can this be done somehow without contacting Microsoft?
transfer is only possible on a "per resource" basis. official documentation covers moving resources.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure" }
Delphi Firemonkey get UTC time How does one get the UTC time in Firemonkey? I tried this code from another Stackoverflow answer but it appears GetSystemTime() is not available in FMX. function NowUTC: TDateTime; Var UTC: TSystemTime; begin GetSystemTime(UTC); Result := SystemTimeToDateTime(UTC); end;
If you add `DateUtils` to the `uses` clause, you can use the `TTimeZone` class, its `Local` class property, and the `ToUniversalTime` method: ShowMessage(DateTimeToStr(TTimeZone.Local.ToUniversalTime(Now)));
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 3, "tags": "delphi, firemonkey, delphi 10.3 rio" }
Hide cookies from document.cookie I opened cookie browser for firefox, I noticed that my localhost(php/apache) has a cookie named sessid. But when I tried `document.cookie` in the browser, the result is "", how is that possible?
Cookies created by some server side application (or PHP) can be marked as `httpOnly`. Then these cookies are not visible to javascript on client side, however, the cookies are still transmitted in http(s) requests. PHP Session cookies are marked as `httpOnly`, thus, you cannot access them using `document.cookie`. The reason for this feature was to mitigate some cross-site scripting attacks (cookie stealing).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "javascript, php, cookies" }
How to get the length for each list according to its key inside map how to get the length for each list according to its key Map mymap= <String, List>; Example key1 : 5(length of the value(list)) key2 : 48
It seems similar to this, you can do `mymap['k1']?.length`, here `?.` means it will return null if there is no value. Rest you can follow @zabaykal's answer. Map<String, List> mymap = { "k1": [1, 2, 4], "k2": [5, 6, 7], "k3": [] }; print(mymap['k1']?.length); mymap.forEach((key, value) { print('$key: ${value.length}'); });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "flutter, dictionary, dart" }
Closed form for $\sum_k \frac{1}{\sqrt{k}}$ I would like to know if there's any equivalence to: $$\sum_{k=1}^n \frac{1}{k} = \log n + \gamma + \frac{1}{2n} - \sum_{k=1}^\infty \frac{B_{2k}}{2kn^{2k}}$$ But to define $E(n)$ in: $$\sum_{k=1}^n \frac{1}{k^{1/2}} =2 \sqrt{n} + \zeta(\frac{1}{2}) + \frac{1}{2\sqrt{n}} + E(n)$$ (For $n$ an integer $n>1$) I would like to express the error term as a sum/series rather than an integral. I did not find anything on the Internet but error terms using big-O notation. The only exact formula I found is: $$\sum_{k=1}^n \frac{1}{k^{1/2}} = \zeta(\frac{1}{2}) - \zeta (\frac{1}{2}, n+1)$$ I do not know hoy to get from there to $E(x)$. Any help? Thank you.
According to the Euler-Maclaurin summation formula, we have $$\sum_{k=1}^n\frac1{\sqrt k}=2\sqrt n+\zeta(1/2)+\frac1{2\sqrt n}+\sum_{k=1}^\infty\frac{B_{2k}}{(2k)!}\binom{-1/2}{2k-1}n^{\frac12-2k}$$ Notice that all the constant terms get turned into $\zeta(1/2)$, which follows since: $$\zeta(1/2)=\lim_{n\to\infty}\sum_{k=1}^n\frac1{\sqrt k}-\int_0^n\frac1{\sqrt x}\ dx\\\\\zeta(1/2)=\lim_{n\to\infty}\sum_{k=1}^n\frac1{\sqrt k}-\int_0^n\frac1{\sqrt x}\ dx-\underbrace{\frac1{2\sqrt n}-\sum_{k=1}^\infty\frac{B_{2k}}{(2k)!}\binom{-1/2}{2k-1}n^{\frac12-2k}}_{\to0}$$ Notice the similarity to your other result for $\sum\frac1n$.
stackexchange-math
{ "answer_score": 6, "question_score": 4, "tags": "sequences and series, summation, closed form" }
What is a word for "to make scary" I want a word for "to make scary" or "to make something scary." I don't want a word for scaring someone. Here are examples: They _________ their house for Halloween. The staff _________ the haunted house. The owners had _________ the area, which caused the kids to be frightened.
The suffix _-fy_ means to make or become: _beautify_ , _simplify_ , _liquefy_. So you could add _-fy_ to an appropriate adjective. _Scary_ would be problematic because _scarify_ means to make scarred (as in marks on the skin), rather than make scary. _Spookify_ maybe?
stackexchange-english
{ "answer_score": 3, "question_score": 1, "tags": "single word requests" }
Java EE application server libraries I am working with a team of programmers developing web applications for a Java EE Application Server (currently using JBoss but switching to GlassFish in the near future). We were wondering whether we should install the libraries used by our applications on the Java EE server itself or package these libraries with every .war file that we deploy to the server. The obvious advantage of installing the libraries on the server in a common location is much lighter-weight application packages, but on the other hand we want to ensure that we won't run into problems down the line when we want to use newer versions of these installed libraries. I realize this question really doesn't have an _answer_ per se but I feel as if there is definitely a right or wrong way to go about doing this.
In general, keep your application specific libraries in your EAR/WAR. As you find yourself deploying more libraries and applications, you'll find one somewhere that causes a compatibility problem with another application. (Even commons-logging causes me issues with this.) I think Application Servers should be as lean and mean as possible, and keep the classpath unpolluted. Keep your libs in your EARS.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "jakarta ee" }
I'm trying to make a call from a run file to model method link to the models The error I'm getting is the cli app is shutting down when I type y def see_barbers puts "Would you like to see your barbers y/n" answer = gets.chomp if answer.downcase == "y" @user.barbers.all.name #so I'm sure this line is written wrong just not sure how to fixit else puts "ok what else" end end
When you have an array of something and you want to call a method on each thing in that array and group together the results the typical approach is to use `map`, as in: @user.barbers.all.map(&:name) If you've already loaded all of these records then this is fine, or if you have just a regular Ruby array of objects. That this is really inefficient since you're loading every record, picking out just the bits you want, and throwing out the rest. This is like ordering a hundred salads just to pick out the tomatoes. There's a method called `pluck` for ActiveRecord which can extract _just_ the data you want, like: @user.barbers.pluck(:name) Where that does, effectively, a `SELECT name FROM ...` to get only the data you require.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "ruby" }
Reloading maven projects in IDEA: unable to find valid certification path to requested target I am reloading a maven project in IDEA when the error occurs. The error description is: Could not transfer artifact org.apache.parquet:parquet-common:pom:1.11.1-h0.gdd.maem.V100R023C00.r1-SNAPSHOT from/to mae-cloudsop-repo (< PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I have imported the certificate as the adopted answer. And I try to install the maven project in command line by "mvn -U clean install". It builds success. But reloading maven projects in IDEA still throw the error. My java version is 1.8 and maven version is 3.6.0.
IDE launches the Maven goals with the JDK you choose in the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | **JDK for importer** settings. This error happens when the JVM tries to use non-trusted self-signed certificate. It is likely that the proxy server in your network replaces the remote certificate with its own self-signed. So you need to import your certificate into the JDK trust store which you use to build by Maven ( **JDK for importer** setting).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "java, maven, intellij idea" }
A ******* Riddle Here’s a quickie. Won’t take that long to solve. The title holds a clue. Make sure to explain it in your answer. Good luck! > The first that starts but the last that ends, > Plus a synonym for making amends, > Of just above, keep only the first three plus two, > Then that mixed up is a word for you. Hint: > The exact number of asterisks in the title doesn't matter. What they're doing does.
To resurrect this 11-month-old 'quickie' (!), perhaps this is: > A **censor's** riddle _The first that starts but the last that ends,_ > The first letter of 'starts' is ' **S** '; the last letter of 'ends' is also ' **S** '. _Plus a synonym for making amends,_ > A synonym for 'making amends' is ' _reconciling_ '. _Of just above, keep only the first three plus two,_ > The first five ('three plus two') letters of 'reconciling' (the word clued 'just above' this line) are ' **RECON** '. _Then that mixed up is a word for you._ > A suitable anagram of _SSRECON_ (a combination of all letters from earlier clues) could therefore be **CENSORS** or **CENSOR'S**. This fits with the asterisk-laden title since the use of asterisks in this way is a common printer's technique for demonstrating that sensitive information or profanity has been redacted or ' _censored_ '.
stackexchange-puzzling
{ "answer_score": 9, "question_score": 6, "tags": "riddle, word, wordplay, poetry" }
With WPF, how to retrieve the controls contained by a DataTemplate? Basically I have a DataTemplate that contains Border, StackPanel and stuff, and later I use this DataTemplate as a ContentTemplate in many ContentControl(s). These ContentControl(s) are named, but from the C# code I don't manage to find a way to get back my Border, StackPanel and stuff from them. Any ideas?
You should be able to do somthing like this: // Finding textBlock from the DataTemplate that is set on that ContentPresenter DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; TextBlock myTextBlock = (TextBlock)myDataTemplate.FindName("textBlock", myContentPresenter); And you can find more about it here: How to: Find DataTemplate-Generated Elements
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, wpf, datatemplate" }
Stop execution without quitting console Does anyone know how to stop program execution without exiting the R console? I could just call `q("no")` but am actually looking for something similar to a throws statement to stop the execution, but leave the console active. Return?
You can use the stop function: stop()
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "eclipse, r, statet" }
Team Collaboration via PHP Code Comments Are there any tools or ways or practices in which multiple programmers on a single project collaborate using comments in the code. For example, when a senior programmer reviews the code and comments some TODOs in the code. And the programmer (or all the team) gets a notification via Email about that TODO. This may be possible by a simple script parsing through all files and checking for differences in files; may be I can code such a program on my server. But do anyone know such a tool exists?
I would suggest you guys to work with a decent IDE like PhpStorm that keeps those TODO's for you and knows to index them into one search, Then, I would strongly recommend to work with git, this is the best way to develop as a team, git will help you versionaize your code in a very easy way. Good luck.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "php, comments, collaboration" }
how to get opposite of number in C#? I'm not sure what the name is for the operation I am attempting, but I would like to "flip" the value of a number within a given range. I have a C# program that receives a number that varies from any value from 1 to 1023. How would I "flip" the number so that if I receive 1023 then it would be 1, 750 would be 274, and 512 would still be 512 since its exactly half? I was thinking of using some type of loop but I have never done anything like this. My research came up with people wanting to, for example, turn 40 into 04, but that's not what I am looking for.
If your input number is x then your answer is the expression `1024-x` In general, if you have numbers in the range of 1 to max, then the answer would be `(max+1)-x`
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 1, "tags": "c#, numbers, integer, flip, inverse" }
Why is $\frac{ab}{c}=\frac{a}{c}b$ Simple question. Why is the following true? $$\frac{ab}{c}=\frac{a}{c}b$$
Dividing by $1$ does not change a number, so $b=\frac b1$ When multiplying two fractions, simply multiply the numerators and multiply the denominators. So $$\frac acb=\frac ac\frac b1=\frac{a\times b}{c\times1}=\frac{ab}c$$
stackexchange-math
{ "answer_score": 0, "question_score": -1, "tags": "solution verification" }
Inclusion in sequences of theories and models Is this theorem true, and if so does it have a name and where can I reference it? "Let $T_1$ and $T_2$ be theories where $T_1 \subset T_2$. If $K_1$ and $K_2$ are the classes of all models of $T_1$ and $T_2$ respectively, then $K_1 \supseteq K_2$."
The fact that $T_1 \subseteq T_2 \Rightarrow K_1 \supseteq K_2$ follows almost immediately from the definition of what it is to be a model of a theory: to say that $T_1 \subseteq T_2$ means that $T_2$ requires at least as many things to be true than $T_1$ does. This means that a model of $T_2$ is automatically a model of $T_1$, so that $K_2 \subseteq K_1$.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "model theory" }
Is time a finite resource? I am struggling to find an answer for this question because time as we know it would _end_ when we reach the heat death of a universe. Which would imply that is the end of time. I think I have a misunderstanding that time ends when the heat death happens. So, is time a finite resource when the end of the universe happens, or would it just keep going even after that point?
Assuming general relativity is a valid way to describe the universe, _time_ is just a coordinate like the three spatial coordinates. There is no reason to suppose that the time coordinate has a limit i.e. time increases continuously and without limit into the future. The only way that the time coordinate may have a limit is if the geometry of the universe has a future singularity. In that case we can't continue the time coordinate past the singularity. However, unless some radically new physics turns up there is no reason to suppose our universe has a future singularity. The heat death will certainly make it hard to measure time. A clock, like any mechanism, relies on a free energy gradient to function, and as the universe approaches the hear death all free energy gradients will disappear. But this does not mean that time stops, only that there is no longer any way to measure it.
stackexchange-physics
{ "answer_score": 2, "question_score": -1, "tags": "time" }
GWT tries to load a deleted module I am using Eclispe with Google plugin for AppEngine and GWT. Recently I created a test GWT module, but eventually it has been deleted from the project and I can not find any sign of it in the project now. However, whenever I run the web app locally, I get in console the following message: Loading modules com.piq.exemity.Test [ERROR] Unable to find 'com/XXXXXX/Test.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? Has anyone got any idea where it can be hiding?
It could be there in two places - 1. When you invoke GWTC (via the compile option in Eclipse), the module name com.xxx.Test is passed to the compiler. This causes GWT to look for com/xxx/Test.gwt.xml file 2. You could have a module that inherits the module "com.xxx.Test". Check your gwt.xml file if this is the case I think (1) is more likely the culprit.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 8, "tags": "eclipse, google app engine, gwt" }
Nutrition & diet - what is the ideal BMI range for children between 6 and 12? The 6-12 year age group is in a latent period of growth, while children 12-18 years old experience their main period of growth. The usual BMI range is 18 to 23. But is it applicable to children who are 6 to 12 years old? Sometimes with higher income groups I also find children with lower BMI scores - for example, 13. Sometimes children do not show any significant symptoms, or they have low haemoglobin counts in blood tests. And childhood obesity is becoming more common. So is it useful to take BMI into consideration to determine a balanced diet for a child of this age group? What BMI range should be considered as optimum for children below 12?
BMI itself is a lousy proxy for physical fitness - just ask weightlifters - and it has to be calibrated to the physical scale of adult human beings, so I can't see how it could properly apply to small children. It's better to use the standard height/weight charts to see where a given child falls compared to other children (i.e. in terms of percentile). **EDIT:** For example, the charts found here, and in particular the boys and girls aged 2-20 charts.
stackexchange-fitness
{ "answer_score": 4, "question_score": 2, "tags": "nutrition, bmi, children" }
Warning. Array(s) in Degraded Mode. What should I do? My Machine shows warning message on start up ? Port 1 is in rebuilding state. Warning. Array(s) in Degraded Mode. Press any key to continue..... Why it is showing warning ? Should I rebuild the RAID ? or it requires fresh Installation of OS ? Machine Configuration : Inter Pentium 3.0 HT processor, 3 GB RAM, Intel Entry Server Board SE7230 NH1-E Please let me know. Thanks in advance, Laxmilal Menaria
Point for the future: If you're going to run RAID it's a good idea to do a practice run of what actually happens when a disk outage occurs when you're setting the system up (before it accumulates too much precious data), so it's less of a surprise when it happens for real and you know how to recover.
stackexchange-serverfault
{ "answer_score": 3, "question_score": 0, "tags": "raid" }
How to create a custom search form and handler? I'm trying to build a search that, depending on what user chosen in admin, will either query one of several external api search methods with user input, save all the results in database and then display them or it will search the custom tables in database, it should also be fully encapsulated in a plugin. I already have the business logic that does this, I'm having trouble hooking it up to WP. What would be the best way to accomplish this? edit: sorry, it was probably quite vague question, what I have is an app I described above built on php framework, what I want to do is move it to WP, the problem is while the logic itself will require little modification, I have no idea how to hook it up to wordpress via plugin, essentially how do I create a form with plugin and how do I take input from that form and direct it to the logic that will handle that request?
To change the search form, filter `get_search_form`. You get the form as a string here, and you can change it as you need. add_filter( 'get_search_form', function( $form ) { // Replace the form, add additional fields return $form; }); To change the search query to the database, filter `posts_search`. You get the query as a string and the current `WP_Query` object which provides more information. See `wp-includes/query.php` for context. add_filter( 'posts_search', function( $search_query, $wp_query ) { // change the SQL return $search_query; }, 10, 2 ); If you don’t want to filter the search query, change the `name` attribute in the search form, example `foo`, and inspect the `$_POST` request: if ( ! empty ( $_POST['foo'] ) ) { $global $wpdb; $results = $wpdb->get_results( /* custom sql */ ); }
stackexchange-wordpress
{ "answer_score": 0, "question_score": 0, "tags": "plugin development, search" }
Resource image files for VBA? I have a word doc that I have been writing some VBA for, and in it I use this a lot: LoadPicture(ThisDocument.Path & "image_name") However, for this to work I've needed users to have an "Images" folder in the same directory, which is very inconvenient. Is there a better way to include resources in a VBA project? Thanks!
Why not check if the folder exists on document open and create the folder if it does not? Private Sub Document_Open() Dim imagesFolder As String imagesFolder = ThisDocument.Path & "\images\" If Len(Dir(imagesFolder, vbDirectory)) = 0 Then MkDir imagesFolder End Sub
stackexchange-stackoverflow
{ "answer_score": -3, "question_score": 2, "tags": "image, vba, excel, ms word" }
Actioscript Error #2032 only in IE Sorry about my English. I'm developing a flash application using Flex SDK, it's an actionscript project, not a Flex project. I use `URLLoader` to send an HTTP post request to the server. In Safari/Chrome, it works fine, but in IE I get this: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: How can I fix this? If it works in Safari/Chrome, why it doesn't work in IE? in my case ,i can't change the server side code, can i fix this just by writing some Actionscript code? Thanks.
This weird problem is kind of popular. It can be fixed by setting cache-control header. It is pretty well described at <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "actionscript 3" }
Accidentally rm -rf /lib64 I accidentally removed /lib64 from the remote server. The system is CentOS 6.8 64bit. And then the basic command like ls are not found. How can I recover the system? Many Thanks.
I’d suggest restoring from a Backup. Failing that; build a BackupPC server and make sure you always have active backups. Hope this helps,
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "shell, centos" }
What does the number of teeth in a gear determine (when meshing identical gears)? Suppose I want to mesh two identical gears (size and number of teeth). What would be the difference if both had 12 teeth versus both having 48? Assume the motor spins at the same speed in both scenarios.
So, assuming that the more teeth that there are, the smaller the teeth become (and logically for gears with few teeth, the bigger the teeth are): Big teeth: * Capable of handling higher load * Capable of transmitting a greater force * less likely to strip * less precise * greater tolerance * more sliding friction1 * greater backlash * Less smooth movement Small teeth: * Less load capable (for a given material and gear thickness) * Capable of transmitting a lesser force * More likely to strip under heavy load (for a given material and gear thickness) * More precise * Tighter tolerance (more susceptible to defects, and misalignment, in the drive train) * Less sliding friction1 * Less backlash * Smoother movement Data summarised from Does the size of the teeth on a gear really matter? * * * 1 Although, in the case that you describe, with a 1:1 ration the gears will be more geometrically perfect, and friction should be minimal
stackexchange-robotics
{ "answer_score": 2, "question_score": 2, "tags": "gearing" }
Why do racing cyclists wobble when furiously pedalling? In all pro-cycling races, they start wobbling towards the finish line instead of biking steadily (e.g., in this video: < Why do they do that? Note: I have no experience with racing or a bike with handles curved to the front, so maybe a stupid question.
Not a stupid question. The simple answer is that they are throwing every ounce of leverage, weight, and power into the pedals and that much movement side to side is the visible result of trying that hard to move forward. If you could stay absolutely still, and input the same amount of force to the pedal, then more of that energy would go to moving forward, but you can't. It's a matter of balance and leverage.
stackexchange-bicycles
{ "answer_score": 16, "question_score": 17, "tags": "racing, technique" }
Change role of one user no working with Symfony2 Sorry if this question has been asked many times but I didn't found any solution on the Web. So, I just have installed FOSUserBundle and I've created 2 users on my application with the console. The problem is they don't have any role. So in on controller, I get the user Entity and y set his role but when I try to access to a page restricted for admin, it says access denied. Moreover, the roles has no changed on the databse. My code in the controller : $user = $this->container->get('security.context')->getToken()->getUser(); $user->setRoles('ROLE_ADMIN'); if (!$this->get('security.context')->isGranted('ROLE_ADMIN')){ throw new AccessDniedException('Access Denied !'); } Anyone have an idea ? Thanks in advance !
It is a very bad practice to set a user role in your controller if you want to keep them away from the controller in the first place. I hope you use this line of code for testing only. The FOSUserBundle provides a number of command line utilities to help manage your application's users. The one you need is: `$ php app/console fos:user:promote testuser ROLE_ADMIN` Replace testuser with your username. Did you also define your roles in your firewall?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "symfony, fosuserbundle, roles" }
Not able to redirect entire output of a command to a log file using shell script I'm redirecting output of a command to a log file in a shell script as follows : script > file.log However, towards the end of the script, some of the final content which includes key information like "PASS" or "FAIL" gets printed on the console rather than re-directed to file.log I would like this information to be re-directed as well. Any tips?
Most likely the output of `"PASS" "FAIL"` is output to `stderr` instead of `stdout`, so you want to redirect both `stdout` and `stderr` to your file, e.g. script > file.log 2>&1 (or you can shortcut the command with `script &> file.log`)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "shell" }
Try catch with AngularJs I am not sure whether try/catch is performance hit or not I want to use it in one of my AngularJs application. Will you please navigate me to right direction.
if you want to handle try/catch better or handle exception and keep the log of them write a decorate around angularjs exception handler example here app.config(function($provide){ $provide.decorator("$exceptionHandler", function($delegate, $injector){ return function(exception, cause){ var $rootScope = $injector.get("$rootScope"); $rootScope.addError({message:"Exception", reason:exception}); $delegate(exception, cause); }; }); });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "angularjs, try catch" }
Backbone Model Fields I'm trying to add a new _virtual field_ to my backbone model whenever a new item is added, the code is simple: window.DealModel = Backbone.Model.extend({ defaults: { title: '', desc: '', location: '', terms: '', price_orignial: 0, price_discounted: 0 } }); window.DealCollection = Backbone.Collection.extend({ model: DealModel, initialize: function (models, options) { this.bind('add', this.addTitleShort); }, addTitleShort: function(rdeal){ rdeal.set('title_short', _.str.prune( rdeal.get('title') , 140, '+++')); } }); However, I keep getting a `_ Cannot use 'in' operator to search for 'id' in title_short_`, not sure what the problem is, appreciate the help.
I think that "`set`" uses object hash: rdeal.set( { title_short: _.str.prune( rdeal.get('title') , 140, '+++') }); But if there was no "title_short" property in the created model, I don't know if you can "set" it. You can just do rdeal.title_short = _.str.prune( rdeal.get('title') , 140, '+++'); Also you can add a function to Model class that will return the result thus eliminating the need to handle model's "`change`" event: window.DealModel = Backbone.Model.extend({ ... title_short: function() { return _.str.prune( this.get('title') , 140, '+++'); } }); and use it: `myModelInstance.title_short();` Hope it helped.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, backbone.js" }
Find $k$ such that the vector with $w_n=1/(1+a_n k)$ is orthogonal to a given vector I am a little rusted. I have a vector $v$ with components $v_n$ in $R^N$, and another vector $w$ with components $w_n=\dfrac{1}{1+a_n k}$ in $R^N$. I have to find the value $k$ for which $v\cdot w=0$. Wich is the analytical solution?
So $\vec{v} = (v_k)_{k=1}^N$ and $\vec{w} = \left( \frac{1}{1+a_n k} \right)_{n=1}^N$. You must find $$ 0 = \vec{v} \cdot \vec{w} = \sum_{i=1}^N v_i w_i = \sum_{i=1}^N \frac{v_i}{1+a_i k}. $$ Can you continue from here? (Using numerical techniques, like Bisection or Newton's Methods, looks much easier unless $N$ is very small...)
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "linear algebra, inner products" }
Necessity of MacTeX installation to work with LyX I want to install LyX on my Mac OS X. It is said here that "Before you install LyX you need to install a TeX system such as MacTeX." What if I download LyX for Mac without installing a TeX system? I am new to Mac and TeX in particular. Any explanation would by appreciated.
Just install the MacTex distribution (< like any other program on the Mac. It takes the "Unix pain" out of installing dozens of different programs and utilities. Once you've run the MacTex installer you have a whole LaTex installation on the unix side of the Mac (which you won't see) and a few front-end applications such as TexShop and LaTexIt. Then, and only then, will you be able to use Lyx, which is another front-end and which relies on the whole LaTex installation in the background. Do this and then the funny error message about which you asked in the other question will disappear (and people stop getting stroppy with you).
stackexchange-tex
{ "answer_score": 4, "question_score": 1, "tags": "lyx, mac" }
JMETER - Extractor Expressão Regular (regex) Boa tarde, Estou com a seguinte dificuldade no JMETER: "presignedUrlRequest": "< Preciso extrair todo o link, mas em 3 partes. 1 com apenas o https. A segunda com o fng-contratos-dev.s3.amazonaws.com. E a terceira a partir do d29e66.... Alguém poderia ajudar? Obrigado!
Adicionar um Extrator de expressão regular use a seguinte configuração em seu extrator de expressões regulares. Field to Check : URL Name of Created Variable : Value Regular Expression : (.+?):\/\/(.+?)\/(.+?)\?X-Amz Template : $1$2$3$ Match no: 1 ![inserir a descrição da imagem aqui]( This will extract all 3 required values on a single go and saves these values in variables `Value_g1, Value_g2, Value_g3` ![inserir a descrição da imagem aqui]( Você pode usar $ {Value_g1} / $ {Value_g2 / Value_g3} para substituir valores Mais Informações Extratores de expressão regular
stackexchange-pt_stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "regex, jmeter" }
Callback function is executed right away I have a confirm popup that ask for yes or no, this is the code: Confirm({ Title: 'Warning', Message: 'Are you sure?', Buttons: [{ text: 'Yes', callback: function(){ RRSubmitRemoveReportRequest($(this)); }, highlighted: true }, { text: 'No)', callback: null, type: 'no' }] }); If if send the parameter $(this), I should use an anonymous function, otherwise it calls the function right away, anybody can explain me this please? Thanks
The `callback` property needs to be set to a `function`. If you do: callback: RRSubmitRemoveReportRequest($(this)) you are setting `callback` to the _return value_ of the `RRSubmitRemoveReportRequest` function. You need to pass it a function. `RRSubmitRemoveReportRequest` is a function, `RRSubmitRemoveReportRequest($(this))` is a function call, so it's ran and its return value is used. When you do: callback: function(){ RRSubmitRemoveReportRequest($(this)); } you are passing a function, that when called, will call `RRSubmitRemoveReportRequest` correctly.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript" }
Ajax Contact Us Form Validation - Cakephp 2.0 I'm having a website < There in the home page I have built a Enquiry Form, The form usual validation works fine, but I need Jquery & Ajax validation, the form submits to 'enquiry/add', Pls help me on how to use Jquery Ajax in cakephp 2.0, I gone through a video of Andrew Perkins, but It didn't work for me. If I submit the form, then the whole home page is displayed on that Enquiry Div. I'm trying it from a week, but not working, pls help me as soon as possible.
When you submit form with ajax to controller `enquiry/add` the html returend by ajax request is a view associated with this `enquiry/add`. If you want to customize this html you have to modify `add` action in controller: At the end of the action try this: if($this->request->is('ajax')) { $this->autoRender = false; $this->render('/elements/enquiry_success'); } And in app/view/elements/ add enquiry_success.ctp containing some html/php code which will be returned to #succces div (for example `<p>Enquiry added!!!</p>`). This code detects if request is ajax and id it is it doesnt render default view for action but some element.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ajax, jquery, cakephp 2.0, cakephp ajaxhelper" }
Changes in Environment Variable is not working and applying - Windows 8 Hi I'm working with `hugo` and I will change the path variable but its not applying. My question is about the settings on path variable that is not working properly when i type to cmd > echo %PATH%
Can you show what was the echo %PATH% output ? Please take note that you need to make sure that there is no character spaces between the path that you are setting. For example Incorrect: > C:\Program Files\nodejs\; ;C:\Hugo\bin; Correct: > C:\Program Files\nodejs\;C:\Hugo\bin; If it don't works just try to restart your command prompt then type > echo %PATH% output to see if it works.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "web, hugo" }
Diff b/w viewController and modelViewController please clear the concept of view controller and ModelViewController
I guess you mean Mod* _a_ *l View Controller. A Modal View Controller handles Modal Views which are basically views that pop out as a separate logical task. See the email app, the messaging app, alarms app. When you hit compose on mail, write new message on messages, add a new alarm or add a new contact on you contact list. See how the action behaves? A new view pops out and that is known as a modal view in the sense that it encompasses a task which is totally contained in it and needs to be done before exiting the view. A view controller is presented as a Modal View. Note that. Modal refers to the principle & why the view controller is presented so. View Controllers are your plain vanilla handles for views as you might have already read along your learning curve.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, uiviewcontroller" }
Deploy lambda function inline I have a python function that I can deploy through S3 bucket. But it is possible to deploy a function "inline"... < But I do not see any clear instructions about how to do this. I do not want to use S3 bucket.
You can deploy an AWS Lambda function inline within a CloudFormation template through the following YAML syntax. LambdaFunction: Type: AWS::Lambda::Function Properties: Code: ZipFile: > def handler(event, context): print('hello from lambda') Handler: index.handler Role: Fn::GetAtt: [ LambdaRole , "Arn" ] Runtime: python3.6 Timeout: 60
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 4, "tags": "aws lambda, aws cloudformation" }
How can I increment or decrement pointer argument value in function call in C in one line? I have the following code: #include <stdio.h> int foo2(int *px, int *py) { int sum = *px + *py; *px = *px + 1; *py = *py - 1; printf("foo2 : res=%d x=%d y=%d\n", sum, *px, *py); return sum; } int main() { int x = 4, y = 7, res; res = foo2(&(x++), &(y--)); printf("%d", res); return 0; } I need to increment `x`, decrement `y`, then I need to pass them in `foo` function as arguments. I have `error: lvalue required as unary ‘&’ operand`. Also I tried to use `x + 1` and `y - 1` instead of `x++` and `y++`. How can I increment `x` and `y` values and pass pointer to them in `foo2` function call? Is it possible?
You can use the comma operator: res = foo2((x++, &x), (y--, &y)); However this is not very readable, so unless you have a really good reason it is better to write it as three separate statements: x++; y--; res = foo2(&x, &y);
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "c, pointers" }
how to create expandable list inside a linear layout I have in a scrollview defined three main linear layout. When on click on one of this layout I would like to expand a list with different options. How to do that? I have something like this: Currently I have: Main.java: linlayout1.setOnClickListener(new OnClickListener() { public void onClick(View v) {..../ go to a new inntent} } Main.xml: Layout1 Layout2 Layout3 When clicking on Layout1 I would like to see: Layout1 Option1 Option2 Option3 Layout2 Layout3 Can someone help me with the best solution to this? Thx
you can use this tutorial for your specification. Here is a link, Click Here
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, android linearlayout, expandablelistview, expandable" }
Revert `font-lock-face` changes I have a custom face defined as (defface my-underlined '((t (:underline "red"))) :group 'my-group) At some place I underline some words with something like (add-text-properties (match-beginning 0) (match-end 0) '(font-lock-face my-underlined))))) What would be a correct way to revert this text properties set on some words (or on all words on demand) as well as restore their syntax highlight that might have existed before? Nothing with `font-lock-` seems to work. What would be a correct way to underline and revert? A function `underline-region` doesn't seem to work. It just inserts `^H_` into the text.
See the Emacs Lisp manual section on removing text properties. `remove-list-of-text-properties` seems to do what you want. See related discussion here on the Emacs StackExchange.
stackexchange-emacs
{ "answer_score": 1, "question_score": 0, "tags": "font lock, text properties" }
Extract text from image using MSER in Opencv python I want to detect text in a image using mser and remove all non-text regions. Using the code below i was able to detect text: import cv2 import sys mser = cv2.MSER_create() img = cv2.imread('signboard.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) vis = img.copy() regions, _ = mser.detectRegions(gray) hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions] cv2.polylines(vis, hulls, 1, (0, 255, 0)) cv2.imshow('img', vis) if cv2.waitKey(0) == 9: cv2.destroyAllWindows() How can I remove all non-text regions and get a binary image with text only? I searched a lot over but could not find any example code to do so using python and opencv.
You can get a binary image using the contours you found. Just draw the filled in contours to an empty img in white. mask = np.zeros((img.shape[0], img.shape[1], 1), dtype=np.uint8) for contour in hulls: cv2.drawContours(mask, [contour], -1, (255, 255, 255), -1) **Note** : _Seethe official docs for more on drawContours_ You can then use this to extract only the text: text_only = cv2.bitwise_and(img, img, mask=mask)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "python, python 3.x, opencv, image processing, mser" }
Why does iTunes keep re-downloading my deleted podcast episodes? I delete my podcast episodes from iTunes after I listen to them. Recently, I migrated from a Lion machine to a Mavericks machine (both iTunes 11), bringing my iTunes Library with me (but not my preferences file). Since then, when iTunes updates my podcast, it insists on re-downloading the episodes I've deleted (and worse, now they're marked as unplayed). Is there a setting I need to change to stop this? It used to work fine.
I still don't know why it was doing this, but I've since set iTunes to automatically delete played podcasts after 1 day, and stopped deleting them manually. That does what I need.
stackexchange-apple
{ "answer_score": 2, "question_score": 5, "tags": "itunes, podcasts" }
Getting rid of the high volume warning Whenever I have to reboot my phone, shortly after it gives me a warning about volume being too high and decides to set it to 13. It's annoying because it often happens when I'm driving (and therefore controlling the volume from my car). Is there any way I can tell my phone that I already have a mom and that this repeated warning is unwelcome? My phone is a Nokia Lumia 920 running Windows Phone 8.1 developer preview. I'm in Canada but I've set the regional settings to US in order to be able to use the beta version of Cortana.
Do not reset your phone! This warning will ALWAYS show up as far as I'm aware. It seems to not happen so often anymore after the WP8.1 update. Also, if you do not restart your phone very often, it should not happen as much. It seems to just happen a few times after startup.
stackexchange-windowsphone
{ "answer_score": 2, "question_score": 8, "tags": "notifications, audio, volume, alert" }
What is a deleted segment in linux pmap output? Here are the first few lines of output from pmap on a process, running on CentOS 5.2: Address Kbytes RSS Anon Locked Mode Mapping 00101000 1268 - - - r-x-- libc-2.5.so 0023e000 8 - - - r---- libc-2.5.so 00240000 4 - - - rw--- libc-2.5.so 00241000 12 - - - rw--- [ anon ] 00244000 36 - - - r-x-- threads.so (deleted) 0024d000 4 - - - rw--- threads.so (deleted) 0024e000 20 - - - r-x-- Socket.so (deleted) 00253000 4 - - - rw--- Socket.so (deleted) [...] What does "(deleted)" mean on the shared library mappings?
That means that the file in question has been deleted. Its link count in the filesystem has gone to 0. The file will stay around until the last in-kernel reference to it has been closed, then it will be removed from the disk. You will often see this when a program has continued running while the packaging system has installed new updates. The old libraries have been removed and new libraries installed.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "linux, pmap" }
Declare a class in another class in android i want to use a class in another class e.g public class storge extends Activity { public void save() { // } } public class Startuo extends Activity { . . . . storge s=new stoge(); s.save(); } when i run it the program stop immediately!! Do i have to add a permission or something to let it work ??? are there wrong in the declaration or what ?
Classnames should start upper cases. Also, don't declare two classes in one Java File, use two files. If you want to use both of this classes as Activitys, they booth need to be added to your Android Manifest. Last but not least, you don't use an Activity by creating an instance of it. To show it up, you should use an Intent.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, android" }
Android wake lock is not released I get the wake lock like in `onCreate` method and it works fine (I also set the permissions): PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Wake lock"); wl.acquire(); However, when I try to release it like: @Override protected void onDestroy() { super.onDestroy(); wl.release(); } it is not released for some reason. How is this possible ? Any ideas ? **EDIT** : I have an exit button which calls finish() which then calls onDestroy(). When I press the exit button and then put the phone to sleep I expect my program not to work but it works which shows me that the lock is not released
The right way to determine whether your `WakeLock`-releasing code works is to use `adb shell dumpsys power`, before and after the release, to see if your `WakeLock` is released. Since other apps can request and acquire `WakeLocks` whenever they want, other casual checks (e.g., does my app run when the screen is off?) will be unreliable.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "android, release, wakelock" }
Where to download wicketstuff-dojo binaries? I'm looking for wicketstuff-dojo binaries - legacy maven-based project depends on it. I can't find it in maven repo - < and I can't build it since it's missing some sh script in trunk. Is there any place to get it? Or just by chance - do you have org.wicketstuff:wicketstuff-dojo:jar:1.3.0-beta ? Thanks
I'd check this repo first: < See also this, but I'm not convinced the answer is complete.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, dojo, wicket, wicketstuff" }
Submodules of a Quotient Ring Viewed as a Module I'm aware of the fact that when a commutative ring $R$ is viewed as a module over itself, the submodules of $R$ are just the ideals. We can pick an ideal $I \subset R$ and take the quotient ring $R/I$, which is also an $R$-module. Are the $R$-submodules of $R/I$ again the ideals of $R/I$ as a ring?
Yes, this is true. For any $R/I$-module $M$, the $R/I$-submodules of $M$ coincide with the $R$-submodules of $M$. This is because an $R/I$-module is the same thing as an $R$-module killed by $I$ (the $R/I$-module structure is uniquely determined by the $R$-module structure).
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "ring theory, commutative algebra, modules" }
how do I use the node Builder from Scriptacolus to insert html for example this code var html = "<p>This text is <a href=#> good</a></p>"; var newNode = Builder.node('div',{className: 'test'},[html]); $('placeholder').update(newNode); casues the p and a tags to be shown, how do I prevent them from being escaped?
The last parameter to Builder.node is "Array, List of other nodes to be appended as children" according to the Wiki. So when you pass it a string it is treated like text. You could use: var a = Builder.node('div').update("<a href='#'>foo</a>") Where the link is text or: var a = Builder.node('div', {'class':'cool'}, [Builder.node('div', {'class': 'another_div'})] ); And you could use just Prototypes new Element() (Available as of version 1.6). var a = new Element('div').insert( new Element('div', {'class': 'inner_div'}).update("Text in the inner div") );
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, dom, scriptaculous" }
When did Lego stop putting small catalogs into boxes? In former times, all Lego sets used to come with a small catalog. This was either just a single leaflet with an overview of several themes (with a focus on new sets or subthemes), found in smaller sets, or a small booklet like a smaller version of the main catalog, just restricted to "minifig size" sets (when buying one of those minifig sized sets) and usually without any product descriptions (just set numbers), included in larger sets. _Personal nostalgia anecdote: These catalogs were significant to me as a child because they would often grant the first glimpse at new sets of the upcoming year during the first few weeks of January before toy stores would get the first main catalogs._ Recently, I noticed that current sets do not include this kind of catalogs anymore. **When did TLC change this habit?**
To be fair, it is hard to tell and depending on definition you may even tell TLG has never stopped doing so. But it depends on the series. Bricklink has a lot of catalogs in their item data base. Single leaflet catalogs are called "Mini" and small booklet ones are called "Medium". Catalogs you can find in store are called "Large". While Bricklink's database can be considered the largest in terms of catalogs they have, for some reason they didn't record if any of these catalogs come in sets. So it is hard to say when/if did TLG stop including Mini and Medium catalogs. Looking at the data recorded in Bricklink I would assume 1999-2001 are the years when TLG stopped putting "Medium" catalogs into System/City/Technic sets. It also depends which series you are interested in, since Duplo kept getting their "Medium" catalogs for much longer. However you can also find that some of recently introduced Dots sets may have had catalog of "Mini" type in their 2020 range.
stackexchange-bricks
{ "answer_score": 5, "question_score": 11, "tags": "history" }
Showing that the generalized inverse for a square invertible matrix is unique Let $A\in\mathbb{C}^{m\times n}$, then a generalized inverse matrix $B$ of $A$ satisfies the following $$ABA = A \ \text{and} \ BAB = B.$$ I am to show that $B$ is unique if $A$ is square and invertible. I also want to know if my approach is correct. From the first criterion, we get $B=A^{-1}$. My first question is then, does this imply $A=B^{-1}$? Second, if there exists a $C\neq B$ such that $$ACA = A \ \text{and} \ CAC = C,$$ then clearly $C=A^{-1}$, and since $A^{-1}$ is unique, then $C=B$, and so we have a contradiction. Is this a correct way to prove the generalized inverse $B$ of $A$ is unique? And can I deduce that $A=B^{-1}$ from the fact that $B = A^{-1}$? I also feel that I am not really using the second criterion ($BAB=B$) and I feel that I should. Thanks
Suppose that $B$ and $C$ are generalised inverses of $A$. In particular, we have $ABA=ACA$. Therefore, $$B=(A^{-1}A)B(AA^{-1})=A^{-1}(ABA)A^{-1}=A^{-1}(ACA)A^{-1}=(A^{-1}A)C(AA^{-1})=C.$$ Note that the equations $BAB=B$ and $CAC=C$ are not needed to derive the result.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "linear algebra, inverse" }
Purpose of tracking non-remote branch Usually, a local branch tracks a remote branch. The remote branch will be updated when pushing or pulling. But what is the purpose of letting a local branch track another local branch?
When you work with Git and you have multiple features you are working on simultaneously, it is good practice to have a separate branch for each feature. When a feature is completed, you push it into the main branch. The other branches should then pull from the main branch to make sure that their changes are compatible with the completed branch so that potential merge problems are detected early. In that case it would be convenient when all feature branches would track the local main branch.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "git" }
Why do people use log(x+1) or log(y+1) as their independent/dependent variable? Why do people use log(x+1) or log(y+1) as their independent/dependent variable? In these cases, is it that different from using just log(x) or log(y)? What is the benefit of using log(x+1) or log(y+1)? Sometimes when I read papers, the authors specify that their model's variable is the log of a variable + 1. I have been trying to read through the posts on why this is the case, but still having a hard time figuring it out.. can someone explain to me please?
The answer is that people do it when they have zero-values in their data. When that happens, you cannot log your data, since $\log(0)$ is undefined. However, if you add some small value, such as $1$, then you can take the logarithm of that small value. This practice, however, is of questionable statistical validity.
stackexchange-stats
{ "answer_score": 3, "question_score": 3, "tags": "regression, logarithm" }
Linux ssh user connect I all, I have a linux Server (Ubuntu) where some user can be connect to by ssh. Is possible to know who was connected to the server? A sort of list of login by ssh of the past day. Is possible to retrieve?
`who` will show you who is currently connected. `w` will show you who is curretly connected, plus what command they're running. `last` will show you all users logged in/out since `/var/log/wtmp` was last rolled. The contents of `/var/log/auth.log` and/or `/var/log/secure` may also be useful, but the commands above will probably get you what you need to know
stackexchange-serverfault
{ "answer_score": 5, "question_score": 0, "tags": "linux, ssh, users" }
Oracle connection test We are developing java based web application, which runs on Ubuntu 12.04. At the start of installation, we prompt for Oracle server's Host, Port, user, password & SID details and then passed them to installer to build jdbc:oracle:thin url. Eventually, our installer connects to Oracle and creates some tables. Now I am trying to write a script(shell or python) to quickly verify user entered Oracle settings are correct or not by simply connecting to Oracle and disconnecting before passing those to our installer. I tried to use `echo "exit" | sqlplus -L user/password@//host:port/SID | grep Connected > /dev/null` but sqlplus easy connect is only taking service-name not SID. Is there any easy way to test Oracle connectivity. I need to write it in script, which needs to run automatically as a part of installation steps. Thanks for all the help.
Read Oracle listener is expected to listen to your request for connection. Here is the copy of Tom's answer [tkyte@desktop tkyte]$ sh -vx test.sh sqlplus 'scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=152 1)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ora9ir2.kyte.com)))' Use your host, port and service_name.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "oracle, shell, python 2.7, jdbc, sqlplus" }
Powershell - Invoke-SqlCmd, retrieving PRINT statements asynchronously I would like to know if its possibly to retrieve PRINT statements from a stored procedure asynchronously? Currently the code below, only displays all the PRINT systems once the stored procedure has been executed. "Invoke-Sqlcmd -ServerInstance $sql_server -Username $sql_usr -Password $sql_pwd -Database $sql_db -QueryTimeout 6000 -Query "EXEC TV.StoredProdure $cob_date, $region" -Verbose" Any assistance will be greatly appreciated.
No. `PRINT` will only display once the command has completed, whether you run it from OSQL, SSMS, or Powershell. What you **CAN** do is use `RAISERROR` to get immediate feedback: `RAISERROR('This will display immediately',0,1) WITH NOWAIT`
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "sql, stored procedures, powershell, printing, sqlcmd" }
Test Flash generated .IPA, using Testflight It's posible to install a Flash generated .IPA using TestFlight ? I need to test my app in a few number of ipads, for private (not public) use. Thanks.
I haven't used it myself, but there's a native extension for TestFlight provided by Adobe. It comes bundled with the Adobe Gaming SDK (maybe you can download it separately). Here's the documentation.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "actionscript 3, ipad, flash, testflight" }
probabilities of getting $1,2,3,4$ aces when dealt 5 cards You are dealt five cards from a standard deck find probability of getting $1$ ace, $2$ aces, $3$ aces, $4$ aces * * * **_Attempt_** There are $\binom{ 52}{ 5}$ possible outcomes. $p_1$ is probability of being dealt one ace $$ p_1=\frac{4}{\binom{ 52}{ 5} }$$ $p_2$ is probability of being dealt one ace $$ p_2=\frac{\binom{5}{2} \binom{50}{3} }{\binom{ 52}{ 5} }$$ $p_3$ is probability of being dealt one ace $$ p_3=\frac{\binom{5}{3} \binom{49}{2} }{\binom{ 52}{ 5} }$$ $p_4$ is probability of being dealt one ace $$p_4=\frac{\binom{5}{4} \binom{48}{1} }{\binom{ 52}{ 5} }$$ $p_5$ is probability of being dealt one ace $$ p_5=\frac{1 }{\binom{ 52}{ 5} }$$ * * * **_have a follow up question needing correct $p$'s_**
Count the number of ways to pull there required number of aces times the number of ways you can pull the required number of non-aces. There are 48 non-aces in the deck. 0 aces. $\frac {{48\choose 5}}{52\choose 5}$ 1 ace $\frac {{4\choose 1}{48\choose 4}}{52\choose 5}$ 2 aces $\frac {{4\choose 2}{48\choose 3}}{52\choose 5}$ etc.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "probability, card games" }
preg_replace regular-expression to find numbers preceeded by letters I'm really confused as to using `preg_replace` but slowly learning. I need help with the function: $str= preg_replace('#\W\d+#', '\W \d+', $str); The idea is that Im looking for numbers that have letters directly before them with no spaces, ie **abc123**. (NOT 'abc 123' and NOT '123abc') and how do I simply include a space or character in between so abc123 becomes abc 123 or abc@@123 thanks everyone!
<?php $str = 'abc()1234'; $str= preg_replace('#([a-zA-Z()])(\d+)#', '$1 $2', $str); echo $str; Output: > abc() 1234 $1 and $2 are backreferences and refer to the first and second captured groups, respectively. More info @ <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, regex, preg replace" }
Vue CLI Fails to install for Mac Mojave I get the following error when setting up a new Vue project: npm install -g @vue/cli Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
I got around this error by changing permissions for two directories: Set permissions to Everyone - Read / Write for * /usr/local/lib/node_modules * /usr/local/bin 1. Open Finder. 2. Press Command +Shift+G. A dialog box opens. 3. Enter the path and click **Go** 4. Right-click the directory and select **Get Info** 5. Click the lock icon to allow changes and enter your credentials 6. In the **Sharing & Permissions** section change **everyone** to **Read & Write** 7. Click the cog icon and select **Apply to enclosed items** from the drop down 8. Confirm the prompt Reference Article: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "macos, vue.js, npm, vuejs2" }
Good jQuery Autocomplete that is not part of jQuery UI? Is there a good alternative to jQuery UI autocomplete? I couldn't find one on the internet. jQuery UI is far too big for just using the autocomplete, and I don't want to roll yet another autocomplete on my own. **Answer** : jQuery UI custom build for just autocomplete is 23,052 bytes. SO uses the original Zaefferer version that was adapted into jQuery UI autocomplete. I guess if it's good enough for SO, it's good enough for me, forked it from agarzola on GitHub.
See <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 6, "tags": "javascript, jquery, autocomplete" }
Proof that n-Dimensional Rotations Leave A (n-2) Subspace Fixed Looking at many of the questions on this site and literature, there are many references made to the fact that rotations in ${\Bbb R}^n$ leave a $(n-2)$ dimensional subspace fixed. I have looked for a proof of this statement, and couldn't find any. This is as close as I got: > Let $R$ be a rotation in ${\Bbb R}^n$. If for some non-zero vector $v$, $Rv = v$, then there exists $(n-3)$ vectors $w_1, w_2, ...$ mutually orthogonal to themselves and $v$, such that $Rw=w$ Based on the question Rotation in 4D? But I failed to find a proof as I couldn't prove that the Eigenspace corresponding to the '$+1$' eigenvectors was $n-2$ dimensional.
The proposition is false. Take, for example, $R=\operatorname{diag}(-1,-1,-1,-1,1,\dots)$. Its determinant is $1$, so it’s a rotation, but the eigenspace of $1$ is obviously $(n-4)$-dimensional. (If you don’t like using what seems like a reflection, replace the first four rows with a pair of Givens rotations.) Indeed, a rotation in $\mathbb R^{2m}$ for $m\ge2$ need not have any non-trivial fixed points at all: a simple example is $-I$. Now, you could define a _simple_ rotation, similar to a Givens rotation, that only has a single plane of rotation, but then the proposition pretty much _is_ the definition of the rotation itself. There are some interesting things that one can say about planes of rotation and their relationship to the eigenvalues of a rotation, though. This Wikipedia article is a pretty good gloss on the subject.
stackexchange-math
{ "answer_score": 2, "question_score": 3, "tags": "linear algebra, matrices, eigenvalues eigenvectors, linear transformations, rotations" }
Force Reponsive FileManager to Use thumbs_base_path Usually when Responsive FileManager is opened, the thumbnails it uses are retrieved from the `$thumbs_base_path` folder (configured in config.php). However, in some cases (usually for very small files) the images are taken directly from their original path. This poses some complications for my project. Is it possible to force it to always use $thumbs_base_path?
Figured it out, it's controlled from `dialog.php` in the root folder of RFM. Here is the "offending" code: if($img_width<122 && $img_height<91){ $src_thumb=$current_path.$rfm_subfolder.$subdir.$file; $show_original=true; } if($img_width<45 && $img_height<38){ $mini_src=$current_path.$rfm_subfolder.$subdir.$file; $show_original_mini=true; } Commenting this out completely resolves the problem, but of course it's also possible to play with the settings/directories.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "responsive filemanager" }
WPF Drag And Drop DataBinding Hey guys, I'm starting to wrap WPF around my head and I came to a dead end. I have a ListBox that accepts files/folders by drag and drop. I have a Files Class witch contains files properties like "Name", "Thumbnail" [and so on] and a FilesCollection Class well it's self intuitive. The Collection takes a "FilesPath" and then it retrieves all the files from that path. Currently it has a static path associated with it but I want that path to change when I drag a folder to the ListBox. So what I want is: * when I drag a folder to the ListBox, associate the path of it to the FilesCollection Class
All you need to do is set AllowDrop to True and handle the Drop event. The ListBox definition: <ListBox AllowDrop="True" Drop="ListBox_Drop"> </ListBox> The event handler: private void ListBox_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("FileName")) { string folderPath = e.Data.GetData("FileName"); //do whatever you need to do with the folder path } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wpf, data binding, drag and drop" }
Pass in object in partial I would like to render a partial in my application.html.erb. The partial originates from the Product folder "products/categories". When I try to insert a partial in the application.html.erb, like below, I get undefined local variable or method `categories' for #<#:0x007fcfa35c9c78>. Any help is greatly appreciated. application.html.erb <%= render 'products/categories', locals: { categories: categories }%> products/_categories.html.erb <% @categories.each do |category| %> <li><%= category %></li> <% end %> products_controller.rb def categories @categories = ProductCategory.all end
With your render you have locals: { categories: categories } which will define `categories` in your partial But in that partial you are referring to `@categories`. You will still have access to all instance variables in the partial even if you don't pass them as locales. Also be aware that controller methods aren't automatically available to views. You need to also write `helper_method :categories` in the controller or move the method to the helpers file. Although it's probably not a good idea to name local variables the same as methods, so you should rename the method to `get_categories` or something.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ruby on rails, ruby" }