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
31,607,196
For some entities we need to keep loads (thousands) of detached enties permanently in memory. Many of their attributes are from a limited set of strings (though not limited enough to put it into an enumeration). Is it possible to have hibernate use String.intern for those attributes to save space? Ideally that should...
2015/07/24
[ "https://Stackoverflow.com/questions/31607196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21499/" ]
As you suggest yourself, it's perfectly doable with a JPA attribute converter. You could do it on a general level by using `autoApply = true` on the converter, or you could do it on a field by field level with the `@Convert` annotation. ``` import javax.persistence.AttributeConverter; import javax.persistence.Converte...
1) You can use property access for the critical properties and intern the strings in the setters: ``` public void setFoo(String foo) { this.foo = foo != null ? foo.intern() : null; } ``` 2) If the above solution is tedious (you may have lots of such `String` properties), then you could register a [Hibernate inter...
2,046,502
I want to create a file named "new text document.txt" in the folder `%tv%` using a batch file ( `*.bat`). This is my batch file: ``` set tv=D:\prog\arpack96\ARPACK\SRC cd "%tv%" @CON >> "new text document.txt" set tv= ``` Although I can really create the file in `%tv%`, but when I run the above batch file, I will ge...
2010/01/12
[ "https://Stackoverflow.com/questions/2046502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
In order to get a truly empty file without having to provide user interaction, you can use the `set /p` command with a little trickery: ``` set tv=c:\documents and settings\administrator cd "%tv%" <nul >"new text document.txt" (set /p tv=) ``` The `set /p` asks the user for input into the `tv` variable after outputt...
Create an empty file from a \*.bat file - this worked for me. ``` echo off > test.txt ```
66,604,703
**HTML** ``` <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>sample</title> </head> <style > body{ background: black; } div{ background : red; height: 200px; margin : 20px 100px; width : auto; display: none; } button{...
2021/03/12
[ "https://Stackoverflow.com/questions/66604703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15135917/" ]
You can use **CSS transition** to make it *smooth*. If you want **transitions** you can't use `display: none;` to hide it because with `display` it is completely **hidden** or completely **visible**, instead, you can use `height` or `opacity`. To toggle its visibility, I also recommend toggling a class with the st...
Here is a solution using opacity. It seems like a good use case because it also eliminates content shifting in this example (the button changing position). ```js function myFunction(){ document.getElementById("myDIV").classList.add('div-show'); } ``` ```css body{ background: black; } div{ ...
6,794,156
Basically this line of code does not work and I'm not quite sure as to why: ``` String[] stringHolder = string.split("_(B"); ``` I get this error: Unclosed group near index 3 This line of code works however: ``` String[] stringHolder = string.split("_B"); ``` So this leads me to believe that it's caused ...
2011/07/22
[ "https://Stackoverflow.com/questions/6794156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/783401/" ]
The `(` is a special character in regex, you need to escape it with a `\`. And since `\` needs to be escaped inside a string literal, you add two: ``` String[] stringHolder = string.split("_\\(B"); ``` More info: [Use Round Brackets for Grouping](http://www.regular-expressions.info/brackets.html)
The `split()` method takes a regular expression, not a string literal. So you need to escape the opening bracket/parenthesis: ``` String[] stringHolder = string.split("_\\(B"); ``` Brackets are special characters in regular expressions, used for groups.
17,276,296
I am just finished with my script in Python and i want my collegues to use it as well. It runs in python 2.7 Windows 7 64 bit professional env. Now comes the question: How can i make them use my script in an easy way? * First choice is the hard way, making them install python on their machines and then install parami...
2013/06/24
[ "https://Stackoverflow.com/questions/17276296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2516297/" ]
You need to convert it to an executable. py2exe is a module that does this for you. Follow the tutorial [here](http://www.py2exe.org/).
Pyinstaller is the python .exe maker that I've had the most success with --> <http://www.pyinstaller.org/>
4,831
I have a project where I aim to create a retro arcade game cabinet, the technology would be ~1988. For now I am planning to only simulate the system on my PC in order to develop the game. The dedicated hardware, if ever created, will come later. **However I have to know what kind of video hardware to simulate in order ...
2017/10/04
[ "https://retrocomputing.stackexchange.com/questions/4831", "https://retrocomputing.stackexchange.com", "https://retrocomputing.stackexchange.com/users/2123/" ]
The [Yamaha V9958](https://en.wikipedia.org/wiki/Yamaha_V9958) video chip was used in the MSX2+ (1988) and MSX Turbo-R (1990). It supports a resolution of 256x212 with up to 19,268 colors, 32 4BPP sprites, and horizontal and vertical scroll registers. It's a successor of the TMS9918 which was the basis of the video ch...
Assuming you're happy with a forward-looking 1988 machine, how about the [TMS34010](https://en.wikipedia.org/wiki/TMS34010) (from 1986) or '020 (from 1988)? It's a RISC CPU/GPU combination, so you're supposed to supply a frame buffer, and its instruction set includes 2d drawing. It became the basis of the solid polygon...
45,931,291
I have 2 view controller. 1. ViewController (VC) 2. WebViewController (WVC) In VC I click on a button and WVC is shown. After successfully completing all tasks in WVC, I want to show VC and execute a particular function in VC. Now, Storyboard contains some objects and add to VC using click and drag. Initially...
2017/08/29
[ "https://Stackoverflow.com/questions/45931291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5597739/" ]
**Try to pop:** In this start() method just replace a line `self.navigationController?.popViewController(animated: true)` instead of pushing the ViewController. ``` func start(){ ---- do some process ---- dispatch_async(dispatch_get_main_queue(), { () -> Void in let ViewCont = self.storyboard!.ins...
From my understanding, probably what you want is to dismiss `WVC` and go back to `VC`. in `WebViewController`'s `start()`: ``` self.navigationController?.popViewController(animated: true) ``` and after pop, you need to execute `doSomeProcess()` function. There're several ways to do this and I'll introduce one here....
31,749,593
I want to find the parameters of `ParamGridBuilder` that make the best model in CrossValidator in Spark 1.4.x, In [Pipeline Example](http://spark.apache.org/docs/latest/ml-guide.html#example-model-selection-via-cross-validation) in Spark documentation, they add different parameters (`numFeatures`, `regParam`) by using...
2015/07/31
[ "https://Stackoverflow.com/questions/31749593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4288229/" ]
This is the ParamGridBuilder() ``` paraGrid = ParamGridBuilder().addGrid( hashingTF.numFeatures, [10, 100, 1000] ).addGrid( lr.regParam, [0.1, 0.01, 0.001] ).build() ``` There are 3 stages in pipeline. It seems we can assess parameters as the following: ``` for stage in cv_model.bestModel.stages: print 'st...
[![enter image description here](https://i.stack.imgur.com/7LL7l.png)](https://i.stack.imgur.com/7LL7l.png) If java,see this debug show; ``` bestModel.parent().extractParamMap() ```
13,235,317
I want to use the new Log4J 2 - Java Logging Framework. Everything work fine, but I tried since a hour to load a custom configuration file to configure the logging (like log level). This is my log4j2.xml: ``` <?xml version="1.0" encoding="UTF-8"?> <configuration status="OFF"> <appenders> <Console name="Console"...
2012/11/05
[ "https://Stackoverflow.com/questions/13235317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3597614/" ]
TIP : To use custom log4j files. (Rather default "log4j2.xml" thingie). It might be useful to have multiple configurations in some instances. Just in case if any one using maven and wish to configure log4j2, Here is what you need in your pom.xml : ``` <systemProperties> <property>...
My 2 cents: Software system: log4j 2, NetBeans and TestNG. I had the same problem, but with the testing environment. In default, (that is, in log4j2.xml file located in src/) the logging level is set to error. But when running the tests, I want the logging to be trace. And, of course logged to some more or less hard...
101,755
I have a trigger on "Opportunity" object which on record update also updates it "OpportunityLineItem" records. We have a validation rule on "OpportunityLineItem" that if a field is blank the error should be thrown. Now in my org we have many "Opportunity" records with its corresponding "OLI" records with that field as...
2015/12/08
[ "https://salesforce.stackexchange.com/questions/101755", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/12252/" ]
put these line in try catch ``` if(!OppLineItemList.isEmpty()){ update OppLineItemList; //This is line 40 } ``` something like ``` try { if(!OppLineItemList.isEmpty()){ update OppLineItemList; //This is line 40 } } catch(exception ex) { //display ...
Insert of just **`update`** you can use **`Database.update(List<sObject>)`** method. That will return you **`Database.SaveResult`** (or list of them ) that will contain all the errors if they are Here is more information about <https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_sys...
18,971
This has been bugging me for sometime and now with a important deadline tonight i need to find a solution to my Workflow issues. I have 2 workflows i need to construct and through all my testing and designer none of my steps are working. I am kind of new to SP2010 admin - so forgive me if these seem basic. WF1: To se...
2011/09/08
[ "https://sharepoint.stackexchange.com/questions/18971", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/4693/" ]
For WF1, you should consider creating a variable and setting it to the author of the original thread. Then you can use that value to send the reply emails to. That way, the value of "creator" isn't overwritten when a reply to the thread is done. For WF2, the pausing of a workflow for a time period relies on the workf...
WF2: my guess is that your issue is with "Wait for Status to not equal Completed", because the workflow will wait for the status to change. Instead, try this: if status is equal to completed then stop workflow else send reminder
19,523,913
How can I remove all the HTML tags including &nbsp using regex in C#. My string looks like ``` "<div>hello</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb...
2013/10/22
[ "https://Stackoverflow.com/questions/19523913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2210098/" ]
I've been using this function for a while. Removes pretty much any messy html you can throw at it and leaves the text intact. ``` private static readonly Regex _tags_ = new Regex(@"<[^>]+?>", RegexOptions.Multiline | RegexOptions.Compiled); //add characters that are should not be removed to this regex...
``` var noHtml = Regex.Replace(inputHTML, @"<[^>]*(>|$)|&nbsp;|&zwnj;|&raquo;|&laquo;", string.Empty).Trim(); ```
23,216,127
I have a data like this in a table: ``` column1 column2 a 1 a 2 b 2 b 3 a 4 c 5 ``` I want a output like this: ``` column1 column2 a 1-2 b 2-3 a 4-0 c 5-0 ```
2014/04/22
[ "https://Stackoverflow.com/questions/23216127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/654652/" ]
Try this query: ``` with vw1 as (select table1.*,rownum rn from table1), vw2 as (select col1,col2,rn,rn - col2 dis from vw1), vw3 as (select col1,min(rn),to_char(min(col2))||' - '|| case when min(col2) = max(col2) then '0' else to_char(max(col2)) end col2 from vw2 group by col1,dis order by min(rn)) select col1,col2 ...
You haven't really given a lot of information. - Will there always only be 1 or 2 values in column2, for each value in column1? - Will column2 always be in order? - etc, etc? But, for the given data, the following should give the results you have asked for. ``` SELECT column1, MIN(column2) ...
384,592
I’m doing some review and some of the questions ask what would effect capacitance, and I think that because of C=Q/V that a change in Q or V should affect the capacitance yet it doesn’t. Why is that?
2018/02/06
[ "https://physics.stackexchange.com/questions/384592", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/183945/" ]
You have to distinguish between the simple *mathematical* meaning of the equation and the *physical* meaning. In this case the equation alone says mathematically that $C$ would change if you only changed $Q$ or $V$ but not both. But physically that's not really possible. The capacitance is taken to be constant: its val...
For a *given* geometry - say two parallel plates - adding more charges to the plates (more + charges on one plate, more - on the other plate) will lead to an increase in the electric field since the field between the plates is $E\sim \sigma/\epsilon$ where $\sigma$ is the surface charge density. Since the field is co...
2,321,872
I have just now installed Python 2.6 on my Windows 7 (64 bit) Lenovo t61p laptop. I have downloaded [Sphinx](http://sphinx.pocoo.org/) and [nose](http://somethingaboutorange.com/mrl/projects/nose/0.11.1/) and apparently installed them correctly using ``` python setup.py install ``` (at least no errors were reporte...
2010/02/23
[ "https://Stackoverflow.com/questions/2321872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40348/" ]
I don't know anything about these specific packages so I may not be much help. But for what it's worth I have run into the "can't find python executable" errors before with 64 bit python. It happened when the package I was trying to install didn't have a 64 bit version and it was looking for 32 bit python. I ended up j...
Install this 64-bit version of setuptools instead. <http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools>
19,033,760
I recently updated the NewRelic agent using this commmand: ``` Update-Package NewRelic.Azure.WebSites ``` When I redeploy my site, it fails with this error in the logs. Any ideas? ``` Copying all files to temporary location below for package/publish: C:\DWASFiles\Sites\mysite\Temp\eca8e7b2-2483-4759-ba73-1c0431...
2013/09/26
[ "https://Stackoverflow.com/questions/19033760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142098/" ]
When updating the New Relic .NET NuGet package for Azure Websites, try stopping the site, deploying and then restarting the instance. The expected behavior is that the process stops, then the assets get overwritten during a deployment with the ones New Relic packs up in the site root (located at: C:\Home\site\wwwroot\n...
I experienced the same problem after updating the Microsoft.AspNet.Web.Optimization package via NuGet. The problem can be solved by disconnecting and then reconnecting your git repository to the Azure portal. * Go to the Azure portal website * Click "Disconnect from GitHub" in the "quick glance" section * After a shor...
52,328,440
I am trying to make a GET request with some custom headers from a react application. This is the code for the axios interceptor: ``` addCaptchaHeaders(captcha, sgn, exp) { // remove the old captcha headers if (this.captchaHeadersInterceptor !== undefined) { this.removeCaptchaHeader(); } // Sign ...
2018/09/14
[ "https://Stackoverflow.com/questions/52328440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4341439/" ]
Better to use `DataTable` and load contents of `SqlDataReader` with `DataTable.Load()` instead of assigning the reader contents directly to `GridView` instance: ``` DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection(strConnString)) { using (SqlCommand cmd = new SqlCommand(query, con)) ...
remove the line- `if (reader.Read())` because DataReader.Read method advances the SqlDataReader to the next record. Here is the code- ``` public partial class DisplayGrid : System.Web.UI.Page { string strConnString = System.Configuration.ConfigurationManager.ConnectionStrings["PostbankConnectionString"].Connecti...
14,462,855
In Fatwire, there are two asset types which contain code: CSElement and Template. From what I've found, Template is a combination of a CSElement and a SiteEntry. Currently, I use Templates as a wrapper for a set of CSElements, but I'm not totally sure this is the best way to structure my sites. Is there any rule of th...
2013/01/22
[ "https://Stackoverflow.com/questions/14462855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125342/" ]
The conversion is to use minimum logic part in templates and all cs elements should be called from the template. The logic should be coded in CSElements. For example, if a page is rendered using one template. The navigation part will be done using one CSElement, Header logic will be in one template , logic to load bo...
A modular strategy is strongly preferred when designing your pages. Templates can be typed or typeless.With typed templates, you could write the rendering logic per asset type/sub type thereby containing the data & presentation logic within the asset type boundary. Coding this way has multiple benefits as given below ...
34,232,492
First array ``` var danu = ["nu", "da", "nu", "da", "da", "da", "da", "da", "da", "nu", "nu"]; ``` Second array ``` var abc2 = ["2", "3", "2", "3", "3", "2", "2"]; ``` I want to replace all "da" from first array with the values from the second array 1 by 1 so i will get ``` ["nu", "2", "nu", "3", "2", "3", "3", ...
2015/12/11
[ "https://Stackoverflow.com/questions/34232492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5670420/" ]
You can use `.map` to apply changes on each item in the `danu` array. Then have a `c` count which increments when `"da"` was found. ``` danu = ["nu", "da", "nu", "da", "da", "da", "da", "da", "da", "nu", "nu"]; abc2 = ["2", "3", "2", "3", "3", "2", "2"]; c = 0; newArr = danu.map(function(e,i){ if(e == 'da') retu...
Assuming that the second array is equal in length to the number of "da" in the first array, the code would look like: ``` var j = 0; for(int i; i<danu.length; i++){ if(danu[i] === "da"){ danu[i] = abc2[j]; j = j + 1; } } ``` However, if the second array is of different length, incrementing j...
14,647,006
Is there a module for Python to open IBM SPSS (i.e. .sav) files? It would be great if there's something up-to-date which doesn't require any additional dll files/libraries.
2013/02/01
[ "https://Stackoverflow.com/questions/14647006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1725303/" ]
As a note for people findings this later (like me): `pandas.rpy`has been deprecated in the newest versions of pandas (>0.16) as noted [here](http://pandas.pydata.org/pandas-docs/stable/r_interface.html#rpy-updating). That page includes information on updating code to use the `rpy2` interface.
Perhaps you may find this useful: <http://code.activestate.com/recipes/577811-python-reader-writer-for-spss-sav-files-linux-mac-/>
5,583,266
Is classic ADO.NET still widespread and in use with many developers out there inserting, reading data etc? Even though we now have LINQ and EF.
2011/04/07
[ "https://Stackoverflow.com/questions/5583266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/595577/" ]
Yes it is still used in some situations. At my day job we have a couple cases where we use SQL Bulk Copy which requires good ole' Connections and Commands. Additionally, there are some new datatypes in SQL 2008 R2 (Geography, Geometry, Hierarchy) that don't have support in Entity Framework. In those cases, one appro...
Yes, absolutely! EF and Linq-to-SQL are great for most line-of-business apps and operations - but they both don't work very well for e.g. bulk operations (like bulk inserts etc.), where using "straight" ADO.NET is your best bet. Also, certain things aren't supported by EF/L2S - like new SQL Server 2008 datatypes such...
778
I work in an open plan office that houses about 50 to 60 people. It is mostly engineers at their desks working away, so it is a typical office environment. As you can imagine, sometimes, the noise and the distractions (visual and physical) can get in the way of focusing and doing work. Sometimes, I try to get back foc...
2012/04/19
[ "https://workplace.stackexchange.com/questions/778", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/89/" ]
One thing no one else seems to mention when discussing the issue of noise in an open office environment is: **Management chose to put you into a sub-optimal situation. They are therefore choosing less productivity.** Therefore the first thing to do is to stop worrying about the fact that you could do more under better...
I have a nice set of [custom in-ear headphones](http://www.logitech.com/en-us/ue/custom-in-ear-monitors#). Noise isolation without resorting to full-on noise-cancellation. The visual of employees wearing big headphones when visitors/clients come through is not a good thing (in some organizations). To keep focus, I wo...
111,693
So I work for a small financial technology business in the UK, not quite startup size but close. We have a dozen staff on site and usually 5-10 remote contractors working for us. There isn't really a hierarchy so to speak, but I'm generally considered to be the owner's second in command although in practical terms this...
2018/05/04
[ "https://workplace.stackexchange.com/questions/111693", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/83404/" ]
> > Is there any point in trying to salvage this or should I leave my > resignation on his desk this afternoon and contact the police? > > > Neither. 1. Polish up your resume and start looking for jobs now. If your boss has lost faith in the company, than it's unlikely to survive, regardless of this matter 2. P...
Whether due to Brexit or not, if the owner believes that the company will fold inside of the next 18 months, there is a good possibility that it will, so is probably a good idea to start looking around for another job. That said, to solve your current dilemma, is there any reason why you cannot simply "do" what the ow...
268,564
I was trying to emulate python's `timeit` in C++. My main aim for this is to measure the performance of small functions of C++ code that I write and print some basic stats like avg., min, max. ### Code: `ctimeit.h`: ``` #ifndef CTIMEIT_H #define CTIMEIT_H #include <chrono> #include <cmath> #include <iostream> #incl...
2021/10/01
[ "https://codereview.stackexchange.com/questions/268564", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/233346/" ]
I'm guessing `int64_t` is intended to be `std::int64_t`? Don't assume that all compilers declare these types in the global namespace as well as `std`. If `std::int64_t` is present, it's declared in `<cstdint>`, so be sure to include that. Your code could be more portable if you used e.g. `std::uint_fast64_t` - or in th...
There's a glaring bug in how you forward arguments ``` template <size_t N = 1000, typename Callable, typename... Args> void timeit(Callable func, Args&&... Funcargs) { // ... for (size_t i = 0; i < N; ++i) { // ... func(std::forward<Args>(Funcargs)...); // ... } ``` Consider this ``` tim...
60,602
GnuPG (GPG) has the ability to both digitally sign and encrypt things (things being messages, documents, files, etc.). Is a public-key signature legally valid? If so, do the public keys need to be published on all key servers to remain legally effective? Or can they be posted on just one (some key servers such as the ...
2021/01/28
[ "https://law.stackexchange.com/questions/60602", "https://law.stackexchange.com", "https://law.stackexchange.com/users/36495/" ]
This is a common issue when a contractor is hired to write a technical document. Under [united-states](/questions/tagged/united-states "show questions tagged 'united-states'") law, at least, the answer is clear. The contractor owns the copyright unless there is a written agreement transferring the copyright. This may o...
It's not just copyright. My resume contains my private information. If you publish my resume, that's a violation of my privacy. If I find out, I'll come after you for that. And it will kill your business, because nobody will want you to write their resume and then see it published in a book. As far as copyright is con...
42,391,009
I am using Google Vision API, primarily to extract texts. I works fine, but for specific cases where I would need the API to scan the enter line, spits out the text before moving to the next line. However, it appears that the API is using some kind of logic that makes it scan top to bottom on the left side and moving t...
2017/02/22
[ "https://Stackoverflow.com/questions/42391009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7604576/" ]
I get max and min y and iterate over y to get all potential lines, here is the full code ```py import io import sys from os import listdir from google.cloud import vision def read_image(image_file): client = vision.ImageAnnotatorClient() with io.open(image_file, "rb") as image_file: content = image_...
Based on Borislav Stoilov latest answer I wrote the code for c# for anybody that might need it in the future. Find the code bellow: ``` public static List<TextParagraph> ExtractParagraphs(IReadOnlyList<EntityAnnotation> textAnnotations) { var min_y = int.MaxValue; var max_y = -1; foreach (v...
4,185,521
I need some way to get the Name of a Type, when `type.IsGenericType` = `true`. ``` Type t = typeof(List<String>); MessageBox.Show( ..?.. ); ``` What I want, is a message box to pop up with `List` showing... how can I do that?
2010/11/15
[ "https://Stackoverflow.com/questions/4185521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/481702/" ]
``` Type t = ...; if (t.IsGenericType) { Type g = t.GetGenericTypeDefinition(); MessageBox.Show(g.Name); // displays "List`1" MessageBox.Show(g.Name.Remove(g.Name.IndexOf('`'))); // displays "List" } ```
My take on yoyo's approach. Ensures more friendly names for primitives, handles arrays and is recursive to handle nested generics. Also unit tests. ``` private static readonly Dictionary<Type, string> _typeToFriendlyName = new Dictionary<Type, string> { { typeof(string), "string" }, { typeof(ob...
36,583,296
I would like to do a page like this : <https://www.dropbox.com/s/5qwht1q96idtc22/hf.png?dl=0> with this parameters : ``` Background: red header: 70px tall, black background, is always at the top of your browser (fixed position), total width Content: 500px wide, centered in height matches the contents of a blue ...
2016/04/12
[ "https://Stackoverflow.com/questions/36583296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4862198/" ]
This should get you started: <https://jsfiddle.net/hex8xsbs/> html: ``` <div class="header"></div> <div class="container"> <div class="content"></div><div class="sidebar"></div> </div> ``` css: ``` html { background: red; } .header { height: 70px; width: 100%; position: fixed; top: 0; left: 0; b...
there are many ways of achieving that layout. another (similar) solution to switz's one could be: the HTML ``` <div id="fejlec"></div> <div id="kek"> <div id="sarga"></div> <div id="feher"></div> <div class="clear"> </div> </div> ``` and the css: ``` *{ margin:0; padding:0; } html, body { height: 100%; wi...
74,130,038
I have two controllers (FirstController, SecondController) that use the same functions, to avoid rewriting them I thought of creating another controller (ThirdController) and subsequently calling the functions through it. the problem is that if in ThirdController there are relationship query they give me the error tha...
2022/10/19
[ "https://Stackoverflow.com/questions/74130038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18365403/" ]
One approach without regex. First, we cut the text by `\n`, because all the numbers we need start on a new line. Then we discard those elements that do not start with a number. Next, we cut the remaining elements by spaces and get numbers. ``` text = "[' \n\na)\n\n \n\nFactuur\nVerdi Import Schoolfruit\nFactuur nr. : ...
removing Regex as no longer need ``` text = "[' \n\na)\n\n \n\nFactuur\nVerdi Import Schoolfruit\nFactuur nr. : 71201 Koopliedenweg 33\nDeb. nr. : 108636 2991 LN BARENDRECHT\nYour VAT nr. : NL851703884B01 Nederland\nFactuur datum : 10-12-21\nAantal Omschrijving Prijs Bedrag\nOrder number : 77553 Loading date : 09-12-2...
2,439,356
I am using a SQL Server database in my current project. I was watching the MVC Storefront videos (specifically the repository pattern) and I noticed that Rob (the creator of MVC Storefront) used a class called Category and Product, instead of a database and I have notice that using LINQ-SQL or ADO.NET, that a class is ...
2010/03/13
[ "https://Stackoverflow.com/questions/2439356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200477/" ]
I think in this case, the Category and Product classes are wrappers that persist their data to the database when something is changed. The [Entity Framework](http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx) is a perfect example of that.
A class is an object in .NET, a class may or may not contain methods for data access to a database. However they are not comparable or related. Read hear about classes: <http://www.devarticles.com/c/a/C-Sharp/Introduction-to-Objects-and-Classes-in-C-Sharp-Part-2/>
96,370
The WiFi interface won't turn on when i press "Activate wifi" from the preferences neither from the status bar. I tried restarting the mac,and reset the pram. The Ethernet works fine and this is the result of ifconfig in the terminal: ``` en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 optio...
2013/07/14
[ "https://apple.stackexchange.com/questions/96370", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/53262/" ]
Cycling the network setup has worked for me. Run the following in Terminal: ``` networksetup -setairportpower en0 off networksetup -setairportpower en0 on ```
Found [this](http://dioisme.blogspot.com/2012/05/solving-wifi-wont-turn-on-lion-osx.html): * Restart your mac. * Open "Network Preferences". On the left tab, look for wifi connection (usually named Wi-Fi). * Select the wifi connection, and disable that. To disable a connection, choose gear icon below the tab, and choo...
17,784
I recently went on a 2 week holiday and I took about 3,000 photos (I'm a sucker for taking photos in bursts of 3 or so to catch motion) I'm looking for some software that will let me sift through these images in full screen and mark the ones that I want to keep. Being able to tag them and specify a folder that they go...
2011/12/07
[ "https://photo.stackexchange.com/questions/17784", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/2680/" ]
I use FastPictureViewer 64 to sift through my images after shooting. It lets me scroll using my mouse *fast* and add star ratings with 1-5 number keys. I can delete jpg and raw with one keystroke as well. Since the application displays using accelerated video hardware, it's really fast. You can set up keystrokes to sav...
I have the same problem and I never get down to wading through all those shots, no matter what the software is. So here's my current strategy: I use [Wallpaper Slideshow Pro](http://www.gphotoshow.com/wallpaper-slideshow-pro.php) to have my windows desktop cycle through all those shots and when I see one, I note down t...
6,745,751
**EDIT:** OK, I believe I've found a way around the issue using the info posted by @ManseUK along with @Johan's comment. As a n00b I can't answer my own question but I've added an explanation below the question in case it helps anyone else out. > > I am re-writing part of an e-commerce solution which was written by ...
2011/07/19
[ "https://Stackoverflow.com/questions/6745751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/851683/" ]
You need to treat both files as iterators and zip them. Izip will allow you to read the files in a lazy way: ``` from itertools import izip fa=open('file1') fb=open('file2') for x,y in izip(fa, fb): print x,y ``` Now that you've got pairs of lines, you should be able to parse them as you need and print out the ...
Python's built-in [`zip()`](http://www.python.org/doc//current/library/functions.html#zip) function is ideal for this: ``` >>> get_values = lambda line: map(float, line.strip().split(',')[1:]) >>> for line_from_1,line_from_2 in zip(open('file1'), open('file2')): ... print zip(get_values(line_from_1), get_values(li...
45,964,584
I found [this](https://github.com/VladimirKulyk/SoundTouch-Android) on GitHub which is a wrapper for the great SoundTouch C++ library. I'm completely new to NDK though, so would any of you kindly explain to me how to set it up correctly? I downloaded the zip from GitHub and copied the directories into my existing pro...
2017/08/30
[ "https://Stackoverflow.com/questions/45964584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6427630/" ]
That's not possible because `Event` can't be referenced from within the template. (`as` is also not supported in template binding expressions) You need to make it available first: ``` class MyComponent { EventType = Event; ``` then this should work ``` [(ngModel)]="(event as EventType).acknowledged" ``` **upd...
* **Using my *TypeSafe* generics [answer](https://stackoverflow.com/a/69466380/1283715):** * **And inspired from [smnbbrv answer](https://stackoverflow.com/a/66154034/1283715) pass type explicitly as an optional argument when there is nowhere to infer the type from.** ``` import { Pipe, PipeTransform } from '@angular...
62,997,321
I have the below service and I am trying to inherit my service with an base class so I can put all the constant option data in the base class, > > Service class > > > ``` import { BaseNotification } from './baseNotification'; declare let toastr: any; @Injectable({ providedIn: 'root' }) export class Notificatio...
2020/07/20
[ "https://Stackoverflow.com/questions/62997321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7988437/" ]
`ex_dict.popitem()` it removes the last (most recently added) element from the dictionary
We can use: ``` dict.pop('keyname') ```
692,880
I am currently working on a program which sniffs TCP packets being sent and received to and from a particular address. What I am trying to accomplish is replying with custom tailored packets to certain received packets. I've already got the parsing done. I can already generated valid Ethernet, IP, and--for the most par...
2009/03/28
[ "https://Stackoverflow.com/questions/692880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59844/" ]
When a TCP connection is established, each side generates a random number as its initial sequence number. It is a strongly random number: there are security problems if anybody on the internet can guess the sequence number, as they can easily forge packets to inject into the TCP stream. Thereafter, for every byte tran...
[RFC 793](http://www.faqs.org/rfcs/rfc793.html) section 3.3 covers sequence numbers. Last time I wrote code at that level, I think we just kept a one-up counter for sequence numbers that persisted.
102,305
I'm looking to migrate about 20 in-house researchers from their current XP workstations to thin-clients which connect to a VM running within our LAN. I'm planning on using HP thin-clients which use a linux based client os and the backend would be a dell rack server running Server 2008 Std. with Hyper-V. After talking t...
2010/01/13
[ "https://serverfault.com/questions/102305", "https://serverfault.com", "https://serverfault.com/users/9884/" ]
This entirely depends on what you're doing with your users. 20 VM's is going to be HARD on the server. A lot of memory, a lot of disk use, a lot of network use...I'd not try doing that. Terminal services are something we used to use. We could support on decent hardware about 15 to 20 sessions at a time. Problems...mul...
One extra thing to look out for on top of Bart's answer. It may not be possible for you to use your XP licenses in the VM. Some of these OEM copies of XP are locked onto specific vendor hardware and you may have some problems activating the VM. This problem won't exist with full retail versions of XP.
24,075,403
I know that, given a class, say, std::array, which has a member function, say, size(), we can call on that member function via a ".", that is, in the following code, ``` array<int,5> myarray; int s=myarray.size(); ``` s would be the integer representing the size of myarray. The tricky thing happens when member funct...
2014/06/06
[ "https://Stackoverflow.com/questions/24075403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713167/" ]
`now()` is a `static` member function. This means that the function itself doesn't have a hidden `this` pointer. Instead, it's just like a regular function - just part of the class to avoid name collisions. (THe `high_resolution_clock` is a class, `chrono` is a namespace, in your example. Both use `::` to indicate "I...
There is nothing *wrong* with the syntax you suggested. It works. However it creates an object, whereas the `::` version does not create any object. There doesn't seem to be much point in creating that object since it is not necessary to do so in order to call the static function. So it is simpler to just call the sta...
61,121,201
so here is my auth.js code: ``` import locationHelperBuilder from 'redux-auth-wrapper/history4/locationHelper'; import { connectedRouterRedirect } from 'redux-auth-wrapper/history4/redirect'; import { createBrowserHistory } from 'history'; // import Spinner from '../components/layout/Spinner'; const locationHelper ...
2020/04/09
[ "https://Stackoverflow.com/questions/61121201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11926619/" ]
Variables have different types * the variable `rq` is a `str` * the attribut `answer` is an `int` Also, do not use an `elif` with the opposite condition of the `if` just use an `else` ``` def bst_q(question, answer): rq = input(str(question)) if rq == str(answer): print('Correct, Well done') else...
The mistake you are making here, is that you compare a `string` from `input()` with an `int` (26 in this case). So your comparison is: is 26 = "26"? Which fails, as the number 26 is not equal to the string 26. You could also add checks on the input type, if it is a sting and try to cast it to an int, but this should ...
52,864,412
I have an input field like this: `<input myCurrencyFormatter type="text" [(ngModel)]="value" name="value">` The input value should be formatted to number such as: 1 024,50(this value should be only visible for input), but value in the ngModel should be stay not formated: 1024.05(dot instead a comma). How I can do it?...
2018/10/17
[ "https://Stackoverflow.com/questions/52864412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7314051/" ]
This can be done by redefining getter and setter like so: ``` <input type="text" [(ngModel)]="displayValue" > ``` And in ts side: ``` get displayValue(){ return this.realValue + '$' ; } set displayValue(v){ this.realValue = v?.replace('$',''); } ```
There are probably several approaches. One solution is to use a custom property where you save the converted input to. Listen to input changes with `(change)` and do the conversions there. Find an example below: In the template: ``` <form (ngSubmit)="test(value)"> <input myCurrencyFormatter type="text" [ngModel]="v...
37,526,315
What is the best practice using ElasticSearch from Java? For instance one can easily find documentation and examples for delete-by-query functionality using [REST API](https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html). This is not the case for Java Transport Client. 1. Where can...
2016/05/30
[ "https://Stackoverflow.com/questions/37526315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/418516/" ]
The best practice of using Elasticsearch from Java: [Follow This](http://elasticsearch-users.115913.n3.nabble.com/What-is-your-best-practice-to-access-a-cluster-by-a-Java-client-td4015311.html) Nexts: 1. You can follow the library : [JEST](https://github.com/searchbox-io/Jest/tree/master/jest) 2. Yes, in maximum time...
To complete [@sunkuet02 answer](https://stackoverflow.com/questions/37526315/elasticsearch-http-client-vs-transport-client/37526762#37526762): As mentioned in [documentation](https://www.elastic.co/blog/found-interfacing-elasticsearch-picking-client), the `TransportClient` is the preferred way if you're using java (p...
14,501,135
I want to compile following line of code through Eclipse but during built time i will get Error which i can not understand.. Is any one have a solution to solve it. ``` #include <boost/test/unit_test.hpp> #define BOOST_TEST_DYN_LINK #define BOOST_AUTO_TEST_MAIN #define BOOST_TEST_MODULE First_TestSuite BOOST_AUTO_TE...
2013/01/24
[ "https://Stackoverflow.com/questions/14501135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2005739/" ]
If you want to only use the header variant, you should include the following ``` #define BOOST_TEST_MODULE First_TestSuite #include <boost/test/included/unit_test.hpp> ``` instead of your ``` #include <boost/test/unit_test.hpp> ``` And you only need the `#define BOOST_TEST_MODULE First_TestSuite` with the header ...
You should use the `Single Header Variant of the UTF` from Boost. <http://www.boost.org/doc/libs/1_46_1/libs/test/doc/html/utf/user-guide/usage-variants/single-header-variant.html>
20,613,206
I have installed the PHP Cookbook from opscode and the chef-dotdeb cookbook found at [chef-dotdeb](https://github.com/ffuenf/chef-dotdeb) so that I can run **PHP 5.4** in the vagrant box. I would like to modify some of the default `php.ini` settings. According to the documentation for the chef php cookbook I can modi...
2013/12/16
[ "https://Stackoverflow.com/questions/20613206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361627/" ]
Had the same issue installing priestjims php with Apache. Installing Apache first and running apache2::mod\_php5 does not mean you can leave out php::apache2 that was the mistake for me. Solution is to include php::apache2 recipe and then it is writing it's php.ini to 'apache\_conf\_dir'. This way development ini se...
I know it's quite old question, but it's might help others. the `@` symbol meant it's a variable. Template resources have variables property and you can add the directives attribute there. More on the doc: ``` This attribute can also be used to reference a partial template file by using a Hash. For example: templat...
26,163,856
I'd like to upload an app written in swift. Application loader delivers the app successfully, but after a few minutes I get a reply by apple telling: > > Invalid Swift Support - The bundle contains an invalid implementation of Swift. The app may have been built or signed with non-compliant or pre-release tools. Visit...
2014/10/02
[ "https://Stackoverflow.com/questions/26163856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1776548/" ]
OK, I have been working on this for many hours now and finally found a solution. To pre-frame the answer here is what I did: - tried everything in the previous answers - spent an hour on the phone with Apple Tech support. - read every Apple developer forum having to do with "invalid swift" in their developer network...
I actually just solved this with a completely different, unrelated and really weird fix. Had the above error, but did NOT change anything in the Project or build Environment. After a lot of Rebuild and Upload Cycles, it turned out that it was an Ad-Hoc certificate that was causing this issue. Using fastlane and setti...
25,276,919
I'm using snap.svg I have index.html ``` <!Doctype> <html> <head> <title>MAP_TEST</title> <meta charset="utf-8"> <script type = "text/javascript" src = "JS/jquery.js"></script> <script type = "text/javascript" src = "JS/init.js"></script> <script type = "text/javascript" src = "JS/snap.svg.js"></sc...
2014/08/13
[ "https://Stackoverflow.com/questions/25276919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3564452/" ]
``` $ brew install zbar ``` and after that ``` $ pip install zbar ``` The header files will then be found (zbar.h)
I encountered this issue recently while attempting to launch a service locally from Mac OS in a virtual environment, that imports zbar in the python application. The service was still running python2.7. Having the service running in a virtual environment I was unwilling to attempt anything that required global system ...
8,560,320
``` >>> False in [0] True >>> type(False) == type(0) False ``` The reason I stumbled upon this: For my unit-testing I created lists of valid and invalid example values for each of my types. (with 'my types' I mean, they are not 100% equal to the python types) So I want to iterate the list of all values and expect th...
2011/12/19
[ "https://Stackoverflow.com/questions/8560320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/532373/" ]
The problem is not the missing type checking, but because in Python `bool` is a subclass of `int`. Try this: ``` >>> False == 0 True >>> isinstance(False, int) True ```
As others have written, the "in" code does not do what you want it to do. You'll need something else. If you really want a type check (where the check is for exactly the same type) then you can include the type in the list: ``` >>> valid_values = [(int, i) for i in [-1, 0, 1, 2, 3]] >>> invalid_values = [True, False,...
3,307,226
While working on a problem, i transformed a function into the following form: $$y=\frac{26+17x}{17-2x}$$ Is there an efficient way to find the positive integer solutions of this problem if the numbers in the function get bigger?
2019/07/29
[ "https://math.stackexchange.com/questions/3307226", "https://math.stackexchange.com", "https://math.stackexchange.com/users/692163/" ]
You want $\frac{26+17x}{17-2x}$ to be an integer, for some integer $x$. General idea is that for sufficiently large $|x|$ you will have $-9<\frac{26+17x}{17-2x}<-8$. So just solve this system of inequalities, get boundaries for $x$ and check them
As $17-2x$ idd $$(17-2x)\mid(26+17x)\iff(17-2x)\mid2(26+17x)$$ $$2y=\dfrac{2(26+17x)}{17-2x}=\dfrac{52+289}{17-2x}-17$$ $\implies17-2x$ must divide $52+289=11\cdot31$ $\implies17-2x$ must lie in $\in[\pm1,\pm11,\pm31,\pm341]$ But $y>0\implies(17x+26)(2x-17)<0\implies-\dfrac{26}{17}<x<\dfrac{17}2<9$ As $x$ is an i...
51,757,837
The visual studio stopped sending my commits to the bitbucket and this error appears > > Error encountered while cloning the remote repository: Git failed with a fatal error. > HttpRequestException encountered. > There was an error submitting the request. > can not spawn > > > C / Program Files (x86) / Microso...
2018/08/09
[ "https://Stackoverflow.com/questions/51757837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10200626/" ]
I have added my password to remote URL. (Team Explorer > Repository Settings > Remotes) <https://username:password@bitbucket.org/username/myproject.git>. After that my problem has solved.
A better solution. ------------------ > > **After chatting with Chad Boles (who maintains Team Explorer in Visual Studio), we worked out another option. This is preferred over overwriting the files in the Visual Studio installation as this may break future updates and can cause hard to debug issues in the future.** >...
10,650,443
I have this error while trying to get the tokens the code to make the lexical analysis for the Minic langauge ! ``` document.writeln("1,2 3=()9$86,7".split(/,| |=|$|/)); document.writeln("<br>"); document.writeln("int sum ( int x , int y ) { int z = x + y ; }"); document.writeln("<br>"); document.writeln("int sum ( i...
2012/05/18
[ "https://Stackoverflow.com/questions/10650443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1241074/" ]
You need to escape special characters: ``` /,|\*|-|\+|=|<|>|!|&|,|/ ``` [See](http://www.fon.hum.uva.nl/praat/manual/Regular_expressions_1__Special_characters.html) what special characters need to be escaped:
You need to escape the characters `+` and `*` since they have a special meaning in regexes. I also highly doubt that you wanted the last `|` - this adds the empty string to the matched elements and thus you get an array with one char per element. Here's the fixed regex: ``` /\*|-|\+|=|<|>|!|&|,/ ``` However, you ca...
71,209,830
I run a site that displays user-generated SVGs. They are untrusted, so they need to be sandboxed. I currently embed these SVGs using `<object>` elements. (Unlike `<img>`, this allows loading external fonts. And unlike using an `<iframe>`, the `<object>` resizes to the SVG's content size. [See this discussion.](https:/...
2022/02/21
[ "https://Stackoverflow.com/questions/71209830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/229792/" ]
First change the `RespData` field's type: ```golang type response struct { Status string `json:"status"` ErrorCode string `json:"error-code"` RespMessage string `json:"message"` RespData interface{} `json:"data"` } ``` Then, depending on what request you are making, set the `...
@mkopriva as you said tried this suggestion it worked. ```golang package main import ( "encoding/json" "fmt" "strings" ) type loginData struct { Token string `json:"token"` RefreshToken string `json:"refresh-token"` } type userdata struct { FirstName string `json:"first-name"` Las...
4,149,374
I have a collection of objects (IQueryable). Each object has various properties, some string some datetime, I'm not concerned about the datetime properties. How can I iterate through each object and return a collection of those objects that maybe have null values in one or more fields For simplicity, consider a collec...
2010/11/10
[ "https://Stackoverflow.com/questions/4149374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155992/" ]
``` Employees.Where(e => string.IsNullOrEmpty(e.FirstName) || string.IsNullOrEmpty(e.LastName)) ```
If I understand the question, the solution should be pretty trivial: ``` IEnumerable<Employee> collection = iQuaryable.AsEnumerable(); List<Employee> myCollection = new List<Employee>(); foreach(var emp in collection) { if(string.IsNullOrEmpty(emp.LastName) || string.IsNullOrEmpty(emp.FirstName)) ...
15,966
Which one is the correct use? > > She judged him **wrong**. > > > She judged him **wrongly**. > > > Or, are both correct, but have slightly different meanings?
2011/03/11
[ "https://english.stackexchange.com/questions/15966", "https://english.stackexchange.com", "https://english.stackexchange.com/users/4744/" ]
> > She judged him wrong. > > > This means she decided he was wrong in something he did or said. > > She judged him wrongly. > > > This means the error was hers. Usually you would express that this way: > > She judged him unfairly. > > > But *wrongly* works as well.
There are two different structures. "Wrong" may be either the complement of the verb (what she judged him to be) or an adverb modifying the verb (how she did the judging). As others have said, "wrongly" can only be the adverb, but "wrong" can be either - though in more formal use, it would tend to be used only as the...
3,003,494
if $A = \begin{bmatrix} 1 &0 &0 \\i& \frac{-1+ i\sqrt 3}{2} &0\\0&1+2i &\frac{-1- i\sqrt 3}{2} \end{bmatrix}$.Then the find the trace of $A^{102}$? My attempt : i know that eigenvalue of A are $1,w$ and $w^2$ As im not able to proceed further pliz help me
2018/11/18
[ "https://math.stackexchange.com/questions/3003494", "https://math.stackexchange.com", "https://math.stackexchange.com/users/557708/" ]
The matrix $A$ has eigenvalues the cube roots of unity $1, j=\mathrm e^{\tfrac{2i\pi}3}$ and $\bar{\mkern-1muj\mkern2mu}$, and its characteristic polynomial is $X^3-1$. So, by *Hamilton-Cayley*, we have $\;A^3=I$, therefore $\;A^{102}=(A^3)^{34}=I$ and $$\operatorname{Tr}\bigl(A^{102}\bigr)=\operatorname{Tr}(I)=3.$$
In general, for any polynomial p(X) and any square matrix A, the eigenvalues of p(A) are p($\lambda$), where $\lambda$ are the eigenvalues of A. In your case, the polynomial is $X^{102}$ and therefore the eigenvalues of $A^{102}$ will be $1, w^{102} and (w^2)^{102}=w^{204}$ , since as you noted, the eigenvalues of A c...
52,970,047
Please could you help correct this code! It's for finding all perfect numbers below the set limit of 10,000, I've used comments to explain what I'm doing. Thanks! ``` #Stores list of factors and first perfect number facs = [] x = 1 #Defines function for finding factors def findfactors(num): #Creates for loop to ...
2018/10/24
[ "https://Stackoverflow.com/questions/52970047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10552237/" ]
Found the problem! Should have been: ``` for i in range(1, num - 1) ``` Rather than: ``` for i in range(1, num + 1) ``` Thanks to all contributors!
intialize list inside the def and return and the range should not include the original `num` so range would be from 1 to num which includes 1 but excludes orginal `num` so it will generate range from `1` to `num-1` ``` #Stores list of factors and first perfect number x = 1 #Defines function for finding factors def fin...
55,140,674
I have two screens in my app. Screen A runs a computationally expensive operation while opened, and properly disposes by cancelling animations/subscriptions to the database when `dispose()` is called to prevent memory leaks. From Screen A, you can open another screen (Screen B). When I use `Navigator.pushNamed`, Scr...
2019/03/13
[ "https://Stackoverflow.com/questions/55140674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9673174/" ]
I know it's a bit late but I think you should override the `deactivate` method. Since we are changing the page we are not actually destroying it, that's why the `dispose` isn't being called. If you'd like more information [this page lists](https://www.developerlibs.com/2019/12/flutter-lifecycle-widgets.html) the lifec...
Not only to call 'deactivate()' but also to use 'Navigator.pushReplacement()' for page moving is necessary. Not working if you are using 'Navigator.push()'.
233,247
I've noticed that one of the cores on a four-core laptop is pegged, and the temp is very high. I found this in `top`: ``` PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 359 root 20 0 188684 147228 1552 R 99.4 5.0 111:19.91 systemd-udevd 20011 root 20 0 188320 147604 ...
2015/10/01
[ "https://unix.stackexchange.com/questions/233247", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/9760/" ]
It looks like libmtp found a device, but it's unable to disconnect it properly and it's checking for it constantly. It happens with certain devices and can be disabled by editing **/lib/udev/rules.d/69-libmtp.rules** Look for a couple of lines that look like this (at the end of the file): ``` # Autoprobe vendor-speci...
There is a bug in the kernel that cause systemd-udevs 100% CPU usage. So, the work around is to reboot the system, press and hold Shift during loading Grub. Then select the older kernel listed in the bootloader list. This work fine for me.
270,391
I'm using MessageFormat to format some addresses with a template like this: ``` "{0}\n{1}\n{2}\n{3}, {4} {5}" ``` where * 0 = street 1 * 1 = street 2 * 2 = street 3 * 3 = city * 4 = state * 5 = zip Most of these fields are optional when captured. How do I avoid having an empty line when for instance, there is not ...
2008/11/06
[ "https://Stackoverflow.com/questions/270391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21176/" ]
IMHO [Chunk Templating engine](http://www.x5software.com/chunk/) is the best. The jar file only has **180 KB**! and support **IF** and **iteration**. How cool is that !
Freemarker is pretty good. It's light, fast, has conditional formatting, and a tonne of other features.
8,080,496
I want to get an exclusive tail set of a SortedSet. The shortest method I can come up with is: ``` private void exclusiveTailSet(SortedSet<String> s, String start) { System.out.println(s); // [Five, Four, One, Six, Start, Three, Two] SortedSet<String> t = s.tailSet(start); System.out.println(t); // [Start,...
2011/11/10
[ "https://Stackoverflow.com/questions/8080496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/171296/" ]
is this helpful? (I just copy and paste your codes in question, and did some change: ``` private void exclusiveTailSet(SortedSet<String> s, String start) { SortedSet<String> t = s.tailSet(start); t.remove(t.first()); } ``` and if you have "start" element as parameter, it would also be ``` t.remove(start...
Guava version 11: ``` SortedSet exclusiveTailSet = Sets.filter(eSortedSet, Ranges.greaterThan(start)); ``` **p.s.** There is also a **hack** for SortedSet in case you couldn't use NavigableSet. The solution is to add for the search pattern a special symbol (start+"\0"). And this addition symbol will change the h...
68,876,845
So currently I am trying to make an app where when the player collides with the enemy, the enemy disappears. I have achieved this by writing this code; ``` func didBegin(_ contact: SKPhysicsContact) { var firstBody = SKPhysicsBody() var secondBody = SKPhysicsBody() if contact.bodyA.node?.n...
2021/08/21
[ "https://Stackoverflow.com/questions/68876845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The reason for the init statement is to limit the scope of variable and allow the *reusing* of values returned by functions. C++17 introduced dedicated init statements for both `if` and `for-each` Sometimes you might want to check if a function failed by returing 0 or nullptr before using the value it returned and you ...
The condition expression you have put in `if` statement is an operation. If the operation is successful (meaning `n` is declared and is filled with 10), then it is valued as `true`. So it will compile and the `if` statement will be ran.
46,480
Is the contraction from *that will* to *that’ll* an actual word or not?
2011/10/27
[ "https://english.stackexchange.com/questions/46480", "https://english.stackexchange.com", "https://english.stackexchange.com/users/14251/" ]
Well, *that'll* is not a word but a contraction. Some dictionaries include it, some don't. *That'll* clearly exists, and is used to some degree. It's just a matter of whether it has been used enough to be widely understood. An example of its usage would be in the song [That'll be the day](http://en.wikipedia.org/wiki...
The [Corpus of Contemporary American English](https://www.english-corpora.org/coca/) has 3221 uses of this contraction. Since MetaEd mentions this as a part of the phrase "that'll be the day", I'll mention that the phrase appears only 40 times in COCA, so 99% of the time it is used in other contexts. The Google n-gram...
35,849,763
Basically I want to do this: ``` Object obj; while (app->running) obj = update(obj) ``` Where update is a function that under some circumstances returns a new Object, and in others returns the same object, unchanged: ``` Object update(const Object& obj) { if (something) return Object{/*params*/}; ...
2016/03/07
[ "https://Stackoverflow.com/questions/35849763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6016319/" ]
One way would be to enable moves for your `Object` class and move your object in and out of the `update` function.
I would suggest something like `void update(Object& obj)`, as others have mentioned, or preferably a member `update` function that you can call on any object. ``` class Object { public: //other stuff bool update() { if (something) { //update stuff return true; else retu...
62,964,709
i am use OAuth 2.0 Flow to get Authorization code. but why after hit API appear docusign login screen. and after login we get Authorization code. we need Authorization code but can't login docusign again. please help me.
2020/07/18
[ "https://Stackoverflow.com/questions/62964709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9672022/" ]
``` for i in li: for j in li: print(f'{i} * {j} = {int(i)*int(j)}') print('') ``` I don't think this is efficient but it gets the result you want. ``` 1 * 1 = 1 1 * 2 = 2 1 * 3 = 3 1 * 4 = 4 1 * 5 = 5 1 * 6 = 6 1 * 7 = 7 1 * 8 = 8 1 * 9 = 9 1 * 10 = 10 2 * 1 = 2 2 * 2 = 4 2 * 3 = 6 2 * 4 = 8 2 * 5 =...
This worked for me: ``` my_list = list(map(int, ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) new_list = [number_n * number_m for number_n in my_list for number_m in my_list] print(new_list) ``` Output: ``` [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 3, 6, 9, 12, 15, 18, 21, 24, 27, ...
50,239,502
I have an array serialNumbers. It can look like this. ``` lot: 1 Serial: 2 lot: 1 Serial: 3 lot: 1 Serial: 4 ``` ... and so on. or it may look like ``` lot: 1 Serial: 5 lot: 1 Serial: 9 lot: 8 Serial: 2 lot: 8 Serial: 4 ``` ``` var dictSerials = [] if (serialNumbers.length > 0) for (var i of serialNum...
2018/05/08
[ "https://Stackoverflow.com/questions/50239502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9760229/" ]
An alternative to accomplish your requirement, is using the function `reduce` to group the keys and values. ```js let array = [{lot: 1, Serial: 2},{lot: 1, Serial: 3},{lot: 1, Serial: 4},{lot: 1, Serial: 5},{lot: 1,Serial: 9},{lot: 8,Serial: 2},{lot: 8,Serial: 4}], result = Object.values(array.reduce((a, c) => { ...
``` function getDictSerials(serialNumbers) { var dictSerials = {}; if (serialNumbers.length > 0) { for (let i of serialNumbers) { let lot = i.lot; let serial = i.serial; if (!dictSerials[lot]) { // If the key isn't found - intiate an array dictSeria...
37,910,766
I'm building my first iOS application, and I am using Firebase to handle authentication, database, etc. I added a sign up screen and used the following code to create a new user: ``` FIRAuth.auth()?.createUserWithEmail(emailAddress.text!, password: password.text!, completion: { (user, error) in }) ``` When...
2016/06/19
[ "https://Stackoverflow.com/questions/37910766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6486383/" ]
If you're using Scene delegate from and you have **different iOS versions like 9, 10 up to 13**, you must call in **AppDelegate.swift** in this way: ``` if #available(iOS 13.0, *) { } else { FirebaseApp.configure() } ``` And in **SceneDelegate.swift** this way: ``` if #available(iOS 13.0, *) { Firebase...
Here is my code for `AppDelegate.swift` ``` import UIKit import Flutter import Firebase @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { ...
31,939,030
**Restated my Question, old Text Below** As I am still hoping for an answer I would like to restate my question. Image I have a GUI with two lists, one that shows a List of all entries to a database `tblOrders` and another one that shows the items in each order. I can use Linq2sql or EF to get all orders from the dat...
2015/08/11
[ "https://Stackoverflow.com/questions/31939030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3907299/" ]
Entity Framework lazy-loads object data, meaning it loads the minimum amount of data it has to as late as possible. Take your query: ``` ListOfOrders = context.tblOrder.ToList(); ``` Here you are requesting all of the records in the `tblOrder` table. Entity Framework doesn't read ahead in your program and understand...
Just an answer to the first question. Like EF says, you disposed the context after the [unit of] work (a must in ASP, a good practice in WinForm/WPF). ``` using (DataClasses1DataContext DataContext = new DataClasses1DataContext()) ListOfOrders = DataContext.tblOrder.ToList(); ``` after this, if you try to ru...
30,372,586
We wish to avoid an excessive class usage on our code. We have the following html structure: ``` <div id='hello'></div> <div></div> <div></div> <div></div> <div></div> <div id='hello2'></div> <div></div> <div></div> <div></div> <div></div> <div id='hello3'></div> <div></div> <div></div> ``` How can we select, for e...
2015/05/21
[ "https://Stackoverflow.com/questions/30372586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/378170/" ]
You don't need JS (nor jQuery framework), it's CSS task. Use siblings selectors: ``` <style> #hello ~ div {background: red} /* four divs after #hello will be red */ #hello2, #hello2 ~ div {background: white} /* reset red background to default, #hello2 and all next will be white */ </style> ``` <https://jsfi...
OK, you can use `nextUntil`. But, since you want that for a conditional. You should find a way to get a boolean from this. For **example** adding to it, `.hasClass()`
47,770,186
I’m working on a project in Xcode 9.1 and a very strange problem occurs with my Table View Controller. I need to have a table view with static cells and Xcode tells me that I can achieve this only with a TableViewController (doesn’t work with a TableView in a ViewController. Gives me errors). I’ve embedded my TableVi...
2017/12/12
[ "https://Stackoverflow.com/questions/47770186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952674/" ]
Solved it! The problem was the code I wrote to hide the navigation bar hairline (the 1px line under the bar). Commenting the code make everything work fine.
To fix your issue I think your Navigation Bar is set to hidden. 1. In your storyboard click on the navigationBar in the navigation controller. 2. Then look for the attributes section "Drawing" 3. Check to see if hidden is true. 4. If it is uncheck it. My setup has it set to false as default. to hide navigation yo...
39,170,556
Fetch is the new Promise-based API for making network requests: ``` fetch('https://www.everythingisawesome.com/') .then(response => console.log('status: ', response.status)); ``` This makes sense to me - when we initiate a network call, we return a Promise which lets our thread carry on with other business. When t...
2016/08/26
[ "https://Stackoverflow.com/questions/39170556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/980799/" ]
> > Why are these fetch methods asynchronous? > > > The naïve answer is ["because the specification says so"](https://fetch.spec.whatwg.org/#dom-body-arraybuffer) > > * The `arrayBuffer()` method, when invoked, must return the result of running [consume body](https://fetch.spec.whatwg.org/#concept-body-consume-b...
Looking at the implementation [here](https://github.com/github/fetch/blob/master/fetch.js) the operation of fetching `json` is CPU bound because the creation of the response, along with the body is done once the response promise is done. See the implementation of the [`json` function](https://github.com/github/fetch/bl...
59,691,851
my HTML is ``` <form method="POST" action="{% url 'lawyerdash' %}"> {% csrf_token %} username<input type="text" name="username"><br> password<input type="password" name="password" ><br> <input type="button" value="sign in" > ``` my view is ``` def lawyerdash(request): if request.method ...
2020/01/11
[ "https://Stackoverflow.com/questions/59691851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11345613/" ]
You need to set `c = 1` to begin with, so that `++c` will work: (some programmers like to toggle between `0` and `1`, while your original code toggled between `1` and `2`. Both work and it is up to you.) Toggling between `0` and `1`: (I also might have used `prop()` instead of `attr()`, but to keep it close to your ...
```html <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head> <body> <img id="floorImgId" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Hamiltonian_path.svg/440px-Hamiltonian_path.svg.png" /> <script> var c = 1,imgExt = ...
21,205,963
How can I use select if I have 3 tables? **Tables:** ``` school_subject(ID_of_subject, workplace, name) student(ID_of_student, firstName, surname, adress) writing(ID_of_action, ID_of_sbuject, ID_of_student) ``` I want to write the student's name and surname (alphabetically) who have `workplace=home`. Is this possi...
2014/01/18
[ "https://Stackoverflow.com/questions/21205963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881818/" ]
``` SELECT s.firstName, s.surname FROM student S INNER JOIN writing Z ON Z.ID_of_student = s.ID_of_student INNER JOIN school_subject P ON P.ID_of_subject = Z.ID_of_subject WHERE P.workplace = 'home' ORDER BY S.firstName, S.surname // Sort the list ```
To order alphabetically the result it is possible to use **ORDER BY** keyword. So your query becomes: ``` SELECT DISTINCT S.firstName, S.surname FROM student S, school_subject P, writing Z WHERE P.workplace = 'home' AND P.ID_of_subject = Z.ID_of_subject AND Z.ID_of_student = S.ID_of_student ORDER BY S.surname, S.fi...
4,495,864
I use `genstrings` to generate `.strings` files from source code files in my project. Though the project is technically a [Cappuccino](http://cappuccino.org/) app, this question should apply equally to any project that uses `.strings` files. I have a format string that I'd like to be localized: `@"%d:%02d %@"`. It is ...
2010/12/21
[ "https://Stackoverflow.com/questions/4495864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/549363/" ]
``` $('acronym').each(function() { var $this = $(this); $this.before('<abbr>' + $this.html() + '</abbr>'); $this.remove(); }); ```
``` $('acronym').each(function() { $(this).replaceWith('<abbr>' + $(this).html() + '</abbr>'); }); ```
10,032,361
I have an App which stores images to Custom Library in Photo Album in iphone. I called the following Function of ALAssetLibrary ``` -(void)saveImage:(UIImage*)image toAlbum:(NSString*)albumName withCompletionBlock:(SaveImageCompletion)completionBlock { //write the image data to the assets library (camera roll) ...
2012/04/05
[ "https://Stackoverflow.com/questions/10032361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503985/" ]
First of all, there is an open ticket on the [PrimeFaces Issue Tracker](http://code.google.com/p/primefaces/issues/detail?id=3887), which targets this question but was recently labeled as "won't fix". Nevertheless, I found a nice workaround. The sorting of PrimeFaces tables can be triggered by calling an undocumented ...
**EDIT:** Solution posted below (LazyTable) works for the p:dataTable backed with LazyDataModel. Overriden **load** method is called after every update/refresh on the desired table and it handles sort properly. The problem with simple p:dataTable is that it performs predefined sort only on the first load, or after th...
1,485,955
IE doesn't like the å character in an XML file to display. Is that an IE problem or are å and alike chars indeed invalid XML and do i have to create the &#xxx; values for all these letters? Michel by the way: the chars are inside a CDATA tag The declaration is this: hmm, can't seem to get the xml declaration pasted ...
2009/09/28
[ "https://Stackoverflow.com/questions/1485955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/103089/" ]
I am pretty sure that this is an encoding problem. You need to check that the encoding of your file is indeed something internationalised, like UTF-8, and that the xml header indicates this. The xml file should start with `<?xml version="1.0" encoding="UTF-8"?>`
Make sure that you actually save the file using the encoding that is specified in the XML. The Notepad for example by default saves files as ANSI rather than UTF-8. Use the "Save As..." option so that you can specify the encoding. I saved your XML as an UTF-8 file, and that shows up just fine in IE.
12,151,366
I'm already using a plugin to handle the CSS3 attribute. It works when clicking it, and rotates 45 deg, but when it is clicked again to hide the content it isn't rotated back. ANy thoughts on how to get this working? ``` $("#faq dt").click(function() { $(this).next('dd').slideToggle('fast'); if ($(this).next('dd')...
2012/08/28
[ "https://Stackoverflow.com/questions/12151366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1461204/" ]
Why don't you put the rotation on a class, then use javascript to add and remove the class, so it flicks back and forth?
Here's a [quick fiddle](http://jsfiddle.net/fAXn7/) with the basic rotation functionality. Implementation I leave to you :)
5,868,086
is it possible to repeat only right side of picture. If I have a menu button picture, there are border or stripe on left side and I only want to repeat right side(without border). When I'm just putting `repeat-x scroll right` or just `repeat-x`, the whole picture will repeat, but I only want right side to repeat, not...
2011/05/03
[ "https://Stackoverflow.com/questions/5868086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/581785/" ]
Not sure why you can't use a solid color, but why not simply use a wider image? ![enter image description here](https://i.stack.imgur.com/CUB7o.png)
just put "no-repeat top right" is that what your meaning
25,482,406
Hi guys this most be duplicate question, but i spent a day to search for the answer, and didn't find what i'm looking for. the question is simple: I have a simple HTML page, i want to set a background for it, to cover the whole screen at any time. and then, i want to put an image on the screen, to always be at cente...
2014/08/25
[ "https://Stackoverflow.com/questions/25482406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Edit this : ``` ball8 = new ImageView(this); ball8.setImageResource(R.drawable.ic_launcher8); rel.addView(ball9); ``` to ``` ball8 = new ImageView(this); ball8.setImageResource(R.drawable.ic_launcher8); rel.addView(ball8); ```
You can try with basic way ``` _ delete rel=(RelativeLayout) findViewById(R.id.rel2); ( I dont know what it did ? ) _ ball1 = (ImageView) findViewby(R.id.idOfImageview) ``` the same with Imageview remaining.. **Remember create imageview in layout.** , and sort all imageview in layout file.
256,087
I recently added a caption to my image in WordPress and now there is an empty `<p></p>` tag after `<img>` tag. It broke my style. Can anyone tell how to remove it? Thanks for the help. [![demo](https://i.stack.imgur.com/VYPiW.png)](https://i.stack.imgur.com/VYPiW.png)
2017/02/11
[ "https://wordpress.stackexchange.com/questions/256087", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/113088/" ]
It is not a good practice to override the WordPress native functionality. Instead you can hide the empty elements using CSS ``` p:empty { display: none; } ``` This will the empty elements.
You can do this on the `do_shortcode_tag` hook. ``` function remove_empty_wp_caption_text($output, $tag) { if ($tag === 'caption') { $output = str_replace('<p class="wp-caption-text"> </p>', '', $output); } return $output; } add_filter('do_shortcode_tag', 'remove_empty_wp_caption_text', 10, 2); ``` What's...
13,042,281
I have a struts Action Class with method searchUser() now I want to call this method. So i have following configuration in struts.xml ``` <action name="searchUser" method="searchUser" class="test.User"> <interceptor-ref name="validation"> <param name="excludeMethods">searchUser</param> </interceptor-ref> <result ...
2012/10/24
[ "https://Stackoverflow.com/questions/13042281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/743191/" ]
This is nothing to do with the validation interceptor behaviour per-se. By configuring your action with ``` <action name="searchUser" method="searchUser" class="test.User"> <interceptor-ref name="validation"> <param name="excludeMethods">searchUser</param> </interceptor-ref> <result name="success">/jsp/userAdded....
The default intercepters meybe overwrited. Try this: ``` <action name="searchUser" method="searchUser" class="test.User"> <interceptor-ref name="defaultStack"> <param name="validation.excludeMethods">searchUser</param> </interceptor-ref> <result>...</result> </action> ```
21,789,778
Sorry for noob question, but, how i can print a values of cid1 and cid2 from array? Simple code here: ``` // Handle the parsing of the _ga cookie or setting it to a unique identifier function gaParseCookie() { if (isset($_COOKIE['_ga'])) { list($version,$domainDepth, $cid1, $cid2) = split('[\.]', $_COOKIE["_ga"...
2014/02/14
[ "https://Stackoverflow.com/questions/21789778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2652888/" ]
This should do it ``` print_r(gaParseCookie()); ```
If I'm reading your question right, this is really what I think you want. ``` function gaParseCookie() { if (isset($_COOKIE['_ga'])) { list($version,$domainDepth, $cid1, $cid2) = split('[\.]', $_COOKIE["_ga"],4); $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' =>...
159,009
So, my boss comes in, railing that "English is a stupid language!" Since this is pretty much a thrice-weekly occurrence 'round these parts, I barely raised an eyebrow, and waited for him to continue. "Mary just wrote to tell us that she's back from maternity leave, and I want to congratulate her and ask whether she h...
2014/03/21
[ "https://english.stackexchange.com/questions/159009", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1547/" ]
> > * "Is **it** a boy or a girl?" > > > I'm wondering about the grammar: what role is that "it" playing in that sentence? Is it a personal pronoun or a dummy pronoun? > > > 1.) The word "it" is the grammatical subject -- we know this because of the subject-auxiliary inversion in the interrogative clause. 2a.) ...
I think in this context 'it' is actually referring to the term of 'boy' or 'girl'. Similar to if someone said, "What is your name? Is it Joe?" The 'it' in this sentence is not calling the person an it but referring to their name. It in the context of the initial sentence is a place holder for the sex of the child. I t...
11,839
I wrote the following question: [Can Ride be used to Push a mount/animal companion?](https://rpg.stackexchange.com/questions/192887/can-ride-be-used-to-push-a-mount-animal-companion) containing multiple questions. I was asked to separate them out, so I did. Once I separated out the question [When pushing an animal, how...
2021/11/11
[ "https://rpg.meta.stackexchange.com/questions/11839", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/59003/" ]
I don’t think anyone’s going to undelete your question if you delete it. Even if they did, it’s not like you’d be “in trouble” for it or anything. You could even, if you wanted nothing more to do with it but folks insisted on keeping it undeleted, ask to have the question dissociated from your account. But I really dou...
Don't delete it - answer it --------------------------- You asked a question. That's good. You now know the answer. That's better. Armed with this knowledge, you now answer your original question so it is an ongoing benefit to others. That's best.
1,012,845
We're looking for a way to run a Docker container that needs a connection to an On-Premise database. This was previously done using a Hybrid Connection with a Web App. Does Azure Container Instances (suppose running on Windows) support Hybrid Connections similar to Web Apps?
2020/04/17
[ "https://serverfault.com/questions/1012845", "https://serverfault.com", "https://serverfault.com/users/570374/" ]
Yes you can, you need to deploy your container group into a VNet that has access to a VPN or ExpressRoute connection to your on premises systems. More details can be found here: <https://docs.microsoft.com/en-us/azure/container-instances/container-instances-vnet> At the time of writing, keep note this is only genera...
Windows containers in web apps do not support hybrid connection. As Alex stated the only way to achieve this will be with ACI on a vNet and connecting to on prem through Express Route or VPN. This will only be possible with Linux containers, Windows ACI does not support vNet join.
21,639,128
I'm trying to make a tweak for iOS 7 so that when a device is ARM64 it runs one version and when it is not it runs another (since float is for 32 bit and double is for 64 (If you have a solution for that let me know.) So it would be like this ``` if ARM64 { \\run double code } else { \\run float code } ```
2014/02/07
[ "https://Stackoverflow.com/questions/21639128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288341/" ]
You would do the following ``` #if __LP64__ \\You're running on 64 bit #else \\You're running on 32 bit #endif ```
On arm64 environment, the pointer take 8 bytes. ``` - (BOOL)isArm64 { static BOOL arm64 = NO ; static dispatch_once_t once ; dispatch_once(&once, ^{ arm64 = sizeof(int *) == 8 ; }); return arm64 ; } ```
41,057
Recently, I was reminded in Melvyn Nathason's first year graduate algebra course of a debate I've been having both within myself and externally for some time. For better or worse, the course most students first use and learn extensive category theory and arrow chasing is in an advanced algebra course, either an honors ...
2010/10/04
[ "https://mathoverflow.net/questions/41057", "https://mathoverflow.net", "https://mathoverflow.net/users/3546/" ]
Categorical ideas should be certainly introduced early, as they are quite useful. On the other hand, as Andreas and Terry say, studying category theory at the beginning of your mathematical education is a waste of time, and could be a turnoff, like all unmotivated formalism. On the other hand, the formal language of c...
I think that there are certain notions that are needed to "set the stage" for category theory. I don't think students are going to understand category theory unless they've already seen some of the following examples: * Galois Theory * Covering spaces and pi\_1 * The universal property of tensor product * The differen...
12,824,751
I have `MyContentProvider` in my app which works fine when I develop and run in debug mode. ``` <provider android:name=".MyContentProvider" android:authorities="com.contactcities" android:exported="false"> </provider> ``` But when I export the app, download it and run it, it crashes instantly : ```...
2012/10/10
[ "https://Stackoverflow.com/questions/12824751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/796414/" ]
I was getting the same error, turns out I had the wrong `android:name` attribute value for my provider tag in *AndroidManifest.xml*: ``` <provider android:authorities="com.example.ProviderClass" android:name=".ProviderClass" android:exported="false" > </provider> ``` So double check this value is as abov...
You might have passed your class limit on older OS versions—before Android 5.0 (API level 21) replaced the DEX runtime with ART. If you're right on the edge of the limit, you can pass compilation but get this error during startup. Try enabling multi-dex as described in the Android [Enable Multidex for Apps with Over 6...
57,826,909
Help with R: I need to group by a column and count occurrences of values in a set of columns. Here is my data frame ``` ID Ob1 Ob2 Ob3 Ob4 3792 0 0 0 1 3792 0 0 -1 0 3792 1 -2 -1 0 3792 2 -2 -1 0 8060 -1 0 -2 2 8060 -1 0 -3 0 8060 0 0 0 0 13098 0 0 0 0 13...
2019/09/06
[ "https://Stackoverflow.com/questions/57826909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10709394/" ]
``` with(reshape2::melt(df1, id.vars = "ID"), table(ID, value)) # value #ID -3 -2 -1 0 1 2 # 3792 0 2 3 8 2 1 # 8060 1 1 2 7 0 1 # 13098 0 0 2 10 0 0 ```
Try using `dplyr`. Assume the datafame is called `df` ```r library(dplyr) df %>% group_by(ID) %>% summarise(Obs1 = sum(Obs1), Obs2 = sum(Obs2), Obs3 = sum(Obs3), Obs4 = sum(Obs4)) ```
7,016,288
thanks to help from stackoverflow posters I have set up some oop javascript. However, I have hit another snag. I have two different classes with the same inheritance. They then both have a function named the same, but doing different things. The trouble is, if ClassB is defined last, then even when I have a ClassA obj...
2011/08/10
[ "https://Stackoverflow.com/questions/7016288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/886773/" ]
You are setting up the prototype of the new classes incorrectly ``` BaseClass = function(){ ...init some stuff... }; ClassA = function(){ BaseClass.call(this); ...init some stuff... }; ClassA.prototype = new BaseClass(); // innherit ClassA.prototype.MyFunction(){ return 1; }; ClassB = function(){ ...
Normally you wouldn't want to have two functions with the same name in any network of objects which nest into or inherit from eachother. Why not rename the second `MyFunction(){` to something else?
10,886,727
I need to remove the last part of the url from a span.. I have ``` <span st_url="http://localhost:8888/careers/php-web-developer-2" st_title="PHP Web Developer 2" class="st_facebook_large" displaytext="facebook" st_processed="yes"></span></span> ``` And I need to take the `st_url` and remove the `php-web-developer-...
2012/06/04
[ "https://Stackoverflow.com/questions/10886727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150062/" ]
``` $('span').attr('st_url', function(i, url) { var str = url.substr(url.lastIndexOf('/') + 1) + '$'; return url.replace( new RegExp(str), '' ); }); ``` **[DEMO](http://jsfiddle.net/LNW4V/229/)**
First you need to parse the tag. Next try to extract st\_url value which is your url. Then use a loop from the last character of the extracted url and omit them until you see a '/'. This is how you should extract what you want. Keep this in mind and try to write the code .
37,065,191
I'm brand new to C# and I couldn't figure out what to search for. I'm trying to print a list of strings in a "column" to the right of another list of strings. Two of the strings in the right "column" have multiple values that each need their own line. But when I try to do this, the values that need their own lines just...
2016/05/06
[ "https://Stackoverflow.com/questions/37065191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6298712/" ]
You are not set any text to JButton so it's not working, If you set text Text, then it will appear on the image, So you can do one thing 1. Set the `setName` Method and add text to that. 2. in `actionPerformed`, use `getName` rather than `getText`. For Example: ``` ImageIcon normalButtonImage = new ImageIcon("src/Ima...
I think the best way to rework your code is to use client properties of a button. ``` private static final String EVENT_TYPE = "event_type"; // button creation normalSetupButton = new JButton(); // set appropriate event for this button normalSetupButton.putClientProperty(EVENT_TYPE, SimulationEvent.NORMAL_SETUP_EVENT...
1,435,312
I wouldn't have asked this question if I hadn't seen this image: [![](https://i.stack.imgur.com/A9GOc.jpg)](https://i.stack.imgur.com/A9GOc.jpg) From this image it seems like there are reals that are neither rational nor irrational (dark blue), but is it so or is that illustration incorrect?
2015/09/14
[ "https://math.stackexchange.com/questions/1435312", "https://math.stackexchange.com", "https://math.stackexchange.com/users/252531/" ]
Irrational means not rational. Can something be not rational, and not not rational? Hint: no.
The set of irrational numbers is the complement of the set of rational numbers, in the set of real numbers. By definition, all real numbers must be either rational or irrational.
56,806,704
A simple problem in R using the For loop to compute partial sums of an infinite sequence is running into an error. ``` t <- 2:20 a <- numeric(20) # first define the vector and its size b <- numeric(20) a[1]=1 b[1]=1 for (t in seq_along(t)){ a[t] = ((-1)^(t-1))/(t) # some formula b[t] = b[t-1]+a[t]...
2019/06/28
[ "https://Stackoverflow.com/questions/56806704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11254108/" ]
You can also provide a .runsettings-file to the vstest.console-process, as indicated here. <https://learn.microsoft.com/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019>. In order to provide custom parameters modify the `TestRunParameters`-section, e.g: ``` <!-- Parameters used by t...
Basically you should favour to have only a single `Assert` within your test, so that every tests checks for **one single thing**. So what you have is similar to this, I suppose: ``` [Test] public void MyTest() { Assert.That(...); Assert.That(...); Assert.That(...); } ``` When you want to exclude e.g. t...
112,311
During an internship for a small company, my boss created an account for me, so I generated a password and I used it. The next day, my boss told me to write down the password of my account on a piece of paper, put it in a letter and to sign the envelope. Then he took the letter and told me that if he needs to access my...
2016/01/31
[ "https://security.stackexchange.com/questions/112311", "https://security.stackexchange.com", "https://security.stackexchange.com/users/42544/" ]
I don't think you are in a particularly worse situation than not disclosing your password. Your boss could: * Get the system administrator to make a copy of your (hashed) current password * Change it to something new * Do something evil in your name * Put the old password back (replace the hash back what it was) What...
Philipp is correct here. Let me restate something he said: > > In order to use your password, one needs to break the seal of the envelope you signed. When you think your password was abused, you can ask to see the envelope with your signature and check if it is still unopened. > > > To add to what he's saying, yo...
69,190
So I am currently on the fence about my next bike, I have in the last year and a half taken up cycling more seriously. To give some background I mean I am probably doing around 50km (31 miles) a week. Bearing in mind that this is less now because it is winter here. When in summer when races start again I will probably ...
2020/06/27
[ "https://bicycles.stackexchange.com/questions/69190", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50349/" ]
Only you can decide if you "need or "want" a road bike. I would not upgrade your mountain bike in an attempt to make it a better road bike. As the saying goes a pig wearing lipstick is still a pig. If you want to road ride for a change of scenery or pace buy a used quality built bike. The used market should have lots o...
Every bike is an engineering compromise, so you got to know what you want in order to get it. For example a road bike is optimized for speed, which means good aerodynamics, low rolling resistance and low weight at the expense of everything else, notably comfort, ability to ride on any road that isn't smooth enough, lu...
426,484
The news that DeepMind had helped mathematicians in research (one in representation theory, and one in knot theory) certainly got many thinking, what other projects could AI help us with? See MO question [What are possible applications of deep learning to research mathematics?](https://mathoverflow.net/questions/390174...
2022/07/12
[ "https://mathoverflow.net/questions/426484", "https://mathoverflow.net", "https://mathoverflow.net/users/1189/" ]
At the interface of [topological data analysis](https://en.wikipedia.org/wiki/Topological_data_analysis) and AI (neural networks, machine learning) there is a variety of applications that help to visualize high-dimensional data. One application in this context is [Estimating Betti Numbers Using Deep Learning](https://i...
The method ["UMAP"](https://umap-learn.readthedocs.io/en/latest/) comes to mind and uses a lot of mathematics from category theory, topology to reduce dimension. I have tried it on "real world" datasets and on "number theoretic datasets" with custom distances on natural numbers and it works as one would expect it. Her...
7,661,104
My code is : ``` EditText edt edt.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { final String number = edt.getText().toString(); int count = arg0.length(); edt.setSelection(count); } @Override public void beforeTextCha...
2011/10/05
[ "https://Stackoverflow.com/questions/7661104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/548218/" ]
Try the following code ``` int start =editText.getSelectionStart(); //this is to get the the cursor position String s = "Some string"; editText.getText().insert(start, s); //this will get the text and insert the String s into the current position ``` Here is the code to delete selected text from EditText ``` int ...
I currently use this solution: ``` public static void insertText(String text, EditText editText) { int start = Math.max(editText.getSelectionStart(), 0); int end = Math.max(editText.getSelectionEnd(), 0); editText.getText().replace(Math.min(start, end), Math.max(start, end), text, 0, text.length()); t...
2,413
When frying food, what's a good alternative to paper towels for soaking up/draining excess oil?
2014/01/05
[ "https://sustainability.stackexchange.com/questions/2413", "https://sustainability.stackexchange.com", "https://sustainability.stackexchange.com/users/737/" ]
Personally I use a wire rack over a cookie sheet to drain fried or greasy foods. The oil drips to the pan below and I can pour the oil into a container or dispose of it however I need to.
Slices of stale bread are a good alternative. I keep crusts / the ends of loaves in the freezer and place 4 to 6 on a tray to cover the tray. You then just place your fried food on top to drain. The bread is fine to go in the compost afterwards.
2,965,626
The "[On the state of i18n in Perl](http://rassie.org/archives/247 "Rassie’s Doghouse » On the state of i18n in Perl")" blog post from 26 April 2009 recommends using [Locale::TextDomain](http://p3rl.org/Locale::TextDomain) module from libintl-perl distribution for l10n / i18n in Perl. Besides I have to use gettext anyw...
2010/06/03
[ "https://Stackoverflow.com/questions/2965626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46058/" ]
The gettext manual is wrong to suggest that it is not okay for you to [demand a CPAN prerequisite](http://p3rl.org/CPAN::Meta::Spec#prereqs). Everyone does this in the Perl world, and thanks to the CPAN infrastructure and toolchain, it works just fine. In the worst case you can bundle the dependencies you need. The st...
Create a directory "fallback/Locale" and create a module TextDomain.pm there with stub implementations for all functions that you need: ``` package Locale::TextDomain; use strict; sub __($) { return $_[0] } sub __n($$$) { return $_[2] == 1 ? $_[0] : $_[1] } # And so on, see the source of Locale::TextDomain for gett...
29,493,444
i hav confirmed that "apples.txt" do exist.what is wrong with my code? ``` def Loadfile(fileName): myfile=open(fileName,'r') next(myfile) for line in myfile: linesplit=line.split() print line print Loadfile('apples.txt') ```
2015/04/07
[ "https://Stackoverflow.com/questions/29493444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4759141/" ]
The file probably isn't in your [working directory](https://stackoverflow.com/questions/17359698/how-to-get-the-current-working-directory-using-python-3). Either change your working directory to where `apples.txt` is located, or provide a full path to the file such as `'C:\\folder\\subfolder\\apples.txt'`
``` arq = open('C:\\python2.6\\projetos\\test\\list.txt', 'r') texto = arq.readlines() for linha in texto: print(linha) arq.close() ```
61,679
This is one of a series of questions centered around how an isolated group of people would survive. Each question focuses on a single aspect of survival. Details about the peoples' situation are below: > > In a novel I am developing, a village's worth of people is living on a > peninsula. The isthmus connecting the...
2016/11/18
[ "https://worldbuilding.stackexchange.com/questions/61679", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/6620/" ]
**To survive in the long run, your population's diet will have to diversify in range, shrink in quality, and vary hugely in quantity** *Diversity*: Their diet on land will expand to encompass a wider definition of what animals count as food than most of your modern readers, 'pest' species included: rats, bushtail pos...
I suggest putting a nice, steep, jagged mountain at the far end of the peninsula, made of nice hard flinty rocks which will make great tools and building materials. Let there be a robust population of fast-breeding goats on that mountain, and plenty of fast-growing trees or better yet, bamboo on its lower slopes. Furth...
19,857,824
Is it possible to specify custom filters like `'ABC*.pdf'` which means: "*Show all PDF which starts with ABC*"? I can only specify `*.pdf`, `*.doc`, `*.*`, etc. Thanks Florian
2013/11/08
[ "https://Stackoverflow.com/questions/19857824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2071938/" ]
Answer is straight forward : **NO** You can set the Filters to allow only specific File Types with property `Filter` asbelow : ``` fileOpenDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; ``` but filtering file names is `NOT` Possible. You can create your own Custom `OpenFIleDialog` in that case. S...
Use this: ``` Microsoft.Win32.OpenFileDialog myDialog. = new Microsoft.Win32.OpenFileDialog(); myDialog..DefaultExt = ".pdf"; myDialog.Filter = "FilesIWant (ABC*.pdf)|ABC*.pdf ```