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 |
|---|---|---|---|---|---|
40,122,633 | I want to check `if`/`else` condition in my blade file. I want to check the condition `$user->status =='waiting'` as the code given below. Output returns correctly as I expected. But along with my output I caught curly braces {} printed. I want to remove curly braces in result. Is there anything wrong in my `if` condit... | 2016/10/19 | [
"https://Stackoverflow.com/questions/40122633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3386779/"
] | No curly braces required you can directly write
```
@if($user->status =='waiting')
<td><a href="#" class="viewPopLink btn btn-default1" role="button" data-id="{{ $user->travel_id }}" data-toggle="modal" data-target="#myModal">Approve/Reject<a></td>
@else
<td>{{ $user->status }}</td> ... | You don't have to use braces in blade conditions, so your code would be like this:
```
@if($user->status =='waiting')
<td>
<a href="#" class="viewPopLink btn btn-default1" role="button" data-id="{{ $user->travel_id }}" data-toggle="modal" data-target="#myModal">
Approve/Reject
<a>
<... |
13,088,766 | In C#, it seems the following method works which will allow you to
call Streamreader.readline() and then access that very same line in the next loop.
```
string line;
double score = 0;
count = 0;
while ((line = sr.ReadLine()) != null)
{
score += double.Parse (line);
count++;
}
... | 2012/10/26 | [
"https://Stackoverflow.com/questions/13088766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1477816/"
] | If you have the filename, instead of just a stream, you can use `System.IO.File.ReadLines` for the neatest way:
```
Dim score As Double = 0
count = 0
For Each line In File.ReadLines(filename)
score += Double.Parse(sr.ReadLine())
count += 1
Next
averageScore = CDbl(inValue) / count
```
Or use LINQ:
```
Dim... | Use a Do-Loop with an exit statement, like this:
```
Do
Dim line = sr.ReadLine()
If line Is Nothing Then Exit Do
score += Double.Parse(line)
count += 1
Loop
```
Do note the advantage of doing it this way over the accepted answer, it is very lean on memory usage and doesn't req... |
3,357,553 | If I didn't need localStorage, my code would look like this:
```
var names=new Array();
names[0]=prompt("New member name?");
```
This works. However, I need to store this variable in localStorage and it's proving quite stubborn. I've tried:
```
var localStorage[names] = new Array();
localStorage.names[0] = prompt(... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3357553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/385815/"
] | `localStorage` only supports strings. Use `JSON.stringify()` and `JSON.parse()`.
```
var names = [];
names[0] = prompt("New member name?");
localStorage.setItem("names", JSON.stringify(names));
//...
var storedNames = JSON.parse(localStorage.getItem("names"));
```
You can also use direct access to set/get item:
``... | Just created this:
<https://gist.github.com/3854049>
```
//Setter
Storage.setObj('users.albums.sexPistols',"blah");
Storage.setObj('users.albums.sexPistols',{ sid : "My Way", nancy : "Bitch" });
Storage.setObj('users.albums.sexPistols.sid',"Other songs");
//Getters
Storage.getObj('users');
Storage.getObj('users.albu... |
448,136 | Могут ли быть слова “кисть - кидать” и “пасть - падать” однокоренными?
По аналогии с:
весть ведать;
страсть страдать;
власть обладать;
сласть сладость;
прясть прядь;
красть обкрадывать;
зависть завидывать;
класть клад;
вывести вывод;
соблюсти соблюдать;
ясти ядь. | 2019/02/04 | [
"https://rus.stackexchange.com/questions/448136",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/187289/"
] | Кисть-кидать никак не родственны, согласна с Aer♦, а вот пасть и падать всё-таки этимологические родственники, судя по этимол. словарям:
Фасмер о происхождении слова пасть:
>
> Пасть - про́пасть, чеш. раst᾽ ж. «ловушка». Первично, по-видимому,
> знач. «пропасть», от паду́. Ср. знач. в.-луж. khlama «морда, пасть» из... | Слова "кисть" и слово "кидать" не однокоренные.Слова "пасть" (если не имеется ввиду ""челюсти", "рот" и т.п.) и "падать" - однокоренные. |
11,953,087 | I work with FORTRAN a lot, but I never had formal instruction in the proper way to write source code. I currently use modules to store global variables, but I understand you could also use them to store subroutines and functions. The codes I work with have many subroutines, as they are very large and complex. Should al... | 2012/08/14 | [
"https://Stackoverflow.com/questions/11953087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1046429/"
] | One of the major benefits of using modules is that your compiler will automatically perform interface checking on any functions or subroutines you `use` from a module to ensure that your are calling the routine with the appropriate parameter types. A good article on this topic is [Doctor Fortran Gets Explicit - Again!]... | Modules help the Fortran program by automatically providing the explicit interfaces, as already described in some of the other answers. This allows the compiler to check for consistency between arguments in procedure calls and the procedure declarations, which catches a lot of mistakes -- here are some Stackoverflow an... |
27,807,018 | I'm having a hard time copying files over to my Google Compute Engine. I am using an Ubuntu server on Google Compute Engine.
I'm doing this from my OS X terminal and I am already authorized using `gcloud`.
```
local:$ gcloud compute copy-files /Users/Bryan/Documents/Websites/gce/index.php example-instance:/var/www/ht... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27807018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2761425/"
] | The reason this doesn't work is that your username does not have permissions on the GCE VM instance and so cannot write to `/var/www/html/`.
**Note** that since this question is about Google Compute Engine VMs, you cannot SSH directly to a VM as `root`, nor can you copy files directly as `root`, for the same reason: [... | I had the same problem and didn't get it to work using the methods suggested in the other answers. What finally worked was to explicitly send in my "user" when copying the file as indicated in the official [documentation](https://cloud.google.com/sdk/gcloud/reference/compute/scp). The important part being the "USER@" i... |
16,298,527 | I've got a doubt:
Is this a good practice to find a parent which it's two levels above the matched element.
The html structure looks like this:
```
<div class="cli_visitas left cli_bar hand" title="Control de las visitas del cliente">
<a href="/fidelizacion/visitas/nueva/id/<?php echo $cliente->getI... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16298527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1913266/"
] | How about using:
```
$(this).closest('.cli_visitas').css(...
``` | Why dont you want to use [`.parents()`](http://api.jquery.com/parents/)? You can do this chaining with the [`eq()`](http://api.jquery.com/eq/):
```
$(this).parents().eq(1);
``` |
63,548,783 | I have several exports of telegram data and I would like to calculate the md5 and sha256 hash of all files but it only calculates those in the root directory
`$ md5sum `ls` > hash.md5`
```
md5sum: chats: Is a directory
md5sum: css: Is a directory
md5sum: images: Is a directory
md5sum: js: Is a directory
md5sum: lists... | 2020/08/23 | [
"https://Stackoverflow.com/questions/63548783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14152758/"
] | A tool which helps, but might not be installed by default, is `hashdeep`.
`hashdeep` does it directly and has some more advantages, e.g. binary is available for Windows, too.
Your question would be answered using `hashdeep` with this command:
```
hashdeep -c md5,sha256 -r -o f -l . > hash.md5
```
This calculates md... | Alternatively, you can use `find` with `-exec` option:
```
find topdir -type f -exec md5sum {} + > MD5SUMS
```
Replace the `topdir` with the actual directory name, or drop it if you want to work on the current directory (and its subdirectories, if any). This will only compute the checksums of regular files (so, no "... |
62,983,990 | I am new to kotlin. And I got a problem.
I have this code:
```
val sdf = SimpleDateFormat("dd.MM.yyyy")
val currentDate = sdf.format(Date())
println(currentDate)
val stringDate = "12.03.2015"
val dateFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy", Locale.ENGLISH)
val millisecondsSinceEpoch = LocalDate.parse(st... | 2020/07/19 | [
"https://Stackoverflow.com/questions/62983990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13829933/"
] | Following is the corrected version of your initial program. However as others pointed out it is advisable to use new java Time API.
There is nice article highlighting problem with old Java Date and Calendar API
<https://programminghints.com/2017/05/still-using-java-util-date-dont/>
```
import java.util.Date
import ja... | Get your required Date and then can do this:
```
val sdf = SimpleDateFormat("dd/MM/yyyy",Locale.ENGLISH)
val theDate = sdf.parse(selectedDate)
val selectedDate = theDate!!.time/86400000 //.time gives milliseconds
val currentDate = sdf.parse(sdf.format(System.currentTimeMillis()))
... |
27,731,614 | I am trying to check if the NSMutableArray has a specific object, before adding the object to it, if exists then don't add.
i looked over many posts explaining how to do this, managed to implement it like this, but it always gives me that the object "doesn't exist", though i already added it !
```
//get row details ... | 2015/01/01 | [
"https://Stackoverflow.com/questions/27731614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4380614/"
] | The first method listed on the NSArray documentation under the section "querying an array" is `containsObject:`. If it's not working, that suggests that your implementation of `isEqual:` is not correct. Make sure you follow the note in the documentation:
>
> If two objects are equal, they must have the same hash valu... | Sets are composed of unique elements, so this serves as a convenient way to remove all duplicates in an array.
here some sample,
```
NSMutableArray*array=[[NSMutableArray alloc]initWithObjects:@"1",@"2",@"3",@"4", nil];
[array addObject:@"4"];
NSMutableSet*chk=[[NSMutableSet alloc ]initWithArray:array]; //fi... |
16,735,092 | Want to grep file and export the row like separated vars and the last two to be in one var.
After that to create loop and export the vars in html tags.
File view:
```
1.1.1.1 host red 70% /
1.1.1.1 host green 0% /dev/shm
1.1.1.1 host green 63% /staging/om_campaign_files
1.1.1.1 host red 7... | 2013/05/24 | [
"https://Stackoverflow.com/questions/16735092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1716704/"
] | If you're looking for something usable in a program, rather than a one-liner at the command prompt:
```
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
while (my $line = <DATA>) {
chomp $line;
my ($ip, $hostname, $color, undef, $mount) = split ' ', $line;
say "<tr><td>$ip</td><td>$hostname</td><td... | ```
perl -anE 'say "<tr><td>$F[0]<td/><td>$F[1]<td/><td color=$F[2]>$F[4]<td/></tr>"' file
``` |
40,892,156 | I'm learning to write scripts with PowerShell, and I found this code that will help me with a project The example comes from [Is there a one-liner for using default values with Read-Host?](https://stackoverflow.com/questions/26386267/is-there-a-one-liner-for-using-default-values-with-read-host).
```
$defaultValue = 'd... | 2016/11/30 | [
"https://Stackoverflow.com/questions/40892156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7231560/"
] | This is a common programming pattern:
```
if (user entered a price)
{
price = user entered value
}
else
{
price = default value
}
```
and because that is quite common, and also long winded, some languages have a special `ternary operator` to write all that code much more concisely and assign a variable to "... | To *complement* the great answers given [by Ansgar Wiechers](https://stackoverflow.com/a/40892322/45375) and [by TessellatingHeckler](https://stackoverflow.com/a/40892457/45375):
It *would* be great *if* PowerShell had operators for [ternary conditionals](https://en.wikipedia.org/wiki/%3F:) and [null-coalescing](https... |
44,181,725 | I have been trying to run tomcat container on port 5000 on cluster using kubernetes. But when i am using kubectl create -f tmocat\_pod.yaml , it creates pod but docker ps does not give any output. Why is it so?
Ideally, when it is running a pod, it means it is running a container inside that pod and that container is ... | 2017/05/25 | [
"https://Stackoverflow.com/questions/44181725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4661576/"
] | In Kubernetes, Docker contaienrs are run on Pods, and Pods are run on Nodes, and Nodes are run on your machine (minikube/GKE)
When you run `kubectl create -f tmocat_pod.yaml` you basically create a pod and it runs the docker container on that pod.
The node that holds this pod, is basically a virtual instance, if you... | I'm not sure where you are running the `docker ps` command, but if you are trying to do that from your host machine and the k8s cluster is located elsewhere, i.e. your machine is not a node in the cluster, `docker ps` will not return anything since the containers are not tied to your docker host.
Assuming your pod is ... |
62,399 | I joined Facebook in 2008 but don't recall if I used its messaging function at the time. I checked my old deactivated account and the oldest message is from 2009.
That's around 5 years ago now, so I'm wondering if Facebook deletes messages/inactive conversations older than 5 years? Being a teenager at the time I said ... | 2014/06/08 | [
"https://webapps.stackexchange.com/questions/62399",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/71984/"
] | Facebook does not delete old messages/conversations that haven't been active in years. (my oldest one: 2007-05-30). Note that at that time people often used to post on walls to discuss even private matters. | It seems they do delete old messages written to you by others, especially if those others are no longer on Facebook. My archived messages look like Swiss cheese, with only my side of conversations saved and even the names of my interlocutors and their messages deleted (redacted) somehow. |
312,701 | This IC is on a breakout board for a SIM868 chip. It is on the GPS antenna signal line, just before the U.FL connector.
It has 5 pins, 3 that are connected to ground, 1 to the signal, and 1 (I think) to power.
What is this chip and what does it do?
Zoomed-in photo (IC's markings are visible):
[ as EditText
et.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable) {
et.removeTextChangedListener(this)
forChanged(et)
... |
4,691,212 | I've got my own way of doing this but I'm not convinced its the best, in **C#**
Given a `List<DateTime>`, a `DateTime startDate` and an `DateTime endDate`. How would you return a new `List<DateTime>`for every **month** between `startDate` and `endDate` that is **not** included within the original `List<DateTime>` incl... | 2011/01/14 | [
"https://Stackoverflow.com/questions/4691212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192313/"
] | Well, assuming the same month in different years is considered different:
```
private List<DateTime> GetUnincludedMonths(DateTime startDate, DateTime endDate,
IEnumerable<DateTime> dates)
{
var allMonths = new HashSet<Tuple<int, int>>(); //month, year
... | ```
public IList<DateTime> GetMissingMonths(IList<DateTime> currentList, DateTime startDate, DateTime endDate)
{
// Create a list for the missing months
IList<DateTime> missingList = new List<DateTime>();
// Select a startdate
DateTime testingDate = startDate;
// Begin ... |
11,675,001 | My video sites get a very high click rate on video ads. So I'm creating an affiliates program plugin for my php site.
To check if my video ads were clicked I need to check for the existence of a cookie. So I have
written a php script that basically checks for the existence of a cookie in a loop.
I have understood ... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11675001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1544763/"
] | This is a basic issue of PHP vs JavaScript.
If you want to check for a cookie every minute using PHP, you'll have to refresh the page every minute. This is obviously very uneconomical for a great variety of reasons, the least of which is that you're checking for something on the client side using server-side code - by... | I agree with Matt. You would be better off detecting the cookie only in the instance when a cookie is likely to change (when they click on the video). However, it depends on the exact situation. Are you setting the cookies, or are the cookies being set by an external site when they click the ads?
### EDIT:
Your two g... |
1,565,347 | **I got a Wikipedia-Article and I want to fetch the first z lines (or the first x chars, or the first y words, doesn't matter) from the article.**
The problem: I can get either the source Wiki-Text (via API) or the parsed HTML (via direct HTTP-Request, eventually on the print-version) but how can I find the first lin... | 2009/10/14 | [
"https://Stackoverflow.com/questions/1565347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61855/"
] | You don't need to.
The API's `exintro` parameter returns only the first (zeroth) section of the article.
**Example:** [api.php?action=query&prop=extracts&exintro&explaintext&titles=Albert%20Einstein](https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exintro&titles=Albert%20Einstein&format=jsonfm)
There ... | You need a parser that can read Wikipedia markup. Try [WikiText](http://wiki.eclipse.org/Mylyn/Incubator/WikiText) or the parsers that come with [XWiki](http://www.xwiki.org/xwiki/bin/view/Main/WebHome).
That will allow you to ignore anything you don't want (headlines, tables). |
45,679,651 | I can't seem to get this script to work. I'm getting the following error:
>
> Msg 137, Level 16, State 1, Line 14
> Must declare the scalar variable "@TVP\_GLICU".
>
>
>
Can anyone tell me what am I missing?
```
Declare @TVP_GLICU TVP_GLICU
DECLARE @cmd varchar(500)
Declare @TimeStamp as nvarchar(100) = Replac... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45679651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8327916/"
] | Flexbox:
```
container {
display: flex;
justify-content: center;
}
```
If you want space between the pictures, use:
```
margin-left:
```
or
```
margin-right:
``` | **try this**
```css
body, html {
height: 100%;
margin: 0;
padding: 0;
}
.circles-container{
display: table;
border-spacing: 40px;
}
.row {
display: fle... |
32,193 | We have a number of PCs running XP SP2 (and a couple running SP1) already in production, and we're looking to keep the local administrator's password consistent across the OU. The only solutions I can think of would be using pspassword to change all of their passwords, or having a script containing the password run loc... | 2009/06/26 | [
"https://serverfault.com/questions/32193",
"https://serverfault.com",
"https://serverfault.com/users/9922/"
] | I'm not sure what you're looking for here since it would be difficult to deploy a local account password change solution that will 'somehow' work for online and offline computer accounts. The process would be if it's an actual script or GP, for them to get the password change at 'some point' when they're online. If you... | We do this through Group Policy.
I don't know the specifics of how the GPO is created, but it is in the section:
```
Computer Configuration
/ Windows Settings
/ Security Settings
/ Local Policies/Security Options
/ Accounts
```
There are settings to allow disabling of the guest account and renamin... |
32,750,845 | I have a code which does something like this:
```
if [ -z "$SOME_VARIABLE" ]; then
echo "something something 1"
else
echo "something something 2"
fi
```
I have no clue what "-z" is doing here. Can someone explain please? | 2015/09/23 | [
"https://Stackoverflow.com/questions/32750845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1148859/"
] | What about
```
cursor.execute("""SELECT pivot_id
FROM aud_qty
WHERE hshake1 is NULL
AND ((strftime('%s', DATETIME('now')) -
strftime('%s', sent_to_pivot)) / (60)) > 30;
""")
```
? Using `"""` or `'''` you get the same... | how bout
```
from models import AudQty,session
update_limit = time.time()-30*60 # 30 minutes ago
session.query(AudQty.pivot_id).filter(hshake1=None,
sent_to_pivot_lte=update_limit).all()
```
strings can also be multiline without triple quotes, as two quotes strings next to each other ... |
10,347,678 | this is what I'm trying to achieve:
```
config.Name("Foo")
.Elements(() => {
Element.Name("element1").Height(23);
Element.Name("element2").Height(31);
})
.Foo(23);
```
or like this:
```
.Elements(e => {
e.Name(... | 2012/04/27 | [
"https://Stackoverflow.com/questions/10347678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112100/"
] | Any reason you don't want to use object and collection initializers?
```
public class Config
{
public string Name { get; set; }
public int Foo { get; set; }
public IList<Element> Elements { get; private set; }
public Config()
{
Elements = new List<Element>();
}
}
// I'm assuming an element *... | Here's **method 1** to place inside Config -- "one at a time":
```
public Config Element(Action<Element> a) {
Element e = new Element();
a(e);
this.elements.Add(e);
return this;
}
```
And here's how to use it:
```
config.Name("Foo")
.Element(e => e.Name("element1").Height(23))
.Element(e => ... |
567,130 | Einstein’s relativity rejects the notion of a universal ‘now’ moment. It underlines how the concept of ‘now’ is compromised due to time passing at differing rates in differing frames of reference, depending on such things as local gravitation or the acceleration of a body at high speed. Some other reasons I have seen e... | 2020/07/21 | [
"https://physics.stackexchange.com/questions/567130",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/105651/"
] | >
> It underlines how the notion of ‘now’ is compromised due to time passing at differing rates in differing frames of reference
>
>
>
I think your confusion stems mainly from this. The fact is, that logic is reversed to what you are saying. You cannot compare two clocks before you know what it means for two event... | This is not really an answer. It’s more of a continuation of your thought experiment. Maybe it will help to think of the question in different ways.
Imagine that every particle in the universe had its own personal timer that said “exactly 20 billion years after the big bang, I need to record what I’m doing at that ins... |
54,906,850 | I am trying to create a bash script that uses the sed command to replace a pattern by a variable that contains a string or put a space if there is nothing in the variable. I cannot find the good way to write it and make it work. Here is the part where I have issues:
```
a_flag=$(echo $a | wc -w)
if [[ $a_flag = 0 ]]... | 2019/02/27 | [
"https://Stackoverflow.com/questions/54906850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11125295/"
] | You only need a single parameter expansion here, to replace the expansion of `$a` with `\hspace{2cm}` if the expansion is empty.
```
sed -i -e "s/#b/${a:-\\\\hspace{2cm}}/g" source.tex
```
You need a stack of `\` because there are two rounds of escaping involved. First, the shell itself reduces each `\\` to a single... | Counting the number of occurrences of someething seems like a very roundabout way to approach this anyway.
```
case $a in
*[A-Za-z0-9_]*) x='\\hspace{2cm}';;
*) x=$a;;
esac
sed -i "s/#b/$x/g" source.tex
``` |
2,595,013 | Theorem - There is a division of $\mathbb{N}$ for $\aleph\_0$ sets so every set has cardinal of $\aleph\_0$.
I don't know even where to start in order to prove this theorem. | 2018/01/07 | [
"https://math.stackexchange.com/questions/2595013",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/507015/"
] | For example:
Let a natural number $a$ belong to the $n$th set of the partition if $a$ has exactly $n$ prime factors.
(And put $0$ and $1$ to any of them, say to the first one.) | Since there are a few different ways here already, here is my personal preference:
Put $1$ in the first partition. Put $2$ in the second partition and $3$ in the first partition. Put $4$ in the third partition, $5$ in the second partition and $6$ in the first partition. And so on. |
44,187,778 | I created a style.css file. To include it in a .html file I tried :
```
<link rel="stylesheet" href="https://github.com/karinakozarova/HealthCalc/blob/master/style.css">
```
and
```
<base href="/style.css">
```
and
```
<href="/style.css">
```
None of them seem to work. Any ideas how to add CSS to my app via ex... | 2017/05/25 | [
"https://Stackoverflow.com/questions/44187778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7946648/"
] | I think you may be missing a "type" attribute within that link. Try the markup below:
```
<link rel="stylesheet" type="text/css" href="https://github.com/karinakozarova/HealthCalc/blob/master/style.css">
``` | The GitHub "blob" urls are webpages showing your file. Not the file itself. So you need to use the "raw" url or something like jsDelivr. |
6,651,146 | I'd very much like to have some idea of the state of the art of MVC frameworks for **node.js**. Specifically, current commercial practice of the art, not research, with frameworks for front-end web apps. As a PHP programmer might choose Yii Framework—what are the options for node.js programmers and what are the pros an... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6651146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We've been using our MVC framework, [Sails](http://sailsjs.com), in a production environment for several of our clients since March. It's built on Express, Socket.io, and Sequelize. The main distinction is that it routes realtime Socket.io requests the same way as standard HTTP requests: using Express routes.
Hope tha... | I just did a search on twitter for nodejs and mvc - and it pointed to something called matador - <https://github.com/Obvious/matador>. I haven't used it, but would like to see a comparison before I pick one... |
42,637 | I have a script that pulls a file from an external server, and tries to save it locally (to then be processed). I'm using Varien\_Io\_Ftp() to facilitate this, however, upon saving the file locally, it throws the following exception, despite creating the file that is required which upsets me.
```
Warning: chdir(): Inv... | 2014/11/05 | [
"https://magento.stackexchange.com/questions/42637",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/5408/"
] | For anyone looking at this in the future, RS has provided an example that works, but I wanted to jump in and give a little explanation about WHY his solution works.
The exception being thrown at lib\Varien\Io\File.php on line 547 is due to the reference to `$this->_iwd` not being supressed (and inherently, the fact th... | Try
```
$pickupFile = new Varien_Io_Ftp();
$localDir = "/path/to/local/dir";
$remoteFile = "/path/to/remote/dir/text.csv"
mkdir($localDir, 0700, true);
$localFile = $localDir . '/local.csv'
try {
$pickupFile->open(
array(
'host' => $host,
'user' => $username,
... |
11,758,696 | How to port this code in Objective-C? Anyone please help.
```
return data.length != 0 ? new Byte(data[0]) : null; // In Java
```
I am doing it this way, but this does not show the proper result
```
return datalen!= 0?malloc(sizeof(char) *data[0]) :NULL; //In Objective C it is write java data is byte
**In obj... | 2012/08/01 | [
"https://Stackoverflow.com/questions/11758696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1425885/"
] | `inline` enables some changes to the *one definition rule*. Specifically, a function (including an explicit specialization of a function template) declared `inline` can be defined in multiple translation units (provided the definitions in different translation units are the same) and *must* be defined in any translatio... | >
> Is there any other way to do this?
>
>
>
```
template <>
static void f<int>(int p)
{
std::cout << "f two" << std::endl;
}
```
or have them `inline`, but use special compiler flags (where available) to suppress actual inlining
>
> What does inline actually do?
>
>
>
Best answer(s) are already availabl... |
25,018,821 | I have a C++ plugin for QML that has some properties and I am wondering if there is some documentation regarding what order the functions will be called in the following QML code:
```
MyCustomThing {
propertyA: 20 // Will putting this line first guarantee A before B?
propertyB: 30
}
```
On my machine things ... | 2014/07/29 | [
"https://Stackoverflow.com/questions/25018821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/101645/"
] | You could also load the Flume Configuration file rather than writing it within the Java code.The same configuration could be used while starting your standalone Flume Agent.
```
public static void main(String[] args)
{
String[] args = new String[] { "agent", "-nAgent",
"-fflume.conf" };
Applicatio... | Instead of doing that, try using an embedded agent (a far more elegant and cleaner solution). You create a `Map<String, String>` with the configuration of the Flume agent you wish to run, and then create an agent and configure it.
```
Map<String, String> properties = new HashMap<String, String>();
properties.put("chan... |
3,638,361 | I have a question regarding clearing of the log data in Magento.
I have more than 2.3GB of data in Magento 1.4.1, and now I want to optimize the database, because it's too slow due to the size of the data. I checked the log info (URL,Visitors) and it shows more than 1.9 GB. If I directly clear those records, will it a... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3638361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172376/"
] | **Cleaning the Magento Logs using SSH :**
login to shell(SSH) panel and go with `root/shell` folder.
execute the below command inside the shell folder
```
php -f log.php clean
```
enter this command to view the log data's size
>
> php -f log.php status
>
>
>
This method will help you to clean the log data's ... | After clean the logs using any of the methods described above you can also disable them in your app/etc/local.xml
```
...
<frontend>
<events>
<frontend>
<events>
<!-- disable Mage_Log -->
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_... |
18,316,573 | I've written a simple PHP script on shared hosting and wish to implement some rules in the .htaccess file so that every time my script calls, let's say, <http://www.google.com/test1> it will get <http://www.otherwebsite.com/test1> instead.
I've used standard URL Rewriting Rules before but didn't need this specific fun... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18316573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927901/"
] | There is no really elegant way to do this in Sybase. Here is one method, though:
```
select
mt.MainId,
mt.Data,
Others = stuff((
max(case when seqnum = 1 then ','+Name+'='+cast(status as varchar(255)) else '' end) +
max(case when seqnum = 2 then ','+Name+'='+cast(status as varchar(255... | Well, here is how I implemented it in Sybase 13.x. This code has the advantage of not being limited to a number of `Name`s.
```
create proc
as
declare
@MainId int,
@Name varchar(100),
@Status tinyint
create table #OtherTable (
MainId int not null,
CombStatus varchar(250) not nul... |
302,542 | We need to get all the instances of objects that implement a given interface - can we do that, and if so how? | 2008/11/19 | [
"https://Stackoverflow.com/questions/302542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I don't believe there is a way... You would have to either be able to walk the Heap, and examine every object there, or walk the stack of every active thread in the application process space, examining every stack reference variable on every thread...
The other way, (I am guessing you can't do) is intercept all Objec... | If the classes implementing the specified interface are yours then you can implement a list of weak references upon instantiation. |
60,384,103 | I have a working HTTP POST Request in Angular 7 with HttpClient as below which is returning details of a user profile:
```
const request {
firstName: this.firstName,
lastName: this.lastName,
city: "Dallas"
}
this.http.post("URL Path", request).subscribe(response => console.log(response);
```
My question is, i... | 2020/02/24 | [
"https://Stackoverflow.com/questions/60384103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10071193/"
] | You can use the `map` method to calculate a value for each item in the `art.fields` array.
```js
const art = {
'fields': [
{title:'Title 1'},
{'text': [
{spaces: '1'}, {link: 'This is a link'}, {mouse: 'Yes'}
]},
{title: 'Title 2'},
{title:'Title 3'},
... | you could do something like this
```
const newArr = art.fields.map(space => {
return {...space.text}
});
```
so I'm assuming you want to return a new array containing an object of the text array |
30,713,725 | I am currently using the following to upload an image into a folder but I am finding that for my specific purpose I need to copy the image as it is uploaded and add it to a folder a little higher up in the directory.
Example: The image file gets uploaded to **/folder/folder/images** and this is good. I need it there. ... | 2015/06/08 | [
"https://Stackoverflow.com/questions/30713725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/914251/"
] | Based on the comments on your question:
```
if(move_uploaded_file($_FILES['file']['tmp_name'],'images/'.$_FILES['file']['name'])){
$tmp='images/'.$_FILES['file']['name'];
$new = 'newFolder/'.$_FILES['file']['name']; //adapt path to your needs;
if(copy($tmp,$new)){
echo 'images/'.$_FILES['file']['na... | Is good idea to use `copy()` function.
```
if(move_uploaded_file($_FILES['file']['tmp_name'],
'images/'.$_FILES['file']['name'])){
$tmp='images/'.$_FILES['file']['name'];
echo 'images/'.$_FILES['file']['name'];
copy($tmp,'/folder/images/'.$_FILES['file']['name']);
//echo '{"status":"success"}';
exit;
}
... |
14,145,931 | I am trying to delete some data from a table variable using a SELECT query. The following code works perfectly:
```
DECLARE @sgID int
SET @sgID = 1234
DELETE FROM
@tbl_users
WHERE
(userID NOT IN (
SELECT
userID
FROM
[SGTable]
WHERE
... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14145931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/792888/"
] | Is it possible that a userID can be associated with more than one sgID in SGTable?
If so, then you're deleting users in your sgID (@sgID) because they are also associated with another sgID.
You might prefer:
```
DELETE tmp
FROM @tbl_Users tmp
LEFT OUTER JOIN [SGTable] sgu ON sgu.userID = tmp.userID AND sgu.sgID = ... | Shouldn't that where clause be "=" rather than "<>" ? You want to delete the record that matches, not the ones that don't (which might be all of them), right? |
188,607 | Over the course of my PhD, I've had the pleasure of being a TA for many courses under many different profs, all were great experiences. I learned a lot, did a lot of good work with the other TAs and helped the students a ton.
Currently however, the professor I am a TA for is an absolute menace to deal with, especially... | 2022/09/11 | [
"https://academia.stackexchange.com/questions/188607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/162547/"
] | Depending on the structure of your department, *this professor is probably not your boss.* You probably report to the Graduate Director in your department, or someone in a similar position. This is worth keeping in mind!
Moreover, bullies are usually known to be bullies. All too often, there is usually no way to dismi... | This professor is a bully and a [redacted], and luckily your interaction with him will be over relatively soon. Your focus should be on getting there with minimal repercussions to yourself and, where possible, others. I recommend you change your perspective on your TA position to get the best out of it nevertheless.
*... |
18,040 | I'm looking for a baby monitor that comes with both a monitor device that I can use to view it and also the option to download a mobile app that can view it via a mobile (over Wifi).
I have googled it to death with no luck. It would give me the option to use my phone to see when baby cries as well as a device for conv... | 2014/12/21 | [
"https://parenting.stackexchange.com/questions/18040",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/11921/"
] | You're looking for a "smart baby monitor".
However, asking to have a baby monitor that comes with both a proprietary viewing device **and** and mobile app is probably asking too much from the manufacturers.
Developing hardware to view the baby monitors requires the manufacturer to have:
* More materials costs
* I... | You could use any ip camera(such as a foscam or drop cam) and simply buy a low cost tablet as the monitor device.
Any Android or iPad device would do the trick. Amazon kindle fire for example is very low cost and would work with any ip camera. Or you may already have an old iPod touch or tablet that you don't use or ... |
68,738,441 | I'm quite new to Spring Boot and I'm not sure on which version is preferable to use.
In particular, I don't know if it's better to choose a RELEASE version ( that should be more stable, but has a nearer End Of Life ) or one of the last version.
For example, which version of Spring Boot Starter Parent is better to use ... | 2021/08/11 | [
"https://Stackoverflow.com/questions/68738441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9188403/"
] | My rule of thumb - if you don't have any limitation (dependencies or such), always take the latest. more features/bugfixes/etc.
and the release in the name is meaningless, they are both valid stable versions | I usually use the latest stable version of spring(in this moment is the 2.5.3). The RELEASE part in the name is not used anymore, just be careful to don't use the "SNAPSHOT" version, sometimes those are unstable. |
252,341 | I was having Ubuntu 10.04 Server running over a software raid 0. Yesterday, I left it running continuously for 10 hours, when I came back, the computer became weird. I cannot shut it down. It was saying "Bus error" or something similar to that. So I force a shutdown by holding power button for 4 seconds. Then I turn it... | 2011/03/27 | [
"https://serverfault.com/questions/252341",
"https://serverfault.com",
"https://serverfault.com/users/33163/"
] | RAID 0 has no redundancy so errors will break the entire array. Are you confusing it with RAID 1 (mirrored)? | Can you tell us how your RAID 0 array was set up? I had the impression that it consists of 2 physical drives: `/dev/sda + /dev/sdb` and the resulting device is /dev/md0. Now you are talking about /dev/md1. Does `/dev/md0 = /dev/sda1 + /dev/sdb1` and `/dev/md1 = /dev/sda2 + /dev/sdb2`? And if so - how you expect to repa... |
21,811 | According to Star Trek (2009) movie, Kirk became captain of USS Enterprise NCC-1701 when he was much younger than he was in TOS. In TOS, it was shown that Christopher Pike was captain of Enterprise 13 years prior to Kirk's 5 year mission. Why was Kirk replaced with Christopher Pike? | 2012/08/10 | [
"https://scifi.stackexchange.com/questions/21811",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/931/"
] | J. J. Abrams has confirmed 100% that the 2009 film is in an alternate timeline to TOS, so the events for Kirk and Pike can be completely different between the two.
>
> The notion that when this one character arrived – Nero – that basically **the timeline is altered at that moment. So everything forward is essentially... | They're not in the same continuity. The 2009 film exists in an alternate timeline to TOS. |
10,113,380 | I'm writing a class constructor with a decimal field, that is need to be initialized by a random value. Just one little field and I need to create new `Random` object. In the first place it looks cumbersome, and in the second there is can arise a lot of equal values, in case of creating a lot of objects in one time sli... | 2012/04/11 | [
"https://Stackoverflow.com/questions/10113380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/897090/"
] | You're looking for [Math.random](http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#random%28%29). This is a static method that implicitly initializes a new `Random` object the first time it is called, and then uses that object thereafter. So you get the benefits of sharing a single `Random` object between al... | Are you're using Java 7, `Random` is thread-safe, as documented:
>
> Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded design... |
19,040,151 | Simple problem: I have an array A of n entries each one containing one character. I want
to create the corresponding string S from this array in an efficient way, i.e. in O(n) time, without using external commands, just bash code and bash builtins.
This obvious way...
```
func_slow ()
{
local numel=${#A[*]}
for ((... | 2013/09/26 | [
"https://Stackoverflow.com/questions/19040151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2821398/"
] | If you want to do an in-place edit, adding text to the end, you can do this:
```
sed -ie 's/$/WHATEVER/g' FILENAME
```
Or, to add text to the beginning:
```
sed -ie 's/^/WHATEVER/g' FILENAME
```
Special characters will have to be escaped via `\`. A regex cheat sheet is your best friend. | Not sure about the computational complexity, but this works:
```
t=${A[@]}
S=${t// /}
``` |
36,397,537 | I need row number 1,2,3,4,5 as new column in below screen shot..
[](https://i.stack.imgur.com/aDqtt.png)
Query:
```
Select
ROW_NUMBER() OVER (ORDER BY vgid) AS RowNumber,
*
from
T_EMS_VGDM_RULEMST
where
VGID in (156, 157, 158,... | 2016/04/04 | [
"https://Stackoverflow.com/questions/36397537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1485536/"
] | Isn't it simply:
```
Select
ROW_NUMBER() OVER (ORDER BY CASE
WHEN VGID = 165 then 1
WHEN VGID = 158 then 2
WHEN VGID = 159 then 3
WHEN VGID = 157 then 4
... | ```
Select
ROW_NUMBER() OVER (ORDER BY vgid desc) AS RowNumber,
* from T_EMS_VGDM_RULEMST where VGID in (156,157,158,159,165)
ORDER BY CASE
WHEN VGID = 165 then 1
WHEN VGID = 158 then 2
WHEN VGID = 159 then 3
WHEN VGID = 157 then 4
WHEN VGID = 156 then 5
END
``` |
4,970,297 | The [FactoryBean](http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factory-extension-factorybean) can be used to programmatically create objects which might require complex instantiation logic.
However, it seems that the beans *created* by the `FactoryBean` doesn't bec... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4970297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/416564/"
] | The object created by the `FactoryBean` *are* managed by Spring, but not instantiated or configured by Spring. By using a `FactoryBean`, you take responsibility for that yourself. All injection and config must be handled by the `FactoryBean`
There is an alternative which may work better for you - use [annotation-based... | A manual way would be:
1. Inject the dependencies in the factory bean
2. set them manually on the target object.
You can also inject `ApplicationContext` in the factory bean (or get it by implementing `ApplicationContextAware`), and do `ctx.getAutowireCapableBeanFactory().autowireBean(bean)`
I admit both feel strang... |
36,750,167 | Suppose I have the following function:
```
def sum(summands)
s = 0
for a in summands:
s = a + s
```
The user might call it with a list `sum([1, 2, 3])` but it would be convenient if you could also call it directly with a number `sum(5)`. (It's not actually about numbers, just a simplified example.)
... | 2016/04/20 | [
"https://Stackoverflow.com/questions/36750167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | You can check if it's iterable and make it one (assuming it's not a string). Note: `sum` is the name of a built-in, so you probably shouldn't name your own function the same thing. See [PEP 8 - Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/).
```
import collections
def mysum(summand):
if n... | You could test if it is a list or an int:
```
if isinstance(summand, list)
sumlist(summand)
if isinstance(summand, int)
Sumint(summand)
```
And then write summing functions for each type. Or you could use a list comp to turn the integer ino a list 'summand = [x for x in range(summand +1)] and use that. |
15,091,284 | I have the following input:
```
AG23,VU,Blablublablu,8
IE22,VU,FooBlaFooBlaFoo,3
and so on...
```
I want it to "parse" with `scanf()` using some code like this:
```
char sem[5];
char type[5];
char title[80];
int value;
while(scanf("%s,%s,%s,%d", sem, type, title, &value) == 4) {
//do something with the read line ... | 2013/02/26 | [
"https://Stackoverflow.com/questions/15091284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1291235/"
] | The comma is not considered a whitespace character so the format specifier `"%s"` will consume the `,` and everything else on the line writing beyond the bounds of the array `sem` causing undefined behaviour. To correct this you need to use a scanset:
```
while (scanf("%4[^,],%4[^,],%79[^,],%d", sem, type, title, &val... | The problem that you are having is because when you say
```
scanf("%s,%s,%s,%d", sem, type, title, &value)
```
what happens is that you are trying doing is that you are fitting all the line into the first string which is just 5 characters. Therefore the **`sem[5]` overflows**, and soes all sorts of funny things. ... |
90,227 | >
> **Possible Duplicate:**
>
> [How to force Windows XP to rename a file with a special character?](https://superuser.com/questions/31587/how-to-force-windows-xp-to-rename-a-file-with-a-special-character)
>
>
>
I have a few files whose names have characters such as "?" and ":" that are forbidden by windows. I... | 2010/01/01 | [
"https://superuser.com/questions/90227",
"https://superuser.com",
"https://superuser.com/users/22053/"
] | If Idigas' suggestion does not work, you could always move them with a Linux LiveCD such as [Ubuntu](http://ubuntu.com). It allows question marks and colons in filenames so it should have no problem handling the files.
You just need to mount your drive first. If XP is your only operating system installed on the disk, ... | For some reason, I usually have more luck when moving/copying/renaming/(anything really) files from the command line, than when doing it windows explorer. |
47,257,172 | Is the following the recommended way to attempt finding Max with streams?
```
List<Employee> emps = new ArrayList<>();
emps.add(new Employee("Roy1",32));
emps.add(new Employee("Roy2",12));
emps.add(new Employee("Roy3",22));
emps.add(new Employee("Roy4",42));
emps.add(new Employee("Roy5",52));
Integer maxSal= emps.str... | 2017/11/13 | [
"https://Stackoverflow.com/questions/47257172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1483620/"
] | You can use the method `Integer.min` in reduce which returns `OptionalInt`, can be used to get `Int` (make sure the boundary checks)
using `IntStream`
```
int max1 = emps.stream().mapToInt(Employee::getSalary).max().getAsInt();
```
using `IntSummaryStatistics` [if you are interested in statistics, like min, max, av... | First, you *might* shorten your `emps` initialization with`Arrays.asList(T...)` like
```
List<Employee> emps = Arrays.asList(new Employee("Roy1", 32),
new Employee("Roy2", 12), new Employee("Roy3", 22),
new Employee("Roy4", 42), new Employee("Roy5", 52));
```
Next, you can use [`OptionalInt.orElseTh... |
118,421 | I tried to illustrate a landscape, and I am very unsatisfied as it is
[](https://i.stack.imgur.com/0auf2.png)
I think it lacks depth, I think the lighting is weak and and I just... I don't know. I don't what it all lacks, but I am just not satisfied.
What can I d... | 2018/12/23 | [
"https://graphicdesign.stackexchange.com/questions/118421",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/131019/"
] | **Changes:**
First thing that comes to my mind; it **isn't** landscape *orientation*. I would definitely start with making it landscape proportions.
[](https://i.stack.imgur.com/BhIUt.png "Landscape proportion, like a... | First of all, I will try to maintain the original image's look.
Composition
-----------
Explore some basics of composition. In photography, a basic one is the rule of thirds.
This means that if you divide your frame in a 3x3 grid, some elements should be in those lines.
Look how none of your elements follow this co... |
47,232,954 | Can anyone provide some code examples that act differently when compiled with `-fwrapv` vs without?
The [gcc documentation](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html) says that `-fwrapv` *instructs the compiler to assume that signed arithmetic overflow of addition, subtraction and multiplication wraps a... | 2017/11/11 | [
"https://Stackoverflow.com/questions/47232954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8922300/"
] | Think of this function:
```
int f(int i) {
return i+1 > i;
}
```
Mathematically speaking, `i+1` should always be greater than `i` for any integer `i`. However, for a 32-bit `int`, there is one value of `i` that makes that statement false, which is `2147483647` (i.e. `0x7FFFFFFF`, i.e. `INT_MAX`). Adding one to t... | -fwrapv tells the compiler that overflow of signed integer arithmetic must be treated as well-defined behavior, even though it is undefined in the C standard.
Nearly all CPU architectures in widespread use today use the "2's complement" representation of signed integers and use the same processor instructions for sign... |
760,204 | I was able to go to the ubuntu software center before and remove it and now it doesn't show up since the switch to the gnome software store. Trying the terminal method of removing the shopping lens doesn't work in this release.
[](https://i.stack.imgu... | 2016/04/21 | [
"https://askubuntu.com/questions/760204",
"https://askubuntu.com",
"https://askubuntu.com/users/234461/"
] | You just click on the app then drag it into the trash (it work for me). | [How can I remove Unity web apps?](https://askubuntu.com/questions/214755/how-can-i-remove-unity-web-apps)
-> Try:
```
sudo apt-get remove unity-webapps-amazon*
```
Can't say it's the solution, because first thing I did, was search "amazon" files and manualy deleted "/usr/share/unity-webapps/userscripts/unity-webap... |
70,595,087 | How SWT browser works internally? does it call native browser or it uses OS libraries?
Kindly explain internal working of swt browsers or share some free documentations | 2022/01/05 | [
"https://Stackoverflow.com/questions/70595087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14501769/"
] | According to the [Eclipse Foundation](https://www.eclipse.org/articles/Article-SWT-browser-widget/browser.html) - "The Browser widget binds to a suitable native HTML rendering engine for the platform it is running on (Internet Explorer on Windows, Mozilla on Linux, Safari on the Mac" | The open source SWT browser Equo Chromium (<https://github.com/equoplatform/chromium-swt>) does not rely on native browsers (Internet Explorer on Windows, WebKit on macOS, and WebKitGTK+ or Mozilla/XULRunner on Linux). Instead, it binds to Chromium. Then you will have the same rendering experience across all platforms ... |
70,621,381 | I want to make a GUI Windows application that can run console applications. When this happens, the console window should not be shown. Instead its content should be shown in a visual component (memo/richedit). This component should show exactly the same content which would appear in the console window, even the color o... | 2022/01/07 | [
"https://Stackoverflow.com/questions/70621381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17862719/"
] | You wrote `$table->string('status')->default("Pending");` and ind your const vars you write it lowercase. that would be the problem. Please check if you also consider lower and uppercase when setting the status.
```
class Constants{
const APPROVED = "approved";
const PENDING = "pending";
const REJECTED... | Laravel have the authorization already figured out for you, what you need to do is create a [middleware](https://laravel.com/docs/8.x/middleware) file named (eg. Status)
```
public function handle($request, Closure $next)
{
if ($request->user()->status !== 'APPROVED') {
return back()->with('er... |
9,952,505 | I am new to iOS development and am trying to figure out how it is MVC.
I see how there are controllers that produce views.
However, where are the models that represent data? I just see iOS development as controllers that "delegate" (I still don't see what that çlearly means.) functionality to each other. | 2012/03/31 | [
"https://Stackoverflow.com/questions/9952505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1279646/"
] | iOS development done the right way is a great example of true MVC programming. If you really want to see this in action, check out Stanford's iTunes U videos.
The model for iOS will be either a CoreData store, a manually built class, etc. The ViewController is the controller and the View will be the nib or storyboard ... | In simply words you create views and code separately. Then you link them between themselves using class name, variables and methods. Likewise for program data.
But it is too basic question. You can learn it from the first pages of all the books about objective-c |
35,667,209 | My table id is "termTable". I am iterating through each row of the table. The id of textbox is "label'+ i +'" since I used for loop to generate ids randomly. The values of i will be unordered maybe after adding the rows or deleting the rows. Example: IDs are label1, label2, label3. After deleting the 2nd row, I am addi... | 2016/02/27 | [
"https://Stackoverflow.com/questions/35667209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5389766/"
] | without you html format cant help much.
but try this ones.you dont even need a for loop to get all the textbox and their ids from table.
```
var ids=[];
$('#termTable input[type="text"]').each(function(){
ids.push($(this).attr('id'))
})
```
if you want ids of the textboxes in first column of the ta... | The best practice is to add a specific class to all of your elements that need to be iterated.
For example add the class `term-table-input` to your inputs:
```
row.insertCell(0).innerHTML = '<input type="text" class="form-control term-table-input" id="label' + (len - 1) + '" name="label' + (len - 1) + '" value=""><in... |
2,421,086 | Can someone give me a solution to this problem, I'm lost.
$\lim \limits\_{n \to \infty}$ $ (\frac {(n!) ^{(1/n)} } {n}) $ | 2017/09/08 | [
"https://math.stackexchange.com/questions/2421086",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/401136/"
] | **Hint**: Use the theorem that *if $a\_{n} >0$ and $a\_{n+1}/a\_{n}\to L$ then $a\_{n} ^{1/n}\to L$*. Take $a\_n=n! /n^{n} $. You should easily get the answer as $1/e$. | In the same spirit as in answers and comments, consider
$$A\_n=\frac{(n!)^{\frac{1}{n}}}{n}\implies \log(A\_n)=\frac{\log (n!)}{n}-\log (n)$$ and use Stirling formula for large $n$
$$\log(n!)=n (\log (n)-1)+\frac{1}{2} \left(\log (2 \pi )+\log
\left({n}\right)\right)+O\left(\frac{1}{n}\right)$$ which makes
$$\log(A\_... |
254,216 | My table structure looks like this:
```
tbl.users tbl.issues
+--------+-----------+ +---------+------------+-----------+
| userid | real_name | | issueid | assignedid | creatorid |
+--------+-----------+ +---------+------------+-----------+
| 1 | test_1 | | 1 | 1 ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2025/"
] | ```
SELECT
IssueID,
AssignedID,
CreatorID,
AssignedUser.real_name AS AssignedName,
CreatorUser.real_name AS CreatorName
FROM Issues
LEFT JOIN Users AS AssignedUser
ON Issues.AssignedID = AssignedUser.UserID
LEFT JOIN Users AS CreatorUser
ON Issues.CreatorID = CreatorUser.UserID
ORDE... | Does this work?
SELECT
i.issueid,
i.assignedid,
u1.real\_name as assigned\_name,
i.creatorid,
u2.real\_name as creator\_name
FROM users u1
INNER JOIN issues i ON u1.userid = i.assignedid
INNER JOIN users u2 ON u2.userid = i.creatorid
ORDER BY i.issueid |
44,807,980 | I'm making an application with swift 3.0. But I have a problem, because in the API REST still have not implemented the service, I'm creating a simulated JSON to continue working. But the problem as you will see at the end of all the explanation in the image is that I do not know how to declare a JSON "-.- .... Basicall... | 2017/06/28 | [
"https://Stackoverflow.com/questions/44807980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7672866/"
] | Hi not sure if you will be open to this, but it will be better to try creating a JSON in file and load it in using Bundle like this :
```
func loadJsonFrom(fileName: String) -> NSDictionary {
let path = Bundle.main.path(forResource: filename, ofType: "json")
let jsonData = try! Data(contentsOf: URL(fileURLWit... | I think your syntax is wrong for declaring your JSON. Pretty sure declaring Dictionaries inline in swift you only use ["key":"value"]
So just remove all of the { and }
Edit: Sorry, didn't realise it was outside of a method. If you want to do that you have to declare it directly like so
```
var deliverables = ["... |
59,237,418 | How to position both buttons below at the end of their respective columns ?
[](https://i.stack.imgur.com/otyjy.png)
By default, the buttons are positioned to **start** in each column.
```
<div id="app">
<v-app id="inspire">
<v-container fluid>
<v-row justify... | 2019/12/08 | [
"https://Stackoverflow.com/questions/59237418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3329664/"
] | Option 1: Add `class="text-right"` to both `<v-col>` elements if you want to position inline elements such as text.
Option 2: Add `class="d-flex justify-end"` to both `<v-col>` elements to position block elements.
Since the `<v-btn>` element is most likely displayed as an inline-block element, both options will work... | Just add `align="end"` to each of `v-col`.
Here is the [working codepen](https://codepen.io/loia5tqd001/pen/OJPMJBE?&editable=true&editors=101).
Because `v-col` is just `display: flex; flex-direction: column;`. Instead of `v-row` you use `justify` to align elements, in `v-col` you use `align`.
[ {
return this.myName;
}
public void setMyName... | 2010/06/17 | [
"https://Stackoverflow.com/questions/3061013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267269/"
] | I'm not sure I entirely understand what you are doing, but from what you wrote it looks like you are creating a new Map\_Delegate each time. So you create one object and set the values then you create another object and try to get the values (but by creating a new object the values are initialised to null). You should ... | The reason for the null values that you are creating two map\_delegate instances. A new instnace has null values for the properties (unless you specify a default value - not the case here.) You set the values on the first instance, but then retrieve from second - the second instance is newly constructed with null value... |
41,662,873 | ```
apiRoutes.post('/authenticate', function(req, res) {
User.findOne({
name: req.body.name
}, function(err, user) {
if (err) throw err;
if (!user) {
res.send({success: false, msg: 'Authentication failed. User not found.'});
} else {
// check if password matches
user.comparePasswo... | 2017/01/15 | [
"https://Stackoverflow.com/questions/41662873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7091886/"
] | >
> if one of them are in lines[k], the code have to pass and do next code
>
>
>
The If statement should be:
```
if 2 in list[k] or 0 in list[k]:
pass
else:
continue
``` | If I understood your question correctly, you want to check each nested list inside `lines = [[1,1,1],[1,2,1],[1,0,1],[1,1,1]]` whether it contains `2` or `0` and perform a certain operation if that is the case.
You can do this by looping over the nested lists inside `lines`:
```
lines = [[1,1,1], [1,2,1], [1,0,1], [1... |
55,947 | I am learning about SSH and how to use it to secure file transfers and commands between a windows machine and a Linux server. Everything that I have read so far indicates that I need to use an SFTP client (like WinSCP) to connect to my server and transfer files. Gettin gin a little deeper, the docs for WinSCP never tel... | 2014/04/16 | [
"https://security.stackexchange.com/questions/55947",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/42370/"
] | **Short answer:** there is necessarily a public/private key pair on the server. There *may* be a public/private key pair on the client, but the server may elect to authenticate clients with passwords instead,
---
[SSH](http://en.wikipedia.org/wiki/Secure_Shell) is a generic tunnel mechanism, in which some "applicatio... | In SSH, you have two sets of key pairs: one for the server and one for the users.
The server key pair is mandatory but it is typically generated during the installation of the server: all you have to do is validate the server public key fingerprint (a simple hash) and, as long as the key is unchanged, your client will... |
30,733 | A project manager's responsibility is to lead a project to a successful completion, which includes finishing the project on time, a happy customer, a proud team, etc. But it also includes financial results, right?
A project manager is preparing correct estimations and a project plan and controls their execution - thes... | 2020/12/06 | [
"https://pm.stackexchange.com/questions/30733",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/40376/"
] | A lot depends on the commercial context, the business need being served and presumably the nature of the PM role as well. You have tagged this question with "Scrum" but in Scrum there is no project manager and the Product Owner is the person who is expected to be responsible for delivering business value.
Irrespective... | As noted [here](https://www.projectmanagement.com/wikis/345150/Key-Performance-Indicators), it doesn't really matter which financial indicator is used, as long as it's objective and measurable.
The other key point is, that for a Project Manager to be held responsible to avoid and mitigate risks (as well as all the oth... |
4,079,575 | In some web pages, when we stop mouse cursor on some words (e.g. some popular movie star names) on the web page, a pop-up box near the words will show-up, showing maybe some related pictures for the move star, a short summary for the movie star, and related twitter link for this movie star. Then we can move mouse on th... | 2010/11/02 | [
"https://Stackoverflow.com/questions/4079575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63235/"
] | You're looking for the HoverCard effect?
<http://www.shoutmeloud.com/gravatar-hovercards-for-wordpress-org-blogs.html>
<http://closure-library.googlecode.com/svn/docs/closure_goog_ui_hovercard.js.source.html> | I think `onmouseover` is what you need to look into |
16,210 | Are there any other runners out there who have bunions on their feet? If so, has running led to any long-term or short-term health problems? Is it worthwhile to get a special pair of shoes to accommodate the bunions?
I've heard conflicting answers on this, from both professionals and well-meaning people who don't nece... | 2014/04/21 | [
"https://fitness.stackexchange.com/questions/16210",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/8434/"
] | Disclaimer: I am not an expert in running form or podiatry. This is my own experience.
I have a bunion on one foot, which was I suspect caused by over-aggressive rock climbing shoes, but when it flares up it can also make running painful. What seems to set off the pain is shoes that put lateral pressure on my toes (i.... | I've heard from my trainer that you could really hurt yourself if you continue to run with bunions on hard surfaces. I'd suggest running on a track (the rubberized kind) or on grass - even bare feet would be ok. Alternately if you live near a beach, running on dry sand is also a great idea. Finally if none of the above... |
41,281,747 | I want to customize the display of my html, using `window.open()`. I wrote the code below, and got the output as per the screen shot attached.
My points are:
1. I found the window to be `resizable` though i used `resizable=no`
2. how to hide the `bar title`
3. How to add my customs title to the form/page, I want to r... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41281747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2441637/"
] | If you want a title to appear in the new window just set the `title` tag in your `text` inside the `<head>`.
```
<title>Title you want</title>
```
Example:
```
var report = window.open('', '_blank', 'title="Report",toolbar=0, top=500,left=500, width=200,height=100,resizable=no,scrollbars=no, menubar=no, location=no... | ```
var report = window.open('', '_blank', 'title="Report",toolbar=0, top=500,left=500, width=200,height=100,resizable=no,scrollbars=no, menubar=no, location=no, status=no');
report.document.body.innerHTML = text;
**report.document.title = 'custom one';**
``` |
32,030,244 | I'm using Django 1.8.
When running `python manage.py squashmigrations myapp` I get this:
```
manage.py squashmigrations: error: the following arguments are required: migration_name
```
How do I find the **migration\_name**? | 2015/08/15 | [
"https://Stackoverflow.com/questions/32030244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4162811/"
] | the migration\_name is the number head of the files locate in yourapp/migrations/
```
python manage.py sqlmigrate asset 0001
ll asset/migrations/
total 12
-rw-r--r--. 1 root root 1326 Feb 9 20:17 0001_initial.py
-rw-r--r--. 1 root root 1405 Feb 9 20:20 0001_initial.pyc
-rw-r--r--. 1 root root 0 Feb 5 06:07 __ini... | To find out programatically in a script you can use
```
./manage.py migrate --list <app_name> | tail -1 | cut -d ' ' -f 3
```
For a bunch of apps
```
APPS="asset common product"
for APP in $APPS
do
# find out the latest migration
MIGRATION_NAME=`./manage.py migrate -l $APP | tail -1 | cut -d ' ' -f 3`
... |
59,784,489 | I am trying to implement MVP Matrices into my engine.
My Model matrix is working fine but my View and Projection Matrices do not work.
Here is the creation for both:
```
public void calculateProjectionMatrix() {
final float aspect = Display.getDisplayWidth() / Display.getDisplayHeight();
final floa... | 2020/01/17 | [
"https://Stackoverflow.com/questions/59784489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11562753/"
] | While the answer of @Rabbid76 of course it totally right in general, the actual issue in this case is a combination of bad API design (in the case of JOML) and not reading the JavaDocs of the used methods.
In particular the [Matrix4f.\_mNN()](https://joml-ci.github.io/JOML/apidocs/org/joml/Matrix4f.html#_m00(float)) m... | So I tried everything and found out that you should not initialise the uniform locations to 0.
In the class that extends the ShaderProgram class, I had:
```
private int l_TextureSampler = 0;
private int l_ProjectionMatrix = 0;
private int l_ViewMatrix = 0;
private int l_ModelMatrix = 0;
```
Changing ... |
40,974,664 | I'm trying to generate a system that allows me to check if multiple jobs have completed running on a cluster.
This bash code should work to wait until all PBS jobs have completed:
```
#create the array
ALLMYJOBS=()
# loop through scripts, submit them and store the job IDs in the array
for i in 1 2 3 4 5
do
ALLMYJO... | 2016/12/05 | [
"https://Stackoverflow.com/questions/40974664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7252002/"
] | You've called `in_fridge` but you haven't done anything with the result. You could print it, for example:
```
result = in_fridge()
print(result)
``` | You are not priting the result of the `in_fridge` call, you should print it:
```
def in_fridge():
try:
count =fridge [wanted_food]
except KeyError:
count =0
return count
fridge ={"apples":10, "oranges":3, "milk":9}
wanted_food="apples"
print(in_fridge())
``` |
61,433,963 | I have a button. I want to change the background after I click on it. My problem here is the button auto call `paintComponent()`. How can prevent this? I expect after clicking the button the button will be blue, but it will still be red.
```
package test;
import java.awt.Color;
import java.awt.Graphics;
import java.aw... | 2020/04/25 | [
"https://Stackoverflow.com/questions/61433963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10721258/"
] | My personal gut feeling is that `JButton` is probably not suited to your desired goal.
Essentially, you want to control when and how the "selected" state of the piece is changed.
Personally, I would have some kind of controller which monitored the mouse events in some way (probably having the piece component delegate... | If you want to change the background for a short while you can do it with swing `Timer`:
```
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
public class ButtonD... |
3,046,284 | I'm currently trying to capitalize the very first letter from an input.
Here's what I tryed :
```
fieldset input
{
text-transform:capitalize;
}
```
But it doesn't work the way I want, as every word is capitalized.
I also tryed this :
```
fieldset input:first-letter
{
text-transform:uppercase;
}
```
But it... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3046284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367392/"
] | **JS**: `str.charAt(0).toUpperCase();` | ```
$('#INPUT_ID').keyup(function(){
if($(this).val().length>0 && $(this).val().length<5){
$(this).val($(this).val().charAt(0).toUpperCase()+$(this).val().substr(1));
}
});
```
Can't use length==1, as it doesn't work if user types fast. |
6,452,466 | I have a service which I believe to have running in the foreground, How do I check if my implementation is working? | 2011/06/23 | [
"https://Stackoverflow.com/questions/6452466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811985/"
] | Starting with API29 (Q), you can simply check it with the following code.
Can be called from inside your service. If you don't have your service instance, you can obtain it by using binder.
```
class MyService : Service {
val isForeground: Boolean get() = foregroundServiceType != FOREGROUND_SERVICE_TYPE_NONE
}
`... | This worked for me in the [***Coinverse***](https://play.google.com/store/apps/details?id=app.coinverse) app for crypto news.
It's is the most concise **Kotlin** solution. Thanks to [Abbas Naqdi](https://github.com/oky2abbas) in this [GitHub issue](https://gist.github.com/kevinmcmahon/2988931#gistcomment-2937968).
`... |
51,639,263 | My task is to remove Placeholder from input box when user clicks on it and make label visible.
If user doesn't fill anything in it again place back the placeholder and make label invisible.
I am able to hide it but can't reassign it.
I have tried element.setAttribute(attribute,value) , element.attribute=value & elemen... | 2018/08/01 | [
"https://Stackoverflow.com/questions/51639263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8810517/"
] | I would suggest to use CSS for the placeholder portion instead:
```
:focus::placeholder{
opacity: 0;
}
```
```css
:focus::placeholder {
opacity: 0;
}
```
```html
<input placeholder="Visible">
``` | If you can't do this using css ([using @Darlesson's answer](https://stackoverflow.com/a/51639331/4488121)) for compatibility reasons, you can do this as the following snippet using javascript.
The trick is to store the old placeholder so that when you need to restore you have it available. In this case I used a new at... |
1,604,060 | I want to remove this [arrow thing](https://i.stack.imgur.com/V4oF7.png) in MS Word
[](https://i.stack.imgur.com/V4oF7.png)
I tried everything like searching about this on the net but to my dismay, I found nothing. Please help. | 2020/11/22 | [
"https://superuser.com/questions/1604060",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | All you have to do is Google.
"Expand/Collapse is a feature built-in to all the default heading styles in Word except for No Space and Normal. There is no option to disable the Expand/Collapse feature unless you will be using the Normal style or you will be creating a custom style based on the Normal formatting."
[Ho... | As others have mentioned, this is most likely due to the OP using one of the Heading styles.
However, it can still happen that you will have the expand/collapse arrows when using the Normal style. This is a problem I ran into from time to time for years, and no amount of Googling ever provided me with a solution, but ... |
3,430,810 | I'm using wget to download website content, but wget downloads the files one by one.
How can I make wget download using 4 simultaneous connections? | 2010/08/07 | [
"https://Stackoverflow.com/questions/3430810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413869/"
] | I found (probably)
[a solution](http://blog.netflowdevelopments.com/2011/01/24/multi-threaded-downloading-with-wget)
>
> In the process of downloading a few thousand log files from one server
> to the next I suddenly had the need to do some serious multithreaded
> downloading in BSD, preferably with Wget as that wa... | `make` can be parallelised easily (e.g., `make -j 4`). For example, here's a simple `Makefile` I'm using to download files in parallel using wget:
```
BASE=http://www.somewhere.com/path/to
FILES=$(shell awk '{printf "%s.ext\n", $$1}' filelist.txt)
LOG=download.log
all: $(FILES)
echo $(FILES)
%.ext:
wget -N -... |
1,369,388 | I know of the ||= operator, but don't think it'll help me here...trying to create an array that counts the number of "types" among an array of objects.
```
array.each do |c|
newarray[c.type] = newarray[c.type] ? newarray[c.type]+1 ? 0
end
```
Is there a more graceful way to do this? | 2009/09/02 | [
"https://Stackoverflow.com/questions/1369388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160863/"
] | ```
types = Hash.new(-1) # It feels like this should be 0, but to be
# equivalent to your example it needs to be -1
array.each do |c|
types[c.type] += 1
end
``` | In Ruby 1.8.7 or later you can use `group_by` and then turn each list of elements into count - 1, and make a hash from the array returned by `map`.
```
Hash[array.group_by(&:class).map { |k,v| [k, v.size-1] }]
``` |
13,252,684 | I'm trying to set up my own autoscaling system on AWS and I've set up alarms for any instance spawned with a specific AMI ID.
When I check the the metrics which are only monitoring one server, they get information just fine. The "aggregated" stats however always fail.
Is this a problem with AWS or does this not do w... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13252684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1400370/"
] | Have you enabled detailed monitoring for your instances? AWS supports aggregated metrics only for instances with detailed monitoring enabled:
>
> For the instances where you've enabled detailed monitoring, you can also get aggregated data across groups of similar instances.
>
>
>
See: <http://docs.aws.amazon.com/... | If your cloud metrics says "insufficient data" that means your server have not met the state which you have configured using CLI. |
38,327,133 | I've got this error on Android. Just in case, I use react-native-maps. Do you know what is it from?
[](https://i.stack.imgur.com/FmbJE.png) | 2016/07/12 | [
"https://Stackoverflow.com/questions/38327133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442172/"
] | I also got this error when I was conditionally rendering a element based on the truthiness of a non-boolean value:
```
<View>
{stringVariable && <Text>{stringVariable}</Text>}
</View>
```
This code gives me the error. However, if I double negate string variable like so:
```
<View>
{!!stringVariable && <Text>{st... | The problem for me with this error was that somehow I managed to end up with a `<View>` inside of `<Text>`. That was not very obvious because I had a `Button` component that was accepting some children wrapped in a `<Text>` and I was using some custom component for an `Icon` when instantiating Button. After a while som... |
11,832,371 | So this is not about the pumping lemma and how it works, it's about a pre-condition.
Everywhere in the net you can read, that regular languages must pass the pumping lemma, but noweher anybody talks about finite languages, which actually are a part of regular languages.
So we might all aggree, that the following lang... | 2012/08/06 | [
"https://Stackoverflow.com/questions/11832371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572445/"
] | There's a simplest way to show that some language is infinite. Assume that L is the language for some regular expression E, L(E).
Suppose L(E) is equivalent to `{ab^nc | n ≥ 0}`.
We know that E is in the form `ab*c`, and we know this language is probably regular(we can't prove something be regular), since the pumping... | Finite languages are regular languages by definition because you can build a regular expression that satisfies it by just expressing the union of all the words (e.g. `(abc)|(defghi)` is a regular expression that satisfies your language) and consequently you can have a [deterministic finite automaton](http://en.wikipedi... |
24,828,382 | I have one asp.net page with two gridview using updatepanel.when i click the submit button data inserting in db and update the gridview. i'm handling duplicate insertion of same data when refresh the page. but the problem is when i refreshing the page previous data in the gridview showing not present data. again if i'm... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24828382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1307273/"
] | Here is some code that produces the strings you want. I leave to you defining the new value labels and assigning to the variables. Let us know if it's useful.
```
clear all
set more off
*----- example -----
label def gen 0 "Male" 1 "Female", modify
*label value Gender gen
label def meal 0 "Lunch" 1 "Dinner", modify... | Stata doesn't understand TeX or LaTeX, at least not like this.
You could just prefix with space(s), but often Stata would just ignore them any way.
A bizarre trick I've used occasionally is to use `char(160)` as a pad which looks like a space but won't be trimmed.
```
length(trim("`=char(160)'"))
```
is reporte... |
68,435,943 | I have a problem with a code that scrapes a weather website. It's supposed to update hourly, but for some reason, the data given is not the current data on the website; it also doesn't update its data, but keeps feeding the same data continuously. Please help!!!
Also, I need help scraping the weather icon from the sit... | 2021/07/19 | [
"https://Stackoverflow.com/questions/68435943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16478105/"
] | ```py
import requests
from bs4 import BeautifulSoup
def main(url):
r = requests.get(url)
soup = BeautifulSoup(r.text, 'lxml')
x = list(soup.select_one('.card').stripped_strings)
del x[4:8]
print(x)
main('https://weather.com/en-NG/weather/today/l/4dce0117809bca3e9ecdaa65fb45961a9718d6829adeb72b6a6... | It appears the error might have been from the site, because it's working now without the issues. Thank you all for the suggestions. @Ahmed American your code is beautiful. I've learnt from it. @furas I'll try to construct the SVG as you suggested.
[That's the output.](https://i.stack.imgur.com/BXfmp.png) |
70,660,908 | >
> Write a function called `minVal` that returns the minimum of the two numbers values passed in as parameters. Note: Be sure to include comments for all functions that you use or create. For example, if you made a call like `x = minVal(10, 14)` `x` should have the value `10`. For your program, you need to define the... | 2022/01/11 | [
"https://Stackoverflow.com/questions/70660908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17898009/"
] | Just for fun:
```
def minVal(x, y):
return x if x < y else y
x = minVal(2, 4)
print("The min is " + str(x))
``` | >
> With Two Different Options
>
>
>
```
def minVal(x, y):
if x>y:
return x
elif x==y:
return None
else:
return y
```
>
> With a List With Two Items
>
>
>
```
def minVal(l1):
if l1[0]>l1[1]:
return l1[0]
elif l1[0]==l1[1]:
return None
else:
... |
451 | Do numbers have an objective existence? If life had not evolved on planet earth would there be numbers or are numbers an invention of human minds?
Are there any relevant works that discuss this? (I know of Husserl's *Über der Begriff der Zahl* and Frege's *Grundlagen der Arithmetik* already; are there any other notabl... | 2011/06/17 | [
"https://philosophy.stackexchange.com/questions/451",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/160/"
] | A number is an abstract thing. It doesn't exist independently of a thought about it.
For example a cat... . A cat can exist without a human observing it - ask the mouse! Or think about Brontosaurus. But a number is abstract - you can compare a basket with 3 bananas and a box with 3 letters, and the common thing among... | Mathematics is a science that studies common properties of physical objects which do not depend on the actual physical substance of which the objects are constructed. For example it studies what is in common with all round things, with all triangular things etc.
Certain objects can be said of to consist of other const... |
48,873,489 | I am developing a REST API using node js and express js.
For example, my RESTful API end points are as follows
```
/api/v1/books/:id
/api/v1/books
```
I want to authorize the end points only for specific application(web, android or ios).
\*\*The users of the application may or may not authenticate in the applica... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48873489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6109352/"
] | I would suggest trying the following:
* Log into the server, preferably as the user that the service is set to run as.
* Ensure your Zebra printer is installed as a local printer, and the printer name is correct.
* Print a test page from the printer properties.
* Print your ZPL manually:
`net use lpt1 "printer shared... | i develop a websockt for this cases [ZPLwebSocket](https://drive.google.com/open?id=1vse4zhsYnPhSoJ6HqyzfhOWYm9PeqEyP)
1. Download the file and uncompress.
2. Run SetUp.exe on client PC.
3. Go to services and start 'Servicio de Impresion desde Navegador'
4. open trysocket.html with GoogleChrome or mozilla
5. write th... |
68,800,162 | I got this code from <https://github.com/aws/aws-lambda-go/blob/master/events/README_ApiGatewayEvent.md> :
```
package main
import (
"context"
"fmt"
"log"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
func handleRequest(ctx context.Context, request events.APIGatew... | 2021/08/16 | [
"https://Stackoverflow.com/questions/68800162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019965/"
] | This happens because your handler has the same signature in both cases, but what that implies differs based on what is proxying your request.
When you send the request from the Lambda GUI, the body gets unmarshaled into the `events.APIGatewayProxyRequest` straight away. That struct has a field defined as:
```
Body st... | Though i am not familiar with the lambda GUI i suspect that there you input the json representation of the request (with headers and body), but when sending via curl, you don't need to wrap the body (-d), so just send it like this `[{\"id\":\"123\"}]` as this is what the body should contain. |
166,849 | ```
Fatal error: Uncaught TypeError: Argument 1 passed to FDB\FreeSamples\Helper\SampleCategories::__construct() must be an instance of FDB\FreeSamples\Model\Checkout\Type\Onepage, instance of Magento\Checkout\Model\Type\Onepage\Interceptor given,
```
Model
```
namespace FDB\FreeSamples\Model\Checkout\Type;
class O... | 2017/03/30 | [
"https://magento.stackexchange.com/questions/166849",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/49811/"
] | Ok, so I discovered a little more about this but as @circlesix pointed out it's not possible to use these LESS mixins nested like this.
Furthermore if you look at the `<head>` section of Magento you'll notice that the *styles-l.css* is loaded after the mobile styles, i.e. *styles-m.css*.
```
<link rel="stylesheet" t... | Using the the core files as an example for how to use that mixin, i don't think you can have them nested in that way (even though i think that is the preferred way to use media queries).
Looking at a file in core like **vendor/magento/theme-frontend-luma/Magento\_Theme/web/css/source/module/\_collapsible\_navigation.l... |
8,549 | In Mark 11, as Jesus is entering the temple he stops to inspect a fig tree to find out if it has any fruit. It doesn't, which Mark tells us is "because it was not the season for figs." Jesus then proceeds to curse the tree, saying "May no one ever eat from from you again."
The whole episode strikes me as rather odd, b... | 2014/03/11 | [
"https://hermeneutics.stackexchange.com/questions/8549",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/33/"
] | The fig tree cursing narrative is found in Matthew's and Mark's gospels. Mark's account varies in sequence from Matthew's account as it is written in two sections: First, after departing the temple, Jesus sees the fig tree **in leaf**, but no fruit found, followed by cursing [Mark 11:12-14]. Second, after departing fro... | Before entering Jerusalem Jesus sent His disciples to Bethphage to find things which were to be brought to Him (Matthew 21:1, Mark 11:1, and Luke 19:29). Bethphage means "house of unripe figs" [[G967-Bethphage]](https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?Strongs=G967&t=KJV). Figs picked too early will not... |
589,520 | I use the following code to call a wcf service. If i call a (test) method that takes no parameters, but returns a string it works fine. If i add a parameter to my method i get a wierd error:
>
> {"ExceptionDetail":{"HelpLink":null,"InnerException":null,"Message":"The token '\"' was expected but found '''.","StackTrac... | 2009/02/26 | [
"https://Stackoverflow.com/questions/589520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11619/"
] | I have only ever thought that posting is essential for username and password log on functionality so this is the way I encode the JSon parameters I send to the web service...
Here is the Webservice Contract..
```cs
[ServiceContract]
public interface ILogonService
{
[OperationContract]
[WebInvoke(
... | I think on your operation you need this attribute:
```
[WebInvoke(Method="POST",
BodyStyle=WebMessageBodyStyle.Wrapped,
ResponseFormat=WebMessageFormat.Json
)]
```
See [jQuery AJAX calls to a WCF REST Service](http://www.west-wind.com/weblog/posts/324917.aspx) for more info. |
11,386,843 | This is a PHP/Apache question...
1. I have the following code. In particular I would like to emphasize the
following:
```
// store email in session variable
$_SESSION["jobseeker_email"] = $_POST["jobseeker_email"];
// perform redirect
$target = util_siblingurl("jobseekermain.php", true);
... | 2012/07/08 | [
"https://Stackoverflow.com/questions/11386843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1510578/"
] | ```css
h1, h2, h3, h4, h5, h6 {
scroll-margin-top: 80px;
}
```
Got this idea from React docs. | Everyone else gave CSS answers but the question asked for JS
@assmmahmud's answer works with one small tweak: gotoSpecificPosition needs to changed to offsetAnchor in the first statement.
This was very helpful in adjusting all id links for a sticky header.
```
/* go to specific position if you load the page directly... |
8,814,472 | What is the simplest way to create an `<a>` tag that links to the previous web page? Basically a simulated back button, but an actual hyperlink. Client-side technologies only, please.
**Edit**
Looking for solutions that have the benefit of showing the URL of the page you're about to click on when hovering, like a n... | 2012/01/11 | [
"https://Stackoverflow.com/questions/8814472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/835805/"
] | And another way:
```html
<a href="javascript:history.back()">Go Back</a>
``` | The easiest way is to use `history.go(-1);`
Try this:
```html
<a href="#" onclick="history.go(-1)">Go Back</a>
``` |
50,011,443 | I'm using tslint, and got the error.
```
'myVariable' is declared but its value is never read.
```
I went to the website that documents the rules <https://palantir.github.io/tslint/rules/> and searched for the string `is declared but its value is never read` but didn't find that text. While I can and did look for s... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50011443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3281336/"
] | Add this line just before the line which causes the error:
```
/* tslint:disable:no-unused-variable */
```
You will no longer receive the tslint error message.
This is a better solution than turning off the error for you whole codebase in tslint.conf because then it wouldn't catch variables that really aren't use... | Another way to avoid this is to create a get-method for every variable you have, like this:
```
get variablename():variabletype{return this.variablename;}
``` |
40,716,356 | I am trying to convert `varchar` field which is in format `dd.mm.yyyy` to date type field in SQL SERVER 2008.
I used approach like `convert(datetime, left(yourDateField, 2) + '01 20' + right(yourDateField, 4), 100)` but unable to so.
Is there any way to convert `Varchar` string which is in format `dd.mm.yyyy` to `Dat... | 2016/11/21 | [
"https://Stackoverflow.com/questions/40716356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5566276/"
] | ```
select convert(date,dateField,104)
from tab
``` | If Your date field is not in proper datetime format then this type of Out of range value error will occurred.
If your date field is in proper datetime format then you can easily convert varchar field to datetime format.
see example:
```
select CONVERT(datetime,'2016-11-21 01:02:12')
select CONVERT(datetime,'2016-11... |
359,333 | I created a windows service that's basically a file watcher that wont run unless a user is logged into the machine its on. The service is running on a Windows Server 2003 machine. It is designed to move the files that are put into one directory into a different directory based on keywords in the file names, but none of... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You probably have to set the service to log on as a spesific user, try going into services, doubleclick the service and select "log in as account", and then provide your account details (domain\username and password).
The LocalService account has extensive rights, but may lack the rights to spesific users files/folder... | There has to be some setup problem with your service. Windows Server doesn't have a problem running applications without a user logged in (otherwise, scheduled tasks would be a lot less useful).
How did you *install* the service? |
43,947,459 | The problem is that it disables text editing but in case 1 of the Switch when you have to activate it again it does not
This is the code I am using.
```
public class ejemolo extends AppCompatActivity {
String[] Items = {
"Dc amps a Kw",
"Ac una fase amp a kw ",
"Ac trifasicaam... | 2017/05/12 | [
"https://Stackoverflow.com/questions/43947459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7767739/"
] | since OP answered himself I'll just copy-paste a commend made by @lospejos, which I think is a way better solution than the one proposed by OP (just for future generations sake)
```
if (matchesFormat(input)) {
/* ok */
} else {
/* not ok */
}
```
with a helper method
```
boolean matchesFormat(String input... | I was using && when I should be using ||, fixed.
Thanks |
27,389,053 | I need to replace a certain string with a string blanks that equal removed lines, For instance If I am given
```
1234567890
```
I need to replace some of the text with blanks that equals the number of letters removed.
```
123 8790
```
or
```
1234 90
``` | 2014/12/09 | [
"https://Stackoverflow.com/questions/27389053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4314038/"
] | The standard O(n) multi-precision add goes like this (assuming [0] is LSB):
```
static void Add(byte[] dst, byte[] src)
{
int carry = 0;
for (int i = 0; i < dst.Length; ++i)
{
byte odst = dst[i];
byte osrc = i < src.Length ? src[i] : (byte)0;
byte ndst = (byte)(odst + osrc + carry... | I used a variation of Cory Nelsons answer that creates the array with the correct endian order and returns a new array. This is quite a bit faster then the method first posted.. thanks for the help.
```
private byte[] Increase(byte[] Counter, int Count)
{
int carry = 0;
byte[] buffer = new byte[Counter.Length]... |
27,150,118 | Using below web.xml (with out filter config) i can able to connect with rest services, but after this i couldn't access JSP pages under the servlet.so included a filter for rest easy inside web app tag, but after inserting filter that ear file failed to deploy in JBOSS, so am i handling the filter wrongly here.
```
<d... | 2014/11/26 | [
"https://Stackoverflow.com/questions/27150118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2047363/"
] | Try with below code:
```
String date = "2014-11-25";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
Date testDate = null;
try {
testDate = sdf.parse(date);
}catch(Exception ex){
ex.printStackTrace();
}
SimpleDateFormat formatter = new SimpleDateFormat("MMM dd,yyyy");
String newFormat = formatter.fo... | ```
String t = "2014-11-26";
// To parse input string
SimpleDateFormat from = new SimpleDateFormat("yyyy-mm-dd", Locale.US);
// To format output string
SimpleDateFormat to = new SimpleDateFormat("MMMM dd, yyyy", Locale.US);
String res = to.format(from.parse(t));
``` |
34,156,025 | Given 2 tables tbl1 and tbl2. Values in tbl1 should be updated/replaced with values from tbl2 in corresponding rows, if the values in tbl2 aren't NULL or empty strings (''). For any reason, MySQL (and MariaDB) are treating 0 values as it were empty strings or NULL values. Is there any way to get around it?
**Edit:** t... | 2015/12/08 | [
"https://Stackoverflow.com/questions/34156025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5320981/"
] | The problem lies in this predicate:
```
t2.val != ''
```
This evalutes to `true` when `t2.val = 0`. This is due to *implicit type coversion*. Check [**this demo**](http://sqlfiddle.com/#!9/b4f76/3) to see for yourslef.
The predicate is not necessary, since `val` is of type `tinyint(3)` (according to table definitio... | You can write your query much more simply as:
```
UPDATE tbl1 t1 JOIN
tbl2 t2
ON t1.id = t2.id
SET t1.val = t2.val
WHERE t2.val IS NOT NULL;
```
A Giorgos explains, the main problem with your query is the comparison of a numeric column to a string -- and the resulting implicit type conversion.... |
54,343,083 | I have a problem with `range()` or the for loop.
in C++, the for loop can be used like this:
```
for(int i=1;i<=100;i*=10){
//lala
}
```
My Python script that causes the error looks like this:
```
li = [x for x in range(100, 0, /10)]
print(li)
```
I hope to get `li = [100, 10, 1]`
How can I achieve this witho... | 2019/01/24 | [
"https://Stackoverflow.com/questions/54343083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7369672/"
] | You can simply use a generator expression, like
```
for i in (10 ** x for x in range(2, -1, -1)):
print(i)
# 100
# 10
# 1
```
Or, if you want your "power range" to be a reusable function, you can create your own, i.e.
```
def powrange(*args, base=10):
for i in range(*args):
yield base ** i
for i in... | To change make a `log(n)` time complexity loop you need the log function or use while loops to do the job
```
In [10]: import math
In [9]: [10**x for x in range( 0,int(math.log10(1000)))]
Out[9]: [1, 10, 100]
```
I still think while loops are the way to go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.