qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
67,057,864
I'm trying to use [lcapy's](https://www.google.com/search?q=lcapy&oq=lcapy&aqs=chrome..69i57j35i39j35i19i39j69i59j69i60l4.1424j0j7&sourceid=chrome&ie=UTF-8) python library to draw some electrical circuits in google colab. Unfortunately, I'm always getting an error: `RuntimeError: pdflatex is not installed` Even thoug...
2021/04/12
[ "https://Stackoverflow.com/questions/67057864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9943255/" ]
I experienced a similar issue/error trying to render PDFs from latex output generated by pandas in google colab recently. The error I got was complaining about a file ([Error Code 2](https://stackoverflow.com/questions/6758514/python-exit-codes/6758687)), listed 'pdflatex' as the missing file, but I confirmed the insta...
I ran into the same issue myself and after verifying pdflatex is installed with `!pdflatex -help`, I looked into Lcapy's code. The easiest workaround I found is to comment out line 73 of system.py. I only need schematic tools, so this solution is adequate for me. If you need a proper solution, all the relevant function...
11,338,420
**ERROR** ``` Unable to cast the type 'System.Nullable`1' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types. ``` This is the error I am getting. **Controller** - ``` public ActionResult FixturesAll() { teamMgr = new TeamManager(); fixtureMgr = new Fixtu...
2012/07/05
[ "https://Stackoverflow.com/questions/11338420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438624/" ]
Instead of: ``` <% foreach (var item in ViewData["Fixtures"] as IEnumerable<DataAccess.FixtureModel>) ``` try: ``` <% foreach (var item in Model) ``` Also try to eagerly load your entities using the `.ToList()` method: ``` ViewData["Fixtures"] = fixtures.ToList(); ``` Also you might consider using view models ...
Give this a shot... (although id tweak the try catch a bit, if you end up using it. i wouldn't recommend suppressing an error and not doing anything about it/allow it to die a silent death ;P) ``` public string NullableObjectToString(object obj) { try { if (obj == null) return "";...
204,696
My question is in regards to MySQL, but I also wonder how this affects other databases. I have several fields that are `varchar(255)` but my coworker insists if they were `varchar(30)` -- or any smaller size -- then queries would run faster. I'm not so sure, but if it's so I'll admit to it.
2008/10/15
[ "https://Stackoverflow.com/questions/204696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28240/" ]
It depends on the query and the data, but you're probably optimizing too soon to even be worried. For SELECT queries, the statement itself will run just as fast within MySQL, and as long as the data doesn't get larger than it would be at the smaller sized field then it will transmit as fast. If the smaller field force...
If you're only ever using the first 30 characters, then there won't be a difference between a varchar(30) and a varchar(255) (although there would be a difference with varchar(1000), which would take an extra byte). Of course, if you end up using more than 30 characters, it will be slower as you have more data to pass...
34,672,248
I'm trying to configure [Let's Encrypt certificates](https://letsencrypt.org/) on a server that is publically accessible. Originally, the server was hiding behind a router, but I have since forwarded ports 80 and 443. The certificate seems to have completed a majority of the install process, but fails with the message...
2016/01/08
[ "https://Stackoverflow.com/questions/34672248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1944335/" ]
I finally figured out what was going on. I discovered that the `--manual` flag steps through the authentication process interactively. Each phase in the process will display a prompt similar to the following: ``` Make sure your web server displays the following content at http://www.example.net/.well-known/acme-chall...
If you're using Cloudflare DNS in front of your site, remember to have the DNS A, AAAA records point directly to your site, temporarily until renewal finishes.
19,630,886
I am developing an app that targets for tablets only not for phones. Is this code is enough to acheive my goal? Is there any way to test it or google play sorts it's by itself and present to users? Below is the code I have tried. But I don't know how to test it? ``` <uses-sdk android:minSdkVersion="11" android:tar...
2013/10/28
[ "https://Stackoverflow.com/questions/19630886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1277837/" ]
Seems oke, should work as far as I know. Think about what you define as a tablet. What makes your app less suitable for a 6" phone, than for a 7" tablet? You can't really test this until you upload it in the Google play Store. These filters in the manifest.xml are used by the Google Play Store, not actually when in...
You can use a trick here... **1)** Create an startup activity, which only verifies screen size in its on create an starts actual activity in success scenario. like, ``` // In onCreate of startup activity if (isTablet()) { startActivity(new Intent(StartupActivity.this, MainActivity.class)); this.finish(); // ...
48,823,158
i want to build a project and failed because it requires root permission. When i change the user to root as "sudo -s", it prompted `[sudo] password for ubuntu`. As ec2 doesn't offer ubuntu password, it login with pem file. How can I login as root and create files? Thanks!
2018/02/16
[ "https://Stackoverflow.com/questions/48823158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5772775/" ]
I fixed this by doing using "sudo" for a Ubuntu AWS EC2 SSH Login: ``` $ sudo passwd ubuntu ``` Instead of prompting me for: ``` "(current) UNIX password:" ``` It prompts now for: ``` "Enter new UNIX password:" ``` I hope this fixes some problems with ec2 ubuntu users!
I was surprised as well, when AWS ec2 ubuntu prompted me for a password. ``` [sudo] password for ubuntu: ``` In the end I just hit `return` without inserting anything and it worked.
53,076,457
I make a button, put it in a div, center align the div and button, however the button aligns itself from its far left side which makes it appear off center. Is there a way to make it align from wherever its actual center is? ```css .btndiv{ width: 80%; height: 500px; margin: 0 auto; text-align: center; } .test...
2018/10/31
[ "https://Stackoverflow.com/questions/53076457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10583888/" ]
For aligning element, its always recommended to use "grid", example in snippet: ```css .grid-container { display: grid; grid-template-columns: auto auto auto; } .grid-item { background-color: rgba(255, 255, 255, 0.3); border: 1px solid rgba(0, 0, 0, 0.1); padding: 10px;...
Add below css and you're done... ``` .testbutton { left: 0; right: 0; margin: auto; } ``` Also, If you want to center align it vertically add below css ``` .testbutton { left: 0; right: 0; top:0; bottom:0; margin: auto; } ``` ```css .btndiv{ width: 80%; height: 500px; margin: 0 ...
16,191,626
* Our windows store application is especially for our customers. * It requires user credential to login. * It doesn't have any sign up page. * New users cannot access our application(They should be our customer.) * For new users, Admin will create an account and share them to the user. * At the first time, user is requ...
2013/04/24
[ "https://Stackoverflow.com/questions/16191626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2315398/" ]
`%.*%` This will match 1) a % 2) any number of any characters 3) a % And since it will match greedily rather than lazily, it will match the widest %...% it can, rather than stop at the first. For example, the lazy version of this would be %.\*?% (putting ? after a \* makes it lazy) and it would close after the fi...
`/%.+?%/` should do the trick. See greedyness of regex expressions. `[^%]` stops at the first `%`. But you want to include all characters between the two `%`s.
7,622
I want to gather the Edid information of the monitor. I can get it from the `xorg.0.log` file when I run `X` with the `-logverbose` option. But the problem is that If I switch the monitor (unplug the current monitor and then plug-in another monitor), then there is no way to get this information. Is there any way to g...
2011/02/18
[ "https://unix.stackexchange.com/questions/7622", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/4843/" ]
After more searching, it looks like the easiest way to do this is with `\_s`. So for example: ``` /hello\_sworld ```
The way I know of is not hard, but it's a little tedious. Replace every space in your search query with the following: ``` [ \t\n]\+ ``` (Note the space after the `[`.) This is regular expression matching syntax. Broken down, it means: * `[...]` means match any one of the list of characters inside the brackets. * `...
8,088
What is the largest number of pieces in a set for LEGO, Nanoblock, or any other brand? I recently bought a 6800-piece LOZ Block set (Chinese Nanoblock knockoff). I was wondering if there are sets in any block size or brand that have more pieces than that.
2016/10/01
[ "https://bricks.stackexchange.com/questions/8088", "https://bricks.stackexchange.com", "https://bricks.stackexchange.com/users/7751/" ]
Brickset has a query for sets with most pieces: [brickset.com/sets/query-45](http://brickset.com/sets/query-45) Top of the list is Taj Mahal with 5922 pieces.
There is a 11,800 nanoblock building Neuschwanstein Castle.
409,529
This particular example relates to Django in Python, but should apply to any language supporting exceptions: ``` try: object = ModelClass.objects.get(search=value) except DoesNotExist: pass if object: # do stuff ``` The Django model class provides a simple method *get* which allows me to search for *one...
2009/01/03
[ "https://Stackoverflow.com/questions/409529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42974/" ]
Believe it or not, this actually is an issue that is a bit different in each language. In Python, exceptions are regularly thrown for events that aren't exceptional by the language itself. Thus I think that the "you should only throw exceptions under exceptional circumstances" rule doesn't quite apply. I think the resu...
I agree with the other answer but I wanted to add that exception passing like this is going to give you a very noticeable performance hit. Highly recommended that you check to see if the result exists (if that's what filter does) instead of passing on exceptions. --- Edit: In response to request for numbers on this,...
62,487,263
I'm trying to pass data from my ag-Grid to a form in a new component by clicking on the row. I could get the data from the row by clicking on the cell via **onCellClicked** . But i don't know how to pass it to my other component now. here is my 2 interfaces : [![Ag-Grid](https://i.stack.imgur.com/TMH8O.png)](https://i....
2020/06/20
[ "https://Stackoverflow.com/questions/62487263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13095163/" ]
You need to convert your index to datetime ``` df.index=pd.to_datetime(df.index) ```
``` import pandas as pd df.index = df.index.astype('datetime64[ns]') df_train = df[(df.index > '2017-01-01') & (df.index < '2020-04-01')] df_test = df[df.index > '2020-04-01'] ```
4,065
At our University, we have in the first semester a very difficult C Introductory Course, that consists of presenting a shortened version of the language specification: What are for/while loops, if clause, what is a pointer and so on. But they never show how good C code in a more complicated application should look. Wh...
2017/12/21
[ "https://cseducators.stackexchange.com/questions/4065", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/1868/" ]
Too much, too fast ------------------ "First semester". If I parse correctly, you say 60% students are **new to programming**. You say "The following points knock them out: they don't know how to test, they don't know how to check for memory leaks, they have no concept of encapsulating". And you say "group assignment...
if they are new to programming start with flip-flops. I usually refer to Lombardi's "This year, we are going to start from the beginning. This, gentleman, is a football". It makes it funnier when they are British. You can delete this answer as I don't have comment permissions. ``` debian eclipse-cdt svn/git cmake jen...
47,964,186
Say you have a function `f:integers -> integers`, one should be able to lift this function to act on sets of integers. I.e. `f:sets of integers -> sets of integers`, by `f({a,b,...}) = {f(a),f(b),...}` How can one do this succinctly in python? That is, not involving iterables (loops), potentially something more nati...
2017/12/24
[ "https://Stackoverflow.com/questions/47964186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9137341/" ]
You can pass multiple arguments as well , like this: ``` def square(*args) : l = [] for i in args: l.append(i**2) return l ``` It'll return like: ``` >>>> square(1,2,3,4) >>>> [1,2,9,16] >>>> square(1) >>>> [1] >>>> square(1,6) >>>> [1,36] ```
``` from funcy import curry def lift(fn): return curry(map)(fn) ```
448,136
Out of interest, I'm looking for the word describing the usual cap of detergent for manual dish-washing. It consists of two parts which can be moved relatively to each other in vertical orientation so that pull up opens the bottle and pushing down closes it. The bottle is then turned upside-down and the detergent can b...
2018/05/28
[ "https://english.stackexchange.com/questions/448136", "https://english.stackexchange.com", "https://english.stackexchange.com/users/137985/" ]
[![enter image description here](https://i.stack.imgur.com/kXtwL.jpg)](https://i.stack.imgur.com/kXtwL.jpg) According to [numerous sources](https://www.google.de/search?q=push-pull%20cap&rlz=1C9BKJA_enDE701DE701&hl=de&prmd=sivn&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjLkYmYlqnbAhVIMJoKHa9pCuEQ_AUIEigC&biw=1024&bih=748), ...
Generally call it **push / pull cap**
17,175
Most recipes that call for Bisquick have volume measurements, but I've read it's better to measure most dry ingredients by mass (not to mention more convenient and less messy). So what is the proper conversion factor for Bisquick (i.e. it's density)? I assume it's close to that of flour, but [different types of flours...
2011/08/27
[ "https://cooking.stackexchange.com/questions/17175", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/6328/" ]
My recipes with buisquick work just fine and I generally find that 4 cups of buisquick weigh 500 g.
I sifted the bisquick and them measured very carefully one cup--on my electronic scale (caliberated of course) the weight was 4 ounces. I repeated this three times with the same results.
239,826
I'm trying to settle a debate with my girlfriend. She says "how quicker" is incorrect and you should always use "how much quicker". Which of these is [more?] correct? > > See how quicker the cars flow into the city than out of the city. > > > Or > > See how much quicker the cars flow into the city than out of ...
2015/04/16
[ "https://english.stackexchange.com/questions/239826", "https://english.stackexchange.com", "https://english.stackexchange.com/users/2929/" ]
The correct sentence is definitely: * "See how much quicker the cars flow into the city..." Unfortunately the presence of a structure on teh intarweb doesn't mean it is correct, and in this case most of the hits for "how quicker" are for constructs like "See how quicker response can help you...", which is an entirely...
Actually, I'm afraid both of you are wrong. The correct version is "See how much more quickly the cars flow into the city than out of the city." The base word is "quick" - fast, or speedy. The normal adjectival construction uses "-er", and the normal adverbial construction is "-ly". So "quicker" is an adjective, and...
46,266,458
I was wondering when I worked on a project if I could achieve this, but assuming it does not seem currently possible to get this behavior without any change of structure (I would really like to keep the hover inside its own class declaration), to you, what would be the cleanest solution ? **LESS** ``` @blue: blue; @b...
2017/09/17
[ "https://Stackoverflow.com/questions/46266458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2480215/" ]
This should do what you want: ``` .text-blue { color: @blue; a&:hover { color: @blue-darker; } } ``` [Fiddle](http://jsfiddle.net/d39f2ps5/)
I would use a `:link` CSS pseudoclass, because `<a>` without `href` is not treated as a hyperlink. See at <https://jsfiddle.net/jsqdom1s/> ``` .text-blue { color: @blue; a&:link:hover { color: @blue-darker; } } ```
25,730,192
I'm looking for a script that can extract the line with the highest latency hop from a traceroute. Ideally it would look at the max or avg of the 3 values by line. How can I so that? This is what I tried so far: ``` traceroute www.google.com | awk '{printf "%s\t%s\n", $2, $3+$4+$5; }' | sort -rgk2 | head -n1 ...
2014/09/08
[ "https://Stackoverflow.com/questions/25730192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131021/" ]
Try: ``` $ traceroute 8.8.8.8 | awk ' BEGIN { FPAT="[0-9]+\\.[0-9]{3} ms" } /[\\* ]{3}/ {next} NR>1 { for (i=1;i<4;i++) {gsub("*","5000.00 ms",$i)} av = (gensub(" ms","",1,$1) + gensub(" ms","",...
Stephan, you could try and use pchar a derivative of pathchar. It should be in the Ubuntu repository. I takes a while to run though so you need some patience. It will show you throughput and that will be much better than latency for determining the bottleneck. <http://www.caida.org/tools/taxonomy/perftaxonomy.xml> H...
12,885,037
I'm trying to extract a string from an url. The URL can either be: ``` http://page.de/s/project.html?id=1 ``` or ``` http://page.de/s/project.html?id=1/#/s/project.html?id=x ``` I need to extract the last `?id=-value` but I can't get it to go. This is what I have: ``` url_snip = key.replace("?id=","") ``` whi...
2012/10/14
[ "https://Stackoverflow.com/questions/12885037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/536768/" ]
You can use `enumerate` function, which accepts a list (`orig_list`) and return list of pairs, in which first element is index of item in `orig_list` and second element - that item from `orig_list`. Example: ``` orig_list = numpy.array([0.0, 35., 2., 44., numpy.pi, numpy.sqrt(2.)]) filter_func = lambda (idx, value):...
``` >>> def some_sort_of_f(data, condition = lambda x: x<4.): rez=[] for i in range(len(data)): if condition(data[i]): rez.append(i) return rez >>> data = [0.0, 35., 2., 44.] >>> some_sort_of_f(data) [0, 2] >>> ```
19,626,893
I'm using VS 2013 RTM Ultimate, and when I try to add a Controller to my MVC 5 project I get the following error: "There was an error running the selected code generator: 'The Parameter searchFolders does not contain any entries. Provide at least one folder to search files.' None of the scaffolders work basically, al...
2013/10/28
[ "https://Stackoverflow.com/questions/19626893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/469736/" ]
If you have recently installed a package with T4Scaffolding dependency (ex. MVCMailer uses T4Scaffolding.Core), then you can uninstall T4Scaffolding.Core and restart VS 2013. Notice that MvcMailer which caused this in my case, won't work in 2013. Best is to check your references or packages for suspects. **From comme...
My solution was to open VS installer, then go to modify and install .net framework templates
20,607,296
I need to check if a parameter (either string or int or float) is a "large" integer. By "large integer" I mean that it doesn't have decimal places and can exceed `PHP_INT_MAX`. It's used as msec timestamp, internally represented as float. `ctype_digit` comes to mind but enforces string type. `is_int` as secondary chec...
2013/12/16
[ "https://Stackoverflow.com/questions/20607296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/608395/" ]
I recommend the binary calculator as it does not care about length and max bytes. It converts your "integer" to a binary string and does all calculations that way. BC math lib is the only reliable way to do RSA key generation/encryption in PHP, and so it can easy handle your requirement: ``` $userNumber = '1233333333...
``` function isInteger($var) { if (is_int($var)) { return true; } elseif (is_numeric($var)) { // will throw warning if (!gmp_init($var)) { return false; } elseif (gmp_cmp($var, PHP_INT_MAX) >0) { return true; } else { return floor($var)...
4,041,469
I need to simplify $z^2+i=0$ and find all solutions for $z$. I have seen that the solutions to $z=\sqrt{i}=\left(\frac{1}{\sqrt{2}}+i\frac{1}{\sqrt{2}}\right)$ and $\left(-\frac{1}{\sqrt{2}}-i\frac{1}{\sqrt{2}}\right)$. I was hoping to find a similar solution for $z=\sqrt{-i}\,$ but my attempt gives me $z=\pm i^{\frac{...
2021/02/27
[ "https://math.stackexchange.com/questions/4041469", "https://math.stackexchange.com", "https://math.stackexchange.com/users/864339/" ]
Here it is another solution for the sake of curiosity. Let $z = x + yi$, where $x,y \in \mathbb{R}$. Then we have the following equation: \begin{align\*} z^{2} + i = 0 & \Longleftrightarrow (x+yi)^{2} = x^{2} - y^{2} + 2xyi = -i\\\\ & \Longleftrightarrow \begin{cases} x^{2} - y^{2} = 0\\\\ 2xy = -1 \end{cases}\\\\ &...
> > I was hoping to find a similar solution for z=−i−−√ but my attempt gives me z=±i32 > > > I don't see why. $z = x+yi$ and $z^2 = (x^2 -y^2) + 2xyi = -i$ so $x^2-y^2 = 1$ and $2xy = -1$ so $x^2 =y^2$ and $x = \pm |y|$ but $2xy =-1$ is negative os $x = -y$ and so $2xy=-1\implies -2y^2 = 1\implies y =\pm \frac 1{...
211,515
I have an API that returns a JSON formatted array of users within a given pair of lat/ long bounds. I'm using this data to plot a number of markers on a map, based on the location of each user. I also want to render a HTML list on each client request so that I can show the list of plotted users alongside the map. Wha...
2013/09/14
[ "https://softwareengineering.stackexchange.com/questions/211515", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/80183/" ]
Return the data for the list and use client side templating to convert it into HTML. ``` GET http://yourwebserver.com/users.json [{ name: 'foo'}] ``` using a [Mustache.js](http://mustache.github.io/) template like this ``` Mustache.render('<ul>{{#.}}<li>{{name}}</li>{{/.}}</ul>', data) ``` With this aproach you ...
REST is a vary adaptive architecture (as I am sure you realize). The answer to your question I think has more to do with you as a programmer than anything else. For example, there is nothing wrong with the following API call ``` GET http://yourapi.com/users.json GET http://yourapi.com/users.html ``` These are two d...
9,580,218
A have an azure webrole with a test page and a service in that role. After publishing the role it doesn't start automatically, only at first use. So if the role is shut down for some reason the first usage after that is quite slow. Is there a way to make webroles start automatically right after they are deployed (eith...
2012/03/06
[ "https://Stackoverflow.com/questions/9580218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1143406/" ]
Check out the [auto start feature of IIS 7.5](http://www.techbubbles.com/aspnet/auto-start-web-applications-in-aspnet-40/). Make sure you set osFamily="2" for the webrole so that it uses the Windows 2008 R2 OS. Edit: We're still stuck on osFamily="1" for technical reasons, so we haven't been able to implement auto sta...
A role is typically restarted about once a month, for OS maintenance of either the Guest or the underlying Host OS. What you're more likely to see is AppPool timeout due to inactivity, which will exhibit the same type of initial-hit delay. The default timeout is 20 minutes. You can change the timeout via elevated start...
11,755,248
I'm trying to authenticate a user using AJAX wrapped with jQuery to call a PHP script that queries a MySQL database. I'm NOT familiar with *any* of those technologies but I (sorta) managed to get them working individually, but I can't get the jQuery, AJAX and HTML to work properly. **[Edit:]** I followed [Trinh Hoang ...
2012/08/01
[ "https://Stackoverflow.com/questions/11755248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1292652/" ]
First if you want to submit form using ajax, you must `return false` from your submit function. Otherwise your browser will handle it and redirect you to another page. If you want to return an object from PHP, you must convert it to json using `json_encode`, for example: ``` //PHP $return = array("url" => "http://www...
You have no ending `;`'s on functions. Should be: ``` function changeMessage(message) { document.getElementById("message").innerHTML = message; }; $(document).ready(function() { $("#form").submit(function() { changeMessage("Checking"); //check the username exists or not from ajax $.p...
7,127,308
I have webservice(WCF) and MembershipProvider/RoleProvider to check credentials. When service called - various methods call providers to get user, get login name by Id, get Id by login name and so on. End result - When looking in Profiler - I can see lot of chat. I can easily incorporate caching into MembershipProvid...
2011/08/19
[ "https://Stackoverflow.com/questions/7127308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/509600/" ]
Absolutely, avoiding a round trip to the DB server pays off. Is not only the memory cache issue. Running a query, even a trivial one, is quite a complex process: * the connection has to be opened and authenticated. It gets amortized with connection pooling, true, but even a pooled connection still requires one extra ...
Depends. What happens when you want to delete or disable a user's account and have the change take effect immediately? You need to make sure that all modifications to user accounts are always reflected in the cache on all of your web servers. But ultimately, it is quite likely that avoiding the network IO (which is wh...
6,830,116
I just started learning Ruby coming from Java. In Java you would use packages for a bigger projects. Is there anything equivalent to that in Ruby? Or what is the best way to achieve a package like setting? The way I'm doing it right now is 'load'ing all the needed class into my new Ruby file. Isn't there a way to tell...
2011/07/26
[ "https://Stackoverflow.com/questions/6830116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/863451/" ]
There's three kinds of package loading in Ruby: * Explicitly loading a library with `require` * Implicitly loading a library using `autoload` * Importing a library with `gem` The `require` method is the most direct and has the effect of loading in and executing that particular file. Since that file may go on to `requ...
You probably want to use `require` rather than load, since it should take care of circular references. If you want to grab all the files in a given folder, that's easy enough: ``` Dir.foreach("lib"){|x| require x} ``` Your other option is to have a file that manually requires everything, and have your other files r...
73,600,074
I want to start by saying that I am a teacher and have very little experience coding. I only have a cursory understanding of how to manipulate cell values in pre-existing code. I created a spreadsheet for my school district to help teachers streamline the creation of student progress reports. On the .xlsm file I used t...
2022/09/04
[ "https://Stackoverflow.com/questions/73600074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19916353/" ]
> > Is there a way to add/download that branch and add it to my repository, so that I can try it out? > > > Sure! First, add a [remote](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) to your local repository pointing at the fork. E.g., if you repository was named `example` and I had forked it, you...
TL;DR ===== * run `git remote add` * run `git fetch` * profit! Long ==== The bottom line is that you need to copy their *commits*. You do not need to copy their "branch" unless, by the word "branch", you mean "the set of commits in question". > > ... without having to clone the repository > > > The act of copy...
1,828,999
How can I solve $$\begin{cases} \sin^2(y\_1) = \frac{1}{2}\sin^2(\frac{y\_1+y\_2}{2})\\ \sin^2(y\_2) = \frac{1}{2}(\sin^2(\frac{y\_1+y\_2}{2})+1) \end{cases}$$ where $$\space y\_1,y\_2 \in [0,\frac{\pi}{2}] $$ Thanks a lot!
2016/06/16
[ "https://math.stackexchange.com/questions/1828999", "https://math.stackexchange.com", "https://math.stackexchange.com/users/348263/" ]
$\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\half}{{1 \ov...
It only comes down to basic high school math$$I=\int\_0^1x\ln\left(\frac{1+x}{1-x}\right)dx=\int\_0^1x\ln(1+x)dx-\int\_0^1x\ln(1-x)$$For the first integral we substitute $u=1+x$ and for the second integral we substitute $v=1-x$ $$=\int\_1^2(x-1)\ln{x}\space dx-\int\_0^1(1-x)\ln x\space dx=\int\_0^2(x-1)\ln x\space dx$$...
35,333,336
I would like to add a shadow effect to my UITextField currently what I'm achieving is this: [![enter image description here](https://i.stack.imgur.com/kjYUh.png)](https://i.stack.imgur.com/kjYUh.png) As you can see the shadow is not rounded in the corners. My code: ``` mNickname.layer.borderWidth = 1 ...
2016/02/11
[ "https://Stackoverflow.com/questions/35333336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4760175/" ]
try this, code is in objective C, but same for swift ``` self.textField.layer.shadowColor = [[UIColor blackColor] CGColor]; self.textField.layer.shadowOffset = CGSizeMake(0.0, 1.0); self.textField.layer.shadowOpacity = 1; self.textField.layer.shadowRadius = 0.0; ```
Try to change shadowOpacity to 0.5 Also, could you send full customisation of this textField?
49,447,175
Need assistance on a macro which tries to download the extract from SAP system but stops exactly in a place where it need to download. But the same problem doesn't arise when manually done. Below are the steps which we follow in SAP system: * In first step, Enter the TCode: ZFIS and do the below selection (Finance Ne...
2018/03/23
[ "https://Stackoverflow.com/questions/49447175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8746502/" ]
To check the issue: 1. Go to Visual studio `Preferences >> SDK Location >> Android` 2. Select the Locations tab Here you will see the Location targeted for each, we are facing issue with JDK. 3. Click on the folder selector so to navigate to the current location been pointed. 4. In my case it was pointing to `"usr/"...
Reinstall [JDK 1.8](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). [MS Instructions](https://learn.microsoft.com/en-us/xamarin/android/troubleshooting/questions/update-jdk?tabs=windows) [![enter image description here](https://i.stack.imgur.com/eAhNG.png)](https://i.stack.imgur....
886,508
I'm trying to find the integral of $y = x\sin^2 (x^2)$. Can someone help please? I've tried converting it to $x(\frac{1}{2} -\frac{1}{2}\cos(2x^2))$ and using integration by parts but it doesn't seem to help. Thanks.
2014/08/03
[ "https://math.stackexchange.com/questions/886508", "https://math.stackexchange.com", "https://math.stackexchange.com/users/167774/" ]
Hint: First let $u=x^{2}$ and notice that $\sin^{2}(u)=\frac{1-\cos(2u)}{2}$
1) $x \sin^2(x^2)dx = \frac{1}{2}\sin^2(x^2)d x^2$ 2) $\sin^2 t = \frac{1 - \cos 2t}{2}$
26,742
Reading [this article](http://www.douglasadams.com/dna/19990901-00-a.html) by the fantastic Douglas Adams I came across this interesting quote: > > ‘[I]nteractivity’ is one of those neologisms that Mr Humphrys likes to dangle between a pair of verbal tweezers, but the reason we suddenly need such a word is that durin...
2011/05/24
[ "https://english.stackexchange.com/questions/26742", "https://english.stackexchange.com", "https://english.stackexchange.com/users/3320/" ]
I wish I had come sooner. You see, my good reptilian sister was to put your race in its place, but, alas, she was slain by a sacrilegious buffoon: ![enter image description here](https://i.stack.imgur.com/sVfO3.jpg) As a classicist, I'd begin with what words the Ancients used themselves. The following two are (most p...
How about something like "unicapital". From **unus** *L. one* + **capitis** *L. head* > > The unicapital inhabitants of the Sol System consume comparatively few facial tissues. > > >
34,770,255
I am new to Gherkin and BDD. We are doing BDD regression tests with Squish. Our application is very complex - similar to a flight simulator. Now I ask myself how to write the tests in Gherkin. As we have a large number of variables as preconditions to a certain situation I would normally put a lot of ``` Given some ...
2016/01/13
[ "https://Stackoverflow.com/questions/34770255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions. Gherkin serves two purposes: serving as your project’s documentation and automated tests. Gherkin’s grammar is defined in the Treetop grammar that is part of the Cucumber codebase. To understand Gherkin in a better ...
Gherkin is the language that Cucumber understands. It is a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented [More here](https://github.com/cucumber/cucumber/wiki/Gherkin) From above statement my understanding is. You don't need ...
30,967
In sentences like "He taught them so that they would understand," if the speaker is certain that "they understand," could we use the normal past tense as *Les enseñaron para que entendieron* instead of *entendieran*?
2019/07/15
[ "https://spanish.stackexchange.com/questions/30967", "https://spanish.stackexchange.com", "https://spanish.stackexchange.com/users/23295/" ]
No, you cannot. You base things off of whether something has already happened at the particular moment in the narrative sequence. He taught them at moment X so that they would learn at some point *after* moment X. Because the very nature of the preposition *para* obligates such an ordering, it's impossible to use indi...
"para que", just like other purpose linkers like "a fin de que / con el objeto/propósito de que", needs to be followed by subjunctive because, at the time when the main action is/was performed, the result is/was not known: * Les enseño para que entiendan. (I teach you that you will understand.) * Les enseñé para que e...
58,243
Given any unsigned 16 bit integer, convert its *decimal form* (i.e., base-10) number into a 4x4 ASCII grid of its bits, with the most-significant bit (MSB) at the top left, least-significant bit (LSB) at bottom right, read across and then down (like English text). Examples -------- ### Input: 4242 ``` +---+---+---+-...
2015/09/18
[ "https://codegolf.stackexchange.com/questions/58243", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/45116/" ]
GNU sed + dc, 116 ================= Score includes +1 for `-r` flags to `sed`: ``` s/.*/dc -e2o&p/e : s/^.{,15}$/0&/;t s/./| & /g s/.{16}/\n+---+---+---+---+\n&|/g y/01/ #/ s/\n([-+]+)(.*)/\1\2\n\1/ ``` Test output: ``` $ { echo 4242 ; echo 33825 ; } | sed -rf 16bitgrid.sed +---+---+---+---+ | | | | # | +---...
[Vyxal](https://github.com/Vyxal/Vyxal), 31 bytes ================================================= ``` \+3-4*\|?b16∆Z\#*2↳ʁ+4ẇṠv"fǏvǏ⁋ ``` [Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCJcXCszLTQqXFx8P2IxNuKIhlpcXCMqMuKGs8qBKzThuofhuaB2XCJmx492x4/igYsiLCIiLCI0MjQyIl0=) ``` ? ...
1,255,917
I newly installed Ubuntu 20.04 in Lenovo i3 PC, but the Snap Store application is not shown in the application menu. When I check on Ubuntu store it is shown that the Snap Store is already installed.
2020/07/03
[ "https://askubuntu.com/questions/1255917", "https://askubuntu.com", "https://askubuntu.com/users/1101669/" ]
The '*Ubuntu Software*' application that you find pre-installed in your system is the Snap Store *itself*. Ubuntu shipped the Snap Store as the default software store application on 20.04 (source: [this OMG! Ubuntu article](https://www.omgubuntu.co.uk/2020/02/ubuntu-snap-store-transition)). You can verify this by runn...
Launch the Snap Store from the terminal instead. Open the terminal and type: ``` snap run snap-store ``` Alternatively you can search for "snap store" in the Software app, click it to bring up the Snap Store information screen, and launch the Snap Store by clicking the `Launch` button.
2,705,607
I have a dictionary in C# like ``` Dictionary<Person, int> ``` and I want to sort that dictionary *in place* with respect to keys (a field in class Person). How can I do it? Every available help on the internet is that of lists with no particular example of in place sorting of Dictionary. Any help would be highly ap...
2010/04/24
[ "https://Stackoverflow.com/questions/2705607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/302047/" ]
You can't sort a `Dictionary<TKey, TValue>` - it's inherently unordered. (Or rather, the order in which entries are retrieved is implementation-specific. You shouldn't rely on it working the same way between versions, as ordering isn't part of its designed functionality.) You *can* use [`SortedList<TKey, TValue>`](htt...
Due to this answers high search placing I thought the LINQ **OrderBy** solution is worth showing: ``` class Person { public Person(string firstname, string lastname) { FirstName = firstname; LastName = lastname; } public string FirstName { get; set; } public string LastName { get; s...
59,989,280
We have a situation in oracle SQL. ``` select x from A where x=10; ``` so if `10` exists in the column, value will be displayed `10`. but if it doesn't exists I want to display `null`. I tried `NVL` but it is not returning anything as data is not displaying. Could you please help me to resolve this.
2020/01/30
[ "https://Stackoverflow.com/questions/59989280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you want to return multiple rows from the original `SELECT` then you can use `UNION ALL` to add a row when the value does not exist: ```sql SELECT x FROM A WHERE x = 10 UNION ALL SELECT NULL FROM DUAL WHERE NOT EXISTS ( SELECT x FROM A WHERE x = 10 ) ``` If your table is: ```sql CREATE TABLE a ( x...
Try this: ``` select max(x) from A where x = 10; --this will return null if no data ``` And then you can do a NVL: ``` select nvl(max(x), 0) from A where x = 10; --this will return 0 if no data ```
745,095
For a second order ODE y''+10y'+ 21y=0 which was reduced to this quadratic expression x^2+10x+21=0 * is there any way to tell whether the expression is bounded that is y(x) is either periodic or has a limit 0 as x tends to infinity? \*Does periodic means having only complex solutions?
2014/04/08
[ "https://math.stackexchange.com/questions/745095", "https://math.stackexchange.com", "https://math.stackexchange.com/users/133532/" ]
To answer the second part, in the differential equation $$ ay''(x)+by'(x)+cy(x)=0 $$ you would need $b=0$ and $ac>0$ to get periodic solutions. With complex, but not purely imaginary eigenvalues you get oscillating solutions where the amplitude changes with an exponential function.
Suppose that you want to solve the quadratic equation, $ax^2 + bx + c = 0$. The quadratic formula gives the two roots as $$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ Now, take a look at the surd, $\sqrt{b^2 - 4ac}$. If $b^2 - 4ac$ was negative, then the roots would be complex, because the square root of a negative real...
2,893,435
This is an excercise from Spivak's Calculus. Show that if $x^n=y^n$ and $n$ is odd, then $x=y$. Hint: first explain why it suffices to consider only the case x and y greater than 0, then show that x smaller than y or greater y are both impossible. I try to prove this by using induction. The base case $n=1$ is correct....
2018/08/24
[ "https://math.stackexchange.com/questions/2893435", "https://math.stackexchange.com", "https://math.stackexchange.com/users/456122/" ]
It seems unlikely that induction is a good approach here. If $x$ and $y$ have opposite signes, then obviously you can't have $x^n=y^n$. Now, let us assume that $x,y\geqslant0$. The case in which $x,y\leqslant0$ is similar. Note that$$x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\cdots+xy^{n-1}).$$So, if $x^n=y^n$, then $x=y$ or $x^...
For fun: $n \in \mathbb{Z^+}$, odd . 1) $x=y=0$ is a solution. 2) Let $(x,y) \not =(0,0)$. $x^n-y^n=0$; $(\frac{x}{y})^n =1$, implies $\frac{x}{y}=1$, since $n \in \mathbb{Z^+}$, $n$ odd.
4,019,609
I just made a Linq-to-SQL .dbml file in Visual Studio 2010. I'm getting the following 2 errors, a total of 60 times in total, mostly the first. 1. The type or namespace name 'Linq' does not exist in the namespace 'System.Data' 2. The type or namespace name 'EntitySet' could not be found I've found various similar qu...
2010/10/25
[ "https://Stackoverflow.com/questions/4019609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/80907/" ]
I've been having the same problem on exactly the same config except for my Windows 7 is 64-bit. Got it solved by doing `[project name] -> References -> Add reference -> System.Data.Linq` Why do you add references by hand?
You can try following: Add reference to **System.Data.Linq** (Right click on References folder | Select Add Reference | Select .Net tab(Is default selected) | select **System.Data.Linq** reference | click OK. I hope this will help you or someone else.
982,214
I want my (ExtJS) toolbar buttons **not** to grab the focus on the web page when they are clicked, but to do their "thing" while leaving the focus unchanged by the click. How do I do that?
2009/06/11
[ "https://Stackoverflow.com/questions/982214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121200/" ]
I don't think there's an easy way to do what you want to do because it's the browser's default behaviour. You could of course blur() the button as soon as it is clicked, but that would simply unselect everything. To have the previously active object regain focus, you'd have to create a "memory" of sorts by adding a bl...
Maybe you should try to use `stateful` and state change properties for form fields or whatever to get focus back?
4,274,114
If A = $\begin{bmatrix} 1 & -1 \\ 0 & -2 \end{bmatrix}$, set B = {X ∈ $M\_2(\mathbb{R})$∣AX + $X^\intercal$A = 0} Find a homogeneous system that will give all the elements of B. My attempt: AX + $X^\intercal$A = 0 AX = $-$ ($X^\intercal$A) ($\cfrac{1}{A}$) AX = $-$ ($X^\intercal$A)$(\cfrac{1}{A})$ X = $-$ $X^\int...
2021/10/11
[ "https://math.stackexchange.com/questions/4274114", "https://math.stackexchange.com", "https://math.stackexchange.com/users/834929/" ]
Your step when apply inverse both side is not correct because you are multiplying from the left and from the right, use instead $$\begin{bmatrix} 1 & -1 \\ 0 & -2 \end{bmatrix} \begin{bmatrix} a& b \\ c& d \end{bmatrix}=- \begin{bmatrix} a& c \\ b& d \end{bmatrix} \begin{bmatrix} 1 & -1 \\ 0 & -2 \end{bmatrix} $$ tha...
You cannot infer from the step $AX=-(X^TA)$ that $A^{-1}AX=-(X^TA)A^{-1}$. When two square matrices are equal, say $X=Y$, you can left-multiply both sides by a matrix $M$ to get another equality $MX=MY$, or you can right-multiply both sides by $M$ to get $XM=YM$. However, you cannot infer that $MX=YM$, because matrix ...
922,774
I've a method that I want to be able to accept either a single string (a path, but not necessarily one that exists on the machine running the code) or a list/tuple of strings. Given that strings act as lists of characters, how can I tell which kind the method has received? I'd like to be able to accept either standar...
2009/05/28
[ "https://Stackoverflow.com/questions/922774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68457/" ]
You can check if a variable is a string or unicode string with * Python 3: ``` isinstance(some_object, str) ``` * Python 2: ``` isinstance(some_object, basestring) ``` This will return `True` for both strings and unicode strings As you are using python 2.5, you could do something like this: ``` if isin...
Check the type with isinstance(arg, basestring)
25,313,784
I would like to list the chars used in a string (sorted) with a function like this one : ``` def foobar(string): return ???? string = 'what a nice day' print foobar(string) ``` This should print the string `acdehintwy` What would be the foobar() function? I tried OrderedDict.fromkeys(items) but I can't sort i...
2014/08/14
[ "https://Stackoverflow.com/questions/25313784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3942297/" ]
``` s='what a nice day' print ("".join(set(s.replace(" ","")))) acedihntwy ``` A [set](https://docs.python.org/2/library/sets.html) will remove the duplicates and `s.replace(" ","")` will remove the spaces ``` def foobar(s): return "".join(set(s.replace(" ",""))) In [4]: foobar("what a nice day") Out[4]: 'aced...
Use a [set](https://docs.python.org/2/library/stdtypes.html#set-types-set-frozenset). ``` >>> mystring = 'what a nice day' >>> chars = sorted(set(mystring.replace(" ", ""))) >>> print(chars) ['a', 'c', 'd', 'e', 'h', 'i', 'n', 't', 'w', 'y'] >>> "".join(chars) 'acdehintwy' ```
5,448,545
Consider: ``` http://example.com/page.html?returnurl=%2Fadmin ``` For `js` within `page.html`, how can it retrieve `GET` parameters? For the above simple example, `func('returnurl')` should be `/admin`. But it should also work for complex query strings...
2011/03/27
[ "https://Stackoverflow.com/questions/5448545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/641151/" ]
I do it like this (to retrieve a specific get-parameter, here 'parameterName'): ``` var parameterValue = decodeURIComponent(window.location.search.match(/(\?|&)parameterName\=([^&]*)/)[2]); ```
I have created a simple JavaScript function to access GET parameters from URL. Just include this JavaScript source and you can access `get` parameters. E.g.: in <http://example.com/index.php?language=french>, the `language` variable can be accessed as `$_GET["language"]`. Similarly, a list of all parameters will be st...
3,980,773
I'm building a new database for a web-based application and find that I am frequently having to decide between flexibility of the model and meaningful foreign keys to enforce referential integrity. There are a couple of aspects of the design that lead me towards writing triggers to do what FKs would normally do: 1. P...
2010/10/20
[ "https://Stackoverflow.com/questions/3980773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86265/" ]
From your description, it seems to me the triggers will get more and more complex over time, and will end up being a nightmare to maintain. I have had to maintain this kind of "ObjectId" data schema in my career, and my experience with it has always been negative. The maintenance becomes very painful over time, and it...
Using triggers to implement a more complex referential integrity rule is ok, but can be confusing to new developers so make sure it's well documented internally. Having clients customize their database structure is asking for trouble though. It's very likely to cause maintenance problems down the road. A better option...
3,987,683
How do I install a specific version of a formula in homebrew? For example, postgresql-8.4.4 instead of the latest 9.0.
2010/10/21
[ "https://Stackoverflow.com/questions/3987683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62612/" ]
Homebrew changed recently. Things that used to work do not work anymore. The easiest way I found to work (January 2021), was to: * Find the `.rb` file for my software (first go to [Formulas](https://github.com/Homebrew/homebrew-core/tree/master/Formula), find the one I need and then click "History"; for CMake, this is...
On the newest version of homebrew (0.9.5 as of this writing) there will be a specific recipe for the version of the homebrew keg you want to install. Example: ```sh $ brew search mongodb mongodb mongodb24 mongodb26 ``` Then just do `brew install mongodb26` like normal. In the case that you had already installed...
4,962,269
This is my homework which is due tomorrow and I have been trying to do it for the past 5 hours, but I can't figure it out. I understand what I have to do, but I just don't know where to start. If you could help me to just get started or to give some advice it would be great. Can i just have the answer I cant figure it ...
2011/02/10
[ "https://Stackoverflow.com/questions/4962269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/612052/" ]
1. Create an array of 27 elements. [Official trail on Arrays](http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html) 2. Iterate through all characters of the string, using for instance an ordinary for loop ([Official trail on the `for` statement](http://download.oracle.com/javase/tutorial/java/nutsan...
So, basically you are trying to count the numbers of occurrence of alphabets in a String. The returning array is size 27 because there are 26 alphabets + 1 cell of non-alphabet characters. What you need to do is simple, 1) create array of size 27 (no need for special initialization since java initialize int array ...
2,665,056
How do I parameterise $x^2-y^2+z^2=0$ where $y\in [0,1]$ ? Here's my thought process right now, but I'm not sure: $x^2-y^2+z^2=0$ $x^2+z^2=y^2$ Let $y=u$ Then can you just parametrise it like you would a circle?
2018/02/24
[ "https://math.stackexchange.com/questions/2665056", "https://math.stackexchange.com", "https://math.stackexchange.com/users/499701/" ]
Yes, so $(x,y,z)=(u\cos t, u, u\sin t)$ is a parametrization, where $u\in[0,1]$ and $t\in[0,2\pi)$. Since it is a surface, we have two parameters, $u$ and $t$.
$y=\sin t$, $ t \in [0,π/2].$ Then $x^2+z^2 = \sin^2 t$ ; $x=\sin t \cos s$; $z= \sin t \sin s$, where $s \in [0,2π).$
45,989,509
I want to insert a syncfusion linearlayout listview, but for some reason it's not displaying any items/data, and I'm not getting any errors at the same time, I tried changing binding syntax and a couple things, but I cannot seem to get it right. This is my xaml: ``` <syncfusion:SfListView x:Name="listView...
2017/08/31
[ "https://Stackoverflow.com/questions/45989509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7560262/" ]
You can do that with a classic loop: ``` let input = [("Ann", 1), ("Bob", 2)] var guests: [Guest] = [] for each in input { guests.append(Guest(name: each.0, age: each.1)) } ``` However, it can be done more concisely (and with avoidance of `var`) using functional techniques: `let guests = [("Ann", 1), ("Bob", 2...
``` //MARK: Call method to create multiple instances createInstance([("Ann", 1), ("Bob", 2)]) func createInstance(_ input: Array<Guest>) { for each in input { guests.append(Guest(name: each.0, age: each.1)) } } ```
26,183,703
I'm stuck on making a loop. I'd like to input the first key in the Teacher1 dict and it's corresponding value into my payload dictionary and run my code on the payload dict. Then the next item in the students dict would be inputted into the payload dict and run till I go through all the values in the students dict. Tha...
2014/10/03
[ "https://Stackoverflow.com/questions/26183703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2785334/" ]
You can just loop over the keys of the dictionary ``` payload = {} for user_id in teacher1: payload['User_id'] = user_id payload['Password'] = teacher1[user_id] # Do some processing with payload here ```
You can do something like this: ``` for k, v in Teacher1.items(): Payload = {} Payload['User_id'] = k Payload['Password'] = v # do payload processing ```
16,942,580
I am trying to scroll into view so that the very last item in a vertical listivew is always showing, but ListView.ScrollIntoView() never works. I have tried: ``` button1_Click(object sender, EventArgs e) { activities.Add(new Activities() { Time = DateTime.Now, ...
2013/06/05
[ "https://Stackoverflow.com/questions/16942580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/152598/" ]
The problem with `ActivityList.ScrollIntoView(ActivityList.Items[ActivityList.Items.Count - 1]);` and similiar "solutions", at least from what I'm experiencing, is that when the ListBox contains the same item more than once, it jumps to the first it finds, i.e. lowest index. So, it doesn't care about the index of the i...
The problem I faced was similar. I was adding programatically to a ListBox and needed the last item added to be visible. After tying various methods I found the following to be the simplest and the best ``` lstbox.Items.MoveCurrentToLast(); lstbox.ScrollIntoView(lstbox.Items.CurrentItem); ```
6,558
I am trying to get back in shape and started running. After a few runs (treadmill at the gym) both my knees are really hurting. * Is this due to a lack of stretching? * Is this overcompensating for weakness in other muscles ? What would i be doing that would make my knees hurt. I have run in the past and never had t...
2012/05/26
[ "https://fitness.stackexchange.com/questions/6558", "https://fitness.stackexchange.com", "https://fitness.stackexchange.com/users/751/" ]
When your knees hurt after running, it's usually an indication that your thigh/hip muscles are not strong enough, and your knees are bearing the brunt. You have to systematically strengthen your various leg muscles. Here's what has helped me (non-exhaustive list but covers the major categories) * [For the glutes](http...
Your running gait matters too. If unsure, you can get a physiotherapist or trainer (one that specialise in that) to assess your gait. Stretching does not really help. Some research out there suggests that stretching does not actually prevent injuries. It is better to do dynamic warm up - jumping jacks, slow jogs for 5...
237,639
Background: 600-ish years into the future. Humanity finally managed to make Earth uninhabitable and now lives in space. Some humans shed their flesh bodies and are now reduced to brains, their "bodies" being space ships. I am looking for a futuristic, but still science-based explanation which allows such a spaceship to...
2022/11/04
[ "https://worldbuilding.stackexchange.com/questions/237639", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/99331/" ]
The gel the brain is stored in reinforces the brain. It seeps into the brain and makes its internal structure sturdier, which makes the whole brain more resistant to acceleration. This could be done by nanites which builds stabilizing micro-structure within the brain which greatly enhance its structural integrity. Or ...
**Store the Brain as Energy** [![enter image description here](https://i.stack.imgur.com/OHTyv.jpg)](https://i.stack.imgur.com/OHTyv.jpg) Before the ship accelerates, the brain or the entire person is scanned, and the data is absorbed into the transporter pattern buffer. The buffer is a mechanical system built to be ...
33,618,681
No, I can't use generic Collections. What I am trying to do is pretty simple actually. In php I would do something like this ``` $foo = []; $foo[] = 1; ``` What I have in C# is this ``` var foo = new int [10]; // yeah that's pretty much it ``` Now I can do something like `foo[foo.length - 1] = 1` but that obvious...
2015/11/09
[ "https://Stackoverflow.com/questions/33618681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/433905/" ]
The simplest way is to create a new class that holds the index of the inserted item: ``` public class PushPopIntArray { private int[] _vals = new int[10]; private int _nextIndex = 0; public void Push(int val) { if (_nextIndex >= _vals.Length) throw new InvalidOperationException("No...
`foo[foo.Length]` won't work because foo.Length index is outside the array. Last item is at index `foo.Length - 1` After that an array is a fixed size structure if you expect it to work the same as in php you're just plainly wrong
28,009,942
This time I'm proving function calling other. `vars.c`: ``` int pure0 () { return 0; } int get0(int* arr) { int z = pure0(); return 0; } ``` My proof start - `verif_vars.v`: ``` Require Import floyd.proofauto. Require Import vars. Local Open Scope logic. Local Open Scope Z. Definition get0_spec := ...
2015/01/18
[ "https://Stackoverflow.com/questions/28009942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1234026/" ]
FIRST: When writing VST/Verifiable-C questions, please indicate which version of VST you are using. It appears you are using 1.4. SECOND: I am not sure this answers all your questions, but, "closed\_wrt\_vars S P" says that the lifted assertion P is closed with respect to all the variables in the set S. That is, S is...
By the way (unrelated to your question), the precondition ``isptr (eval_id _arr)` for get0 is probably unnecessary. It is implied already by ``(array_at tint sh arr 0 100) (eval_id _arr))`. Furthermore, suppose you did want the ``isptr (eval_id _arr)` in your precondition; you might consider writing it as, ``` PR...
3,229,833
I am developing a Java Application that uses Hibernate and is connected to an Oracle instance. Another client is looking to use the same application, but requires it run on MS SQL Server. I would like to avoid making changes to the existing annotations and instead create a package of xml files that we can drop in depen...
2010/07/12
[ "https://Stackoverflow.com/questions/3229833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/203583/" ]
I think that if you don't use `AnnotationConfiguration` when configuring your `SessionFactory`, the annotations will be omitted. So, use `Configuration`.
In my case: Rack and Slot are entities having custom ID Generators. I am using unidirectional one-to-one mapping. Dimension table will hold the data with a Autogenerated Custom ID as foreign key for multiple tables (Rack and Slot for example here). And my [schema](http://i.stack.imgur.com/oQKHJ.png) looks like this ...
2,717,954
When i press a button in my app, I need to return to the last activity. Any ideas?
2010/04/27
[ "https://Stackoverflow.com/questions/2717954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/269671/" ]
This is for a situation where the same fragment may sometimes be the only fragment in an activity, and sometimes part of a multi-fragment activity, for example on a tablet where two fragments are visible at the same time. ``` /** * Method that can be used by a fragment that has been started by MainFragment to termin...
You can spoof a up button call on back button press: ``` @Override public void onBackPressed() { onNavigateUp(); } ```
25,905,540
For some reason, I can't use the `Tkinter` or `tkinter` module. After running the following command in the python shell ``` import Tkinter ``` or ``` import tkinter ``` I got this error > > ModuleNotFoundError: No module named 'Tkinter' > > > or > > ModuleNotFoundError: No module named 'tkinter' > > > ...
2014/09/18
[ "https://Stackoverflow.com/questions/25905540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4021630/" ]
On CentOS7, to get this working with Python2, I had to do: ``` yum -y install tkinter ``` Noting this here because I thought that there would be a pip package, but instead, one needs to actually install an rpm.
We can use 2 types of methods for importing libraries 1. work with `import library` 2. work with `from library import *` You can load tkinter using these ways: 1. `from tkinter import*` 2. `import tkinter`
34,579,657
The last `for` loop of my program isn't running. I have realised this is because the arrays are ending up as `null`, therefore it is skipping this part. I am not sure what I am doing wrong when splitting the text as this seems to be making everything go to `null`. Still unsure. ``` String[] splituptext; for (int loop...
2016/01/03
[ "https://Stackoverflow.com/questions/34579657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5678721/" ]
Regex ranges don't do what you think they do. A `[x-y]` range contains all characters in ascii from `x` to `y`. Therefore `[0-255]` matches characters from `0` to `2` (aka `0`, `1` and `2`) and `5` or in short - `[0125]`. --- To match a number from `0` to `255`, you could do: ``` \d\d?|1\d\d|2([0-4]\d|5[0-5]) ``` ...
Here is a regex variation (based on [ndn](https://stackoverflow.com/users/2423164/ndn)'s [answer above](https://stackoverflow.com/a/34579651/3832970)) that will check if *the entire input text* is a valid IP: ``` ^(?:(?:\d{1,2}|1\d{2}|2(?:[0-4]\d|5[0-5]))\.){3}(?:\d{1,2}|1\d{2}|2(?:[0-4]\d|5[0-5]))$ ``` See [regex d...
3,986
Overview ======== Yesterday I posted the following question [Please make [storage] and [image-storage] synonyms of [online-storage]](https://webapps.meta.stackexchange.com/questions/3982/please-make-storage-and-image-storage-synonyms-of-online-storage). At this time, it received two comments mentioning that [online-st...
2016/03/15
[ "https://webapps.meta.stackexchange.com/questions/3986", "https://webapps.meta.stackexchange.com", "https://webapps.meta.stackexchange.com/users/88163/" ]
I don't think we can come up with a definitive list. It'd be as hard to come up with a list of tags that *aren't* meta-tags. I think there are some non-application-specific tags that are okay, even if they could possibly be considered meta-tags. * [privacy](https://webapps.stackexchange.com/questions/tagged/privacy ...
Hacking tags ============ I'm using "hacking" here to refer to the activity of explore the limits of web applications and to find not too easy to figure out how tos which result in a "hack" or "clever solution" Below there are a list of tags that could be "hacking tools" grouped in four categories, including the numb...
14,797,401
I want to pass raw html from view to controller. Iam trying to do it with jquery ajax request. Everything is ok until object with raw html passes to controller. What is my mistake? Here is my model, controller and jquery. Thank you. Model ``` public class NewsEditionModel { public string Title { get; set; } ...
2013/02/10
[ "https://Stackoverflow.com/questions/14797401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1765751/" ]
Just add `<ValidateInput(False)> _` to your contoller post req.
You can use this example ``` $.ajax({ url: '@Url.Action("AddText", "News")', data: {obj: JSON.stringify({ Text: text, Title: title, SubTitle: "" })}, contentType: 'application/json', dataType: 'json', success: function (data) { alert(data); } }); ```
26,182,824
Can you please tell me if it is possible to have a 2D array with two day types. I am new to C#. For example: `array[double][string]` I have radius of flowers alone with their name as follows: ``` 4.7,Iris-setosa 4.6,Iris-setosa 7,Iris-versicolor 6.4,Iris-versicolor 6.9,Iris-versicolor 5.5,Iris-versicolor 6.5,Iris-v...
2014/10/03
[ "https://Stackoverflow.com/questions/26182824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1255576/" ]
As comments have said, you likely want a simple class for this: ``` public class Flower { public double Radius { get; set; } public string Name { get; set; } } var l = new List<Flower>(); l.Add(new Flower() { Radius = 4.7, Name = "Iris-setosa" }); l.Add(new Flower() { Radius = 4.6, Name = "Iris-setosa" }...
If you don't want to create a class for some reason you can also use [Anonymous Types](http://msdn.microsoft.com/en-us/library/bb397696.aspx), so for your case it will be something like: ``` var a1 = new[] { new {Radius = 4.7, Name = "Iris-setosa"}, new {Radius = 4.6, Name = "Iris-setos...
831,102
Is there a VB6 equivalent to the C/C++ 'continue' keyword? In C/C++, the command 'continue' starts the next iteration of the loop. Of course, other equivalents exist. I could put the remaining code of the loop in an if-statement. Alternatively, I could use a goto. (Ugh!)
2009/05/06
[ "https://Stackoverflow.com/questions/831102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91769/" ]
There is no equivalent in VB6, but later versions of VB do introduce this keyword. This article has a more in-depth explanation: <http://vbnotebookfor.net/2007/06/04/the-continue-statement/> Perhaps you can restructure your code to either add an if statement or have the loop just call a function that you can return fr...
I´m an idiot :P thanks MarkJ ``` For index As Integer = 1 To 10 If index=9 Then Continue For End If 'some cool code' Next ``` No sorry only for .net. I think you have to use goto, I know it looks ‘cleaner’ to use a continue but there is nothing wrong with going the if route. ...
5,855,505
I have a custom Adapter that renders some items in a ListView. I need to show an icon on the ListView's items, if the item's text is ellipsized, and hide it if there's enough room for the text to finish. I have access to the button in getView method of my adapter (where I set the text) but the ellipses are not added im...
2011/05/02
[ "https://Stackoverflow.com/questions/5855505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54538/" ]
> > [public int getEllipsisCount (int line)](http://developer.android.com/reference/android/text/StaticLayout.html#getEllipsisCount%28int%29): > > > Returns the number of characters to be ellipsized away, or 0 if no ellipsis is to take place. > > > So, simply call : ``` if(textview1.getLayout().getEllipsisCount...
You can either set your text to marque. add this in your code might help..... ``` android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:scrollHorizontally="true" android:freezesText="true" android:marqueeRepeatLimit="marquee_forever" ``` You can also...
37,272,814
``` @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("abcde").password("123456").roles("USER"); } ``` and i am getting an error in the last line, it says that ``` The type org.springframework.security.authentication.Authenticat...
2016/05/17
[ "https://Stackoverflow.com/questions/37272814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4505897/" ]
Add spring-security-core.jar to the Build Path of the project. If you are using Eclipse, right click on project --> Properties --> Java Build Path --> Libraries --> click Add jars or Add external jars and point to the jar file. Also, do clean build.
If you use gradle, it's more easy check if you have these libraries ... compile * spring-security-web * spring-security-config * spring-security-taglibs * spring-security-ldap * spring-boot-starter-ws * spring-security-core
886,744
I want to install JDK 1.5 and 1.6 on XP, is it possible? how to do it Also, I am using Eclipse how to setup using different JDK for different projects? thanks.
2009/05/20
[ "https://Stackoverflow.com/questions/886744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/103340/" ]
I have solved this by creating batch files for different Java versions. 1. I have installed the Java versions I need to have 2. Whenever, I need to use Java I run the appropriate batch file and set the environment variables to work with that Java version. **Java 8.bat** ``` @echo off echo Setting JAVA_HOME set JAVA...
There was a big mess with different incompatible JDK and JRE from 90s when Java was created and still this problem exists. The main rule is when you type in console: `java -version` and `javac -version` the result should be the same then you sure both JRE and JDK (JSDK) are compatible, so when you compile you can r...
84,605
For some time you could see pictures someone sent you via Hangouts in an album called "Hangouts". This vanished somehow. When you open a picture from Hangouts on the Computer, you can still see in the URL that there is some kind of album. The URL is in the form `https://plus.google.com/u/0/photos/albums/XXXXXXXXXXXXXX...
2015/09/18
[ "https://webapps.stackexchange.com/questions/84605", "https://webapps.stackexchange.com", "https://webapps.stackexchange.com/users/98286/" ]
It appears this has been deprecated. If you want to download all of the images that have ever been shared with you over hangouts, you need to use Google Takeout. * Visit <https://takeout.google.com/settings/takeout> * Deselect all * Select Hangouts * Hit the download button Google will send you a .zip link with all o...
**Viewing Photos shared with you** On <https://get.google.com/albumarchive/> you can only see photos that were shared **by you**. To see the album of pictures shared **with you** by a specific person, perform the following steps: 1. Navigate to the Person’s G+ Profile (by clicking on the person’s icon in Hangouts) 2....
30,987,883
How do I install PHP 7 (PHP next generation) on Ubuntu? I wanted to install PHP 7 on a clean install of Ubuntu to see what issues I would face. Here’s the official (yet meager guide): <https://wiki.php.net/phpng>
2015/06/22
[ "https://Stackoverflow.com/questions/30987883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4323201/" ]
Ondřej Surý has a PPA at <https://launchpad.net/~ondrej/+archive/ubuntu/php> ``` sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.0 ``` Using the PPA is certainly easier than building from source! A note for people with PHP 5.x already installed; `apt-get` complained a bit when I...
You could install a control panel that supports Ubuntu and PHP 7. For example, ServerPilot [supports Ubuntu](https://serverpilot.io/community/articles/ubuntu-control-panel.html) and [installs PHP 7](https://serverpilot.io/blog/2015/08/20/php-7.0-available-on-all-servers.html).
46,519
This is what I get with `\textbar`: ![enter image description here](https://i.stack.imgur.com/Lt9OX.png) This is what I want it to look like: ![enter image description here](https://i.stack.imgur.com/LMnX4.png)
2012/03/02
[ "https://tex.stackexchange.com/questions/46519", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/9610/" ]
Use a `\rule` ``` \documentclass{article} \newcommand{\lpipe}{\rule[-0.4ex]{0.41pt}{2.3ex}} \begin{document} Wintersemester 2011 \lpipe\ 2012 \end{document} ``` ![result](https://i.stack.imgur.com/tghYm.png) The optional argument takes a vertical lift, the first mandatory argument takes the line width and the sec...
Here is an alternative: ``` \documentclass{standalone} \begin{document} Wintersemester 2012 $\mid$ 2013 \end{document} ``` ![enter image description here](https://i.stack.imgur.com/PHAJ0.png)
62,413,459
I'm altering the fabcar version of hyperledger fabric and wrote some functions. When I executed, I got an error mentioned below (command mentioned below is of shell script) ``` $ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C $CHANNEL_NAME -n clou...
2020/06/16
[ "https://Stackoverflow.com/questions/62413459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13747617/" ]
I think the problem in your case is in the variable type you are using to display the information. I am not sure how you are using `json_decode` in your PHP code, but if you are using `$post['title']` then your answer is converted to a PHP associative array. So, when you are doing your foreach, instead of using `stdCl...
Your data structure as displayed seems to be JSON. But since you can get some values out of it, I will not bother about it. The reason you are not getting the right value is most likely wrong targeting. This particular set of data is nested inside another 'array' so to speak; simply reach it using the right name like: ...
10,643,116
Is that even possible? I have two ObservableCollections. I want to bind and populate a listbox with one of them. For example let's say that we have 2 buttons - one for Twitter and one for Facebook. Clicking on a Facebook button it will populate listbox with friend's names from facebook observable collection and it will...
2012/05/17
[ "https://Stackoverflow.com/questions/10643116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401931/" ]
I would just use one observable collection and fill based on the users choice. You could also fill it with the names from both sources and have a filter to filter out one or the other (apparently you need a wrapper object where you can indicate whether the name is a facebook friend or twitter follower). **Edit**: Here...
In your ViewModel, create a property that exposes one or the other ObservableCollection, and swap it out when the button is clicked: ``` private ObservableCollection<string> _twitterFriendList; private ObservableCollection<string> _facebookFriendList; private ObservableCollection<string> _selectedFriendList; public O...
281,794
I have a lot of `.csv` files that I need to plot. However, the numeric data comes, sometimes, among quotes or just as numbers (without the quotes). For example ``` a,b,c,d "1","4","5","1" "2","3","1","5" "3","5","6","1" 4,1,4,9 5,3,4,7 ``` My question is if there is an option in `pgfplots` to pre-process the data a...
2015/12/06
[ "https://tex.stackexchange.com/questions/281794", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/7561/" ]
If you're not tied to `pgfplots`, [`dataplot`](http://ctan.org/pkg/datatool) can handle quotes in the CSV file. It's far more limited that `pgfplots` and if your real data is a lot larger than the data provided in your MWE it may not cope so well. However, I thought I may as well add this as a possible alternative in c...
Dangerous method: set `\catcode`"=9`; safer method: remove the quotes. ``` \documentclass{article} \usepackage{pgfplots} \usepackage{filecontents} \begin{filecontents*}{\jobname.csv} a,b,c,d "1","4","5","1" "2","3","1","5" "3","5","6","1" 4,1,4,9 5,3,4,7 \end{filecontents*} \begin{filecontents*}{\jobname-noquote.csv} ...
484,742
Is there any way to improve code completion in notepad++? Currently it supports some kind of "static" code completion and it requires to make a list of instructions and they parameters in xml file or it works on a list of words in open document. I`m looking for something that can read \*.h files and make that list au...
2009/01/27
[ "https://Stackoverflow.com/questions/484742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58877/" ]
You have some code completion sections to look at [here](http://cybernetnews.com/2008/06/16/notepad-50-can-auto-complete-code/). But i would mainly suggest you change to an IDE for the programming language because Notepad++ doesn't have any of the benefits you find in a Real IDE. ( Maybe because it's a text-editor and ...
Not possible without creating your own plugin. It might be faster to develop a script that parses your .h files and creates an auto-complete language file for notepad++. Although a plugin that parsed your include files (for any language) and added them to the auto-complete would be very nice.
39,622,173
I just upgraded to MacOS Sierra, and I realized that I can't seem to run the "ssh -X" command in the Terminal anymore. It used to launch xterm windows, but now it's like I didn't even put the -X option anymore. It was working absolutely fine right before I updated. Other than going from OS X Yosemite to MacOS Sierra, I...
2016/09/21
[ "https://Stackoverflow.com/questions/39622173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5035553/" ]
Just upgraded my macbook from El Capitan to Sierra. Simply reinstalling Xquartz has done the trick for me, using ssh -X [linux server]
I spent the whole day looking for solution only to realize that the recent Sierra does not ship with XQuartz installed <https://support.apple.com/en-gb/HT201341>. Upon install (<https://www.xquartz.org/>) all works.
121,089
I recently started teaching activities in an American institution. I have had a couple of students asking for extensions for problem sets / project deadlines for medical or family reasons, which is obviously acceptable. More unexpectedly, other students asked for extensions because they also had problem sets, quizzes...
2018/12/05
[ "https://academia.stackexchange.com/questions/121089", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/97206/" ]
Asking if there is a norm for what is “acceptable” assumes that students care about such norms, but sadly some don’t, and will always try to push the boundaries of what is acceptable. It is up to you to set limits, and this is not especially difficult, and certainly not considered unreasonable in the (U.S., large publi...
I would recommend against the practice in general, but with a variation. It is good to tell students at the beginning what happens if deadlines are missed and to stick to those rules except for emergency situations. You can certainly publish in your course materials the consequences of being late. My own practice wou...
401,385
I calculated the value of $\theta$ to be $53^{\circ}$ for (ii) by using the principle of moments ($6\sin\theta r 2 = 2.4 r$ ) as the disc is in equilibrium. Nothing wrong so far. For (iii), I calculated the horizontal component of $\:\rm 6 N$ force ($6\cos 53^{\circ}= 3.6\:\rm N$) and since it is the only force that h...
2018/04/22
[ "https://physics.stackexchange.com/questions/401385", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/193438/" ]
Some history: In the pre-Wilsonian interpretation of quantum field theory, renormalisability of theories was considered an essential requirement. That is, you should be able to remove all ultraviolet divergences of the theory (that occur in perturbation theory) by absorbing them in a finite number of parameters in the ...
I'm not sure if this will directly answer your question, but perhaps it will be helpful. I will simply quote a few sections from the beginning of *Conformal Field Theory* by Phillipe Francesco, picking only those which relate to high energy particle physics (CFT's are very important in understanding quantum critical po...
64,877,282
``` def encode_units(x): if x <= 0: return 0 if x >= 1: return 1 basket_sets = mybasket.applymap(encode_units) ``` I am getting the type error in this. I am trying to do a basket analysis where I want to convert all positive value to 1 and 0 to 0 only.
2020/11/17
[ "https://Stackoverflow.com/questions/64877282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14653676/" ]
The 401 Unauthorized response is usually emitted as an `error` notification from the Angular `HttpClient`. So you'd need to use RxJS [`catchError`](https://rxjs.dev/api/operators/catchError) operator to catch the error and redirect. You could then emit [`NEVER`](https://rxjs.dev/api/index/const/NEVER) constant so that ...
@Michael D solution was super helpfull. Based on his comment I implemented the following http interceptor : ``` @Injectable() export class HttpResponseInterceptor implements HttpInterceptor { intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { return next.handle(request).pipe(c...
16,104,707
I have one affiliate account and I need to make a `soap` call to get data. I got ready code from one site and I tried to apply it, but I'm getting `500(internal server error)`. My code is given below. ``` public void getdata() { var _url = "http://secure.directtrack.com/api/soap_affiliate.php"; var _action = "...
2013/04/19
[ "https://Stackoverflow.com/questions/16104707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1562231/" ]
I went through this as well, I can even tell where you got this code :) so check it out ``` webRequest.Headers.Add("SOAPAction", action); ``` is the issue simply use ``` webRequest.Headers.Add("SOAP:Action"); ```
You should try using reflection in order to send data to a web service. Try using something like this: ``` Uri mexAddress = new Uri(URL); // For MEX endpoints use a MEX address and a // mexMode of .MetadataExchange MetadataExchangeClientMode mexMode = MetadataExchangeClientMode.HttpGet...
31,715,557
I am stuck with jquery wherein I am trying to add dynamic html elements (on click of +) which should also get removed on clicking on (-). Each element should have unique name and id say "name\_1","name\_2"... But it doesn't seem to going my way. Here is my code: ```js $(document).ready(function() { var maxField =...
2015/07/30
[ "https://Stackoverflow.com/questions/31715557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4014347/" ]
You need to "import" the first file in the second. Be warned that this will litterally include the first, so any code in the first will be executed as if it were litterally in the place of the line. The syntax is: ``` # if /path/to/file exists, then include it [ -f /path/to/file ] && . /path/to/file ``` Note `bash...
If you don't want to do an explicit sourcing of your script file as [bufh suggests](https://stackoverflow.com/a/31715558/520162): I put my often used functions in my `.bashrc` which gets always sourced thus having the functions always available. As bufh pointed out in a comment *always* is not really always but limite...
47,709
Below is my first attempt to write the sheet music for the song "My Way" by Sinatra: [![enter image description here](https://i.stack.imgur.com/FsAjj.jpg)](https://i.stack.imgur.com/FsAjj.jpg) Then I googled and compared with what I found in the internet, for example this one: [![enter image description here](https:...
2016/08/04
[ "https://music.stackexchange.com/questions/47709", "https://music.stackexchange.com", "https://music.stackexchange.com/users/32396/" ]
By pentascale I'm assuming you mean the first five notes of a regular major or minor scale? Not a pentatonic scale, right? If you're just playing five-note patterns like C-D-E-F-G, C#-D#-E#-F#-G# and so on, you might well be playing every pattern starting with right-hand thumb and left-hand pinkie, and then playing ea...
**EDIT: The OP has clarified his/her intent, illustrating that s/he is asking about the first five pitches of a diatonic scale, *not* the pentatonic scale. But I will leave this up, I think, in case it helps future readers.** **Meanwhile, I suggest the author go ahead and start learning the major/minor scales in their...
149,304
Well, it's the whole question. I installed 9.1 before, but I need older version now and I haven't yet found out how to do that.
2012/06/11
[ "https://askubuntu.com/questions/149304", "https://askubuntu.com", "https://askubuntu.com/users/66793/" ]
If you want to install PostgreSQL 8.4 in ubuntu in specific version like ubuntu 12 then Follow the steps: * Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository : `sudo sh -c 'echo "deb <http://apt.postgresql.org/pub/repos/apt/> precise-pgdg main"> /etc/apt/sources.list.d/pgdg.list'` ...
It's 2019 and (at least with my actual Ubuntu 16 config) PG versions prior to 9.3 are not available to instal with `apt-get`. I've followed the instructions provided in this [site](https://erpnani.blogspot.com/2016/03/install-postgresql-84-from-its-official.html) and now I have PG 10.10 and 8.4 installed. Required step...
207,717
What could exist buried in the earth that is sugary and can be used to sweeten food? It should be relatively common, and at a depth where it is only accessible to peoples specialized for digging (specifically, the people described in [this question](https://worldbuilding.stackexchange.com/questions/205889/what-weapons-...
2021/07/24
[ "https://worldbuilding.stackexchange.com/questions/207717", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/75161/" ]
A lot of tubers grow underground, and some need some digging to be reached, like [yam](https://en.wikipedia.org/wiki/Yam_(vegetable)#Harvesting) > > Yams in West Africa are typically harvested by hand using sticks, spades, or diggers. Wood-based tools are preferred to metallic tools as they are less likely to damage ...
If you want the ultimate sugar rush then maybe grow sugar beet [wikipedia link](https://en.wikipedia.org/wiki/Sugar_beet). 20% sugar.
51,779,919
So, I have a code like this: ``` #!/bin/bash awk -v ip="10.0.7.1" -v no="8" -v line='#BalancerMember "ajp://" ip ":8009" route=node" no " loadfactor=1 keepalive=on ttl=300 max=400 timeout=300 retry=60' ' /ProxySet lbmethod=byrequests/{ print " " line ORS $0 next } 1' /tmp/000-site.conf > /tmp/000-site.conf...
2018/08/10
[ "https://Stackoverflow.com/questions/51779919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5851645/" ]
tl;dr ===== If you want 8 AM on first day of July at UTC… ``` OffsetDateTime.of( 2018 , 7 , 1 , // Date (year, month 1-12 is Jan-Dec, day-of-month) 8 , 0 , 0 , 0 , // Time (hour, minute, second, nano) ZoneOffset.UTC // Offset-from-UTC (0 = UTC) ) // Returns a `OffsetDateTi...
You can do it like so, ``` offsetDateTime.atZoneSameInstant(ZoneId.of("Asia/Kolkata")) ``` **Update** If you need an instance of `OffsetDateTime` here it is. ``` offsetDateTime.atZoneSameInstant(ZoneId.of("Asia/Kolkata")).toOffsetDateTime(); ```
3,195,440
I wonder what is the properties of Product Pi Notation? I can't found anywhere about the properties. First of all, i have: $X=\beta\alpha\\ X^2=\beta^2\alpha(\alpha + 1) \\ X^3=\beta^3\alpha(\alpha + 1)(\alpha + 2) \\ . \\ . \\ . \\ \text{And so forth.} $ My question is. I want to write this form into Pi Notation (I...
2019/04/21
[ "https://math.stackexchange.com/questions/3195440", "https://math.stackexchange.com", "https://math.stackexchange.com/users/664855/" ]
In the category of rings with unity (with a $1$), morphisms are required to take the unity to the unity. In the case at hand, unless the morphism is trivial, the kernel will not be a ring with unity that embeds as a ring with unity. Consider for example the case of $R=\mathbb{Z}\times\mathbb{Z}$, and the morphism $R\t...
It may be possible for an ideal of a ring to be a ring with a different one. For instance, we can make a ring out of finite sums of the variables $\{X\_n | n \in \mathbb{N} \}$ where multiplication is given by $X\_n X\_m = X\_{max(n,m)}$ and extending linearly. The one of this ring is $X\_0$. Then, consider the ideal ...
132,015
I have a paper that was a published in a conference proceedings. This paper was extended and turned into a journal paper. However, some things like figures from the motivation section or the experimental setup (used same metrics) are the same. The journal paper was reviewed, and one reviewer raised some concerns about ...
2019/06/17
[ "https://academia.stackexchange.com/questions/132015", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/36841/" ]
Your problem is that you need to show your paper is sufficiently original to merit publication. Calculating a measure of overlap will not help you achieve that goal. Instead, you need to: * Clarify the original aspects of the paper. For example, you might write in the paper "Previously we showed [minor progress]" and ...
You should be able to list the major points in both papers. If the lists are mostly identical then the second paper is too similar to the first, if the points are substantially different then the second does not overlap but takes the topic forward.
11,614,274
I am developing a JQuery mobile web app and I am having some problems with the format after executing $('#someId').replaceWith(php var); The problem, I think, is that as this is executed before the JQuery Mobile libraries are loaded I get a crappy format when I replace. Can anyone think on something that could help...
2012/07/23
[ "https://Stackoverflow.com/questions/11614274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033507/" ]
I know this is an old question, but it turned up when I was searching for the same. Here is my solution to add a compressed (zip) attachment using [System.IO.Compression.ZipArchive (requires .NET 4.5 or higher)](http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive(v=vs.110).aspx) [based on the answ...
You're not creating a valid zip file, you're just creating a compressed stream and writing it to a file that has a `*.zip` extension. You should use a .NET zip library instead of `DeflateStream`. You can use something like [DotNetZip Library](http://dotnetzip.codeplex.com/): > > DotNetZip is an easy-to-use, FAST, F...
146,120
At the following circuit I want to find what it does and basically its transfer function. I've searched a lot but I didn't find any circuit like this. Since it does not match any of the basic types of op amp circuits (inverting or non-inverting amplifier) I don't know where to start from. Finally, anyone knows what's t...
2015/01/01
[ "https://electronics.stackexchange.com/questions/146120", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/40047/" ]
You can determine the transfer function \$H(s)\$ of the circuit reasoning on the following circuit: ![enter image description here](https://i.stack.imgur.com/ChBuF.png) and thinking of \$V\_1\$ and \$V\_2\$ as two independent inputs. Since the circuit is linear superimposition applies, and the output (in the s-domain...
Remember, ideal op amps follow two basic rules: 1. No current flows into either input. 2. Negative feedback forces the voltage at each input to be equal. Let's start with a qualitative approach. Since there's one capacitor, we can divide the frequency response of this circuit into three regions -- low-frequency \$(Z\...
3,922,761
I'm confident with solving this question in cylindrical coordinates (for which there are few answers) but I'm doubtful about cartesian coordinates and can't seem to figure out the limits. $z$ needs to be the outer integral in the below question: [![enter image description here](https://i.stack.imgur.com/X1FbI.png)](ht...
2020/11/25
[ "https://math.stackexchange.com/questions/3922761", "https://math.stackexchange.com", "https://math.stackexchange.com/users/694570/" ]
Here is a simple proof that works when $ n $ is even : Let $ n\in 2\mathbb{N}^{\*} :$ \begin{aligned} \sum\_{k=0}^{n}{B\_{k}\binom{n}{k}\frac{2^{k}}{n-k+1}}&=2^{n°1}\sum\_{k=0}^{n}{B\_{k}\binom{n}{k}\int\_{0}^{\frac{1}{2}}{x^{n-k}\,\mathrm{d}x}}\\&=2^{n+1}\int\_{0}^{\frac{1}{2}}{B\_{n}\left(x\right)\mathrm{d}x} \end{...
We seek to show that for $m$ even $$\sum\_{q=1}^m 2^q B^+\_q {m\choose q} \frac{1}{m-q+1} = \frac{2m+1}{m+1}$$ or alternatively for $m$ even $$\sum\_{q=1}^m 2^q B^+\_q {m+1\choose q} = 2m+1$$ where $$B^+\_q = q! [z^q] \frac{z}{1-\exp(-z)}.$$ We get for the LHS $$-B^+\_0 - 2^{m+1} B^+\_{m+1} + \sum\_{q=0}^{m+1} ...
351,948
> > (a) A computer network consists of six computers. Each computer is directly connected > to at least one of the other computers. Show that there are at least two computers in > the network that are directly connected to the same number of other computers. > > > (b) Find the least number of cables required to co...
2013/04/05
[ "https://math.stackexchange.com/questions/351948", "https://math.stackexchange.com", "https://math.stackexchange.com/users/63102/" ]
HINTS: 1. Pick any one of the six computers; to how many others can it be connected? We’re told that it’s connected to at least one, and there are only five others, so it must be connected to $1,2,3,4$, or $5$ other computers. The same is true of each of the six. That’s how many different possibilities? 2. This proble...
(a) There are six computers, and each computer connected to at least one of the other five computers, this means the possible connection for each computer is: 1, 2, 3, 4, 5, by using the Pigeon and Pigeonhole Principle, let these 5 possible connections be the Pigeonholes, and let the six computers be the Pigeons, there...
18,507
I have 4 years of work experience as Network consultant. I have worked in a team and also led a team of 3. However, I have never worked as a Project Manager. Can I go for the PMP certification or not?
2016/06/17
[ "https://pm.stackexchange.com/questions/18507", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/23815/" ]
A PMP certification requires you to have at least 4500 hours (if you have a 4-year degree) to 7500 hours (if you have a secondary degree) of experience in leading a project (Source: [PMI](https://www.pmi.org/certifications/types/project-management-pmp)). That doesn't mean that you can't start preparing for the exam now...
Management is all about meeting customer expectations and run a business successfully. Consider yourself on a junction where you see many roads that lead to your destination. As long as you know which road you have to take to reach your destination faster/safely/hassle free journey, you are on a right path. Certific...
16,714,567
I think I do not quite understand how F# infers types in sequence expressions and why types are not correctly recognized even if I specify the type of the elements directly from "seq". In the following F# code we have a base class A and two derived classes, B and C: ``` type A(x) = member a.X = x type B(x) = ...
2013/05/23
[ "https://Stackoverflow.com/questions/16714567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1880086/" ]
In order to understand the cause of your confusion you should not go anywhere further, than the first statement of [the link](http://msdn.microsoft.com/en-us/library/dd233209.aspx) you referred to : > > A sequence is a logical series of elements **all of one type**. > > > You can return a sequence of **only one,...
This is just a summary of all answers my question has received, so that future readers can save their time by reading this (and decide whether or not reading other answers to get a better insight). The short answer to my question, as pointed out by @Gene Belitski, is no, it's not possible to avoid casts in the scenari...
37,887,520
I have a list of "home appliances" and i want to model a database to save them in a table. There are different device types with different properties/columns. Example : User "mike" has a "TV (size inch ,energy consumption)", "fridge(min. tempreture,height,width)". A user has a list of "home appliances". I don't know...
2016/06/17
[ "https://Stackoverflow.com/questions/37887520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/928621/" ]
This is a classic problem in data modeling and database design. It goes by different names than the one you used, "abstraction". In ER modeling, it tends to be called "generalization/specialization". In object modeling, it tends to be called "class/subclass" modeling, or "inheritance". When it comes to designing SQL ...
You could create a model like: ``` user (id, name) 1, bob 2, mark ... device (id, name) 1, TV 2, Fridge ... attributes (id, name) 1, size inch 2, energy consumption 3, min temperature 4, height ... device_has_attribute (id_device, id_attribute, value) 1, 1, 2.7inches (you decide t...
51,690,369
A part of my program checks the current data with a specified date to see if it is before that date. If it is, I want to throw a `TooEarlyException`. My `TooEarlyException` class(note that it currently is checked, but I am trying to decide if it should be checked or unchecked): ```java public class TooEarlyException...
2018/08/04
[ "https://Stackoverflow.com/questions/51690369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4450564/" ]
If this is something that shouldn't happen and you want to catch it just in case, then it should be RuntimeException. Otherwise, checked (expected) exception.
You shouldn't use Exception at all in this example. 1. You are using Exception for flow control and you catch it immediately and handle it in the same method. Thus is a bad practice. Using if statement can easily achieve the flow control in your example. 2. Your quote is out of context. Gili has explained what he m...
678,293
I am working on a web app and I decided (after reading many post on SO) to store the actual images in the file system and to store the metadata in the DB. Should I store a relative path or an absolute path. I can think of some advantages for each of the choices. **Absolute:** *Pros:* It is obvious where the file i...
2009/03/24
[ "https://Stackoverflow.com/questions/678293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72453/" ]
I would store a relative path in the database. This gives you the greatest flexibility. Loading images is a simple matter of prepending an "IMAGE\_ROOT" variable (which should probably be configurable) to get the filesystem path. This is important because you might want to move where the images are stored (put them on ...
If you're using SQL Server 2008, you can solve this problem neatly with the new [FILESTREAM data type](http://technet.microsoft.com/en-us/library/bb933993.aspx).
42,021,255
I am clicking on an image in recycleview and uploading new image to the server.If the image uploads successfully then it should reflects in recycleview. I am using this code: ``` private void get_cardview_data(String response) { r_View_StudentInfo.setHasFixedSize(true); recyclerViewlayoutManager = new ...
2017/02/03
[ "https://Stackoverflow.com/questions/42021255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6873553/" ]
First, you need to [`explode()`](http://php.net/manual/en/function.explode.php) string to get an array of IDs. Then use the correct syntax for [`whereIn()`](https://laravel.com/docs/5.4/queries#where-clauses): ``` ->whereIn('id', explode(',', $vlsalesitemid)) ```
``` $vlsalesitemid="11,12,13,"; $val_array = explode(',', $vlsalesitemid); $query=DB::table('st_temp_sales')->where('brand_id', $brandid) ->whereIn('your_id', $val_array)->get(); return $query; ```
13,373,249
I'm trying to extract the time from a string using bash, and I'm having a hard time figuring it out. My string is like this: ``` US/Central - 10:26 PM (CST) ``` And I want to extract the `10:26` part. Anybody knows of a way of doing this only with bash - without using sed, awk, etc? Like, in PHP I would use - not...
2012/11/14
[ "https://Stackoverflow.com/questions/13373249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1741861/" ]
``` echo "US/Central - 10:26 PM (CST)" | sed -n "s/^.*-\s*\(\S*\).*$/\1/p" -n suppress printing s substitute ^.* anything at the beginning - up until the dash \s* any space characters (any whitespace character) \( start capture group \S* any non-space characters \) end captur...
Quick 'n dirty, regex-free, low-robustness chop-chop technique ``` string="US/Central - 10:26 PM (CST)" etime="${string% [AP]M*}" etime="${etime#* - }" ```