INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
whats is the difference in these dimensions
I am wondering what's the difference in these both highlighted dimensions.  you most probably get 3.5 of 5 mm dimensions between resistor's green pads.
|
stackexchange-electronics
|
{
"answer_score": 1,
"question_score": 0,
"tags": "eaglecad, dimensions"
}
|
How to extract values of particular instance variable from Map using Java Stream API?
I have a HashMap, for each key the value is a User Defined Object. This user defined object has variable of type ArrayList. How can I extract this ArrayList into one List using Java stream API. So, the size of my HashMap is 3. Size of the array list inside each user defined object is 1. Final out should be an arraylist of size 3
My object is
class XYZ{
List<ABC> list;
}
My map has values `{"1", XYZ_1},{"2",XYZ_2},{"3",XYZ_3}.` I want to extract list from each object `XYZ_1, XYZ_2,XYZ_3`
|
You are looking for `Stream::flatMap`
Map<Key, List<CustomClass>> map = new HashMap<>();
List<CustomClass> data = map.values().stream()
.flatMap(Collection::stream)
.collect(Collectors.toList());
**EDIT**
Since you have a class with a list inside, you can change your code to look like this
Map<KeyClass, CustomClass> map = new HashMap<>();
List<?> data = map.values().stream()
.map(CustomClass::getList)
.flatMap(List::stream)
.collect(Collectors.toList());
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -1,
"tags": "java, java stream"
}
|
MultiselectComboBox options for be open
How can I achieve this in Vaadin?
MultiselectComboBox box = new MultiselectComboBox();
I can see a dropdown list which works fine , but I am looking for a function where the dropdown is open by default.
|
You can try `ListSelect` :-
ListSelect
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "vaadin"
}
|
Update SASS in ruby
I am working on a project based on ruby. How can I update the SASS engine? My PC has one version, but my project doesn't.
I've tried using `gem update`, but it doesn't update SASS.
Any help?
|
If you are using bundler, you can just run
bundle update sass
Without bundler rubygems can install fresh version, but your app may use old one. Try to uninstall older version.
But the best solution to escape such problems - is to use bundler.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "css, ruby, sass"
}
|
jQuery Hiding element based on previous row td value
I have a table like this:
<table>
<tr>
<td>
<a href="/payinvoice/1">Pay Invoice 1</a>
<span class="paid hidden">False</span>
</td>
</tr>
<tr>
<td>
<a href="/payinvoice/2">Pay Invoice 2</a>
<span class="paid hidden">False</span>
</td>
</tr>
</table>
and I need to hide the Pay Invoice 2 link if the value of the span in the previous row td is False.
I came up with this:
$('span.paid').each(function () {
if ($(this).prev("span.paid").text() == "False") {
$(this).prev("a").addClass("hidden");
}
});
but it doesn't work. Any tips? Thanks!
|
$('span.paid').each(function() {
var $this = $(this);
if ($.trim($this.closest('tr').prev('tr').find('span.paid').text()) == 'False') {
$this.prev('a').addClass('hidden');
}
});
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jquery"
}
|
Authenticating Google Cloud Datastore c# SDK
I am trying to authenticate Google Datastore c# SDK in a k8 pod running in google cloud. I could not find any way to inject the account.json file in to DatastoreDb or DatastoreClient beside using GOOGLE_APPLICATION_CREDENTIALS environment variable. Using GOOGLE_APPLICATION_CREDENTIALS environment variable is problematic since i do not want to leave the account file exposed.
According to the documentations in: <
> When running on Google Cloud Platform, no action needs to be taken to authenticate.
But that does not seem to work.
A push in the right direction will be appreciated (:
|
This is how it can be done:
var credential =
GoogleCredential.FromFile(@"/path/to/google.credentials.json").CreateScoped(DatastoreClient.DefaultScopes);
var channel = new Grpc.Core.Channel(DatastoreClient.DefaultEndpoint.ToString(), credential.ToChannelCredentials());
DatastoreClient client = DatastoreClient.Create(channel, settings:
DatastoreSettings.GetDefault());
DatastoreDb db = DatastoreDb.Create(YOUR_PROJECT_ID, client:client);
// Do Datastore stuff...
// Shutdown the channel when it is no longer required.
await channel.ShutdownAsync();
Taken from: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "google cloud datastore"
}
|
How to echo a language's name using the 'raw' attribute?
I'd like to make a language switcher, but the default options don't work for me, so I'd like to use the 'raw' attribute. I'm currently just testing whether my languages will show up at all:
$translations = pll_the_languages(array('raw'=>1));
echo $translations[0]['name'];
This code doesn't output anything, but doesn't crash the website either. What am I missing?
|
you would need to get it like this:
echo $translations['nl']['name'];
It's better to verify if the key exists in the array or not.
$value= "";
if($key_exists('nl',$translations) && $key_exists('name',$translations['nl'])){
$value = $translations['nl']['name'];
}
echo $value;
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, polylang"
}
|
SQL Server - Create a copy of a database table and place it in the same database?
I have a table ABC in a database DB. I want to create copies of ABC with names ABC_1, ABC_2, ABC_3 in the same DB. How can I do that using either Management Studio (preferably) or SQL queries ?
This is for SQL Server 2008 R2.
|
Use `SELECT ... INTO`:
SELECT *
INTO ABC_1
FROM ABC;
This will create a new table `ABC_1` that has the same column structure as `ABC` and contains the same data. Constraints (e.g. keys, default values), however, are -not- copied.
You can run this query multiple times with a different table name each time.
* * *
If you don't need to copy the data, only to create a new empty table with the same column structure, add a `WHERE` clause with a falsy expression:
SELECT *
INTO ABC_1
FROM ABC
WHERE 1 <> 1;
|
stackexchange-stackoverflow
|
{
"answer_score": 332,
"question_score": 157,
"tags": "sql, sql server 2008, tsql, sql server 2008 r2"
}
|
Difference between try block placement in java
I'm curious as to what difference will it make if I placed the try block outside of a for loop versus inside of the for loop? As in if I were to write it like this:
try{
for(int a : array){
//some code here
}
}catch(Exception e){}
Versus something like
for(int a : array){
try{
//some code here
} catch(Exception e){}
}
Will there be a difference in how the exception is processed? I understand that by putting the try inside the forloop, the try statement will execute and test the code each time the for loop loops. But what about when putting the for inside the try statement?
I hope what I wrote makes sense
|
**Yes**. Wrapping the loop around the try block, means the loop will continue in the face of the exception; trying the next iteration. With the try block around the loop any exception will terminate the loop. In either case (in real code), you should not silently swallow exceptions.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "java"
}
|
Find several strings in a .txt file, and assign them to a different variables
I have a SQL file, that I have converted to a txt file.
The final idea is to do a readline() with Python3 and find a specific string, and return only the lines that have this string.
For example, imagine this file.txt:
*hello, how are you
I am fine, --- thanks*/
What a wonderful day
Yes, it ---is
Regards---*
I need to print (or assign a variable/variables) only the lines where the string "---" appears:
*I am fine, --- thanks*/
Yes, it ---is
Regards---*
Thanks in advance.
|
Using list comprehension:
print ([line for line in open("test.txt").readlines() if "---" in line])
If you want the output in separate lines without "\n" and not list:
my_list = [line.strip() for line in open("test.txt").readlines() if "---" in line]
for line in my_list:
print(line)
line.strip() will remove "\n".
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -3,
"tags": "python, python 3.x"
}
|
Can't Drop foreign key in MySQL
I have had a 1 to many relationship between course and instructor, which I wanted to drop. When I tried to drop the instructorID in course table it told me that. I couldn't drop it as it was a foreign key. Then I decided to drop it like this:
ALTER TABLE course DROP FOREIGN KEY instructorID
But i get this error :
#1091 - Can't DROP 'InstructorID'; check that column/key exists
I don't get what this error means. what am i doing wrong?
|
Please run an `SHOW CREATE TABLE course;` to make sure instructorID is the name of foreign key **constraint**.
Additional: The error means MySQL searches for a foreign key constraint named "InstructorID" but there is no constraint with such name, maybe this is your column name, but you have to use the constraint name to delete foreign keys.
|
stackexchange-stackoverflow
|
{
"answer_score": 80,
"question_score": 42,
"tags": "mysql"
}
|
Running shell script automatically in UNIX / linux server
I want my web server to run a .sh script that runs a series of .jar files. I want this to happen as soon as the server is contacted without any input from the user. A PHP or JS script would be preferable. Is it even possible to do this? Thanks in advance
|
You can also look at gearman.org. It is safer and more flexible than shell_exec().
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "php, linux, shell"
}
|
Difference between Galois and other automorphisms
With respect to the definition of Galois field, for $E$ an extension of $F$ ($E$ and $F$ are finite fields) $\mathrm{Gal}\,(E/F)$ is the set of automorphisms of $E$ which fix $F$ pointwise. So I think that we can distinguish between $\mathrm{Gal}\,(E/F)$ and $\mathrm{Aut}\,(E)$, right?
|
You don't need to assume that $E$ and $F$ are finite fields. Every automorphism of a field fixes its prime field, by which I mean $\mathbb Q$ or $\mathbb F_p$, the field generated by $1\in E$. However it doesn't need to fix any other subfield, so that's what makes the Galois group different.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "finite fields"
}
|
Can Scala's Actor framework handle 10.000 actors without stack problems?
I want to do a multi-agent simulation containing about 10.000 agents (machine and product agents) using the Scala Actor framework.
As I understand, if there are lots of actors passing messages around, can it run out of stack due the recursion?
If so, how can I increase the stack sizes for the underlying worker threads?
|
The actor framework has been designed to handle this - in fact, it can handle this with only one thread, assuming you use the `loop-react` pattern as follows:
import actors._
import actors.Actor._
val a = actor {
loop {
react {
case ABC => //Handle here
}
}
}
On pp 590-593 of _Programming in Scala_ this is discussed in more detail: basically the `react` method never returns normally (it terminates with an exception) and therefore its call stack does not need to be preserved. You can think of it as looping forever.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 5,
"tags": "scala, concurrency, actor"
}
|
Initiating a download with php, is it possible to view the download link?
I am trying to hide the location of my product files, so I am initiating downloads server side with PHP header after a purchase has been made. Is it possible that the url of the file can be discovered?
using the following code
if (file_exists($_SERVER['DOCUMENT_ROOT']."/files/$file")) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
|
streaming the result like you do now, the source is hidden from the client. The output seems to come from the php script then
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -2,
"tags": "php, url, download"
}
|
Is there any JavaScript IDE that's able to show all used objects fields and methods in IntelliSense?
For example, I am using Google Maps API and I want to see all possible fields and methods.
<script type="text/javascript" src=" </script>
<script type="text/javascript">
var ge;
google.load("earth", "1");
If I type `google.` I want to see every available functions and fields
For now I use Visual Web Developer 2010 Express and it shows only base methods available for all objects like toString().
|
To my knowledge not yet, but you can use this simple code to "print" all that's in an object.
It is crude but it works :)
// Obj.keys(); strict
// Object.getOwnPropertyNames( obj ) strict
get_keys = function get_keys (obj) { // all inhereted keys
var keys = [], key;
for(key in obj)
{
//if (obj.hasOwnProperty(key)) {keys.push(key);}
keys.push(key);
}
obj = key = null;
return keys;
};
stringify_object = function stringify_object(obj){
var keys = get_keys(obj),
str = '',
i, len = keys.length;
for(i=0; i < len; ++i)
{
str += i + ": " +keys[i] + ' : ' + obj['"'+keys[i]+'"'] +'\n\n';
}
obj = keys = i = len = null;
return str;
};
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 3,
"tags": "javascript, ide, javascript intellisense"
}
|
Isn't "const" redundant when passing by value?
I was reading my C++ book (Deitel) when I came across a function to calculate the volume of a cube. The code is the following:
double cube (const double side){
return side * side * side;
}
The explanation for using the "const" qualifier was this one: "The const qualified should be used to enforce the principle of least privilege, telling the compiler that the function does not modify variable side".
**My question** : isn't the use of "const" redundant/unnecessary here since the variable is being passed by value, so the function can't modify it anyway?
|
The `const` qualifier prevents code inside the function from modifying the parameter itself. When a function is larger than trivial size, such an assurance helps you to quickly read and understand a function. If you know that the value of `side` won't change, then you don't have to worry about keeping track of its value over time as you read. Under some circumstances, this might even help the compiler generate better code.
A non-trivial number of people do this as a matter of course, considering it generally good style.
|
stackexchange-stackoverflow
|
{
"answer_score": 125,
"question_score": 95,
"tags": "c++, constants, pass by value"
}
|
Returning char* form C++ function
I have a simple question but unfortunately I wasn't able to find the answear online.
const char* foo() const { return "foo"; }
Is this 100% safe ?
|
This is perfectly acceptable from the language PoV.
There's no memory leak of any kind because there are no allocations. The only value constructed is the resulting pointer of primitive type, initialized to point at the literal's location. The pointer returned by this function points to a valid location that can be read and used.
In fact, this function could be marked `constexpr`, as the result can be determined at compile-time, and any program using it will work just as if it used the literal directly.
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "c++, arrays, char"
}
|
Make it clear the OP has the "final vote" on suggested edits
Now that all sites requires at least two votes to approve or reject a suggested edit, there is chance to get into confusing situations like: (for simplicity using case of only 2, like here on Meta)
1. Single vote from ordinary user was needed to approve/reject the suggested edit. (example)
2. One user has voted to approve/reject the suggested then afterwards other (ordinary) user cast opposite vote and it went through without needing a third vote. (example)
The second is more confusing in my opinion; when I saw that page I thought "well, this is a bug, let's report it!" and in the last moment noticed the one rejecting was actually the author of the post.
Same way like moderators are marked with a diamond and thus it's easy to understand why they have the final vote, please mark the post authors as well. Background color would be suitable, same color as appears in the question.
Rough mock up:
> .
Examples from the question:
* Example 1
* Example 2
|
stackexchange-meta
|
{
"answer_score": 10,
"question_score": 34,
"tags": "feature request, status completed, suggested edits, design"
}
|
How to remove the association after deleting a model object
I have a simple has_many/belongs_to association between 2 of my models. My problem is that when I delete an object that I no longer want (from the parent model), the foreign key within the child model's object remains. For example:
**Forest**
`has_many :trees, :inverse_of => :forest`
**Tree**
`belongs_to :forest`
When I delete a `Forest` object, all the associated `Tree` objects still contain a value for `forest_id`, which results in errors on the frontend. Is there some sort of hook like `before_destroy` that I can use? Though I'm thinking there's probably a very simple solution to this.
Thanks
|
I think that you want the `:dependent` option.
has_many :trees, :inverse_of => :forest, :dependent => :nullify
This will set the foreign keys to `nil` when the associated model is destroyed. You could also use `:dependent => :destroy` to destroy the model.
The documentation here might help.
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "ruby on rails"
}
|
What is about-sentiment called?
I don't even know what my problem is called, so I can't research literature on it. I'm hoping someone can point me in the right direction. I have a little experience with sentiment analysis, but what I want to do is more specific. Rather than evaluating the general sentiment of a body of text, I want to evaluate the sentiment about a particular subject in a body of text. For example, let's say I have an article about President Obama. One sentence says
> President Obama arrived in Florida and saw the horrific destruction left behind by the hurricane.
While the general / overall sentiment of this sentence would like be negative, Obama is spoken about fairly neutrally. This is what I mean by about-sentiment. I want to evaluate (with a computer) how positively or negatively the text speaks _about_ a specific subject.
What is this called? Is there literature on it? How can I proceed?
|
Google NLP and others call this 'Entity Sentiment Analysis' (versus document sentiment analysis). Also see "aspect based sentiment', e.g., < Finally, look at OpenAI's approach. It isn't entity/aspect oriented but the sentiment shifts as it reads: <
|
stackexchange-linguistics
|
{
"answer_score": 5,
"question_score": 3,
"tags": "terminology, sentiment analysis"
}
|
What is the geometric interpretation of the leading coefficient in a quadratic equation?
What is the geometric interpretation of the leading coefficient in a quadratic equation? It is clear we do not call it a slope or elasticity or derivative of the quadratic equation.
|
The leading coefficient effects the curvature. Taking the second derivative yields just $2a$, so this determines if the curve is convex or concave, and how much so.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "geometry, quadratics"
}
|
connecting scales(measure weight) to external device(pc or iphone)
I want to make a project for a client where client can easily weigh a product and get the product weight displayed on his PC or iPhone before submitting the data to a web server, I know some scales have APIs but could they be integrated into the web browser? or should I do a custom desktop or mobile application to handle that?
|
If the scales are network capable, then you can write an application using TCP/IP.
If the scales have serial port only, you'll either need a PC connected to it or some embedded device acting like a server. See this device for example, if you want an industrial grade device with rugged case and variable input voltage or you can also take Raspberry Pi or BeagleBone. The server can either provide data over some IP port with defined API or you can implement a web-server there, so that you'll only need a browser on your smartphone (iOS, Android etc.)
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "php, ios, api, serial port"
}
|
How to grab a String BEFORE a certain word
I want to grab a string BEFORE a certain word. I know how to grab after but not before.
I know the code to grab after a certain word is:
GetStringBetween(getURL("url),"startstring", 'stopstring');
But what if I want to grab before a certain string? My thing in question is : `mpegURL|m3u8|172d45823df011328d1450903533c9e6|org|play|iZ7XfsOZq8SgEGdeG1RasA|1565987357|videoserver2`
The `565987357` part changes, and so does the play ID, so I can't for example tell it to start grabbing from the A| part because it won't always be A|. So I need PHP code that will grab everything before the `|video` and stop at the `|` that starts the changing number, sort of like a reverse `getstringbetween` in a way... Thanks for all your advice.
|
If the number of **|** delimiters in your string is constant you can do:
$string = 'mpegURL|m3u8|172d45823df011328d1450903533c9e6|org|play|iZ7XfsOZq8SgEGdeG1RasA|1565987357|videoserver2';
$stringParts = explode('|', $string);
$numbers = $stringParts[6];
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "php"
}
|
What does 辞書形+ ぞって mean?
>
I saw it in a YouTube video. I tried looking it up in the dictionary but I found only. I'm not sure if this is it or is that a different grammar rule?
|
As suggested in the comment above, this is a case of omitted comma, or, and/or
Well ya know, sometimes you wanna eat till you burst. But I make a point to not do that before a workday.
|
stackexchange-japanese
|
{
"answer_score": 2,
"question_score": 1,
"tags": "grammar"
}
|
how change package name in intellij android project?
Just getting started with Android development using `intellij` and Stack Overflow.
I am looking for change the package name of my project , I have one solution and want to use it in two projects with some change and the new one.
for example in my current this is my package
> com.example.test1
i want to make a cope of my project and change the package of it into
> com.example.test2
|
Right click on pacakage name select refactor and rename packagename
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "android, intellij idea"
}
|
Gentlest ascent in dynamical system
I have a question about the following excerpt from the paper("An Iterative Minimization Formulation for Saddle-Point Search") by Gao,Leng, Zhou on gentlest ascent in dynamical systems.!enter image description here
!enter image description here
I am having a hard time understanding the part where it says that "the equation (1b) attempts to find the direction that corresponds to the smallest eigenvalue of the Hessian $\nabla ^2 V(x)$"
If I drop the normalization term in (1b) and set the relaxation constant $\gamma = 1$, then I am basically looking at
$$\dot v = - \nabla ^2 V(x)v \tag A$$, but why is it that this dynamic attempts to find the direction corresponding to the smallest eigenvalue of the Hessian of V?
|
For a fixed $x$ denote $A:=\nabla^2 V(x)$. It is a matrix. Then locally your equation looks like $\dot{v} = -A v$. By standard analysis of linear ODE if $-A$ has all e.v. not laying on the imaginary axis, then the dynamics will follow the largest e.v. of $-A$ i.e. minus the smallest e.v. of $A$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 3,
"tags": "dynamical systems"
}
|
R: GAM with fit on subset of data
I fit a Generalized Additive Model using `gam` from the `mgcv` package. I have a data table containing my dependent variable `Y`, an independent variable `X`, other independent variables `Oth` and a two-level factor `Fac`. I would like to fit the following model
`Y ~ s(X) + Oth`
BUT with the additional constraint that the `s(X)` term is fit only on one of the two levels of the factor, say `Fac==1`. The other terms `Oth` should be fit with the whole data.
I tried exploring `s(X,by=Fac)` but this biases the fit for `Oth`. In other words, I would like to express the belief that `X` relates to `Y` only if `Fac==1`, otherwise it does not make sense to model `X`.
|
If I understand it right, you're thinking about some model with interaction like this:
Y ~ 0th + (Fac==1)*s(X)
If you want to "express the belief that `X` relates to `Y` only if `Fac==1`" don't treat `Fac` as a `factor`, but as a `numeric` variable. In this case you will get `numeric` interaction and only one set of `coefficients` (when it's a `factor` there where two). This type of model is a `varying coefficient model`.
# some data
data <- data.frame(th = runif(100),
X = runif(100),
Y = runif(100),
Fac = sample(0:1, 100, TRUE))
data$Fac<-as.numeric(as.character(data$Fac)) #change to numeric
# then run model
gam(Y~s(X, by=Fac)+th,data=data)
See the documentation for `by` option in the documentation `?s`
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 5,
"tags": "r, gam, mgcv"
}
|
Should I use my domain registrar's nameserver or find an alternative?
I've recently been moving my client's sites as well as my own and my friends to a cloud server instance I've set up. I don't have a nameserver setup on my instance because I'm not sure how to deploy and manage that side of things yet.
I'm using the default nameservers where possible for the sites and just changing the A record DNS settings to point at the server. Some clients are complaining that the sites are running slower then before (since I changed nameservers back to the defaults). Some of the domain registrars are a nightmare to deal with and I can't convince some of my clients to leave them.
Is there a sort of paid service I can use instead?
|
ZoneEdit is excellent and your first two DNS zones are free
|
stackexchange-webmasters
|
{
"answer_score": 1,
"question_score": 1,
"tags": "web hosting, dns, nameserver"
}
|
How to paginate records from API in Laravel
How to paginate/access in any reasonable way remote model based on external API? For Laravel 4 there's a nice library called Trucker (< but I've found absolutely no other tool for L5.
The only think I actually care about is how to accomplish code similar to this:
$users = UserFromApi::get(); // Get all users from api
$activeUsers = UserFromApi::where('active', 1)->get();
...with **UserFromApi** being REMOTE API, not in the database nor anywhere.
I can use simple _get_file_contents()_ method, so it's not the request that's problematic, but the approach to do it in Laravel 5, so I can use a model.
|
look at laravel docs for collections <
so if you got some data from api, parse it to array and do something like:
$collection = collect($data);
$filtered = $collection->where('active', 1);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php, model, laravel 5"
}
|
NodeJs route execution time
every time i do an http request to any route in my app i got in my console the route method , execution time and and anther number that i have no idea what it means(will love to know) . 
df %>%
mutate(Int=findInterval(Age,c(1,5),rightmost.closed = T),
Age=ifelse(Int==1,"1-5",Age)) %>%
group_by(Age) %>%
summarise(Count=sum(Count))
# A tibble: 1 x 2
Age Count
<chr> <int>
1 1-5 10
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "r"
}
|
Best practices for TDD and reporting
I am trying to become more familiar with test driven approaches. One drawback for me is that a major part of my code is generated context for reporting (PDF documents, chart images). There is always a complex designer involved and there is no easy test of correctness. No chance to test just fragments!
Do you know TDD practices for this situation?
|
You could use Acceptance Test driven Development to replace the unit-tests and have validated reports for well known data used as references.
However this kind of test does not give a fine grained diagnostic as unit-tests do, they usually only provide a PASS/FAIL result, and, should the reports change often, the references need to be regenerated and re-validated as well.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 8,
"tags": "pdf, tdd, reporting"
}
|
What was default variable boundary alignment in Visual Studio 6?
I am trying to upgrade old Visual Studio 6 projects. They use "default" memory-boundary alignment. However, it seems that defaults for Visual Studio 6 and 2013 are not the same.
Anyone know what the old default was?
`align(1)` ?
(I need to know this since during the migration we will have a mix of programs. They communicate by serializing C-structs to byte-arrays and passing the array between programs. If the alignments are different that will fail horribly.)
|
According to MSDN "Structure Alignment" documentation:
> The default pack size for Windows 3.x is 2, whereas the default for Win32 is 8.
Be aware that compiler options can be overridden with **#pragma pack**.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "c, memory alignment, visual studio 6"
}
|
No merge commit in the commit history in Git
I merged my development branch to staging branch but I can't see the merge commit on the staging branch. What am I doing wrong? My workflow is as follows.
1. Checkout development branch and make some changes
2. Pull development branch
3. Commit development branch to local repo
4. `git checkout -q staging`
5. `git merge development`
6. `git push origin staging:staging`
7. `git checkout -q development`
8. `git push origin development:development`
I use VS Code GUI for git tasks. I have another dev working in the same project. For some reason in both branches, the commit history looks exactly the same. Earlier it used to show the merge commit without any issue but not anymore. Neither of us are able to figure out where things went wrong.
|
When you perform a merge between two branches with Git and the branch you are merging is a strict superset of the branch you're merging into, Git performs what's called a _fast-forward merge_ , which basically means that the branch you're merging into is just directly updated to be exactly the same as the other branch. In other words, no merge commit is created.
However, sometimes this is undesirable and you want to create a merge commit regardless. You can do that by using `git merge --no-ff`. So in your example, at step 5, you'd run `git merge --no-ff development`.
This can be confusing because most hosting platforms like GitHub always perform a merge commit when merging, even though Git does not.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "git, merge, branch, commit, aws codecommit"
}
|
HTML PHP get select value in same page
I have a question about HTML select form.
I have 5 select forms something like following picture.  listener on each of the drop downs.
The ajax call would hit a PHP file that would execute the MySQL queries and return the HTML to generate the list on the next dropdown.
I would start here.
<
<
This should get you started, If you need help along the way just post a comment or edit your question above to provide more information and I would be happy to help.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -3,
"tags": "php, html, mysql"
}
|
Look and change data on mysql with PHP and strotime() function
I have a problem about strotime() function.
My code like below; (PHP PDO MySQL)
$BasketLastDate = date('Y-m-d H:i:s',strtotime('+7 minutes'));
$BasketLastDate = strtotime($BasketLastDate);
$sepetONAY = 0;
$sg = "SELECT * FROM baskets WHERE approve=1 and checkout=0";
foreach($db->query($sg) as $basketDetails){
$BasketDate = $basketDetails['basket_date'];
$BasketDate = strtotime($BasketDate);
// If the basket older than 7 minutes
if ($BasketLastDate < $BasketDate){
// code....
}
The code should look all rows and change situation if the record older than 7 minutes. But it doesn't happened.
Please help me guys.
|
I think you should check time before 7 minutes not after :
$BasketLastDate = date('Y-m-d H:i:s',strtotime('-7 minutes'));
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, mysql, function, datetime, pdo"
}
|
How to prevent WSEACCESS error on Send via raw socket on Windows XP SP3 for normal user accounts
I have recently begun trying to run our company apps under normal windows user accounts rather than under an account with Administrators group membership. Several of these are failing when atempting to send data on a raw socket (specifically this is an Indy ICMP implementaiton, we are using to ping another server).
Under an account with Administrators membershipt this works just fine. Try it without and the Send() on the raw socket fails with WSEACCESS.
Operating system XP Pro SP3 + hot fixes.
Any ideas how to rectify this situation?
|
I'm don't think this is possible. Raw Sockets functionality is only available to members of the Administrators Group. (See this MSDN article.aspx).)
There's a similar question on SO that has an answer for server 2003, but as the poster suggests, it probably isn't supported in XP.
|
stackexchange-serverfault
|
{
"answer_score": 1,
"question_score": 0,
"tags": "windows xp, socket, permissions"
}
|
cocoa custom view fading in/out new image when dragging
I have a custom view that accepts drags. In the custom view there is an image and the words Drag items here. I would like to make it where when dragging an item over the view the image will fade into another image, then when dragging away it will fade back to the original image. Also, when it will fade into the new image I will make the words Drag items here fade away, then fade back again when dragging away. I think I can do this with another view but I want to keep the original view so that it will continue to accept drags. What is the right approach to do this?
|
Take a look at Apple demo ImageTransition, it does what you want, at least for image
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "image, cocoa, view, fade"
}
|
Order a data set with serial marks
I have the following data set:
import random
def get_data():
data = []
for a in xrange(10):
serial_id = random.randint(0, 100)
node_data = 'data-%d' % (a)
data.append((serial_id, node_data))
return data
Which gives (well, it is random, so ymmv):
[(58, 'data-0'), (37, 'data-1'), (68, 'data-2'), (80, 'data-3'), (89, 'data-4'), (42, 'data-5'), (2, 'data-6'), (90, 'data-7'), (53, 'data-8'), (7, 'data-9')]
I would like to order this data set by `serial_id`, implementing:
def order_data(data):
...
return ordered
Where ordered would be:
[(2, 'data-6'), ... , (90, 'data-7')]
What would be the most pythonic/efficient way to do this?
|
Use `sorted`:
return sorted(data)
or, if you don't care about modifying `data`, you can just use `.sort` to do a (slightly more efficient) in-place sort:
data.sort()
return data
The comparison function for tuples orders them by their first element, then their second element, and so on.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "python"
}
|
git results in another screen rather than under the command
I user Mavericks+iTerm.
When I run any git commands, it displays the result in another screen rather than under the command. It used to be under the command but one day it started using other screen as you can see in the image. !enter image description here
I have to type `q` to go back.
How can I change this? I want to display the results under the git commands.
Thank you in advance.
|
Git is using a _pager_ to show the status in your screenshot. Disable the pager to get rid of this behaviour, e.g.
git --no-pager ...
There are also configuration options to disable the pager for individual commands, or you can change the flags to the pager so it immediately exists if there's less than one screen of output.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "git, iterm"
}
|
Multibranch pipeline with jenkinsfile in svn:external
I have set up a multibranch pipeline job for a repository in SVN. Since I want to keep the jenkinsfiles the same in all branches, they are not really located in the branches, but in a different location and only referenced via svn:externals.
Unfortunately the multibranch pipeline does not seem to follow these references and doesn't find the jenkinsfiles (the paths are correctly set):
Checking candidate branch /branches/aaa/bbb/ccc@HEAD
‘ddd\eee\fff\jenkinsfile' not found
Does not meet criteria
Is there any way to tell Jenkins and the multibranch-pipeline plugin setup to also follow svn:externals when looking for the jenkinsfiles?
|
By default, Jenkins is trying to get the Jenkinsfile with a lightweight checkout which does not consider svn:externals.
This behavior can be (only generally) deactivated, see < chapter "lightweight checkout capability for Subversion on Multibranch Pipeline projects and Externals support"
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jenkins, jenkins pipeline"
}
|
Getting just the "active" remote desktop sessions
In windows I can get the remote desktop sessions on a particular server using:
qwinsta /server:SERVER_NAME
But this gives me sessions of all different states(e.g.: Active, Disc, ... ).
Does any body know about a command or batchfile or script to just get the "active" sessions? I want to be able to run it from an ordinary Windows 7 client.
|
`qwinsta /server:SERVER_NAME | find /I "Active"`
Note that this is just a quick&dirty one-liner which would just spit out every line containing "Active" (in lower or upper case). If you expect user names which contain this string, things are going to be more complicated and require to check the fourth column for the correct "Active" string:
for /F "usebackq tokens=1,2,3,4,5*" %i in (`qwinsta /server:SERVER_NAME ^| find "Active"`) do if "%l" == "Active" ( echo %i %j %k %l %m )
If you need to process single fields of the output anyway, the latter form is preferred as it would expose the fields in the `%i` ... `%m` variables.
But this construct also breaks if you have user names containing spaces. If this is the case, all is lost with qwinsta and you should be looking for a PowerShell function to retreive the user list instead.
|
stackexchange-serverfault
|
{
"answer_score": 3,
"question_score": 5,
"tags": "windows, remote desktop, session"
}
|
Prove the curve is a part of circle
Given a curve $y$ having constant curvature with $y=f(x)$ with $f''(x) > 0 $. I have to prove that this curve is a part of a circle.
My Try
Assume curvature of the curve as $c$. Then, I can write $$c = \frac{f''(x)}{(1+f'(x)^2)^{\frac 32}}$$ After this, I am unable to solve the non-linear differential equation.
Is my approach wrong? Thanks in advance !
|
If you separate the variables in the equation for $g=f'$ you obtain $$ \frac{dg}{(1+g^2)^{3/2}}=cdx $$ With the substitution $g=\tan\theta$ the integral on the left is just $\sin\theta+const.$ so $$ \sin\theta=cx+D $$ If we choose as our initial direction $\theta=0$ (the curve starts horizontally at $x=0$) you get $D=0$. Since $\sin\theta=\tan\theta/\sqrt{1+\tan^2\theta}=g/\sqrt{1+g^2}$ we have $$ \frac{g}{\sqrt{1+g^2}}=cx. $$ Solving for $g$: $$ g(x)=\frac{cx}{\sqrt{1-c^2x^2}}, $$ for $|x|\in[0,1/c)$. Integrating once again $$ f(x)=-\frac{\sqrt{1-c^2x^2}}{c}+E $$ Choosing the initial point of the curve at the origin, we find $E=\frac 1{c}$. Finally, $$ f(x)=\frac 1{c}-\frac{\sqrt{1-c^2x^2}}{c} $$ which is the lower half of the circle centered at $(0,1/c)$ with radius $1/c$, as expected (the radius is the reciprocal of the curvature).
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 1,
"tags": "differential geometry, curves, curvature"
}
|
TypeError: Cannot read property 'on' of undefined in node js and mongoose
I am getting an error when i run my application.
The error:
MongoDB.on('error', function(err) { console.log(err.message); });
TypeError: Cannot read property 'on' of undefined
...
I tried to comment that part of the code out to see if i have anymore similar errors and found another same one. ( This time the word "once" )
The code:
var mongoURI = "mongodb://localhost/chatapp";
var MongoDB = mongoose.connect(mongoURI).connection;
MongoDB.on('error', function(err) { console.log(err.message); });
MongoDB.once('open', function() {
console.log("mongodb connection open");
});
It would be really great if anyone could help me solve this :( I searched the internet and found nothing helpful.
|
var mongoose = require('mongoose');
var mongoURI = "mongodb://localhost/chatapp";
var MongoDB = mongoose.connect(mongoURI).connection;
MongoDB.on('error', function(err) { console.log(err.message); });
MongoDB.once('open', function() {
console.log("mongodb connection open");
});
also before running the application in your terminal type `npm install mongoose --save`
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "node.js, mongodb, mongoose, socket.io"
}
|
Alt+Drag Does Not Focus Window
When I use `Alt`+`Mouse Left` to easily drag windows around, the target window does not focus. Is there a setting somewhere to make the alt+dragged window automatically focus without resorting to focus on hover? If I just click and drag the window title-bar or even the whitespace of the menu-bar, it focuses as I would expect.
|
The alt+drag behavior change be changed through System Settings ( _systemsettings5_ ). Navigate to: Workspace > Window Management > Window Actions. Under the "Inner Window, Titlebar & Frame" section, change "Left button" from "Move" to "Activate, Raise & Move". And then "Apply".
; ?>
For `artist`, use:
<?php echo $_product->getArtist(); ?>
In view page ( **/app/design/frontend/PACKAGE/THEME/template/catalog/product/view.phtml** ), you can place this code after `<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>`
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
<p><?php echo $_product->getFormat(); ?></p>
<p><?php echo $_product->getArtist(); ?></p>
If your attributes are of `dropdown` type, use :
<?php echo $_product->getAttributeText('format'); ?>
<?php echo $_product->getAttributeText('artist'); ?>
|
stackexchange-magento
|
{
"answer_score": 2,
"question_score": 0,
"tags": "magento 1.9, attributes"
}
|
find and copy text in next column in excel
I would like to know about excel find and copy text in next column in excel. I have a column A with text or sentences. I want to find a particular word and copy that word into next column that is column B only if that word is available in text of Column A.
Suppose Cell 1 of column A is:
"Execution of procedure and processes".
I want to search for word as " _Processes_ " and that should copy in Column B (cell 1) "ONLY IF" processes word is available in text.
Could you please help me out in this?
One more thing to confirm that in the same formula, does it work if I want 2 words to find. Lets say 1 is processes and other is procedure. I want a single formula for both search words and it gives a single result with one word where applicable.
|
If you put this in column B:
=IF(ISNUMBER(SEARCH("processes", A4)), MID(A4, SEARCH("processes", A4), 9), "")
it will copy the text from column A that matches (case-insentitive) the word "processes" to column B.
kaedinger's solution shows how to "parameterise" the search with a word in column C, which is a good thing. If you wanted to copy the matching text from column A, you would need to measure the length of the word in column C, where I have hardcoded '9' above.
(ref: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "excel"
}
|
Slow computer/browser performance for testing heavy javascript script
I am working on a javascript/html5 gif editor and i am wondering how can i test in a slower environment. It works great on my pc but since its using heavy javascript and algorithms i need to see if it works smoothly with a less powerful processor.
|
I recommend setting up a virtual machine using VMware Player or VirtualBox. You can adjust attributes like processor speed, number of processor cores, and memory. This will help you test your code out in a slower environments.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 7,
"tags": "javascript, html, canvas"
}
|
Log shipping backup
I m confused with backup for log shipping,by taking full backup(not copy- only) in primary ,does it affect the log backup LSN chain and cause log shipping not to work? If it does not affect LSN chain, can i take full backup and differential backup in primary and then for log backup can i use log backup which is done by log shipping in shared folder for restoration incase primary and secondary server down.
|
> By taking full backup(not copy- only) in primary ,does it affect the log backup LSN chain and cause log shipping not to work?
No..Never. Full backup has NO affect on transaction log backup chain it is not going to break the logshipping. I strongly suggest you to read Backup Myths section by Paul Randal.
> can i take full backup and differential backup in primary and then for log backup can i use log backup which is done by log shipping in shared folder for restoration in case primary and secondary server down.
Yes you can, neither full nor diff backup would break log shipping, although your request seems strange to me. If their is LS database and you want to restore full, diff and log backup make sure you do not let log backups be deleted from shared drive after the threshold is crossed in LS.
|
stackexchange-dba
|
{
"answer_score": 0,
"question_score": 1,
"tags": "sql server 2012, log shipping"
}
|
How to load splash for e(fx)clipse?
I am moving my e4 rcp application( SWT + jface) to **pure** **e(fx)clipse** (JavaFX) and I want a splash screen in application with progress bar like eclipse do have.
Can anyone suggest what should i do?
I Checked this answer from tom but I didn't understand where I can load stage in **e(fx)clipse** application?
[Edit:1] As of now there is not Progress bar support for e(fx)clipse. And **This** helps to load splash with minimum efforts for novice.
[Edit:2] One more thing i have observed as mentioned in forum. Splash screen is visible at background to application.
|
First of all yes OSGi-Application built on e4-JavaFX don't implement the Application class themselves because this needs to be done as part of the OSGi-Lifecycle.
Once you accepted this situation you have multiple choices:
* you bring up a kind of splash through the lifecycle hook with the caveat that it gets up after JavaFX and OSGi have been initialized which might take some time
* if you are on windows/linux you can still use the equinox hook with the only caveat that we bring this one done very early because we can not bring it down on the JavaFX thread
* you adjust the bootstrapping of Equinox-OSGi-Applications and do the launch yourself
If you really want to discuss this stuff in depth than I suggest you post to our forum - <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "eclipse, javafx, efxclipse"
}
|
How would one translate "swag"?
Since _swag_ generally means the coolness of a person (e.g. _I have swag_ , _I am a swaggy person_ ), would _mojosegeco_ or _mojoseco_ be a good translation for _swag_?
|
I’m not super hip with the lingo of today’s youth, but I’ve **heard** that _swag_ comes from _swagger_ , which is a verb that is translated to Esperanto as _paradi_ or _pavi_ (literally “to peacock”). If you wanted to maintain that connotation, you could use _parademo_ / _pavemo_ , _paradeco_ / _paveco_ , ktp. That implies a degree of arrogance that the word _swagger_ carries.
Otherwise, _mojosa_ seems to be the catch-all for positive slang terms. Lernu lists 'cool', 'awesome', 'groovy', 'radical', and 'epic'. To turn that into a noun, you would use _mojoseco_.
|
stackexchange-esperanto
|
{
"answer_score": 6,
"question_score": 10,
"tags": "translation, word choice"
}
|
Low power dual edge detector using too much power
I am creating a hobby circuit which transfer signal to edge triggered pulses. I created circuit like this:

|
You need $\beta$ to be an _orthonormal basis_. You can always obtain such basis by using the Gram-Schmidt process.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 2,
"tags": "linear algebra, inner products"
}
|
Jetbrains (phpstorm): how to expand path of current file in navigation tree?
For example - file was found using CMD-Shift-N (Mac os). I see the path of file in the top of IDE. How to jump to parent catalog of file without clicking in navigation tree?
|
`Alt+F1` (Navigate/Select In). You can also use `'Scroll from source'` button in Project view toolbar (the leftmost one).
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "macos, file, tree, phpstorm"
}
|
Interfacing Matlab to a network socket
I need to import data from a network socket straight into a Matlab environment for the Scientists on my team to process.
Can I use Java to implement the TCP protocol parsing from within Matlab? The idea is that if the application needs to outgrow Matlab, I would already have the network protocol parsing sorted out.
|
you can call java classes and their methods directly from Matlab functions or command window
function sock = opensocket()
sock = java.net.Socket(..)
....
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "matlab, networking"
}
|
Doctrine findBy() calling method from entity
I need little help to call method from entity.
Here is the code I had try to execute.
$datat = $this->getDoctrine()
->getRepository('AppBundle:users')
->findBy(array('userId' => $userId));
after this, when I call
$data->getUser();
I get message about exeption "Error: Call to a member function getUser() on a non-object"
When I dump $data I got data from table or if I execute
`->find()` with ID value.
|
`findBy` returns generally an ArrayCollection.
You should use `findOneBy` instead in order to target only one entity...
So :
$datat = $this->getDoctrine()
->getRepository('AppBundle:users')
->findOneBy(array('userId' => $userId));
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "php, symfony, doctrine"
}
|
Why are traits not working?
I am trying to learn traits. I have used the example from PHP manual, but it does not work - why?
trait ezcReflectionReturnInfo {
function getReturnType() { /*1*/ }
function getReturnDescription() { /*2*/ }
}
class ezcReflectionMethod extends ReflectionMethod {
use ezcReflectionReturnInfo;
}
class ezcReflectionFunction extends ReflectionFunction {
use ezcReflectionReturnInfo;
}
I get the error:
Parse error: syntax error, unexpected T_STRING in /path/index.php on line 23
|
Check your PHP version.
do `echo PHP_VERSION_ID;`
From Traits:PHP Manual
> Traits
>
> As of PHP 5.4.0, PHP implements a method of code reuse called Traits.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": "php, traits"
}
|
unexpected token error in the code
thr below is my code, i try to make tdsum an array, but some how error shows up and i cannot fix it no matter what i did, can anyone please help me, i have tried to replace ntr with numbers and other characters, but it does not work either, so i suspect that there is something i missed that is not related to the ntr part
var tdsum = [];
function find(element,ntr) {
alert(element.cells[0].innerHTML);
var tr_sum = element.parentNode.childElementCount
var tdsum[ntr] = element.childElementCount;
alert(ntr);
alert(tdsum[2])
}
$('#row2').click();
|
You don't declare elements in an array. You only need to declare the array itself.
Remove the `var` on this line:
tdsum[ntr] = element.childElementCount;
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript"
}
|
JQuery - Fade Out Elements After Being Created
I'm currently working on a JQuery game (Just to get around with using JQuery) and on certain collisions, an "explosion" class is created.
Right now I'm using `$("#game").append("the div html code goes here")` to add it in the game div. Now, how do I make it so after the element is created, it fades out after being created? I tried doing something along the lines of `$(".explosion").load(function goes here)` but that doesn't seem to work :\
|
You can do it like this:
$("the div html code goes here").appendTo("#game").fadeOut();
If you want to get rid of it after it fades out, you can do this:
$("the div html code goes here").appendTo("#game").fadeOut(function() {
$(this).remove();
});
**Working demo here:** <
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "javascript, jquery"
}
|
Using regex, Conditionally replace with $1 or empty string
I want to create a function in javascript which accepts two arguments : a regex object and a string.
The regex can have at most one capturing group.
If there is a capturing group, it shall return $1, otherwise the remaining string;
So `myfunc("hello123", /\d+/)` shall return hello and
`myfunc("hello123", /\w+(\d+)/)` shall return 123
How to identify if there's a capturing group or not?
|
When using `match` if the pattern couldn't be matched at all `null` is returned. If there was a match, the string at index `0` will be the full match while subsequent indexes will contain capturing groups. Basically the first capturing group will be at index `1` and so on.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, regex"
}
|
Compare two strings for equality ignoring case in XSLT 1.0
I have to check if a value matches a certain string, and the input may be in any case.
<xsl:if test="$adminStatus='Down'">
do something
</xsl:if>
|
Use the `translate()` function on both `$adminStatus` and target value.
How can I convert a string to upper- or lower-case with XSLT?
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "xslt, xslt 1.0"
}
|
Is it possible to have temp tables in a function?
Apparently, I can't use them. I'm getting an error message like:
> Invalid use of a side-effecting operator 'SELECT' within a function
If I want to do something like this:
select bleh
into #temp
from Blah
... inside a function.
|
No, per this thread where the same question was asked, you cannot, but you can use a `table variable`
DECLARE @MyTempTableVariable TABLE (SCHEMA)
INSERT INTO @MyTempTableVariable
SELECT bleh
FROM bleh
|
stackexchange-stackoverflow
|
{
"answer_score": 40,
"question_score": 23,
"tags": "sql, sql server, tsql, function, temp tables"
}
|
Magento - add feedback with multiple questions and comments
How to add feedback form in magento? I am new in magento. I'm using 1.8.0.
|
Magento is a complicated framework and it can be difficult to learn. You haven't given us enough information about your problem for anybody to be of any real help, however, if you are very new to Magento I recommend the following:
Go to: < and make an account. There you can find many great modules (many of which are free) that you can search through to find what you are looking for.
Once you've found a module you'd like to try, click "Get Extension" (make sure you choose 2.0) and you will receive a key. Copy that key and go to your Magento site's backend to Configuration > Magento Connect
On that page you will see a place to paste the key and install. Magento will download and install the extension there.
The rest is the fun part-- configuring an extension to meet your needs!
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "php, mysql, xml, magento"
}
|
Interesting question on Graph Theory
In a village there are an equal number of boys and girls of marriageable age. Each boy dates a certain number of girls and each girl dates a certain number of boys. Under what condition is it possible that every boy and girl gets married to one of their dates?(Polygamy and polyandry not allowed)
|
What you actually have is a bipartite graph and you are looking for a perfect matching. The theorem that provides a characterization for such conditions is Hall's marriage theorem: There exists a perfect matching for the graph if and only if for any set of boys $B$, $|B|\leq|N(B)|$ where $N(B)$ denotes the set of girls that date at least one of the boys from $B$.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": -3,
"tags": "graph theory"
}
|
Question about differentiability/continuity,please help
I was reading in my textbook that it says "a function $ f $ may have a derivative $ f' $ which exists at every point, but is discontinuous at some point."
Before this there is a theorem that says that if a point is differentiable then it's also continuous. I think I'm missing something; how can this be true?
|
The theorem says: if $f'$ exists at a point, then $f$ is continuous at that point (but $f'$ may or may not be continuous).
The example says: there is a function $f$ that has a derivative $f'$ and $f'$ is not continuous (but $f$ is).
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "real analysis, derivatives, continuity"
}
|
Find the loop invariant of the given while loop
I don't know how to find a loop invariant. I'm not sure where to start. Can anyone find the loop invariant of the given program and explain your method please.
{n ≥ 0 ∧ i = 0}
while i < n − 1 loop
b[i] := a[i + 1];
i:=i + 1
end loop
{∀j.(0 ≤ j < n − 1 → b[j] = a[j + 1])}
|
At the end of each iteration you have $$ \forall j: 0 \leq j < i \implies b[j] = a[j+1] $$ which you can prove by induction. Thus, when the algorithm terminates, $i$ has reached $n-1$ and you have $$ \forall j: 0 \leq j < n-1 \implies b[j] = a[j+1]\,. $$
I figured this out by just asking myself what kind of statement I can make at the end of each iteration. In this case it's that the first $i$ elements have been copied. Then I just turned that into a formal statement.
|
stackexchange-cs
|
{
"answer_score": 5,
"question_score": 2,
"tags": "proof techniques, loop invariants, hoare logic, proof assistants"
}
|
Is there a way to get rid of unwanted equipment?
As I do in most games, I've been picking up everything that enemies drop. However, after 15 hours in single player and 30+ ranks into PVP, I've accumulated quite a lot of equipment, including a ton of duplicate items that I can't seem to find a way to get rid of.
Is there a way to drop or otherwise get rid of unwanted equipment items? There doesn't seem to be any button to do so, but maybe I'm going about it the wrong way?
|
I looked on several forums as well as the reddit. What I can gather from there is that currently you are unable to salvage/destroy items.
> Let us get rid of duplicated gear
someone else mentioned there might not be duplicate gear at all, some might look the same due to a technical bug
> It's not really "duplicated gear" each of the gear has a different color to it. Currently a few are bugged and are using the same model.
|
stackexchange-gaming
|
{
"answer_score": 2,
"question_score": 4,
"tags": "absolver"
}
|
How to extract just part of this string in C?
I have a version file I need to parse to get certain versions in C99. For example purposes, say one of the strings looks like this:
FILE: EXAMPLE ABC123459876-001 REV 1.IMG
The 12345 numbers can be any arbitrary numbers, but always followed by 4 digits and a hyphen + a rev and an extension. I just want to return the middle of this string, that is, the file name + main version so: "EXAMPLE 9876-001 REV 1". I got it to work in the regex101 tester online with something like:
"(?<=EXAMPLE ABC.....)(....-... REV .)(?=.IMG)"
... but C99 regex does not support positive lookahead / lookbehind operators so this does not work for me. Should I be using strstr() or strtok() instead? Just looking for some ideas as to the best way to be doing this in C, thanks.
|
Do you really need regex for this? Could you not just split this string into substrings and work with that?
1. You can remove the extension with finding the dot with strchr
2. Substring the file name
3. Use regex to get the rest with `([0-9]{4}.*$)`
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "c, regex, string"
}
|
How can I configure a message I sent on Slack to be editable by anyone in the Slack workspace?
How can I configure a message I sent on Slack to be editable by anyone in the Slack workspace? (like a wiki answer on Stack Exchange)
|
What you are looking for, is possible using Slack posts.
1. Click on the lightning bolt icon in the bottom left of the message window.
2. Under Slack, select Create a post.
3. Enter a title and begin typing. Your post will be saved automatically.
 which is part of Activity class and it does not seem to work in the subclass of ListActivity.
|
It is Java. `ListActivity` (and anything that extends it) inherits all of the features and functions of `Activity`.
Therefore, just overriding `onCreateOptionsMenu` will work the same.
Boilerplate code:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_xml_name, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_item_id:
// action
break;
}
return true;
}
:)
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "java, android"
}
|
Why is comparison to True/False using the "is" operator bad?
PEP8 states that checks for `None` should be performed using `is None`. The same holds true for singletons in general. But PEP8 also states, that equality to True and False should not be performed using an operator, `is` being even worse than `==`:
Yes: if greeting:
No: if greeting == True:
Worse: if greeting is True:
I understand that the first one is the prettiest and most pythonic way, but sometimes i find myself in a situation where i want to explicitly show that i am comparing against `True` or `False`. How is `is` worse than `==` in that situation?
|
The equality operator `==` can be implemented by classes (as well as all other comparison operators), but `is` cannot.
A class could be defined so that some of its instances are equal to `True`, but they will still always fail the `is True` comparison. Consider a bool-like class, for example:
class MyBool:
def __init__(self, is_true):
self.is_true = bool(is_true)
def __eq__(self, other):
return self.is_true == bool(other)
def __bool__(self):
return self.is_true
This class can make sure that for an instance `a = MyBool(True)`, all of `if a:`, `bool(a)` and `a == True` will behave properly. However, `a is True` will return `False`.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 4,
"tags": "python"
}
|
Exacttarget data extension - How to retrieve all rows in AMPScript
I have a landing page that needs to display a list of all the records in a data extension in real time. In the past we have done this with a subset of the data using the LookupRows function. This works great, but from what I can see it only returns a subset not the entire data extension.
Is there a way in ampscript to return all the rows from a Data Extension?
|
The only way I know of to do this is to create a field in the data extension that has a default value, since this value will be the same for every record you use this field/value pair as your lookup criteria.
So for example add a field called "return", with a default value of "1". Then use this code:
LookupRows("YOUR DE NAME","return","1")
This isn't recommended for large data sets.
|
stackexchange-salesforce
|
{
"answer_score": 6,
"question_score": 3,
"tags": "marketing cloud, ampscript, dataextensions"
}
|
Does Rubbing Alcohol + Bleach really produce Chloroform?
A lot of sources on the internet claim that mixing rubbing alcohol with chlorinated bleach produces chloroform.
Rubbing alcohol is Isopropanol, and bleach is Sodium Hypochlorite. Neither of these are the reagents for the Haloform reaction. So I ask, is chloroform really produced, and if so, how?
|
Yes, rubbing alcohol and bleach could produce chloroform when mixed, if the alcohol is isopropyl-type rubbing alcohol and the bleach is hypochlorite-type bleach. Isopropyl alcohol is indeed a substrate for the haloform reaction, according to Fuson and Bull, _Chem. Rev._ , **15** , 275 (1934) and references therein.
I can't recall the reference off the top of my head, but I believe in "dilute" solutions approaching "bleach and alcohol" the chlorination tends to continue and produces carbon tetrachloride as the main product.
|
stackexchange-chemistry
|
{
"answer_score": 4,
"question_score": 1,
"tags": "organic chemistry, everyday chemistry"
}
|
Using over() in Oracle
I have the table Employees:
 (without subqueries, cte) ?
I need a result, like that:
 as sum_salary
from t
group by department_id
order by sum(salary) desc
fetch first 1 row only;
I cannot readily think of another way of handling this without a subquery or CTE somewhere.
I should note that Oracle has this strange way of nesting aggregations, so you could get the maximum salary without a subquery:
select max(sum(salary)) as sum_salary
from t
group by department_id;
EDIT:
Okay, I thought about it a little more. You can do this without subqueries or CTEs:
select max(department_id) keep (dense_rank first order by sum(salary) desc),
max(sum(salary)) as sum_salary
from t
group by department_id;
I am loath to recommend using the "nested" aggregation functions. Such queries are much easier to follow when the aggregations are nested.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "sql, oracle"
}
|
can any one can clear me some naming conventions in cake php for every mvc folder and files
I checked in web for example and I found naming example as:
Database table: books
Model class: Book
Controller class: BooksController
View found at: /app/views/books/index.ctp
Why only model name should be singular? If I crated all field with page or book means what should be given in model.
|
Yeah only model can be singular, you should use `Book`, if there are fields in the table, you shouldn't have to add anything in the model unless you have validations.
I think this link will explain you more Why does CakePHP use different plural/singular naming conventions?
Hope it helps
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "cakephp"
}
|
Zend framework form hash not working
I have a simple ZF form that includes a hash element:
$hash = new Zend_Form_Element_Hash('hash');
$hash->setSalt('hf823hflw03j');
$hash->addErrorMessage('Form must not be resubmitted');
This works ok, but if I choose to strip out all the decorators and format the form using :
$this->setDecorators( array( array('ViewScript', array('viewScript' => '_form_register.phtml'))));
Then it seems that the hash value is renewed each time it is submitted and thus doesn't work.
In addition, PHPunit thinks the form element hash is invalid and so doesn't test the form processing.
Is there any solution to this?
|
Do you really need to use viewScript Decorator? Otherwise try to use this:
$this->setDecorators(array('ViewHelper','Errors'));
If you want to change the look of the Errors, you could create your own ErrorDecorator and then use it as follows:
$this->setDecorators(array('ViewHelper', new My_ErrorDecorator()));
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "zend framework, zend form"
}
|
Did physical models of galaxies come before they were actually observed?
Black holes were first predicted by astrophysics, then observed. Was the existence of galaxies first predicted by astrophysics, or first observed by astronomers?
|
The idea of the existence of galaxies is certainly not new, and quite a bit older than the field of modern astrophysics.
In 1750, Thomas Wright, an English astronomer correctly speculated that the Milky Way was a flattened disk of stars and that some of the nebulae astronomers viewed in their telescopes were separate "Milky Ways".
In 1755 Immanuel Kant introduced the term "island universe" for these distant nebulae.
In 1912, Vesto Slipher made spectrographic studies of the brightest spiral nebulae to determine if they were made of chemicals found in a planetary system. He discovered they had high red shifts, indicating they were moving away at a rate higher than the milky way's escape velocity.
The matter was conclusively settled in 1922 when Ernst Öpik gave a distance determination which supported the theory that the Andromeda Nebula is an extra-galactic object.
|
stackexchange-physics
|
{
"answer_score": 11,
"question_score": 2,
"tags": "soft question, history, galaxies"
}
|
Enable Dynamic TextBox with Dynamic checkbox checked event
I am adding 2 controls Checkbox1 and Textbox1 dynamically. Textbox1 has been disabled by default. I want to enable Textbox1 if checkbox1 is checked. Thanks in Advance.
Praveen
|
Your code with both controls, should be something like:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox1.Checked)
TextBox1.Enabled = true;
else
TextBox1.Enabled = false;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "c#, asp.net"
}
|
Use PHP to mask URL of image-generating CGI script
I have a networked camera that generates a video snapshot upon hitting ` The problem is that by accessing the root (i.e. `192.0.0.8`) directly, users can access a live video feed, so I hope to hide the address altogether.
My proposed solution is to use PHP to retrieve the image and display it at ` Although users could create motion by hitting this new address repeatedly, I see that as unlikely.
I have tried using `include()` and `readfile()` in various ways, but do not really use PHP often enough to understand if I'm going in the right direction. My best attempt to date resulted in outputting the jpeg contents, but I did not save the code long enough to share with you.
Any advice would be appreciated.
|
A succinct way to do this is as follows:
header('Content-Type: image/jpeg');
readfile('
The content of the jpeg is then streamed back to the browser as a file, directly from `
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 3,
"tags": "php, apache, url rewriting, cgi, jpeg"
}
|
SQL Server all(select ...) is null
I search but i cannot find anything about it. I need SQL server query like
select t1.x
from @tablename as t1
where all
(select t2.y from @tablename as t2 where t1.x=t2.x) is null
`@tablename`'s are same
But I can't use `all(select ...) is null` part of query.
Thanks.
|
Do you want `not exists`?
select t1.x
from @tablename as t1
where not exists (select t2.y from @tablename as t2 where t1.x = t2.x)
This tests that there are no matching values.
Or, perhaps,
select t1.x
from @tablename t1
where not exists (select 1
from @tablename as t2
where t1.x = t2.x and t2.y is not null
) ;
This tests that any matching value has `NULL` for `y`.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "mysql, sql, sql server, isnull"
}
|
VIM How to get the definition for a syntax region
If there a syntax region definition, how to get the definition using VimL or Python?
eg, below is a definition, how can I get the data start from `start`
syntax region potionString start=/\v"/ skip=/\v\\./ end=/\v"/
|
This will match `start` value till the next whitespace.
syntax region potionString start=/\v"/ skip=/\v\\./ end=/\v"/
redir @a
silent syntax list potionString
redir END
let def=split(@a, '\n')[1]
let start=matchstr(def, "start=\\zs.*\\ze\s")
echo start
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "vim, vim syntax highlighting"
}
|
What type of View I can use for text+images report?
I want to make some sort of **non-editable** "report" view with images, titles and text in it. Images generates in code, not from bandle, so I can't use UIWebView.
User puts some data into previous view and press "done" - Next view opens with
"generated image
some text
title
mini title
image
text ... " etc
I think its similar to custom UITableView + UITextView. Has anyone other suggestions?
UPD View is dynamic (not fixed) - text and images generates from code. "report" can be different length from time to time. User can scroll this "report". It's like Help screen in some applications - rich-format text with images.
|
I think you can use Interface Builder to build a custom UIView. Then you can put UIImageView, UITextView. This can only be done if your view is fixed, isn't it?
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "iphone"
}
|
Loop between only 3 values
I'm trying to loop a class for each `div`.
I know how to get the first and last, but can't figure out how to iterate 1-3 (or more for others who want to expand this)
What I have:
$cats = get_categories();
// default value
$i = 0;
foreach ($cats as $cat) {
// reset class
$class = '';
if(++$i % 3 == 0) { $class = 'third - '; }
elseif(++$i % 2 == 0) { $class = 'second - '; }
elseif(++$i % 1 == 0) { $class = 'first - '; }
echo $class . $cat->name;
}
However, when I echo the `$i` to see what is happening, it is adding values each time, rather than going through the if statement (which I thought would not cause it to increase the number)
I end up getting this kind of output:
third - cat01
first - cat02
second - cat03
third - cat04
second - cat05
first - cat06
third - cat07
|
Major problem is at $i % 2 == 0 . It should be $i % 3 == 1. **You must always extract modulus 3 and check the result against 0, 1 and 2** :
$cats = array('cat1', 'cat2', 'cat3', 'cat4', 'cat5', 'cat6', 'cat7');
$i = 0;
foreach ($cats as $cat) {
if ($i % 3 == 0) { $class = ' first'; }
elseif ($i % 3 == 1) { $class = ' second'; }
elseif ($i % 3 == 2) { $class = ' third'; }
$i++;
echo "\n$class - $cat";
}
Output:
first - cat1
second - cat2
third - cat3
first - cat4
second - cat5
third - cat6
<
With 4 classes it works too:
<
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "php, loops"
}
|
"Text & Media" - Typo3 v8 - image with 0px width and height
The width and height of the image dose not apply in the html.
$, and hence its cardinality is at most the continuum. To get a lower bound, consider equivalence relations on $\mathbb{N}$ which have two equivalence classes exactly. We can represent these equivalence classes by infinite binary sequences, with the $i$th term being $1$ if $i$ is in the same class as $1$ and $0$ otherwise. Can you go from here?
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 2,
"tags": "elementary set theory, equivalence relations"
}
|
¿Se dice 'poder de vacaciones'?
En el segundo apartado de estos ejercicios de pretérito simple/pretérito imperfecto veo:
> 2. Como no (tener, nosotros) dinero, el año pasado no (poder, nosotros) de vacaciones.
>
y me parece un eror. ¿Existe verdaderamente?
|
No. No existe ningún modismo ni expresión de este tipo.
Es claramente un error pues falta el verbo de lo que se puede hacer.
La frase correcta sería:
> Como no _teníamos_ dinero, el año pasado no _pudimos **ir_** de vacaciones.
* * *
Yendo un poco más allá, lo que sí tenemos es la forma _poder de X_ , como en _poder de convicción_ , para referirnos a la capacidad de alguien para convencer a otros.
|
stackexchange-spanish
|
{
"answer_score": 3,
"question_score": 1,
"tags": "modismos, conjugación, pretérito"
}
|
Get the order id on WooCommerce "Order received" Thankyou page
I will customize the thankyou page from my WoocCommerce shop. For this I added a blanc thankyou.php into the WooCommerce checkout directory.
I tried this code
function get_order($order_id) {
echo $order_id;
}
add_action('woocommerce_thankyou', 'get_order');
But the variable $order_id is empty.
Is there somebody who knows how I get the order id on the thankyou page?
|
If Url is like `www.example.com/checkout/order-received/1234/?key=wc_order_s5ou6md6nTZDds` you can use the following to get the order id:
global $wp;
if ( isset($wp->query_vars['order-received']) ) {
$order_id = absint($wp->query_vars['order-received']); // The order ID
$order = wc_get_order( $order_id ); // The WC_Order object
}
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "php, wordpress, woocommerce, endpoint, orders"
}
|
background color produtes over background image on left and top
I have a div 40x40px, border 0, padding 0 with a background-color. on top I have a transparent png 40x40px which has an transparent area inside where the background color is visible through it. My problem: the background is also slightly visible on top and right of the png like a small border. I want the png covers the whole background so that the background color is only visible through the transparency of the png and not at the two borders at all. Here's the page: <
|
Looks like it's your image that contains these borders. Zoom a lot on your picture et you will probably see it :)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "css, background color, transparent"
}
|
Finding path between two nodes in Neo4j via Cypher is slow
I intend to find the path between two nodes:
MATCH (x:Column {name:'colA', schema:'a.b'})-[cd:CD*1..]->(y:Column {name:'colB', schema:'c.d'})
RETURN x,y;`
and the explain is illustrated below:
!image
After executing the above cypher, it looks like stuck forever without returning anything. I think the culprit is the VarLengthExpand phase, the Neo4j version is `enterprise-3.4.0`, any suggestions? Thanks.
|
First of all, upgrade. You're using a .0 release, and these are usually the most buggy kinds of releases (aside from the alphas). At the least, get to the latest patch release for the minor version you're interested in (so in your case, if you want 3.4.x, get the latest patch along the 3.4.x line).
Secondly, as both of these nodes can be looked up via the index, and as it seems you're only looking for a single path, not all possible paths, you may want to make use of shortestPath() after matching upon both of the nodes. Give that a try.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "neo4j, cypher"
}
|
Is it common practice to style my page in jQuery?
Most of the appearance of my site is defined in my stylesheets, but I've found it much easier to define the "responsive parts" in jQuery. For example:
var currentWidth = window.width();
$('#element').css('left', 0.1*currentWidth);
$('#element').width(0.9*currentWidth);
etc.
It works alright, everything is always in place, what I'm concerned about, is performance. Is it going to slow things down significantly compared to defining everything in CSS and let my site be a bit less tidy? I'm pretty much a newbie at this, I can usually come up with a solution, but I'm always getting confused about what's good practice and what's tinkering. Thanks in advance!
|
if you style your site in jQuery the list of the problems may occur:
1- jQuery takes longer than CSS to load, because CSS is a browser built in library, but not jQuery
2- if the user turns of javascript, your styles are not gonna be read
NOTE: never use jQuery unless it's absolutely necessary! you can use % in CSS if you want to achieve what you explained in your code!
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -3,
"tags": "jquery, css, performance, styling"
}
|
In Clojure, what does `&` mean in function/macro signature?
I saw the usage of `&` in Clojure function signature like this (<
(thread & body)
And this:
(doseq seq-exprs & body)
Does that means the function/macro can accept a list as variable? I also find `*` is often used to mean multiple parameters can be accepted, like this:
(do exprs*)
Does anyone have ideas about the difference between `&` and `*` in function/macro signature? Is there any documentation to explain this syntax?
|
In clojure binding forms (`let`, `fn`, `loop`, and their progeny), you can bind the rest of a binding vector to a sequence with a trailing `&`. For instance,
(let [[a b & xs] (range 5)] xs) ;(2 3 4)
Uses of `*` and other uses of `&` are conventions for documenting the structure of argument lists.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 6,
"tags": "clojure, macros, lisp"
}
|
Is amazon providing any API to get product list rather than Advertising API
I am going to develop product price comparison app from the amazon products. Is amazon providing any API to get product list whatever they are showing on their website. Amazon providing advertisement API with minimum data like product name and review link, detail page link. But I want those as data not as links. Is any API available. Example (www.91mobiles.com) like this I want to do. Is 91mobile crawling the data?
|
Amazon does provide product advertising apis, below is the wsdl for same -
For details you should check Amazon Product advertising API. Please also need that to use it you should be registered as amazon affiliate.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "amazon product api"
}
|
What is the difference between "$variable" and "variable" - JavaScript - jQuery
I have initialized 2 variables, `var1` and `$var2` under `$(document).ready(function()` in jQuery. What is the main difference (or the possible differences) between these 2 variables?
var1 = "var1";
$var2 = "var2";
$('#click1').click(function() {
alert(var1);
});
$('#click2').click(function() {
alert($var2);
});
**Here** is the working fiddle.
|
There is no difference. Javascript allows the `$` character in identifiers, such as variable and function names, just as it allows letters, digits, and certain other punctuation characters to be used. It has no special meaning.
jQuery sets the global `$` variable to an object with a number of special behaviors, so variables beginning with `$` are often reserved for variables or values related to jQuery. This is not enforced at any level, though. You're free to use `$` in variable names wherever and however you like.
|
stackexchange-stackoverflow
|
{
"answer_score": 18,
"question_score": 8,
"tags": "javascript, jquery"
}
|
Script to dynamically change desktop background
I have a requirement to generate a visualisation (think pie chart) and set it as the desktop wallpaper on a Windows 7 corporate network.
I'm a web/mac guy, so I am guessing at the following implementation (assume I know nothing).
1. Write a script and get the network admins to distribute it to everyones "Startup" folder.
2. The script will download an image from: ` where `USERNAME` is their domain username and `PSK` is a custom variable in their AD profile.
3. The downloaded image is then set as their desktop.
For those whom don't login/out regularly can is there a scheduler that I can use?
The PSK isn't a deal breaker as although the visualisation is custom for everyone, it doesn't need to be secure.
So my question. Is this possible? If so, what languages/technology do I need to use?
Many thanks, Si
|
The closest thing I could find was "Windows 7 RSS Themes". <
You cannot send the username/psk unless you prepare a different theme for each user. This is possible in my situation.
We've decided to proceed with a TideSDK minimal app to do the same thing.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "windows 7"
}
|
Where I define wrapper function and functional interface for exception handling on stream
While using streams, I learned how to handle exceptions using functional interfaces and wrapper functions.
If so, what is the best way to structure the package?
Is it defined together in the class where stream is used? Or should I create a separate common class and define the wrapper function in it?
Thanks!
|
I think it depends. If you have one instance of using this technique, then it probably makes sense to simply use an functional interface and a wrap function that are part of the class which utilizes it. If you are using this same pattern in several places (and they all have the same function interface signature) then you can define the functional interface at the package level and put the wrap function in a utility class.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "java, stream"
}
|
Joomla! 2.5 use login data from another database
I have a hard question. I'd like the joomla login does not use its own database for users/password but I want to use my database users with my table fields, my passwords etc..
I don't know from where start, I thought I could edit database request for login to my db or create a little script to automatically add the users on joomla database.
I tried to see components/com_users/views/login/tmpl/default_login.php but it seems that there is nothing.
Can someone help me figure out what to change?
Maybe the simple thing is import my database users into database user joomla, is there any plugin or something else that you know?
p.s. I use Clarion theme build on Gantry framework, Joomla! 2.5.6 Stable, PHP 5.2.17
|
I would suggest that you find or create an authentication plugin that does this for you. Joomla can support multiple authentication systems.
Have a look at creating an Authentication Plugin for Joomla 1.5. The basic idea is described there.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "database, authentication, joomla"
}
|
Чем std::unique_lock отличается от std::lock_guard?
Чем std::unique_lock отличается от std::lock_guard? В каких ситуациях лучше применять один класс, а в каких другой?
|
`lock_guard` и `unique_lock` \- почти то же самое. Разница в том, что вы можете заблокировать и разблокировать `std :: unique_lock`. `std :: lock_guard` будет заблокирован только один раз при построении и разблокирован при уничтожении.
* lock_guard: когда объект создан, он пытается получить мьютекс
(вызывая `lock()`), а когда объект уничтожен, он автоматически
освобождает мьютекс (вызывая `unlock()`).
* unique_lock: также поддерживает отложенную блокировку, временную блокировку, рекурсивную блокировку и использование условных переменных.
Источник
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 8,
"question_score": 12,
"tags": "c++, синхронизация, c++14"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.