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 |
|---|---|---|---|---|---|
1,229,743 | Can someone please explain traits in Scala? What are the advantages of traits over extending an abstract class? | 2009/08/04 | [
"https://Stackoverflow.com/questions/1229743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43222/"
] | The short answer is that you can use multiple traits -- they are "stackable". Also, traits cannot have constructor parameters.
Here's how traits are stacked. Notice that the ordering of the traits are important. They will call each other from right to left.
```
class Ball {
def properties(): List[String] = List()
... | This is the best example I've seen
Scala in practice: Composing Traits – Lego style:
<http://gleichmann.wordpress.com/2009/10/21/scala-in-practice-composing-traits-lego-style/>
```
class Shuttle extends Spacecraft with ControlCabin with PulseEngine{
val maxPulse = 10
def increaseSpeed = speedUp
... |
889,934 | this is quite related to [this question regarding GCP](https://serverfault.com/questions/859348/using-ftp-client-not-server-on-google-compute-instance), but on AWS, and also trying to solve it with a different approach.
I have an FTP client trying to connect in ftp active mode to some ftp servers located on the Intern... | 2017/12/28 | [
"https://serverfault.com/questions/889934",
"https://serverfault.com",
"https://serverfault.com/users/440567/"
] | Trying to answer my own question **on a limited use-case**
The limit is: only 1 ftp client in active mode behind the nat server (it does not work with masquerading)
* ftp client: 10.60.10.11
* nat server: 10.254.254.203
* public ip : 1.2.3.4
First, fire up netsed on the nat server, local port 21, converting all pack... | >
> Is there any way to "inject" the public IP in the PORT command ?
>
>
>
Even if this would be possible this would not help. While the server would probably accept the PORT command with the public IP address it would not be able to connect back to the FTP client using this IP address and port since there is no m... |
14,633,926 | How can you check for the presence of both Bundler as well as a Gemfile?
My initial guess was `defined?(Bundler) && File.exist?('Gemfile')`, but since you can have a Gemfile with a different name, this won’t cover all cases. | 2013/01/31 | [
"https://Stackoverflow.com/questions/14633926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108369/"
] | I had exactly the same problem and can say it's all a matter of size and most likely an **error in the compression module of hhc**.
When I added some lines of documentation the size of the CHM-file increased from 1.6 to 3.1 MB and it could not be opened anymore.
**This problem could not only be fixed by removing file... | I see 0 byte files in the input? Maybe the compiler can't handle that? |
193,910 | **CODE HTML:**
```
<div id="element">
<div class="col-md-3">
<div data-role="collapsible">
<div data-role="trigger">
<span>Title 1</span>
</div>
</div>
<div data-role="content">Content 1</div>
</div>
<div class="col-md-3">
<div data-role="collapsibl... | 2017/09/20 | [
"https://magento.stackexchange.com/questions/193910",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/49726/"
] | The [recommended](https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/responsive-web-design/rwd_js.html) way would be to use `matchMedia`.
```
require(['jquery','accordion', 'matchMedia' ], function ($, mediaCheck) {
mediaCheck({
media: '(min-width: 768px)',
// Switc... | Less then 640 width would be mobile you can check this below way
```
require(['jquery','accordion'], function ($) {
if ($(window).width() < 640) {
$("#element").accordion({
"openedState": "active",
"collapsible": true,
"active": [0,1,2,3], /** Integrat Dynamic open... |
46,664 | I have some mail messages that OSX Mail puts in my junk folder but does not show the header saying "Mail thinks this message is Junk Mail" and so does not show the button allowing me to mark the mail as not junk.
How do I get Mail to allow me to mark the mail as not junk.
These emails are put in the junk folder by me... | 2012/03/29 | [
"https://apple.stackexchange.com/questions/46664",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/237/"
] | It seems iCloud is marking the message as junk using its algorithm. I don't believe you can adjust this from within the Mail.app. You will need to log into iCloud.com, enter Mail, find the particular message in your Junk Mail folder and then with the message selected, select the gear menu and you should be able to Mark... | all you need to do in Mail toolbar is click on the thumbs up icon to the right of the trash bin. |
35,291,376 | Right now I am practicing on creating a header section, which contains an image which is used as a logo and and a un-ordered list which is used as a navigation menu.
Both of these elements are kept in a div element and I want to align the image to the left in the div element and the un-ordered list to the right of the ... | 2016/02/09 | [
"https://Stackoverflow.com/questions/35291376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2992433/"
] | Use `display:flex` to parent div and give `justify-content: space-between;`
```css
.header-section
{
background-color:red;
display: flex;
justify-content: space-between;
}
ul
{
display:inline-block;
list-style:none;
}
ul li
{
display:inline-block;
}
```
```html
<!DOCTYPE html>
<html>
<body>
... | You could use [float](https://developer.mozilla.org/en-US/docs/Web/CSS/float) like this:
```
ul {
display:inline-block;
list-style:none;
float: right;
}
img {
float: left;
}
``` |
1,309,820 | Some text editors for programming support auto-closing brackets. For example, on Jupyter Notebook or Jupyterlab for Python, given a line, say
>
> asdf wert xcvb
>
>
>
If I double-click to highlight *wert*, and I type *(*, it will give me
>
> asdf (wert) xcvb
>
>
>
Similarly, if I highlight *asdf*, and type ... | 2018/04/01 | [
"https://superuser.com/questions/1309820",
"https://superuser.com",
"https://superuser.com/users/889963/"
] | I don't know of any such global behavior, as what you describe is the
special behavior of this one specific app.
To recreate this for the entire operating system, you will need a
system macro, activated by some chosen keyboard key,
that will translate it to a series of keys to achieve the desired effect.
For example ... | The simplest way to do this is through **System preferences.**
* Go to **System Preferences > Keyboard > Text**
* Click the '**+**' button in the bottom left.
* Enter the shortcut text you want in the **Replace** column(In our case it will be *'('* ).
* Enter the target phrase that you want to expand to in the **With*... |
30,170,408 | I know browserify can consume UMD modules by means of transforms, but when I want to build a lib using browserify, how can I build an UMD module? Is there any transform I can use? | 2015/05/11 | [
"https://Stackoverflow.com/questions/30170408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2633697/"
] | Find the max index of each value seen in `x`:
```
xvals <- unique(x)
xmaxindx <- length(x) - match(xvals,rev(x)) + 1L
```
Rearrange
```
xvals <- xvals[order(xmaxindx,decreasing=TRUE)]
xmaxindx <- xmaxindx[order(xmaxindx,decreasing=TRUE)]
# 2 4 1 3
# 5 4 3 2
```
Select from those:
```
xmaxindx[vapply(1:... | Try this:
```
vapply(1:6, function(i) max(which(x < i)), double(1))
``` |
52,191 | The original article is on [Newsweek](https://www.newsweek.com/indonesian-army-two-finger-virginity-tests-female-recruits-1618611) which I personally consider a reliable source.
>
> The virginity check, which extended to military fiancées, involves someone placing two fingers into the vagina to determine whether or n... | 2021/08/12 | [
"https://skeptics.stackexchange.com/questions/52191",
"https://skeptics.stackexchange.com",
"https://skeptics.stackexchange.com/users/15834/"
] | Yes
The invasive virginity test:
1. began at an unknown time but [probably around 1965](https://asaa.asn.au/beautiful-virgins-the-hard-road-to-becoming-an/) (a retired police officer [remembered having the test](https://www.hrw.org/news/2014/11/17/indonesia-virginity-tests-female-police) in 1965).
2. was [exposed by ... | From the article linked in the question itself, their army chief of staff basically admitted they had hymen "rupture" tests:
>
> Andika Perkasa, the Indonesian army chief of staff, told reporters on Tuesday the controversial practice had ceased.
>
>
> "Previously we looked at the abdomen, genitalia in detail with t... |
31,464,806 | I have been using PostgreSQL for a couple of days and it has been working fine. I have been using it through both the default postgres database user as well as another user with permissions.
In the middle of the day today (after everything had been working fine) it stopped working and I could no longer get back into t... | 2015/07/16 | [
"https://Stackoverflow.com/questions/31464806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2591505/"
] | No, the variables will maintain state without the static modifier | It seems after some research a singleton did the job. Creating one singular instance but calling on it more then once.
See Here:
<http://www.tutorialspoint.com/java/java_using_singleton.htm> |
93,824 | Given a text like this:
```
# #### ## #
## # ## #
#### ##
```
Output the same text but by connecting the pixels with the characters `─│┌┐└┘├┤┬┴┼`. If a pixel doesn't have any neighbours, don't change it.
So the output of the last text is:
```
│ ─┬── ┌─ │
└─ │ ┌┘ │
└──┘ ─┘
```
* You can take input as ... | 2016/09/19 | [
"https://codegolf.stackexchange.com/questions/93824",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/53745/"
] | [Jelly](http://github.com/DennisMitchell/jelly), ~~60~~ ~~52~~ ~~51~~ ~~50~~ ~~49~~ 48 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
======================================================================================================================================================
```
ṖḤ0;+Ḋ×
“µ³Q~... | MATL, 102 characters
====================
I assign a neighbour a value (1, 2, 4 or 8); their sum will match a character in a string containing the drawing characters. I think there is still lots of room for improvements, but for a rough draft:
```
' #│││─┌└├─┐┘┤─┬┴┼' % String to be indexed
wt0J1+t4$( % Get i... |
22,505,664 | ```
<html>
<head>
<title> Algebra Reviewer </title>
<style type="text/css">
h2
{
color: white;
font-family: verdana;
text-shadow: black 0.1em 0.1em 0.2em;
text-align: center;
}
table
{
font-family:verdana;
color: white;
text-shadow: black 0.1em 0.1em 0.2em;
}
</style>
<script type="text/javascript">
function question1(... | 2014/03/19 | [
"https://Stackoverflow.com/questions/22505664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3437488/"
] | You never defined the quiz variable. Use value attribute to get selected radio button. Use the following code.
```
<html>
<head>
<title> Algebra Reviewer </title>
<style type="text/css">
h2 {
color: white;
font-family: verdana;
text-shadow: black 0.1em 0.1em 0.2em;
text-align: center;
}
table {
font-fam... | The `name` attribute for radio buttons and the submit button should not be same I guess.
Try changing `name` attribute of submit button. |
54,011,125 | Laravel echo server is started event is broadcasted but users are not able to join channel hence not able to listen the event.
```
1. ExampleEvent file:
class ExampleEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
... | 2019/01/02 | [
"https://Stackoverflow.com/questions/54011125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10859050/"
] | I had the same issue.
Try this with this version `"socket.io-client": "2.3.0"`
Also debug the queue `php artisan queue:work sqs --sleep=3 --tries=3`
and resolve error if any | You have to choices in listening
1- Put full namespace of your event
```
window.Echo.channel('test-event')
.listen('App\\Events\\ExampleEvent', (e) => {
console.log(e);
});
```
2- To put name of this event in event file
```
public function broadcastAs()
{
return "example-event";
}
```
and call event i... |
17,985,666 | I want to join two below model class with entity framework in controller for present factor in accounting system in a view
```
<pre>
namespace AccountingSystem.Models
{
public class BuyFactor
{
public int BuyFactorId { get; set; }
public DateTime CreateDate { get; set; }
... | 2013/08/01 | [
"https://Stackoverflow.com/questions/17985666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2640592/"
] | Just create another model then calls the other model in there
```
public class ParentModel
{
public BuyFactor BuyFactor {get; set;}
public BuyFactorDetail BuyFactorDetail {get; set;}
}
```
So when you will call it in view
```
@model IEnumerable<AccountingSystem.Models.ParentModel>
@Html.DisplayNameFor(mod... | Use a Linq join query like
```
var query = (from b in context.BuyFactors
join d in context.BuyFactorDetail
on
..
select new
{
BuyFactorId = b.BuyFactorId,
....
... |
13,143,713 | I have been following a tutorial on ListView and the following code gives errors. I have searched all the forums I can find but I keep coming up with the same recommended code. Maybe all the forums are quoting old versions and perhaps Android has moved on.
Anyway, here is the code and the error message:
```
getListV... | 2012/10/30 | [
"https://Stackoverflow.com/questions/13143713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1716514/"
] | You should be able to solve this by specifying the parent class of **onItemClickListener** like this:
```
myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
``` | I suggest like that,If there is ListView, `extends ListActivity` and handle listitem click in `onListItemClick`
```
@Override
protected void onListItemClick(ListView list, View view, int position, long id) {
super.onListItemClick(list, view, position, id);
//handle listitem click.
}
``` |
13,803 | What is the easiest way to disable the touch pad on a laptop?
I have a laptop which lacks a means to turn off the touchpad with a simple Function key sequence. I would like to disable the touchpad so that it stops detecting movement when I am typing. This is quite an annoyance as it sometimes results in deletions of s... | 2009/07/27 | [
"https://superuser.com/questions/13803",
"https://superuser.com",
"https://superuser.com/users/2310/"
] | Original post isn't real clear on if you need something that can be quickly turned back on or not. Typically, the connector from the touchpad to the mobo is easily reached under the keyboard. You could unplug it as long as you don't need to be able to turn it on/off on the fly (and you're not worried about warranty/pos... | Often the manufacturer will have custom software that does this. |
34,673 | >
> For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. [John 3:16 KJV]
>
>
>
I don't see how most Christians define the word "whosoever" as "anybody" and "all." If the word does mean "anybody" and "all," why did the Lord Jes... | 2018/09/22 | [
"https://hermeneutics.stackexchange.com/questions/34673",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/26664/"
] | The Greek text uses a participle, so a more literal reading might be *everyone believing in Him ...*
In the phrase:
>
> πᾶς / ὁ πιστεύων / εἰς / αὐτὸν
>
> *Pas* / *ho* *pisteuōn* / *eis* / *auton*
>
>
>
the *ho pisteuōn* literally means "the believing [one]" - it is in the singular. *Pas* means "every". The p... | I believe in Romans it says he Foreknew, therefore he predestined. So that would mean on his foreknowledge, he predestined people who would be saved based on the decision he knew they would make. |
55,696,920 | I am trying to use Scaffold-DbContext from Entity Framework Core to create Models from an existing MS Access Database.
In Package Manager Console when I run the command:
```
Scaffold-DbContext "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Folder\Database.mdb;" EntityFrameworkCore.Jet
```
I get the following err... | 2019/04/15 | [
"https://Stackoverflow.com/questions/55696920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5454582/"
] | You need to target .Net Framework.
Actually OleDb is not ported to .Net Core.
<https://github.com/dotnet/corefx/issues/23542>
You can try with .Net Framework 4.6 or 4.7. | System.Data.OleDb for .NET Core is now available on NuGet.org as per: <https://github.com/dotnet/runtime/issues/23321#issuecomment-502413964> |
72,195,673 | I want to get the list of all file names in a directory but the order of files matters to me. (And I'm using ***Google Colab*** if that matters)
---
>
> P.S: I've accepted the first answer, but just in case know that when I
> moved my files from google drive to my local PC and run the code, it
> worked and printed t... | 2022/05/11 | [
"https://Stackoverflow.com/questions/72195673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7339624/"
] | The way they exist in the folder isn't really a thing. In reality they are all sitting somewhere in memory and not necessarily next to each other in any way. The GUI usually displays them in alphabetical order, but there are also usually filters you can click to sort them in whatever way you choose.
The reason they ar... | Although I agree with the other comment, there is the option to use natural language sorting. This can be accomplished with the [natsort](https://github.com/SethMMorton/natsort) package.
```py
>>> from natsort import natsorted
>>> files = ['file24.txt', 'file5.txt', 'file61.txt']
>>> sorted_files = natsorted(files)
>>... |
33,881,446 | In VBA, when you use the OR statement, will the processor check through all criteria regardless of whether it has already found a FALSE statement?
i.e. for:
```
If CriteriaA OR CriteriaB OR CriteriaC OR CriteriaD Then
Exit Function
End If
```
If CriteriaA is false, will the other criteria be checked unnecessari... | 2015/11/23 | [
"https://Stackoverflow.com/questions/33881446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2566283/"
] | Alright guys, I took some bits and pieces from other answers and came up with what I think is the best solution for me:
```
$domain = 'example.com';
$hostname = 'www.' . $domain;
$file_contents = '127.0.0.1 {{domain}} {{hostname}}';
$result = preg_replace_callback(
"/{{(.+?)}}/",
function ($matches) {
... | You could use a `preg_replace_callback` to do this, you will need to put your replacements into an array though.
e.g
```
$domain = 'example.com';
$newString = preg_replace_callback(
'/{{([^}}]+)}}/',
function ($matches) {
foreach ($matches as $match) {
if (array_k... |
9,529 | In the first major action between the Germans and Americans, at [the battle of Kasserine Pass](http://en.wikipedia.org/wiki/Battle_of_the_Kasserine_Pass) , the Germans inflicted casualties against (mostly) the inexperienced Americans at the rate of about 5 to 1. Fortunately, the Americans were able to improve substanti... | 2013/07/12 | [
"https://history.stackexchange.com/questions/9529",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/120/"
] | The only time "kill ratios" really matter all that much is when using [attrition warfare](http://en.wikipedia.org/wiki/Attrition_warfare).
While important in World War I, to the best of my knowledge, this strategy was never employed in a large scale on the fronts Germany was involved in.\* The Germans themselves went ... | As mentioned by many here, kill ratios are only really significant if you're talking attrition warfare or at a basic tactical level. Otherwise they're an effect of losing the war, not a cause.
The underlying question of *why* those kill ratios turned against Germany is a very complicated one, but one important aspect ... |
7,413,111 | When send sms from a device to another sometime it received in both devices.
I don't find any error in source code.
Please help me.
NOTE:
this is send source code:
```
try {
String addr = "sms://" + txt_number.getString()+":1234";
MessageConnection conn = (MessageConnection) Connector.open(addr);
TextMessa... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7413111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/941923/"
] | I realise this question has already been answered, but for those looking for somewhat different (not saying better) approach, here is the Magento extension I wrote <https://github.com/ajzele/Inchoo_LoginAsCustomer>. It does not rewrite any blocks, it uses event/observer to inject Login as Customer button on the custome... | For those who does not want to debug the solution you can install the extension via magento connect:
<http://www.magentocommerce.com/magento-connect/login-as-customer-9893.html>
It allows to login from customer view and order view pages from admin. The extension is stable and works fine in all cases |
68,499,676 | I just want to iterate over "banana" and exchange each letter with "A" to obtain a new string "AAAAAA". Why this code doesn't work?
```
let word = "banana";
for (letter of word)
{
letter = "A";
return word;
}
``` | 2021/07/23 | [
"https://Stackoverflow.com/questions/68499676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16510560/"
] | You are actually overwritting the [local variable](https://developer.mozilla.org/docs/Glossary/Local_variable) `letter` once, then you return the unchanged `word`
If you want to replace all letters by a `'A'`, you can [`repeat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/re... | If you want to replace each character, you can use .replace() with a regex for exchange each letter. <https://developer.mozilla.org/en-US/docs/Glossary/Regular_expression>.
```
let word = "banana";
let regex = /([A-z])/g //
let pSplit = word.replace(regex,"A");
console.log(pSplit);
```
<https://jsfiddle.net/tw85bnp4... |
42,904 | Sweden was one of the warring parties in the [First Barbary War](https://en.wikipedia.org/wiki/First_Barbary_War) (1801-1805) with 3 frigates from the Swedish navy.
I had read that Sweden had a [colony in Gold Coast](https://en.wikipedia.org/wiki/Swedish_Gold_Coast) (modern Ghana), taken from the Dutch, from 1650 to 1... | 2018/01/12 | [
"https://history.stackexchange.com/questions/42904",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/28581/"
] | There is a detailed account of the events available [here](https://books.google.se/books?id=dSw5AQAAIAAJ), in swedish. I will summarize briefly.
First we must note that Tripoli declared war all the time, versus different countries. It was part of their strategy. A declaration of war from Tripoli was nothing but a pre... | This answer focuses on the *casus belli*, the cause for Swedish participation in the Barbary Wars.
Quoting [James L. Cathcart](https://en.wikipedia.org/wiki/James_Leander_Cathcart), Monticello.org states:
>
> **The First Barbary War**
>
>
> ... Cathcart explained to the Secretary of State why America owed nothing ... |
102,710 | Lately I've been thinking of a saying that describes the following:
>
> *Ruining something for someone else, for the sole purpose of it not being useful any more to the other party, even though you do not need it yourself in any way.*
>
>
>
I thought that "spoils of war" / "warspoils" was a saying / "proverb" th... | 2013/02/02 | [
"https://english.stackexchange.com/questions/102710",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/-1/"
] | How about *raze to the ground*?
Conquering armies would often raze a city to the ground, ie completely demolish it so that it was no longer habitable. | A (very) late answer, but the first thing I thought of when reading the description was
>
> Being a [spoil-sport](http://www.thefreedictionary.com/spoilsport).
>
>
>
Meaning that you ruin someone's pleasure in something, usually without any direct benifits to one-self except the "pleasure" of hurting the other pe... |
394,121 | I'm having a debate with a friend. He claims that if you change the rotation of the shaft of a dynamo the output DC current changes direction. I, however, claim otherwise. The way I see it is that a dynamo rotates a coil inside a magnetic field, this produces an AC sine wave which then gets rectified to DC by the commu... | 2018/09/03 | [
"https://electronics.stackexchange.com/questions/394121",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/197289/"
] | Sorry, your friend is correct.
A permanent magnet dynamo is the same as a permanent magnet motor. If the motor polarity is reversed the motor spins in reverse. Similarly the EMF generated by the dynamo will reverse with rotation reversal.
[](https://... | Your friend is closer. If the dynamo has permanent magnet, then the brushes would act as rectifier. Or we can say it's a brush DC motor with a permanent magnet.
The rotor is a coil with a commutator, meanwhile the stator has a constant field produced from permanent magnet. If you change polarity on rotor, the motor w... |
2,128,986 | I know the following:
asp.net webforms, mvc, sql server 2005/2008, web services, and windows services.
I want to expand so I can be a little more versatile.
What things should I be focusing on? (this is general guidance, with a web focus)
I am thinking:
SSIS
windows workflow
sharepoint
What other common skills sh... | 2010/01/24 | [
"https://Stackoverflow.com/questions/2128986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | Not technologies but principles really
[SOLID](http://www.lostechies.com/blogs/chad_myers/archive/2008/03/07/pablo-s-topic-of-the-month-march-solid-principles.aspx)
[ORM](http://www.lalitbhatt.com/tiki-index.php?page=Introduction+to+ORM)
[TDD](http://www.artofunittesting.com/)
[DDD](http://domaindrivendesign.org/) | Architectural/design patterns are a big plus. Understanding how technology should be applied when in charge of an application, what technologies to choose in different situations.
If you like the web focus, AJAX, the MS AJAX framework, JQuery, is good to know. Silverlight is also good to know... |
48,805,886 | I had a .NET core 1.0 webapp working fine. I had to upgrade to .NET Core 2.0. I also had to add a migration step for my SQLite database.
If I launch this command:
>
> Add-Migration MyMigrationStepName
>
>
>
I get this error:
>
> Unable to create an object of type 'ServicesDbContext'. Add an
> implementation ... | 2018/02/15 | [
"https://Stackoverflow.com/questions/48805886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/958464/"
] | **Sample**:
```
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
}
public class ApplicationContextDbFactory : IDesignTimeDbContextFactory<ApplicationDbContext>
{
ApplicationDbContext IDesignTimeDbContextFact... | I solve the problem by simply updating Program.cs to the latest .NET Core 2.x pattern:
**From 1.x:**
```
using System.IO; using Microsoft.AspNetCore.Hosting;
namespace AspNetCoreDotNetCore1App {
public class Program
{
public static void Main(string[] args)
{
var host = new WebHost... |
45,900,542 | I have a div of text that I wish to be able to scroll through without showing the vertical scroll bar. I have followed this but to no avail, the text scrolls however the scroll bar is still visible.
[Hide scroll bar, but while still being able to scroll](https://stackoverflow.com/questions/16670931/hide-scroll-bar-but-... | 2017/08/26 | [
"https://Stackoverflow.com/questions/45900542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1567212/"
] | What browser are you working with because after testing your code, the vertical scroll bar is not showing here.
Better still place the CSS within a style tag as shown below
```
<html>
<style>
#activity_parent {
height: 100%;
width: 100%;
overflow: hidden;
}
#activity_child {
width: ... | you can use Web-kit Css, just set "width: 0px" and u stil will be able to scroll.
```css
::-webkit-scrollbar {
background-color: #042654;
width: 0px;
}
::-webkit-scrollbar-track {
background-color: #bebebe;
border-radius: 0px;
}
::-webkit-scrollbar-thumb {
background-color: #8192A9;
border-radius... |
2,842,232 | What are the use cases of having two constructors with the same signature?
Edit: You cannot do that in Java because of which Effective Java says you need static factory. But I was wondering why would you need to do that in the first place. | 2010/05/16 | [
"https://Stackoverflow.com/questions/2842232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82368/"
] | The reason you would want to have two (or more) constructors with the same signature is that data type is not synonymous with meaning.
A simple example would be a Line class.
Here's one constructor: `public class Line(double x1, double y1, double x2, double y2)`
Here's another: `public class Line(double x1, double y... | You wouldn't, and you can't anyway. It wouldn't compile the class files into bytecode as there's no way for the program to differentiate between them to decide which one to use. |
47,833,759 | I have the following problem:
Path of image is being stored to DB, but the actual file in Storage folder as a complete different name and I can't find a way to retrieve to display in view:
public function savePicture(Request $request){
```
if($request->hasFile('image')) {
$image_name = $request->file('image')->ge... | 2017/12/15 | [
"https://Stackoverflow.com/questions/47833759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9073203/"
] | Try something like that;
```
int index = 0;
foreach (var s in varEnclist)
{
Mystring = Mystring.Replace(s, varDataList[index]);
index++;
}
```
**Output:**
```
1214arajark
``` | I am not sure what is your exact requirement hope this helps
```
string Mystring = "adhbegadhjmqadguvaadgaegadguvabdh";
StringBuilder sb = new StringBuilder(Mystring);
sb.Replace("dfd", "a");
sb.Replace("fee", "b");
sb.ToString();
```
or this one will help
```
string... |
38,842,129 | I am working on an app which requires communication with OData service (Microsoft Dynamics CRM to be exact). I have a requirement where I only need to know what all properties does the entity have.
e.g.
```
[Organization URI]/api/data/v8.1/contacts
```
returns all the contacts, however I want only property defini... | 2016/08/09 | [
"https://Stackoverflow.com/questions/38842129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1635060/"
] | See [Query Metadata using the Web API](https://msdn.microsoft.com/en-us/library/mt607522.aspx "Query Metadata using the Web API"). The previous answer is close but you need the `$expand=Attributes` to get the list of Attributes. Plus it gets all entities where you want to filter on Contact.
```
GET [Organization URI]/... | If you are using the Web Api (looks like you are), then you can retrieve the `EntityMetadata` which has a navigation property for `AttributeMetadata`, which will describe attributes (aka; fields, properties).
`[Organization URI]/api/data/v8.1/EntityDefinitions`
[Use the Web API with CRM metadata](https://msdn.microso... |
808,617 | A sort is said to be stable if it maintains the relative order of elements with equal keys. I guess my question is really, what is the benefit of maintaining this relative order? Can someone give an example? Thanks. | 2009/04/30 | [
"https://Stackoverflow.com/questions/808617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/70935/"
] | It means if you want to sort by Album, AND by Track Number, that you can click Track number first, and it's sorted - then click Album Name, and the track numbers remain in the correct order for each album. | The advantage of stable sorting for multiple keys is dubious, you can always use a comparison that compares all the keys at once. It's only an advantage if you're sorting one field at a time, as when clicking on a column heading - [Joe Koberg](https://stackoverflow.com/questions/808617/what-is-the-benefit-for-a-sort-al... |
2,452,973 | I have a project which has a set of binary dependencies (assembly dlls for which I do no have the source code). At runtime those dependencies are required pre-installed on the machine and at compile time they are required in the source tree, e,g in a lib folder.
As I'm also making source code available for this progra... | 2010/03/16 | [
"https://Stackoverflow.com/questions/2452973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78828/"
] | Maybe one of these ideas will help you to solve the problem:
* Derive interfaces from all classes in the 3rd party dlls. Put these interfaces into an own project (same solution) and add a reference to this interface assembly. Also add an EventHandler to [AppDomain.AssemblyResolve](http://msdn.microsoft.com/de-de/libra... | To all the good advice above, agreed. That being said, maybe there is a valid scenario where the external DLL's are generally not needed? So here is what you do. You wrap and isolate them. (Its a higher level of abstraction than creating interfaces, so a bit easier to maintain).
In Visual Studio, if you do not recompi... |
9,667,228 | I need to get value from a href button. Here I have just developed a code which show all href value. Actually I need to get value from where I click.
here is my code
```
$(document).ready(function() {
$("a.me").click(function(){
var number = $('a').text();
alert(number);
});
});
``` | 2012/03/12 | [
"https://Stackoverflow.com/questions/9667228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/884521/"
] | You should do
```
$(document).ready(function() {
$("a.me").click(function(){
//It's not clear if you want the href attribute or the text() of the <a>
//this gives you the href. if you need the text $(this).text();
var number = this.href;
alert(number);
});
});
``` | one of the answers above will work or you could use
```
...
$("a.me").click(function(e){
var number = $(e.target).text();
alert(number);
});
``` |
5,530,005 | I'm not sure of the best way to ask this question, so I'll start with an example:
```
public static void ConvertPoint(ref Point point, View fromView, View toView) {
//Convert Point
}
```
This call is recursive. You pass in a point, it converts it relative to `fromView` to be relative to `toView` (as long as one ... | 2011/04/03 | [
"https://Stackoverflow.com/questions/5530005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36007/"
] | Fretting over the garbage collector is never not a mistake when dealing with short-lived objects such as the Point, assuming it is actually a class. Given that this is C#, it is likely to be a struct, not bigger than 16 bytes. In which case you should *always* write the method to return a Point. This gets optimized at ... | I tend to make everything a class to simplify things. If you find that this creates unwanted memory pressure in your application only then should you investigate a solution that involves a mutable struct.
The reason I say this is that the GC tends to be very good at optimizing collections around the needs of your app ... |
9,945,265 | I got [this SVG image from Wikipedia](http://upload.wikimedia.org/wikipedia/commons/e/e8/BlankMap-World6-Equirectangular.svg) and embedded it into a website using this code:
```
<embed src="circle1.svg" type="image/svg+xml"/>
```
If you run this, you can inspect the element and see the source code. All countries in... | 2012/03/30 | [
"https://Stackoverflow.com/questions/9945265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066924/"
] | Okay using your comments I found an answer to my problem. I added this code in the svg itself.
```
<script type="text/javascript"> <![CDATA[
function addClickEvents() {
var countries = document.getElementById('svg1926').childNodes;
var i;
for (i=0;i<countries.length;i++){
countr... | If your SVG is contained in the DOM, you can attach event listeners to separate elements in the same manner as basic HTML. Using jQuery one example would be: <http://jsfiddle.net/EzfwV/>
Update: Most modern browsers support inline svg, so to load your source into the DOM, all you have to do is load it in from a resour... |
52,165,484 | Got a situation that is unclear to me.
What I want is this: Play an audio and after audio has finished playing, start the microphone recording.
The problem: In FF and Chrome the code works just fine. On Safari however, when the audio has stopped playing and the microphone recording function starts, the audio is at th... | 2018/09/04 | [
"https://Stackoverflow.com/questions/52165484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3537395/"
] | >
> Is it really necessary to go through the process of accepting a string as input and convert it to a numeral to perform the calculation?
>
>
>
It isn't strictly necessary but it does enforce good habits. Let's assume you are going to ask for 2 numbers from the users and use something like
```
std::cout << "Ent... | >
> I was advised to refrain from using cin unless it is really necessary.
>
>
>
First of all, there is a misunderstanding, because you are still using `std::cin`. I will interpret your question as using `std::cin::operator >>` vs `getline(std::cin,...)`. Next I would rather suggest you the opposite: Use `operator... |
117,952 | I have two tables containing Tasks and Notes, and want to retrieve a list of tasks with the number of associated notes for each one. These two queries do the job:
```
select t.TaskId,
(select count(n.TaskNoteId) from TaskNote n where n.TaskId = t.TaskId) 'Notes'
from Task t
-- or
select t.TaskId,
coun... | 2008/09/22 | [
"https://Stackoverflow.com/questions/117952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14072/"
] | In most cases, the optimizer will treat them the same.
I tend to prefer the second, because it has less nesting, which makes it easier to read and easier to maintain. I have started to use SQL Server's common table expressions to reduce nesting as well for the same reason.
In addition, the second syntax is more flexi... | I make it a point to avoid subqueries wherever possible. The join will generally be more efficient. |
3,732,101 | I find myself needing to synthesize a ridiculously long string (like, tens of megabytes long) in JavaScript. (This is to slow down a CSS selector-matching operation to the point where it takes a measurable amount of time.)
The best way I've found to do this is
```
var really_long_string = (new Array(10*1024*1024)).jo... | 2010/09/17 | [
"https://Stackoverflow.com/questions/3732101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/388520/"
] | For ES6:
```
'x'.repeat(10*1024*1024)
``` | Simply accumulating is vastly faster in Safari 5:
```
var x = "1234567890";
var iterations = 14;
for (var i = 0; i < iterations; i++) {
x += x.concat(x);
}
alert(x.length); // 47829690
```
Essentially, you'll get `x.length * 3^iterations` characters. |
40,004 | Et non, ce n’est pas le pays. Dans le livre « Le canard de bois » par Louis Caron, on utilise le mot « catalogne » comme le suivant:
>
> Il la souleva doucement entre ses mains et glissa la catalogne sous le corps inerte
>
>
>
Je n’ai absolument rien pu trouver de ce que veut dire ce mot. | 2019/10/14 | [
"https://french.stackexchange.com/questions/40004",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/22006/"
] | Dans une [autre réponse](https://french.stackexchange.com/a/40005) on a établi qu'il s'agissait d'une *couverture* dans l’œuvre ; plus [généralement](https://www.btb.termiumplus.gc.ca/tpv2alpha/alpha-fra.html?lang=fra&i=1&srchtxt=CATALOGNE&index=alt&codom2nd_wet=1#resultrecs) la [*lirette*](https://larousse.fr/dictionn... | Pour ajouter aux autres réponses. *Car c'est une couverture faite à la mains, mais de caractéristique spéciale.*
Une catalogne peut être faite à la main avec des morceaux de restant de coton ou de laine, mais une catalogne à la base reste **lourde** et compacte. C’est une de ses caractéristiques principales.
Le tissu... |
177,778 | I have an employee that went straight to my boss to ask for a raise. This employee never approached me about her wages.
We do reviews annually, and the last review was about 6 months ago, so it really wasn't something I was even thinking about. If she would have, I would have listened to her reasoning and more than li... | 2021/08/20 | [
"https://workplace.stackexchange.com/questions/177778",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/129064/"
] | >
> a) go ahead and call her in, tell her she is getting a raise, and let her know that her going over me instead of asking me herself was inappropriate?
>
>
>
Fixed that for you. Tell her that she is getting a raise and tell her that you think she deserves it and are pleased to offer it. You might even strongly i... | >
> a) go ahead and call her in, tell her she is getting a raise, and let her know that her going over me instead of asking me herself was inappropriate?
>
>
>
>
> b) wait for her to get tired of waiting and ask me herself.
>
>
>
No, c) Talk to your boss about how responding to your employees like that remove... |
61,468,770 | Source code:
```
#include <glfw3.h>
int main(void){
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTe... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61468770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13420564/"
] | Spaces in arguments matter!
Here:
```
-Wl, -BStatic
```
Try removing the extra space:
```
-Wl,-BStatic
```
The reason is that the part after `-Wl,` is the argument passed to the linker.
See questions like [I don't understand -Wl,-rpath -Wl,](https://stackoverflow.com/questions/6562403/i-dont-understand-wl-rpath... | OK, I tried deleting space but it didn't fix the problem. I was getting error:
```
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: unrecognized option '-BStatic'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ... |
52,257 | In velocity map imaging (photo-dissociation and photo-emission), the ejected particles form a newton sphere. I didn't really get the concept why it is called a ["newton sphere"](http://www.google.com/search?q=velocity+map+imaging+newton+sphere) and also why at the poles the distribution is $\cos^2(\theta)$? | 2013/01/26 | [
"https://physics.stackexchange.com/questions/52257",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/20190/"
] | **The outcomes are not supposed to be the same.**
There are two ways to interpret your question:
**1. You want to calculate the kinetic energy in different *reference frames*.**
Let's think for example of a point-like body moving in a constant velocity $\mathbf{v}$. It's kinetic energy is $\frac{1}{2}mv^2$, but if we... | I think I found your mistake. The moment of intertia of a rod fixed about the center is
\begin{equation}
\frac{1}{12} m L^2
\end{equation}
You can derive this in several ways. I derived it by considering two rods moving separately (but still rigid), so then the moment of intertia is as before, but
\begin{equation}
... |
12,935,398 | Given the following html in a Winforms Webbrowser DOM, I'm attempting to get the second element with `value="type102"`
```
<div class="Input"><input type="radio" name="type" value="type101"
onclick="setType('type101');"><a href="javaScript:setType('type101');"
onclick="s_objectID="javascript:setType('type1... | 2012/10/17 | [
"https://Stackoverflow.com/questions/12935398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
var elems = webBrowser1.Document.GetElementsByTagName("input");
var myInputElement = elems.First(e => !string.IsNullOrEmpty(e) && e.Trim().ToLower().Equals("type102"));
foreach (var elem in elems)
{
var value = elem.GetAttribute("value");
if (string.IsNullOrEmpty(value) && value.Trim().ToLower().Equals("typ... | ```
HtmlElement htmlElem = browser.Document.All.GetElementsByName(...)[1]
``` |
183,519 | There are few different formats I have seen so far:
1. With quotes and brackets:
```
PATH="/usr/local/bin:${PATH}"
```
2. With quotes only:
```
PATH="/usr/local/bin:$PATH"
```
3. None:
```
PATH=/usr/local/bin:$PATH
```
Export all the same:
```
export PATH
```
Which is the correct/preferred way? | 2015/02/07 | [
"https://unix.stackexchange.com/questions/183519",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/102280/"
] | This is about shell variables in general, not just PATH.
Here are some examples of why `""` and `{}` can reduce errors.
Putting it in quotes is safer: if you do `a=hello world` then you will not get what you expect, but for `a="hello world"` you will.
Using `{}` is also safer: doing `h="hello"; echo "$hword"` will n... | They all are effective. One isn't drastically better than the other, but I prefer:
```
export PATH=$PATH:/usr/local/bin
```
It takes care of the export and the setting of the path in one line. I also tend to not put the new path before the existing `$PATH`, but there are cases when that might be necessary to load ne... |
1,100,840 | I want to build a bot that basically does the following:
1. Listens to the room and interacts with users and encourages them to PM the bot.
2. Once a user has PMed the bot engage with the client using various AI techniques.
Should I just use the IRC library or Sockets in python or do I need more of a bot framework.
... | 2009/07/08 | [
"https://Stackoverflow.com/questions/1100840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/417449/"
] | Use [Twisted](http://twistedmatrix.com) or [Asynchat](http://docs.python.org/library/asynchat.html) if you want to have a sane design. It is possible to just do it with sockets but why bother doing it from scratch? | If what you want is to create the AI portion, why bother writing all the code needed for the IRC connection by yourself?
I suggest using [SupyBot](http://sourceforge.net/projects/supybot/), and simply write your AI-code as a plugin for it. There is reasonably understandable documentation and lots of example-code to fi... |
7,781,847 | How to write `FORMAT_OF(type)`,so that it will be `%d` for `int`,`%s` for `char *`,etc.
Is there a macro to get the format for basic data types? | 2011/10/16 | [
"https://Stackoverflow.com/questions/7781847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807893/"
] | No. Currently standardized versions of C does not support type introspection of this sort. | Well, if you only want the macro to take a type, you could:
```
#define FORMAT_int "%d"
#define FORMAT_char "%c"
...
#define FORMAT(x) FORMAT_##x
```
and use `FORMAT(int)` later on; but
```
int i;
FORMAT(i);
```
would **not** work, and `FORMAT(char*)` would not work either. |
1,407,113 | I need a component/class that throttles execution of some method to maximum M calls in N seconds (or ms or nanos, does not matter).
In other words I need to make sure that my method is executed no more than M times in a sliding window of N seconds.
If you don't know existing class feel free to post your solutions/ide... | 2009/09/10 | [
"https://Stackoverflow.com/questions/1407113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/117459/"
] | If you need a Java based sliding window rate limiter that will operate across a distributed system you might want to take a look at the <https://github.com/mokies/ratelimitj> project.
A Redis backed configuration, to limit requests by IP to 50 per minute would look like this:
```
import com.lambdaworks.redis.RedisCli... | My implementation below can handle arbitrary request time precision, it has O(1) time complexity for each request, does not require any additional buffer, e.g. O(1) space complexity, in addition it does not require background thread to release token, instead tokens are released according to time passed since last reque... |
35,719,119 | I am trying to resize a viewpager to the rest of the page. I have this globallayout listener:
```
ViewTreeObserver viewTreeObserver = pager.getViewTreeObserver();
viewTreeObserver
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
... | 2016/03/01 | [
"https://Stackoverflow.com/questions/35719119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1307987/"
] | This Example explains everything regarding POSTFIX and PREFIX.
```
Operator Name Description
++$x Pre-increment Increments $x by one, then returns $x
$x++ Post-increment Returns $x, then increments $x by one
--$x Pre-decrement Decrements $x by one, then returns $x
$x-- Post-d... | Yes that's correct, you can read everything about that back on php.net
<http://php.net/manual/en/language.operators.increment.php>
this will cover it |
2,000,983 | Here's what I want to do:
```
public function all($model) {
$query = 'SELECT ' . implode(', ', $model::$fields) ....;
}
```
Called like this:
```
$thing->all(Account);
```
I get this error:
```
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/mark/public_html/*/account.php on line 15
```
... | 2010/01/04 | [
"https://Stackoverflow.com/questions/2000983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1103052/"
] | You cannot use `self` this way : it can only be used in a static context (i.e. inside a static method) to point to the class -- and not its name.
If you are working with non-static methods (seems you are), you should use `$this`, instead of `self`.
Actually, before PHP 5.3, you cannot use a static method/data with a ... | I find this similar line works in my Laravel app:
```
$thing->all(new Account);
``` |
5,370,786 | We have been using asp.net mvc for development. Sometimes, we need to put some hidden fields on form that are shoved in the model by modelbinder (as expected). Nowadays, users can easily temper the form using firebug or other utilities. The purpose of hidden field is mostly to provide some information back to server on... | 2011/03/20 | [
"https://Stackoverflow.com/questions/5370786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331174/"
] | >
> if user changes the employeeID in
> hidden field, wrong employee will be
> updated in the database
>
>
>
This is a *major* security hole in your website. In everything you do with web development, no matter how clever someone's code might be or how much you think you'll be ok as long as users don't do someth... | One potential alternative would be to store that static, single-use information in TempData on the server and not pass it to the client where it could be tampered with. Keep in mind that by default TempData uses Session and has limitations of its own - but it could be an option. |
70,158,942 | **(solution is at the end)**
I have a tilemap with tiles that can spread to the adjacent tiles based on data I store in a dictionary by position.
[](https://i.stack.imgur.com/XFa3r.png)
While the check for that is done in no time at all it does take considerable r... | 2021/11/29 | [
"https://Stackoverflow.com/questions/70158942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3120417/"
] | `async` functions *always* return promises. You can't fetch data asynchronously during rendering.
You need a `useEffect` hook to run the function which gathers the data, and then a `useState` hook to store it, along with logic to show a loading state while you wait for it.
```
const MyRow = ({ info }) => {
const [... | Use a separate component for the tr tag and call it within it.
```js
const Component = (props) => {
const {info} = props
useEffect(() => {
// call your api and set it to state
}, [])
return <tr>
<td key={info.name}>{info.name}</td>
<td key={info.price}>{info.price}</td>
<td key={i... |
50,542,764 | [Flutter's wiki](https://github.com/flutter/flutter/wiki/Flutter%27s-modes#artifact-differences) mentions obfuscation is an opt-in in release mode.
And yet, the **flutter build** command has no relevant option - see:
`flutter help -v build apk`
Am I missing something here?
Did they make obfuscation the defau... | 2018/05/26 | [
"https://Stackoverflow.com/questions/50542764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9850927/"
] | Obfuscation is needed - a flutter app knows its function names, which can be shown using Dart's StackTrace class. There's **under-tested** support for obfuscation. To enable it:
---
**For Android**:
Add to the file `[ProjectRoot]/android/gradle.properties` :
```
extra-gen-snapshot-options=--obfuscate
```
---
... | All the above answers are correct, but no answer tells you that we need to add a relative path or directory path while generating build.
**Example using Relative Path:**
```
flutter build apk --obfuscate --split-debug-info=./ProjectFolderName/debug
```
**Example using Folder Path:**
```
flutter build apk --obfusca... |
1,330,282 | I'm trying to diagnose why my Outlook plugin written in C#/VSTO 3.0/VS 2008 doesn't load after being installed.
The plugin works awesomely on my development machine, which has Visual Studio 2008 installed. I can't expect all my users to have all the prerequisites though so I went through these steps to write an instal... | 2009/08/25 | [
"https://Stackoverflow.com/questions/1330282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3284/"
] | Make sure you have try-catch handlers at the top level of all methods called by Outlook and log any exceptions you are unable to handle in some way. Focus your troubleshooting on methods like the `Startup` method and other methods called during initialization. | On your machine, when you run the addin from Visual Studio, it should create a registry key in HKEY\_CURRENT\_USER\Software\Microsoft\VSTO\Security\Inclusion{SomeGuid}. Make sure that these registry settings are also being deployed with your addin. They are the ones that allow your code to be trusted. |
38,407,803 | I was recently asked this question at an interview and I wasn't able to solve it. I wanted to post it here and see if anyone can give me some ideas on how to approach on solving such problems.
**Question: Given positive X axis and Y axis...**
1. **Start by drawing a square of width=A (say A=1000)**
2. **Next draw a c... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38407803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1334148/"
] | If you have your html in string form you can perform some regex and loops on the string and get the desired outcome in array from, i'm not sure if this is what you're looking for..
```js
var result = html.match(/<td>(.*?)<\/td>/g).reduce(
function(new_array,x,i,arr) {
if(i % 3 == 0){
new_array.push('<tr class=... | You just need to set counter for this, example :
```
$counter = 0;
foreach ($table_data as $single_table_date){
if ($counter % 3 == 0) {
echo '</tr>';
echo '<tr>';
}
echo '<td>';
echo $single_table_date;
echo ... |
9,235,309 | Using Java, is there a way to look at some content, say, String representation of a file and either confirm or deny that it represents an XML file?
What library would you chose to parse the file? Could you possibly provide an example? | 2012/02/10 | [
"https://Stackoverflow.com/questions/9235309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359862/"
] | IMO the *quickest* way would be to see if it parses, particularly if you have a DTD/XSD. You can check for well-formedness without either using any of the normal XML parsing libs.
Otherwise, not really sure what you could do. | Well, you could just examine the root tag: `<?xml version="" ?>` to check whether it's XML. But if your looking to validate an XML document that has specified a schema or DTD, then just create a validating parser from one of the two JAXP parser factories: SAXParserFactory and DOMBuilderFactory. If your validating only,... |
9,462,356 | I found that I am confusing between web framework and web server.
`Apache is a web server.`
`Tornado is a web server written in Python.`
`Nginx is a web server written in C`
`Zend is a web framework in php`
`Flask/Bottle is a web framework in Python`
`RoR is a web framework written in Ruby`
`Express is a web fra... | 2012/02/27 | [
"https://Stackoverflow.com/questions/9462356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514316/"
] | How I feel your pain !
Like many, I found it hard to get to the essence of Node.js because most people only write/talk about the part of Node that they find useful - and the part they find interesting is usually a secondary benefit of Node rather than its primary purpose. I must say that I think it's mad for people to... | I think the problem is that the terminology of "web server" or "web application server" is dominated by the JEE world, and products, that are not as modularized as today's Javascript world of frameworks, which in turn can be combined more or less freely.
I see no reason why a technology, that can serve complex applica... |
33,814,687 | I have two JS objects, I want to check if the first Object has all the second Object's keys and do something, otherwise, throw an exception. What's the best way to do it?
```
function(obj1, obj2){
if(obj1.HasAllKeys(obj2)) {
//do something
}
else{
throw new Error(...);
}
};
```
For... | 2015/11/19 | [
"https://Stackoverflow.com/questions/33814687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140903/"
] | You can use:
```
var hasAll = Object.keys(obj1).every(function(key) {
return Object.prototype.hasOwnProperty.call(obj2, key);
});
console.log(hasAll); // true if obj2 has all - but maybe more - keys that obj1 have.
```
As a "one-liner":
```
var hasAll = Object.keys(obj1).every(Object.prototype.hasOwnProperty.bind... | Another way to do this, that seems to work fine as well.
```
const o1 = {
a : '....',
b : '...',
c : '...',
d : '...'
},
o2 = {
b : '...',
d : '...',
};
///////////////////////
///// I. IN ONE LINE
///... |
72,384,377 | I have a URI like this:
```
spotify:image:ab67616d0000b2737005885df706891a3c182a57
```
I want to know how to get the image from this URI? I'm currently using the Web API. I imagine I might need to convert the URI into the image URL some how.
I can't see anything elsewhere on Google or in the API docs.
Any help wou... | 2022/05/25 | [
"https://Stackoverflow.com/questions/72384377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3846032/"
] | It's a simple while loop:
```
n = 23452436
while n >= 10:
print(n)
n = sum(int(i) for i in str(n))
print(n)
``` | This is a suitable place to use a recursive method.
```
def digit_sum(n: int):
curr_sum = sum(int(digit) for digit in str(n))
if curr_sum < 10:
return curr_sum
else:
return digit_sum(curr_sum)
``` |
533,183 | I have created this bash function to recursively find a file.
```
ff() {
find . -type f -name '$1'
}
```
However, it returns no results. When I execute the command directly on the commandline, I do get results. I am not sure why it behaves differently, as shown below.
```
mattr@kiva-mattr:~/src/protocol$ ff *.s... | 2019/07/31 | [
"https://unix.stackexchange.com/questions/533183",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/364914/"
] | You may also try the `<<<` (Here Strings) operator to save on lines:
```
$ python <<< 'print("MyTest")'
MyTest
``` | You can also set python path while calling the python file from bash script:
```
export PYTHONPATH=/tmp/python_dep.zip && python test_my.py
``` |
44,810,511 | I'm struggling to add empty spaces before the string starts to make [my GitHub `README.md`](http://github.com/noduslabs/8os/) looks something like this:
[](https://i.stack.imgur.com/S5eT4.png)
Right now it looks like this:
[![enter image description... | 2017/06/28 | [
"https://Stackoverflow.com/questions/44810511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/712347/"
] | Instead of using HTML entities like ` ` and ` ` (as others have suggested), you can use the Unicode em space (8195 in UTF-8) directly. Try copy-pasting the following into your `README.md`. The spaces at the start of the lines are em spaces.
```
The action of every agent <br />
into the world <br />
starts ... | Markdown really changes everything to html and html collapses spaces so you really can't do anything about it. You have to use the ` ` for it. A funny example here that I'm writing in markdown and I'll use couple of here.
Above there are some ` ` without backticks |
8,992,113 | I am building a WPF calculator application, and while testing it (comparing with the behavior of the Windows built in calculator) i have seen some differences.
Here's a print out from one of my tests:
>
> Test 'Comparison.Tests.ComparisonTests' failed:
>
>
> Expected string length 17 but was 16. Strings differ at... | 2012/01/24 | [
"https://Stackoverflow.com/questions/8992113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/494143/"
] | Double is plenty if you're willing to accept its limitations (15-16 digits of precision).
If you're using Windows Calculator as the gold standard, you should be aware that it does not use Double internally -- it was [rewritten in Windows 95](http://en.wikipedia.org/wiki/Calculator_%28Windows%29) to use an arbitrary-pr... | Double will give you 53 bits of precision (52 bits in a 64-bit value, with an implicit extra bit for most values).
Decimal will give you 96 bits of precision (in a 128-bit value).
That the exponent of the former is in binary and of the later is decimal means that the "round" numbers in double can be more surprising t... |
56,561,964 | I want to remove the words having : sign (Like :word:) in its both side.I have already use a regular expression to remove all between two : sign. But i need to remove just single words exists between two : sign, not a full sentence (Like :I like to play cricket:).
```
string txt = "Hello, i :want: to remove :some wor... | 2019/06/12 | [
"https://Stackoverflow.com/questions/56561964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5243258/"
] | the problem is your regex. try this:
```
var output = Regex.Replace(txt, @":([A-Za-z0-9]*):", "");
``` | In your regex you're using `.*` this matches any character except newline. Instead I assume you would like any non-whitespace character. In regex this would be `\S`, so in total you would get:
```
string txt = "Hello, i :want: to remove :some word from: my text";
var output = Regex.Replace(txt, @" ?\:\S*?\:", " ");
`... |
67,699,561 | How to solve **ReferenceError: window is not defined**? this is my code
```
let timestamp = new Date();
var str = params.email;
var enc = window.btoa(str);
var dec = window.atob(timestamp);
console.log(window)
if (window == "undefine"){
var template = handlebars.compile(html);
var htmlToSend = temp... | 2021/05/26 | [
"https://Stackoverflow.com/questions/67699561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14823468/"
] | Adding to what @Nabeel said, use this : if(typeof window === "undefined") | ***window is a browser thing that doesn't exist on Node.*** |
15,208 | Other than frequency response, what makes a mic sound **good**? Say there is a cheap microphone, and an expensive microphone with same frequency response/selfnoise/sensitivity/polar pattern.
Now we compare the recordings, they probably will sound different..and the winner will probably be expensive one. | 2012/08/29 | [
"https://sound.stackexchange.com/questions/15208",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/1055/"
] | I think your main issue with understanding this is that you're looking at it from too simplified a view.
* Frequency response curves can only be so accurate, and even within a manufactured line of a particular mic by a particular company there may be slight variations.
* Polar response is not identical between two dif... | There are some complex well thought out answers here, but to me the straight up question "can you make a cheap mic sound like an expensive one?" The answer is still unequivocally NO! You cannot skirt around it with long winded explanations.
Making two different mics "work well" together with use of eq is a totally dif... |
20,691,463 | Is there any difference in how `Data.Text` and `Data.Vector.Unboxed Char` work internally? Why would I choose one over the other?
I always thought it was cool that Haskell defines `String` as `[Char]`. Is there a reason that something analagous wasn't done for `Text` and `Vector Char`?
There certainly would be an adv... | 2013/12/19 | [
"https://Stackoverflow.com/questions/20691463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2827654/"
] | It's a fairly bad idea to think of `Text` as being a list of characters. `Text` is designed to be thought of as an opaque, user-readable blob of Unicode text. Character boundaries might be defined based on encoding, locale, language, time of month, phase of the moon, coin flips performed by a blinded participant, and m... | To add to what J. Abrahamson said, it's also worth making the distinction between iterating over runes (roughly character by character, but really could be ideograms too) as opposed to unitary logical unicode code points. Sometimes you need to know if you're looking at a code point that has been "decorated" by a previo... |
643,040 | I have the following integral I'm trying to solve:
$$\frac{3}{2\pi}\int\_0^{2\pi}\frac{e^{-ikx}}{5 - 4\cos(x)} \mathrm dx, \quad k \in \mathbb{Z}.$$
I've tried writing the exponential in terms of sines and cosines and then using the usual rational trig function substitutions, i.e. rewriting the integrand as
$$\frac{... | 2014/01/18 | [
"https://math.stackexchange.com/questions/643040",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99261/"
] | Careful when differentiating. With $y=Ate^{-2t}$ I got,
$$y'=-2Ate^{-2t}+Ae^{-2t} $$
and so when we plug that into the differential equation we are looking for values of $A$ such that the following equation is satisfied,
$$ 2(-2Ate^{-2t}+Ae^{-2t})+4Ate^{-2t}=3e^{-2t} $$
So we are looking for $2A=3$. So I do think the... | You are right there are no values of $A$ and $B$ that for which your $y$'s are solutions. Actually the solution is a linear function $y = 3t +C$. |
3,203,321 | Can anybody give pointers how I can implement lzw compression/decompression in low memory conditions (< 2k). is that possible? | 2010/07/08 | [
"https://Stackoverflow.com/questions/3203321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/158163/"
] | The lowest dictionary for lzw is **trie on linked list**. See original implementation in [LZW AB](https://github.com/dbry/lzw-ab/blob/master/lzw-lib.c). I've rewrited it in fork [LZWS](https://github.com/andrew-aladev/lzws). Fork is compatible with `compress`. Detailed documentation [here](https://github.com/andrew-ala... | ```
typedef unsigned int UINT;
typedef unsigned char BYTE;
BYTE *lzw_encode(BYTE *input ,BYTE *output, long filesize, long &totalsize);
BYTE *lzw_decode(BYTE *input ,BYTE *output, long filesize, long &totalsize);
``` |
15,820,760 | I'm trying to test the following:
```
protected IHealthStatus VerifyMessage(ISubscriber destination)
{
var status = new HeartBeatStatus();
var task = new Task<CheckResult>(() =>
{
Console.WriteLine("VerifyMessage(Start): {0} - {1}", DateTime.Now, WarningTimeout);
Thread.Sleep(WarningTimeou... | 2013/04/04 | [
"https://Stackoverflow.com/questions/15820760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83661/"
] | If running asynchronous code, Moq has the ability to delay the response with the second parameter via a `TimeSpan`
```
mockFooService
.Setup(m => m.GetFooAsync())
.ReturnsAsync(new Foo(), TimeSpan.FromMilliseconds(500)); // Delay return for 500 milliseconds.
```
If you need to specify a different delay each ... | I had a similiar situation, but with an Async method. What worked for me was to do the following:
```
mock_object.Setup(scheduler => scheduler.MakeJobAsync())
.Returns(Task.Run(()=> { Thread.Sleep(50000); return Guid.NewGuid().ToString(); }));
``` |
2,669,652 | i wonder if Doctrine 2 is stable enough to use for a production project?
i guess the project will be finished 3 months from now so maybe then Doctrine 2 will be released in a complete version.
i'm wondering if its smarter to use learn and use doctrine 2 right away instead of learning the current version and then conv... | 2010/04/19 | [
"https://Stackoverflow.com/questions/2669652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224922/"
] | Are you able to scroll using touches to the last row? It may be a contentSize issue. | The easiest way is to set this [statusMessagesTableView setContentInset:UIEdgeInsetsMake(0, 0, 80, 0)]; |
34,600,932 | I ran
```
npm config set prefix /usr/local
```
After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.
```
Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'
at Error (native)
```
Have deleted all files from
```
C:\Users\<your userna... | 2016/01/04 | [
"https://Stackoverflow.com/questions/34600932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5236174/"
] | Sometimes, all that's required is to stop the dev server before installing/updating packages. | If cleaning the cache(`npm cache clean --force`) doesn't help you just delete
manually the folder `C:\Users\%USER_NAME%\AppData\Roaming\npm-cacheand` and reinstall NodeJS |
60,559,434 | I would like to manipulate the code from an answer found in the following link:
[Compare md5 hashes of two files in python](https://stackoverflow.com/questions/36873485/compare-md5-hashes-of-two-files-in-python)
My expected outcome would be to search for the two files I want to compare, and then execute the rest of th... | 2020/03/06 | [
"https://Stackoverflow.com/questions/60559434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11915729/"
] | The `filedialog.askopenfilenames` returns a tuple. This means means that `z` and `b`, and in turn the `filename` iterator of the for loop, are tuples. You are getting the error because you are passing `filename`, which is a tuple, into the open function.
A way to fix this could be to simply concatenate the tuples.
``... | Fixed above error as stated using this line of code:
```
filez = z[0], b[0]
``` |
29,618,187 | l1 and l2 are arrays that I input. I want to merge l1 and l2 into l3 and sort them in ascending order. When i tried to add l1 and l2 into l3 i get a syntax error stating, "The left-hand side of an assignment must be a variable".
```
import java.util.ArrayList;
import java.util.Scanner;
public class Array {
publi... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29618187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4771787/"
] | The [`ArrayList.add(int, E)`](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#add%28int,%20E%29) method can take an index and a value (that is, you can't assign the value to the result of `add` **or** *the left-hand side of an assignment must be a variable*). Also, please use braces. Something like
`... | You are trying to do a .add() method at the same time as assigning it to another variable. This doesn't work. You should stick with just:
```
l3.add(a++);
``` |
61,943,014 | It works just once for the below code
```
import {
graphql,
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
buildSchema,
} from "https://cdn.pika.dev/graphql/^15.0.0";
import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
var schema = new GraphQLSchema({
query: new GraphQLObjectType({
... | 2020/05/21 | [
"https://Stackoverflow.com/questions/61943014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8407705/"
] | ```
import {
graphql,
buildSchema,
} from "https://cdn.pika.dev/graphql/^15.0.0";
import {Application, Router} from "https://deno.land/x/oak/mod.ts";
var schema = buildSchema(`
type Query {
hello: String
}
`);
var resolver = {hello: () => 'Hello world!'}
const executeSchema = async (query:any) => {
... | I have created [gql](https://github.com/deno-libs/gql) for making GraphQL servers that aren't tied to a web framework. All of the responses above show Oak integration but you don't really have to use it to have a GraphQL server. You can go with `std/http` instead:
```
import { serve } from 'https://deno.land/std@0.90.... |
469,063 | I’ve joined a writer’s forum that has critiquing workshops, and I’m merrily participating. Some of the work is really good. But I keep running across usages of the word “whilst”, which to me is old fashioned and outdated.
Many of the posters there have English as a second (or third) language, and are (sometimes clearl... | 2018/10/18 | [
"https://english.stackexchange.com/questions/469063",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/-1/"
] | My understanding is that 'whilst' is rarely used anywhere, but it's much more common in UK English than US English.
One quick link:
<https://blog.oxforddictionaries.com/2016/02/18/while-or-whilst/> | It's almost never used in verbal communications in the American English. It is often used in British English verbally. Both are acceptable in written communication, though American readers may find it pretentious at worst and "British" at best. In dialog, it can be used to denote someone with a British accent. American... |
844 | Just curious, what are the requirements for leaving the beta stage and becoming a full-fledged site like, say, English Language & Usage? | 2012/01/11 | [
"https://christianity.meta.stackexchange.com/questions/844",
"https://christianity.meta.stackexchange.com",
"https://christianity.meta.stackexchange.com/users/1039/"
] | As David notes, [instructions for deleting your account can be found here.](https://meta.stackexchange.com/questions/5999/can-i-delete-my-account/7979#7979) Note that you *should* have been able to self-delete your account, since you've never used it. However, since you've already gone ahead and emailed us about it, I'... | In case anyone is looking how to delete his Christianity.SE account, [here is the form](https://christianity.stackexchange.com/help/user-deletion). |
8,414,189 | I need to generate reports from database (billing forms for example) from ASP.NET interface. So I'm wondering which approach is better : Use Crystal Reports, reports based on RDLC or SQL Reporting Services ? I need to create an interface, which allows user to select data and through pre-created report definition genera... | 2011/12/07 | [
"https://Stackoverflow.com/questions/8414189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/876588/"
] | Personally I would go for [DevExpress XtraReports](http://devexpress.com/Products/NET/Reporting/).
I have used it in the past in both windows forms and web forms; it costs few hundreds of bucks but with the package you also get plenty of other UI controls, or you spend less and only buy XtraReports. It pays off in a f... | I would suggest taking a look at [ActiveReports 6](http://www.datadynamics.com/Products/ActiveReports/Overview.aspx). It provides great features and allows you to make almost unlimited customization to your report. For ASP.NET you can either opt for the standard edition which allows you to custom export your reports to... |
2,565 | Suppose you have a standard hotel with a set of rooms. If you have booked a room for a fixed period of time, would allocating a specific room in advance potentially cause a conflict when trying to allocate rooms for other bookings in the future?
I have thought about this and can not think of an example where allocatin... | 2019/09/15 | [
"https://or.stackexchange.com/questions/2565",
"https://or.stackexchange.com",
"https://or.stackexchange.com/users/2352/"
] | I know that you explicitly ask for a statistical test, but maybe this is because you don't know about alternatives that are rather established in the community. When comparing algorithms, my number one is *performance profiles*.
They were introduced in this article: Elizabeth D. Dolan and Jorge J. Moré, [Benchmarking ... | I think there are many different factors to consider. There's a very good paper by [Coffin and Saltzman](https://doi.org/10.1287/ijoc.12.1.24.11899) (Statistical Analysis of Computational Tests of Algorithms
and Heuristics, *INFORMS JOC* 12(1): 24-44, 2000) that discusses this issue in detail. |
52,234,523 | As far as I could understand, if one wants to contribute code to a repository, one would clone/pull and edit.
After that, one would push the changes to, e.g. github.
Aren't they actually "pushes"? | 2018/09/08 | [
"https://Stackoverflow.com/questions/52234523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9681577/"
] | If you like to send a contribution to a GitHub repository, it would be easy to just push it to the repository.
But if everyone just pushes code into one repository, it could get a mess. So therefor you ask the owner to get (and check) your changes, and he **pulls** the changes from your repository into his repository. | >
> Aren't they actually "pushes"?
>
>
>
Actually, **pushing** consists of transmitting by yourself an information to people around that could need it, while **pulling** is about fetching the information YOU need and bring it to you.
Since you generally don't have the right to directly write into a public reposit... |
58,281,356 | I've been making a Car Parking System for a school project, and I've been stuck on this problem for a while now. The goal of the project is to have a maximum of 10 parking slots, where the user is able to select which slot they want to be in from a drop-down box. So far, I've managed to get the drop-down box to show al... | 2019/10/08 | [
"https://Stackoverflow.com/questions/58281356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11355228/"
] | To match the required number of digits and no more, lookahead at the beginning of the pattern for `(?:\d\.?)` 1 to 8 times, and then match `\d*(?:\.\d{1,2})?$` to match a number which, if containing decimals, contains at maximum 2 decimal characters:
```
^-?(?=(?:\d\.?){1,8}$)\d*(?:\.\d{1,2})?$
```
<https://regex101... | You can try this
```
^-?\d{1,8}.?\d{1,2}$
```
Link : <https://regex101.com/r/x7yw5M/2> |
141,677 | I tried installing ubuntu server alongside my windows 7 from a usb drive. After the partitioner level, the installation gives this:
warning: file:///cmrom/pool/main/c/coreutils/coreutils\_8.5-1ubuntu6\_amd64.deb was corrupted.
Should I download another server file? Or is there another way to solve this problem? Thank... | 2012/05/24 | [
"https://askubuntu.com/questions/141677",
"https://askubuntu.com",
"https://askubuntu.com/users/65853/"
] | If you're having NVidia drivers and experiencing frequent crashes and frozen desktops, try to switch to propitiatory NVidia driver instead of open source one. | This may help. Open the GParted program and check if the you see an error message on one of the Ubuntu partitions.
I recently wiped my mac partitions and installed Ubuntu on my hard drive. I see that Ubuntu has created a small 977 KB partition which has the flag `bios_grub`.
I wonder if that is what is causing the ... |
5,803,999 | I am trying to silently install apk into the system.
My app is located in /system/app and successfully granted permission "android.permission.INSTALL\_PACKAGES"
However I can't find anywhere how to use this permission. I tried to copy files to /data/app and had no success. Also I tried using this code
```
Intent... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5803999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/705297/"
] | I checked all the answers, the conclusion seems to be you must have root access to the device first to make it work.
But then I found these articles very useful. Since I'm making "company-owned" devices.
[How to Update Android App Silently Without User Interaction](https://www.sisik.eu/blog/android/dev-admin/update-... | I made a test app for silent installs, using PackageManager.installPackage method.
I get installPackage method through reflection, and made android.content.pm.IPackageInstallObserver interface in my src folder (because it's hidden in android.content.pm package).
When i run installPackage, i got SecurityException wit... |
66,318 | I'm slowly working towards buying my first home (yay!), and have been playing around with the numbers. As far as I can tell, there's literally zero advantage for getting a 10 or 15-year mortgage since I can just get the exact same mortgage in a 30-year version, and just pay it off within whatever year window I choose.
... | 2016/06/19 | [
"https://money.stackexchange.com/questions/66318",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/-1/"
] | I haven't heard 30-year mortgages called unwise. As @jared said, the shorter terms often will be cheaper if you are going to pay off within that term anyway, but the extra cost of the 30 may still be justified because it gives you the "safety net" of being able to fall back to the lower payment if money gets tight. Che... | At this time there is one advantage of having a 30 year loan right now over a 15 year loan. The down side is you will be paying 1% higher interest rate.
So the question is can you beat 1% on the money you save every month.
So Lets say instead of going with 15 year mortgage I get a 30 and put the $200 monthly differen... |
38,798,841 | I want to write a simple scan over an array. I have a `std::vector<int> data` and I want to find all array indices at which the elements are less than 9 and add them to a result vector. I can write this using a branch:
```
for (int i = 0; i < data.size(); ++i)
if (data[i] < 9)
r.push_back(i);
```
This gi... | 2016/08/05 | [
"https://Stackoverflow.com/questions/38798841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1794469/"
] | ```
std::copy_if(std::begin(data), std::end(data), std::back_inserter(r));
``` | Well, you could just resize the vector beforehand and keep your algorithm:
```
// Resize the vector so you can index it normally
r.resize(length);
// Do your algorithm like before
int current_write_point = 0;
for (int i = 0; i < length; ++i){
r[current_write_point] = i;
current_write_point += (data[i] < 9);
}... |
1,896,096 | Morning all. I have the folowing problem:
```
$(document).ready(function(){
$("#actContentToGet").load(function(){
var htmlCODE = document.getElementById('actContentToGet').contentWindow.document.body;
var elements = [];
var z = 1;
function alterContent(htmlCODE){
$("#createdDivs").html("");
... | 2009/12/13 | [
"https://Stackoverflow.com/questions/1896096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/201469/"
] | It looks like you're trying to do a join, so it would be:
```
var query = context.A_Collections.Join(
context.B_Collections,
a => a.PK,
b => b.PK,
(a, b) => new {
A_key = a.PK,
A_value = a.Value,
B_Key = b.PK,
B_value = b.value
});
```
EDIT: As Jon Skeet points out however, the actual translation done b... | Try using Resharper this will help you to convert all Linq queries in Linq Methods if you prefer that. |
1,627,422 | I am calling SSIS package from a .Net windows UI. Both SSIS & .Net app are created in 2008. The SSIS package is stored in file system. When I ran .Net app I got error:
>
> The package failed to load due to
> error 0xC0011008 "Error loading from
> XML. No further detailed error
> information can be specified for th... | 2009/10/26 | [
"https://Stackoverflow.com/questions/1627422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196914/"
] | Do you have SSIS components installed on the computer where you are executing this package? If not, it won't run - see <http://msdn.microsoft.com/en-us/library/ms403348.aspx>
Is the version of SSIS installed on the computer 2008? If not, it won't run - 2005 and 2008 parts are not interchangeable.
Is drive "D" a mappe... | Getting exactly same error on the Lame loadPackage call.
This code was working fine for SQL 2005.
EnvDTE90 doesn't look like add any functionality to the DTS Application model.
Referencing both EnvDTE80 and EnvDTE90 doesn't make any differnece |
185,931 | Is it a good practice to implement event handling through WeakReference if that event is the only thing holding the reference and that we would need the object to be garbage collected?
As an argument to this:
Folks say that if you subscribe to something it’s your responsibility to unsubscribe and you should do it. | 2008/10/09 | [
"https://Stackoverflow.com/questions/185931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22039/"
] | Weak references in their own right, don't solve the problem as the delegate holds the reference. In the Composite Application Library which ships with Prism (www.microsoft.com/compositewpf) there is a WeakDelegate class that you could pull from the source. The WeakDelegate basically ues reflection and creates a delegat... | While what you suggest solves one set of problems (event reference management and memory leak prevention), it is likely to open up a new set of problems.
One problem I can see is during event handling process if the source object is garbage collected (as it was only held with a weak reference), any code that access th... |
1,612,594 | $i + cj - 3k$ is a linear combination of $i + j$ and $j + 3k$.
How do I do this question, if it's not in vector form?
Should my approach be
$i + cj - 3k = a(i + j) + b(j + 3k)$? | 2016/01/14 | [
"https://math.stackexchange.com/questions/1612594",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/299748/"
] | Let $a \in (0,1)$.
For any $\epsilon > 0$, choose $N \in \mathbb{N}$ such that $1/N < \epsilon$.
There are only a finite number of rational numbers $r = p/q \in (0,1)$ in lowest terms with $q \leqslant N$. Indeed, $r \in S\_a =\{1/2, 1/3, 2/3, 1/4, 3/4, ..., (N-1)/N\}.$
Since $S\_a$ is finite we can choose $\delta... | Hint: for $a \in (0, 1)$ and $1/a < n \in \Bbb{N}$, consider the interval $I = (a - 1/2n, a + 1/2n)$ (which has length $1/n$): how many rational numbers $p/q \in I$ (with $p$ and $q$ coprime) can have $q \le n$? |
40,183 | Did Kaori know that Arima loved her? From the letter she gave to Arima, she confessed everything and even gave that photograph, but at the same time, she told him to throw it away if he wanted to. This according to me suggests that she didn't know if Arima loved her. If she knew about Arima's feelings, she wouldn't hav... | 2017/05/04 | [
"https://anime.stackexchange.com/questions/40183",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/29779/"
] | This question eventually led me to a translation of the letter she had written for Arima.
Roughly translated, the ending part of the letter gives us an insight in what she knew and what she thought about Arima his feelings. She thought that he loved Tsubaki, or rather everyone knew that but apart from those 2. She, ho... | Towards the ending of the anime, we realize that Kaori's sole motivation in life was Kousei and the love she had for him. Everything she did, including using contacts, changing her hairstyle, "liking" Watari just so that she could get closer to Kousei, was all done in mind that she may not live to continue the ballad. ... |
1,547,862 | The solution says $2x^{219}+3x^{74}+2x^{57}+3x^{44}=\_52x^3+3x^2+2x^1+3x^0$ but I don't see how they arrived at that, even with Fermat's theorem | 2015/11/26 | [
"https://math.stackexchange.com/questions/1547862",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/272288/"
] | $5$ is prime, thus by Fermat's theorem $a^4 \equiv 1 (\text{mod } 5)$ for all $a \in \mathbb{Z}\_5$, such that $a \neq 0$. Therefore you can reduce any power of $x$ to its remainder after the division by $4$.
For the first coefficient we have then
$$
2x^{219} = 2\cdot (x^4)^{54}\cdot x^3 = 2\cdot 1 \cdot x^3.
$$
And ... | $\forall$ prime $P$, and $\forall$ $a\in \mathbb Z$, $a<P$, Fermat's theorem says that $a^{(P-1)} \equiv 1 (mod P)$ Here $5$ is Prime and hence each power can be reduced to a power less than $5$ because obviously the solution belongs to $\mathbb Z\_5$ |
7,044,065 | I have two tables that need to line up side by side. In order to achieve this I have to specify a `td` height.
In IE the height should be 2.1em. In Mozilla it needs to be 1.76em.
There does not appear to be a
`-moz-height:1.76em;`
Any idea how I can achieve my goal? | 2011/08/12 | [
"https://Stackoverflow.com/questions/7044065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87796/"
] | You can put the IE height into a separate stylesheet and load it after the default one, using IE-conditional comments so the other browsers ignore it. Otherwise, you can use jQuery to change the height after it's loaded (if ($.browser.msie)) | Browser detect IE using IE's conditional comments and write out separate BODY tags:
```
<!--[if IE]><body class="ie"><!--<![endif]-->
<!--[if !IE]><!--><body><!--<![endif]-->
```
Then whenever you have a style, you can be more specific by adding the ie class to over-ride only IE:
```
.mystyle {styles for good brows... |
32,588,352 | I am using Spring(boot) on my project and I access a JMS Queue (ActiveMQ) using :
```
@JmsListener(destination = "mydestinationQueue")
public void processMessage(String content) {
//do something
}
```
And it works perfectly but I need to be able to stop/pause/start this bean programatically (a REST call or somet... | 2015/09/15 | [
"https://Stackoverflow.com/questions/32588352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3938606/"
] | Here is the solution I've found
```
@RestController
@RequestMapping("/jms")
public class JmsController {
@Autowired
ApplicationContext context;
@RequestMapping(value="/halt", method= RequestMethod.GET)
public @ResponseBody
String haltJmsListener() {
JmsListenerEndpointRegistry customRegistry =
... | There's a bean of type `JmsListenerEndpointRegistry` (name `org.springframework.jms.config.internalJmsListenerEndpointRegistry`).
You can access the JMS listener containers from the registry (all or by name) and call `stop()` on the one(s) you want; the container will stop after any in-process messages complete their ... |
24,122,149 | ```
Decimal money = 7;
var result=money.Tostring("C);
```
result displays $7.00
How can i show result as **"7.00"**( with 2 numerics after point) without currency symbol? | 2014/06/09 | [
"https://Stackoverflow.com/questions/24122149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713890/"
] | [`"C"` Format Specifier](http://msdn.microsoft.com/en-us/library/dwhawy9k%28v=vs.110%29.aspx#CFormatString) is for currency representation of numbers. It uses your `CurrentCulture`'s [`CurrencySymbol`](http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencysymbol%28v=vs.110%29.aspx) and [... | Try this :
```
var result = money.ToString("f");
``` |
38,548,314 | I have tried searching, but I am stuck.
Basically I am making a jeopardy game board; which I created using a table. I would like to change the background-color of the td after it has been clicked on. The challenge I am facing is that (1) I am using a link to direct to the question/answer (yes, I know this could be don... | 2016/07/24 | [
"https://Stackoverflow.com/questions/38548314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6308715/"
] | ```
$('a').click(function(e){
e.preventDefault();
$(this).parent().css('background-color','blue');
});
```
So,using JQuery, if you click on an tag, don't jump on whatever link it is, you prevent the default event, then you get its parent which is the element and you add th... | Generally, a hyperlinks like `<a herf="" onclick="">`contain two events: onclick and herf. The order of execution --- 'onclick' in front of 'herf'. so making onclick method return 'false' if you want to page can't jump on whatever link it is when you click hyperlink. Code is as follows.
```js
$(function(){
$("a").o... |
569,118 | My Bibliography is arranged like in the example beneath. So the equal initial letters are merged together (without extra line in between). How I'm able to have an extra line in any cases?
```
Kieviet, André (Lean Digital Transformation, 2019): Lean Digital Transformation: Ge schäftsmodelle transformieren, Kundenm... | 2020/10/31 | [
"https://tex.stackexchange.com/questions/569118",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/134693/"
] | `biblatex` has three parameters to adjust the spacing *between* entries (§3.11.4 *Lengths and Counters*, p. 131, v3.15a of [the `biblatex` documentation](http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf)).
* `\bibitemsep` is the space inserted between individual entries.
* `\bibnamesep` is the sp... | Thanks a lot moewe, you nailed it. It works fine with \bibitemsep instead of \bibinitsep, if this will help someone, someday I set: \setlength{\bibitemsep}{0.75cm}. Also thanks for the hint about academic titles, I will double check this one. |
20,466,718 | I am a beginner for android platform.. I'm using dropbox for android api to download all the images from the users dropbox account to the loacal device. I have followed the demo application provided by dropbox and I got the way how to download the images. but now i want to get all the images from dropbox and priview in... | 2013/12/09 | [
"https://Stackoverflow.com/questions/20466718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `function()` is a.. method. Consider this:
```
private boolean function() {
/* block of code */
return true;
}
```
When you reach the `if` statement, `function()` is called. Meaning that the *block of code* was executed. Then, `function()` returns *true*.
Now, you entered the `if` block, there.. you execute `... | The `method` is called twice (provided it returns true on the first run), and whatever changes that `method` makes are permanent unless you explicitly reverse them somehow. |
63,654,874 | TEXT FILE IM READING
```
1 1 1
1.2 -2.3 0.4
-2 -3 -4
+0 -2 8.85
2.345
```
My code:
```cpp
#include <iostream>
#include <fstream>
using namespace std;
double readFile(ifstream &myfile, double &a, double &b, double &c);
int main()
{
int counter = 0;
double a, b, c;
string line, inputFile, outputFile;
... | 2020/08/30 | [
"https://Stackoverflow.com/questions/63654874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10487269/"
] | Your biggest issue is that `>>` skips leading whitespace, so it doesn't differentiate between a `' '` (space) or `'\n'` -- it's just whitespace. To handle it correctly, you need to read each line into a `std::string` and then create a `std::stringstream` from the line.
Then read your three `double` values from the `st... | I added a different function that chops a line by space and converts them to numbers. Your main function remains largely unaffected. Though I made some changed like adding a `std::vector`, early return to remove some nesting.
Also, I changed the main `while` condition from `eof` to `std::getline`.
* Operations on `st... |
29,071,337 | I have scanned my project with the help of sonar runner and sonar qube, but in the results i am not able to see the coverage details and test cases details. can any one tell me the process for code coverage with sonar for a non maven project.
Thanks in advance | 2015/03/16 | [
"https://Stackoverflow.com/questions/29071337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3588496/"
] | Use this :-
```
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $_SERVER['REQUEST_URI']; ?>">Share on Facebook</a> <br>
``` | I'm assuming client only solution is needed here, server can be anything (PHP, ASP, etc.)
All you've to do is to modify the href property of anchor tag. You can modify your code as -
```
var elm = document.getElementById("demo");
var URLBase = elm.getAttribute("href");
var fullURL = URLBase.window.location.host;
elm.s... |
54,952,754 | I'm adding some optional functionality to an existing project that uses npm and webpack. This functionality makes use of a rather large module (tfjs to be exact), and I'd like to prevent loading it by default, since it approximately doubles the application's payload. Ideally, I'd be able to import it dynamically for us... | 2019/03/01 | [
"https://Stackoverflow.com/questions/54952754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2859006/"
] | You could take a funky [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) by taking the object with key zero (just the first element of the array) and then the `value` property.
```js
var array = [{ label: "1", value: "11" }, { label: "2", value: "22" ... | Use
```js
var array = [{label:"1",value:"11"},
{label:"2",value:"22"},
{label:"3",value:"33"},
{label:"4",value:"44"},
];
console.log(array[0].value);
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.