INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Get certain parts from xml response?
I have some PHP code that calls, then receives a response from an API (using `file_get_contents()`), the API responses with a XML format like so:
<?xml version="1.0"?>
<root><status>success</status>
<duration>5 seconds</duration>
<average>13692.4</average></root>
so for example in PHP how would i take this XML response and get (for lets say) the value of `<average>`? Any help would be greatly appreciated :)
|
There are several ways to parse XML, one of which is the XMLReader. A simple example to retrieve the value of `average` from the XML you posted would be something like this:
<?php
// Read the XML output from the API
$xml = file_get_contents('
$reader = new XMLReader();
$reader->open('data://text/xml,' . $xml);
// Read the XML
while ($reader->read()) {
// Look for the "average" node
if ($reader->name == 'average') {
$value = $reader->readString();
if (!empty($value)) {
// This will output 13692.4
var_dump($value);
}
}
}
$reader->close();
A live example can be seen here: <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php, xml"
}
|
How not to process files which were already processed before? (they will not be zipped or renamed)
I have read-only access to the folder containing lot of logs with names starting with SystemOut*:
_SystemOut_15.03.12_1215124.log_
_SystemOut_15.03.12_23624.log_
_SystemOut_15.03.02_845645.log_
_SystemOut_15.03.14_745665.log_
_SystemOut_15.03.16_456457.log_
_SystemOut_15.03.07_474574.log_
The logs are not zipped or renamed.
What I need to implement is to parse them in such a way that the logs already processed will not be processed again. Also, the mandatory condition is not to process the log with the latest modification date&time.
I would potentially think I need to create a separate file on a location I have write access with the log names my script has already processed?
Grateful if you could provide some suggestions and how to implement them. Thanks
|
I agree keeping track of the logs you have already processed in a separate file is a good idea. It's not clear from your question how you will identify the current log, so I leave that in your court.
Try something like this:
mysavedfiles=/some/path/file.txt
curfile=$(ls -tr | tail -n 1)
for fn in logfiles/*.log
do
if ! grep -q $fn $mysavedfiles && [ "$fn" != "$curfile" ]
then
... process it ...
echo $fn >>$mysavedfiles
fi
done
You could also exclude the last file by changing to a `while read` loop fed by some processing:
ls -tr logfile/*.log | head -n -1 | while read fn
do
....
done
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "linux, bash, file"
}
|
How do I set a block of text to drop to a new line all at once?
I feel like there's a simple solution to this, but I'm not really sure how to phrase it in a search, so here we go...
I have a forum-like display that shows a block of text with a user image, user name, and time stamp appended to the end of the text. Many times, part of the appended section gets dropped to a new line. This is especially annoying when the time stamp (which usually displays "8:25 PM, Mar 4") comes out as something like "8:25" {new line} "PM, Mar 4".
Is there either a tag or a css-trick that would drop an entire section of text to a new line all at once if any part of that section needs to drop?
|
You can give that element a style: `white-space: nowrap;`
If you always want it to drop, then `display: block;` as well.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "javascript, html, css"
}
|
More than one 'And' operator in ASP if statment?
Sorry I am new to ASP. I found a strange problem in the If statement
For example , I use this condition
if sear_type="4" and rs_search_news("search_field")="2" and show_str2<>1 then
....
Endif
And it is not work as expected . Is ASP not allow writing condition like this? Thanks
|
It should work just fine, probably something else is wrong.
Try this for start, and if still not working please explain exactly what's wrong.
If (sear_type="4") And (rs_search_news("search_field")="2") And (show_str2<>1) Then
'....
End If
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "if statement, asp classic, conditional statements"
}
|
git aliases causing "Permission denied" error
The following commands
$ git co -b newbranch
$ git co oldbranch
result in "fatal: cannot exec 'git-co': Permission denied" error.
In the same time,
$ git checkout -b newbranch
$ git checkout oldbranch
and
$ sudo git co -b newbranch
$ sudo git co oldbranch
work as expected. Ownership rights for the .git folder are set for the user owning the home folder and 0755/0644 are the mode for .git folder/subfolder/files.
Aliases are defined in `.gitconfig` of the home folder:
[alias]
co = checkout
There is no difference in `git config -l` output for root or unprivileged user.
What am I missing?
Gentoo 3.0.6 / git 1.7.3.4
|
The issue is resolved, see <
Before git runs the aliases it checks the `$PATH`. In case the directory does not exist, or lacks permissions, git produces the `"fatal: cannot exec 'git-co': Permission denied"`.
Good people from the git mailing list also reminded me of a tool, that `strace` can help finding the entry that is returning EACCES, as in: `strace -f -e execve git foobar`
The credit goes to Jeff King from the git mailing list. :)
|
stackexchange-superuser
|
{
"answer_score": 1,
"question_score": 0,
"tags": "git, gentoo"
}
|
How to pop() a mapping of array in solidity 0.8?
The pop() functions works correctly for normal arrays and mappings.
Based on: How to delete an element at a certain index in an array?
When I try to pop() an array of a mapping not work.
Any alternative to remove the gaps?
pragma solidity ^0.8.0;
// SPDX-License-Identifier:
contract test {
mapping (address => uint[]) MyMap;
constructor(){
MyMap[msg.sender].push(0);
MyMap[msg.sender].push(1);
MyMap[msg.sender].push(2);
MyMap[msg.sender].push(3);
}
//Set last into [2] //1
MyMap[msg.sender][2] = MyMap[msg.sender][MyMap[msg.sender].length - 1];
//Delete last array position
MyMap[msg.sender].pop(); //This line is the problem...
}
|
Answer by **leonardoalt** in Solidity github:
_" Popping an array of mappings is not allowed because you don't know which keys are dirty or not, so the deleting of the mapping does not actually happen. If you have an array of mappings, write to it, delete the array, and read the mapping again, the information is still there. Please see
Source: <
|
stackexchange-ethereum
|
{
"answer_score": 0,
"question_score": 0,
"tags": "solidity"
}
|
How to add day variable in solidity smart-contract?
I want to use days counter in my smart-contract's code.
Is there any built-in constants or good practices to do that? I tried to play with `now` and its comparison with timestamp numbers, but it seems pretty unobvious for me.
|
You can use **time suffixes** after any integer.
In your case, you can use `1 days` which will be converted to an equivalent in **seconds**.
Take care about calendar calculations however, because in fact not every day has exactly the same amount of seconds because of _leap seconds_.
You can finf official Solidity documentation about it here:
<
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "solidity"
}
|
0/0 in limit evaluation
When evaluating limits we often come across the form 0/0 and we cant get a limiting value. As stated in many textbooks and online resources, the method to still get a limiting value as the input approaches a specific value is to first factorize or simplify the function to cancel out the factors/variables responsible for the form 0/0.
My question is doesn't it change the function altogether if we simplify it?
Because if we had used the original function it would not have been defined at that particular input? Can anyone provide the intuition or concept behind this?
|
The main thing is:
> Taking the limit does not mean evaluating the expression at the point, but rather infinitely close to that point (i.e. approaching the point).
Simplifying an expression does change the behaviour at the point (for example getting a value where it previously was indeterminate because of division by 0 or something else), but it does not change the behaviour close to the point, i.e. as you approach the point, which is what matters for the _limit_.
|
stackexchange-math
|
{
"answer_score": 8,
"question_score": 3,
"tags": "calculus, limits, functions"
}
|
After open new form from the main form how to stay in this form after error
I have application and from the main form i open new form:
Form2 frm2= new Form2(file);
frm2.ShowDialog();
And read parameter from user input:
TextBox tbInsert;
private void btnPlay_Click(object sender, EventArgs e)
{
try
{
IPAddress ip = IPAddress.Parse(tbInsert.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
return;
}
}
My problem is that if not legal `IP Address` specified, after the `MessageBox error` `Form2` close and return to the `Main Form` instead of stay in `Form2`
|
You probably made the "btnPlay" button the Form.AcceptButton of your form so that it behaves like an OK buton, pressing the Enter key closes the dialog. Or you set the button's DialogResult property. Either way, the dialog automatically closes, the DialogResult property is automatically set.
So you'll have to reset it again to keep the dialog open:
try
{
// etc...
}
catch (Exception ex)
{
this.DialogResult = DialogResult.None;
MessageBox.Show(ex.Message, "Error");
}
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "c#, winforms"
}
|
Changing Java Date one hour back
I have a Java date object:
Date currentDate = new Date();
This will give the current date and time. Example:
Thu Jan 12 10:17:47 GMT 2012
Instead, I want to get the date, changing it to one hour back so it should give me:
Thu Jan 12 09:17:47 GMT 2012
What would be the best way to do it?
|
**java.util.Calendar**
Calendar cal = Calendar.getInstance();
// remove next line if you're always using the current time.
cal.setTime(currentDate);
cal.add(Calendar.HOUR, -1);
Date oneHourBack = cal.getTime();
**java.util.Date**
new Date(System.currentTimeMillis() - 3600 * 1000);
**org.joda.time.LocalDateTime**
new LocalDateTime().minusHours(1)
**Java 8: java.time.LocalDateTime**
LocalDateTime.now().minusHours(1)
**Java 8 java.time.Instant**
// always in UTC if not timezone set
Instant.now().minus(1, ChronoUnit.HOURS));
// with timezone, Europe/Berlin for example
Instant.now()
.atZone(ZoneId.of("Europe/Berlin"))
.minusHours(1));
|
stackexchange-stackoverflow
|
{
"answer_score": 304,
"question_score": 161,
"tags": "java, date"
}
|
How to name dataframes in a for-loop?
I am attempting to name multiple dataframes using a variable in a for loop. Here is what I tried:
for name in DF['names'].unique():
df_name = name + '_df'
df_name = DF.loc[DF['names'] == str(name)
If one of the names in the DF['names'] column is 'George', the below command should work to print out the beginning of of of the dataframes that was generated.
George_df.head()
But I get an error message:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Previous questions discuss ways to do this in a dictionary, but I am looking for a way to implement this for a dataframe.
|
**SetUp**
df=pd.DataFrame({'names' : ['a','a','b','b'], 'values':list('1234')})
print(df)
names values
0 a 1
1 a 2
2 b 3
3 b 4
* * *
Using `globals` and `DataFrame.groupby`
for name, group in df.groupby('names'):
globals()[f'df_{name}'] = group
print(df_a)
names values
0 a 1
1 a 2
print(df_b)
names values
2 b 3
3 b 4
* * *
Although using `globals` is not recommended, I suggest you use a dictionary
dfs = dict(df.groupby('names').__iter__())
print(dfs['a'])
names values
0 a 1
1 a 2
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "python, python 3.x, pandas"
}
|
Is it bad to throw an exception and ignore "reaches end of non-void function" warnings?
My code:
QSerialPortInfo getCentralInfo()
{
const QList<QSerialPortInfo> infoList =
QSerialPortInfo::availablePorts();
for (auto it = infoList.cbegin();
it != infoList.cend(); ++it) {
if (it->manufacturer() == "1a86") {
happyTalk("Znaleziono centralkę.");
return *it;
}
}
escape("Nie znaleziono centralki.");
}
void escape(QString errorMsg) {
qDebug() << "[!] " << errorMsg;
throw;
}
void happyTalk(QString msg) {
qDebug() << "[\u2713] " << msg;
}
Is it elegant to stop the application like that and why is it not? I'm getting debugger warnings but I think the debugger is wrong here. ;-)
|
Add the `[[noreturn]]` attribute to `escape`, and actually throw an object.
`[[noreturn]]` tells the compiler, optimizer and hopefully warning generator that `escape` never returns, so it should (in an ideal world) block that error.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "c++"
}
|
Given $ax^2+by^2+cxy > 0$, what can I deduce about $a$, $b$, and $c$?
I know that for any nonzero $x,y\in\mathbf{R}$,
$$ax^2+by^2+cxy > 0,$$
where $a,b,c\in\mathbf{R}$. What can I deduce about $a$, $b$, and $c$?
* * *
For example, letting $x=1$ and $y=0$, I know that $\boxed{a>0}$. Letting $x=0$ and $y=1$, I know that $\boxed{b>0}$. Letting $x=y=1$, I know that $\boxed{c>-(a+b)}$.
What else can I deduce about $a$, $b$, and $c$? How will I know when it's time to stop looking? (Is that last question even answerable?)
|
You can write $$ax^2+by^2+cxy=a\left(x+\frac{c}{2a}\,y\right)^2+\left(b-\frac{c^2}{4a}\right)y^2$$ by completing the square. This is a sum of two squares. In order to ensure that it's always positive, the coefficients both have to be positive, so $$a>0$$ and $$c^2<4ab.$$
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 3,
"tags": "algebra precalculus"
}
|
Does right clicking always select the text below the cursor on a mac?
I am pretty new to mac, I am on a desktop mac with a Logitech mouse.
Every time I right click on some text - it selects the word under the cursor.
!right click on mouse
Is this normal? If it is - is there any way to avoid this. For example - I need to copy the link address in a browser, but when I right click - it selects the text and gives me a different context menu which doesn't have the copy link URL option.
|
So I am using the Firefox.
When I right click on link in a browser it shows this menu
!enter image description here
When I click on text (not link) in browser or any other document it shows the same menu as yours.
When I click on the web address in the address bar it shows the menu with Copy, that I use to cop the link.
|
stackexchange-apple
|
{
"answer_score": 1,
"question_score": 1,
"tags": "macos, mouse, contextual menu"
}
|
Solve the limit using polar coordinates
I am given the limit :
$$ \lim_{(x,y)\to (0,0)}\left[ \ x^2 + y^2 \ln(x^2+y^2)\right] $$
to solve using polar coordinates first I would convert the equation to polar coordinates : $$ \lim_{(x,y)\to (0,0)} \left[\sin^2(\theta) + \cos^2(\theta) \ln(\sin^2(\theta) + \cos^2(\theta)) \right]$$
can I apply substitution to get:
$$ \ln(1) = 0$$
|
Important facts:
1. $$x=r\cos\theta$$
2. $$y=r\sin\theta$$
3. $$\begin{align}x^2+y^2&=r^2\cos^2\theta+r^2\sin^2\theta\\\&=r^2(\cos^2\theta+\sin^2\theta)\\\&=r^2\end{align}$$
This means you can substitute $r^2$ in for $x^2+y^2$, $r\cos\theta$ for $x$, $r\sin\theta$ for $y$, and $\lim_{r\to 0}$ in for $\lim_{(x,y)\to(0,0)}$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "limits, multivariable calculus, polar coordinates"
}
|
where can I download source code for asp.net mvc 5.2.2 version (alone)
If I go to < it shows the very latest.
Neither I could get from here: <
If I need source code for any asp.net mvc version, where do I find it (especially for downloading/debugging).
|
Here you can easily download
git clone <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -2,
"tags": "asp.net mvc"
}
|
Model to choose with Cross Validation or not?
I made different tests on an imbalanced dataset and got these results:
* Model 1 = train test validation split + Cross Validation(cv=10) --> f1'micro' 0,95
* Model 2 = train test split + smote method for imbalanced data. No Cross Validation -->f1'micro' 0,97
* model 3 = train test validation + smote method --> f1'micro' 0,97
* model 4 = train test + smote --> f1'micro' 0,98.
I used f1 micro as metric. Can I compare these models with f1 micro or should I take another one like f1 macro? or just the accuracy_score?
|
Selecting the correct scoring metric depends on the business problem you are trying to solve. I would research the differences between f1 micro and macro and determine which scoring metric ultimately tracks performance of your task in a more seemly manner. For example: do you just want to maximize f1 score across all samples? Or do you care about the individual f1's of each class? Answering this will help you determine macro vs micro.
As for the core of your question it's difficult to say without a code sample. In a few cases you are using SMOTE - how are you using it? Are you up-sampling before or after you split your data and use cross validation? Up-sampling before CV/splitting your data can lead to data leakage and will artificially inflate your scoring metrics.
My advice:
1. Pick a single appropriate scoring metric
2. Ensure you are using SMOTE in a way that doesn't cause data leakage
3. Perform experiments & pick the model that maximizes your scoring metric
|
stackexchange-datascience
|
{
"answer_score": 1,
"question_score": -1,
"tags": "python, cross validation, metric, smote, f1score"
}
|
How to get text I inputted into textView
-(void)textViewDidChange:(UITextView *)textView{
self.textView.text=textView.text;
self.statusString=textView.text;
}
In this method ,it returns self.statusString nil or empty description(when initialized statusString it happens), and `self.textView.text` is nil too.
How to get the text I inputted into textView?
|
Give the different name to the connected textView .
IBOutlet UITextView *objTextVIew ;
**In ViewDidLoad**
objTextVIew.delegate = self
-(void)textViewDidChange:(UITextView *)textView{
self.objTextVIew.text=textView.text; // also see that have you got textView's text
self.statusString=textView.text;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ios, uitextview"
}
|
Laravel {!! Form::open() !!} doesn't work within AngularJS
I'm using `Laravel 5.0 + AngularJS` to build some website. The problem is when I use laravel illuminate, things like
{!! Form::open() !!}
{!! Form::close() !!}
are not compiled into forms, instead, the plain texts are displayed.
I guess it's because I'm also using angular, which already have certain use of ' **`{}`** ';
when I use **`{!! Form::open() !!}`** in another page with no angular it works normally.
How can I use laravel form inside angular app? (need the features like csrf token)
|
You will either need to change the blade syntax for laravel or change it for AngularJS. I tend to lean on changing it for Lavavel.
Blade::setContentTags('<%', '%>'); // for variables and all things Blade
Blade::setEscapedContentTags('<%%', '%%>'); // for escaped data
Add that into a common file, such as `routes.php`.
Update your references from `{!!` to `<%` and `!!}` to `%>`.
Edit:
If you would instead like to do this on the AngularJS side, you can with adding this into your `app.js` file (credits: scotch.io).
var sampleApp = angular.module('sampleApp', [], function($interpolateProvider) {
$interpolateProvider.startSymbol('<%');
$interpolateProvider.endSymbol('%>');
});
Replace the module name with your project's app module name.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "javascript, angularjs, forms, laravel"
}
|
is there an OR expression in regex for clojure?
I have a string with two possible out comes it will either be divided by `&|` or just `|` is there a way of doing an or expression to determine which of these is true in regex?
|
I take it you mean that you wish to match strings with either `&|` or `|` and then, in the case of a match, check which case it was that matched?
If so, you can do by matching with a regex in which `&` is optional -- as suggested by HamZa in a comment on the question -- and using `re-find` or capture groups to capture the matching part of the string which you can then examine:
(re-find #"&?\|" "asdf|adsf")
;= "|"
(re-find #"&?\|" "asdf&|asdf")
;= "&|"
With capture groups (use `peek` to get at a vector's final element):
(re-matches #".*^&.*" "asdf&|asdf")
;= ["asdf&|asdf" "&|"]
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "regex, clojure"
}
|
Is possible to build a custom control without an ASP.NET Server Control project?
I have a web application in Visual Studio 2008, and I have found an article explaining how to extend GridView creating an inherited class.
If I create that class inside the same project, is possible to use my new grid? How?
If it isn't possible, why?
|
Yes, this is possible. Depending on which version of Visual Studio you're using, your new control may or may not immediately show up in the Toolbox. Worst case is you have to add it manually.
Once it's in the toolbox, you just use it like any other control. Drag it from the toolbox to the form, set the properties and event handlers, etc.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": ".net, asp.net, controls"
}
|
Does IE9 support input type="file" multiple="multiple"?
Already checked the Internet but I wasn't able to find it out :-(
|
According to Wikipedia (see "Form elements and attributes"), no.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "html"
}
|
Deploying SQLite DB to iPad app (via iTunes?)
I'm solving an iPad app architecture for a client and I've come to these conclusions:
* I will develop a simple, **locally run** CMS where the client can edit content
* The client can from this CMS export the content to a SQLite DB file
* I will develop an iPad application that reads and presents this SQLite DB
* The client must be able to update the SQLite database file
* The iPad application must not be dependent on an internet connection
My question is really, can my client copy this DB file from his/her laptop (Mac if needed) via iTunes, so that the iPad application gets an updated SQLite database?
I'll probably use Monotouch for development, but that shouldn't make a difference. This is strictly an iPad app, but I've included iPhone as a tag since they consociate in many aspects.
|
If you enable the `UIFileSharingEnabled` property in the apps `Info.plist` then the Documents folder becomes available when you connect the iPad to iTunes. You can copy files to/from the device this way.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "iphone, xcode, ipad, sqlite, itunes"
}
|
Interpolating and plotting a surface for a sparse set of 3d data points
I have a set of $(x,y,z)$ coordinates which sparsely cover a surface, e.g.:
data = {{51, 15, 0.1}, {300, 11, 0.99}, {140, 22, 0.123}, {54, 12, 0.66}, ...};
What is a good general method, in _Mathematica_ 9, of interpolating and plotting a surface for this sparse data set? `Graphics3D[BSplineSurface[data]]` doesn't seem to get the job done; the output is a planar rectangle.
|
You can use the option `InterpolationOrder` to control the degree of smoothing.
SeedRandom[42]; data = RandomReal[10, {20, 3}];
Column[
ListPlot3D[data,
ImageSize -> Medium,
Mesh -> None,
InterpolationOrder -> #] & /@ Range[0, 2]]
!enter image description here
|
stackexchange-mathematica
|
{
"answer_score": 1,
"question_score": 2,
"tags": "graphics, graphics3d, interpolation"
}
|
Google Developers: You have exceeded the maximum number of projects that you can create
I have ten Android apps that support Push Notification with OneSignal.
I always followed this manual: OneSignal manual: Generate Google Server API Key.
I always created a new project as in the manual described.
Now I wanted an eleventh app to be able to get Push Notifications. But when following the manual I'm getting:
> You have exceeded the maximum number of projects that you can create. Try deleting a few projects in the Google Developers Console.
at Add Project in Google Developer Console.
What can I do? Won't I able to make more apps be able to receive Push Notifications?
I hope anybody can help me because it's a time-sensitive project.
|
You can re-use the same project number and server key across multiple android apps without any issues. This is the best way to support notifications for more than 10 apps.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "android, push notification, google cloud messaging, onesignal, google developers console"
}
|
Coefficient of power series when $p(x) = \sum b_nx^n$ converges for $|x| \le 1$ and $p(x) = 0$ for $|x| \lt \delta$.
Suppose that the power series $p(x) = \sum b_nx^n$ converges for $|x| \le 1$. Suppose that for some $\delta \gt 0 , p(x) = 0$ for $|x| \lt \delta$. Show that $b_n = 0$ for all $n \ge 1$.
|
For $|x|<1$ $p(x)$ is analytic. But also $p(x)=0$ for $|x|<\delta $. But then $p(x)$ must vanish for all $|x|<1$. Hence $b_{n}=0$.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 0,
"tags": "power series"
}
|
Groovy geb.waiting class is not found
I am using eclipse oxygen 4.7. I have added geb.core-1.1.1.jar, geb-spock-0.10.0.jar, and spock-core-1.1-groovy-2.4.jar to the path. I am getting the following error.
> geb.waiting.Wait cannot be resolved. It is indirectly referenced from required .class files
When I import
> geb.waiting
I see waiting as a package but when I add it I get,
> Groovy:unable to resolve class geb.waiting
I have changed the geb-core library to 1.1 and 1.0 but I still have the same problem. Please what could be causing this?
|
Try to use geb-0.93.0 jar. I had the same Problem and I found the class in that package
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "java, eclipse, groovy, jar"
}
|
How do I access specific values in my xml?
Let's assume I have simple XML, such as:
<people>
<person id="52">
<name>John</name>
</person>
<person id="53">
<name>Sally</name>
</person>
</people>
I use `$xml=simplexml_load_file('filename')` to load the file.
How do I reference the name of person with id 53, without iterating through looking for the person?
|
Use `xpath()` to search for the matching element.
$person = $xml->xpath("/people/person[@id='53']")[0];
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, xml"
}
|
Version history of Sharepoint files in Visual Studio
I've integrated Sharepoint 2010 in our TFS 2010 - and access the documents via the "Team Explorer" in Visual Studio 2010. I can open and edit all documents (docx e.g.). But I couldn't access the version history of each item, as I can do it for source code items in the TFS source control. To do this, I've to open the Sharepoint website, navigate to the document and read the history there.
Are there any options or plugins to get the version history of sharepoint items directly in the Visual Studio?
Thanks, Konrad
|
Unfortunately there is not an option for this without opening the document library in Sharepoint directly. This is a good idea and you should list it on the UserVoice website for Visual Studio. I think it would make a great Power Tool. <
This is a related request where uses would like to be able to link to a specific version from a TFS Workitem. <
Mike
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "visual studio 2010, sharepoint, version control, sharepoint 2010"
}
|
Python and pubsubhubbub
I wrote a quick http server script to first acknowledge a subscription and receive updates. I was able to verify the subscription and start receiving updates. With this method I'm able to print the updated feed items to the console but google's subscriber diagnostics says the receipt failed.
Shouldn't this be enough?: (this is inside a handler class subclassed with BaseHTTPServer.BaseHTTPRequestHandler)
def do_POST(self):
self.send_response(202)
self.end_headers()
stuff = self.rfile.read()
print stuff
Thanks.
|
So it seems with status code 204 it's fine. I guess because I have no body in the response? Anyway, working fine now.
I'd be greatful to get a comment if someone knows why I needed that particular status code. The spec just says 2xx.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "python, websub"
}
|
How can I determine the start non-terminal of a CFG?
Suppose I have a grammar such that there exist $n$ production rules which contain only terminal symbols, and none of these rules produce the same terminal ( _disjoint_ ).
> $A ::= x|y|z$
>
> $B ::= a|b|c$
>
> ...
>
> $N ::= l|m|k$
Further suppose that I cannot simply merge these production rules together as they are used in different parts of the grammar.
How can I hence determine or rather choose, the start non-terminal $S$, for purposes of $LL(1)$ parsing?
Thanks
|
By definition a grammar is a tuple $(N,T,P,S)$ where $N$ is the set of non-terminals, $T$ is the set of terminals, $P$ is the set of productions, and $S \in N$ is the start symbol.
Therefore if you have a grammar you already have $S$ (and if you don't know $S$ then you don't have a grammar).
|
stackexchange-cs
|
{
"answer_score": 3,
"question_score": 0,
"tags": "context free, formal grammars, compilers, parsers"
}
|
Does Rally's Fetch API support recursive fetching?
I am trying to build a tree view of our UserStory hierarchy in an excel document. Right now, I am recursively going through Jason objects attempting to get the children for each user story, and continuing until the child count is 0.
But, I am getting nowhere after getting the initial children. For each one of those children, some should have children as well.
**Is there some way Rally allows this?**
|
The WSAPI used to support this but it was terribly inefficient for deeply nested hierarchies. It is limited to one level currently. You'll have to recursively look up the children at each level of the hierarchy.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "rally"
}
|
How can I enable the Box (or Block) Selection in Eclipse IDE?
I have been using `Visual Studio IDE` and I use `Box Selection` a lot.
Is the same possible for `Eclipse IDE`?
|
Since Eclipse 3.5 there is a button called `Block selection mode` in the main toolbar or you could use its hotkey as well:
* Windows: `Alt`+`Shift`+`A`
* Mac: `Command`+`Option`+`A`
See a blog entry about block selection for more details.
|
stackexchange-stackoverflow
|
{
"answer_score": 17,
"question_score": 13,
"tags": "visual studio, eclipse, ide, comparison"
}
|
What happens if the test set is too small in machine learning?
I'm reading an article in machine learning and healthcare. This author has a total of 1500 patients, but used only 36 patients for test. He did use 5-fold cross validation for classification using KNN and SVM. I think the test set is too low. Or is it okay to have such low test set - only 2.5%?
|
Generally speaking, the more data you use to train your model, the better the predictive power - the more data you hold-out to later test your model, the better the performance estimation.
Since you have tagged "classification" in healthcare, let's just assume a binary outcome ("sick" and "not sick"). A test set containing only 2 sick/34 not sick patients will not be a good estimation.
Patients in the test set need to be representative of all possible patients (feature space). If the author has only used very few features to build his model, maybe the test set is already large enough.
The cross-validation part does not change the fact that the test set might be too small. Data used for validation (to find a good value for k in k-NN) can be regarded as training set and not testing.
|
stackexchange-stats
|
{
"answer_score": 9,
"question_score": 4,
"tags": "machine learning, classification, cross validation"
}
|
motherboard selection for VMware ESX or Xen
any motherboards using compatile NIC chipsets for VMware ESXi4.1 or Xen 3.4?
all major manufacturers ASUS, MSI, Gigabyte seem to be using either Realtek or VIA based chips for NIC which so not have drivers support....
I am considering SOHO borads based on AMD800 series or Intel P55, X58 series
only Intel chipsets have broad support e1000* drivers (825*)
please suggest.....thanks in advance
|
I think this is probably the safest way to go before buying anything:
VMWare Hardware Compatibility List
I got so annoyed with being forced to use certain types of hardware for VMWare I opted for KVM (KVM needs CPU extensions to run) and OpenVZ (it's very fast and needs no specific hardware but doesn't like MS "VMs").
|
stackexchange-serverfault
|
{
"answer_score": 2,
"question_score": 0,
"tags": "linux, networking, hardware, vmware esxi"
}
|
Is there a polyfill for window.DOMParser() for Node
I am trying to recreate the xml to json converted based on DOMParser. Is there a way to make it work for NodeJS
|
The exact polyfill for Domparser in node is xmldom package at <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "javascript, node.js, domparser"
}
|
Should I check for cookie existence right after setting it?
Using good development practices, should one check for the existence of the `setcookie` after setting it, or is it known to be set 100%? Thank you.
<?php
require "includes/settings.php";
require "functions/php_function_library.php";
$item_id = $_REQUEST['item_id'];
$item_qty = $_REQUEST['quantity'];
echo $item_id;
echo $item_qty;
$cookie_guid = guid();
setcookie("anonymous_cart", $cookie_guid);
#check that the cookie I just set exists?
#insert new cart record into DB
...
?>
|
Just check the return value, if false it failed. Otherwise you can consider it set (I've never seen it not get set in that case).
if(setcookie('anonymous_cart', $cookie_guid)){
// Joy, cookie was set
}
However if the cookie being set is of critical importance, then checking it can't hurt (much).
**EDIT**
For those pointing out that this does not guarantee the cookie was _accepted_ , I agree and did not say that it does (how could it? The client hasn't even received the cookie yet). It simply means that the cookie was **set**. Which is what op asked.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "php, cookies"
}
|
rename columns based on specific rule pandas
Initial df is:
df =
a a a a
1 2 3 4
5 6 7 8
9 1 2 3
* * *
Desired output:
df =
b_1 c_1 b_2 c_2
1 2 3 4
5 6 7 8
9 1 2 3
I can do in a long way, like choose odd then even columns, rename them and concat. But looking for a quick solution
|
Try this:
df =pd.DataFrame({'a':[],'b':[],'c':[],'d':[],'e':[],'f':[],'g':[],'h':[]})
df.columns = ['b_'+str(i//2 +1) if i%2==0 else 'c_'+str((i//2 +1)) for i in range(df.shape[1]) ]
print(df.columns)
output:
Index(['b_1', 'c_1', 'b_2', 'c_2', 'b_3', 'c_3', 'b_4', 'c_4'], dtype='object')
[Finished in 2.6s]
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "python, pandas"
}
|
responding with index.html in express and react
I have an express app where inside it has a create-react-app. when the user goes to root url I want to show the index.html present in create-react-app public folder. Here is my code for index.js in express app
const express = require("express");
const app = express();
app.get('/',function(req,res){
});
const PORT = process.env.PORT || 5000;
app.listen(PORT);
Here is my project directory
` you can do something like this:
const router = express.Router();
router.get('/', (req, res) => {
res.sendfile(path.join(__dirname, './client/public', 'index.html'));
});
app.use('/', router);
I'm using the path because depending how you start your app it might break with just the relative path.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 4,
"tags": "javascript, reactjs, express, create react app"
}
|
How to initial and update specified submodules
I have just clone one repository. In it, there are 4 submodules. I only want to update two of them. How to do that? The normal way
git submodule init
git submodule update
will fetch all the submodules is not what I want.
|
Add the name of the submodule like this:
git submodule update --init submoduleName
Another option is to get into the submodule folder and pull the code from there.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "git, git submodules"
}
|
How to pull data from IBM TM1
I have established a connection between Python and IBM TM1 OLAP tool using the TM1py package for Python. Now when I try to fetch data from an MDX view of TM1 in Python, all I get is the column headers. I read the documentation of TM1py and it looks like the get_native_view function are supposed to just return an instance of the view and not the actual data contained in the view.
from TM1py.Services import TM1Service
with TM1Service(address='hostname', port=12523,user='username', password=****, ssl=False) as tm1:
query = tm1.cubes.views.get_native_view('cube_name', 'View_name', private=True)
print(query)
Does anyone know a way to pull the actual data and not just column headers from TM1 in Python?
|
The get_native_view function returns the defition of a cube view.
To pull cube data from IBM TM1 into Python with TM1py you can use the get_view_content function (Option 1) or do an MDX Query (Option 2).
Option 1:
from TM1py.Services import TM1Service
with TM1Service(address='localhost', port=12354, user='admin', password='apple', ssl=True) as tm1:
content = tm1.cubes.cells.get_view_content(cube_name='Plan_BudgetPlan', view_name='Default', private=False)
print(content)
Option 2:
from TM1py.Services import TM1Service
with TM1Service(address='localhost', port=12354, user='admin', password='apple', ssl=True) as tm1:
mdx = "SELECT " \
"NON EMPTY {TM1SUBSETALL( [}Clients] )} on ROWS, " \
"NON EMPTY {TM1SUBSETALL( [}Groups] )} ON COLUMNS " \
"FROM [}ClientGroups]"
content = tm1.cubes.cells.execute_mdx(mdx)
print(content)
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "python, cognos tm1"
}
|
Vmware View & PCoIP Host Card
Does anyone know what the performance will be with or without a host card on a laptop running a vmware view client to a server which is 50-100m away on LAN Gigabit. The specs say that it can handle 60fps @ 1080p but is this true with a soft client like vmware view? I would like to use it for CAD/CAM software on a remote server via laptop but have no idea what the performance will be like.
|
PCoIP at that bitrate will handle CAD/CAM fine - your issue will be the virtual GPU's ability to render the display in the first place.
|
stackexchange-serverfault
|
{
"answer_score": 0,
"question_score": 1,
"tags": "windows, remote access, vmware view, pcoip"
}
|
I need xml tag that work like not ifconfig (!ifconfig)
<reference name="top.links">
<action method="addLink" translate="label title" module="support">
<label>Support</label>
<url ifconfig="support_options/support_data/support_pop" ><![CDATA[javascript:div_show();]]></url>
<title>Support</title>
<prepare/><urlParams/>
<position>100</position>
</action>
<action method="addLink" ifconfig="support_options/support_setting/support_set" translate="label title" module="support">
<label>Support</label>
<url>support</url>
<title>Support</title>
<prepare/><urlParams/>
<position>100</position>
</action>
</reference>
I want to pass 2 url at one link and put validation on it
|
As far as I know there is no such thing.
But the check for ifconfig is in `app/code/core/Mage/Core/Model/Layout.php` -> `function _generateAction`:
if (isset($node['ifconfig']) && ($configPath = (string)$node['ifconfig'])) {
if (!Mage::getStoreConfigFlag($configPath)) {
return $this;
}
}
so eventually you can add something like this below the previous code:
if (isset($node['ifnotconfig']) && ($configPath = (string)$node['ifnotconfig'])) {
if (Mage::getStoreConfigFlag($configPath)) {
return $this;
}
}
and to check with:
<action ifnotconfig="..."
|
stackexchange-magento
|
{
"answer_score": 2,
"question_score": 2,
"tags": "magento 1.7, layout, xml, system.xml, confirmation"
}
|
Entity Framework 6.1.2 Many to Many
I am having trouble with entity framework 6.1.2. I'm sure this will have been covered before but I cant find it anywhere. On building the database entity framework wont create the relationships for the two list items I have because I have them declared as single entities above.
Is there any work around for this?
public class SomeClass
{
public TeamMember LeadPartner { get; set; }
public Team Team { get; set; }
public List<TeamMember> OtherTeamMembers { get; set; }
public List<Team> OtherTeams { get; set; }
}
Sorry if this has been asked before I really couldn't find anything on it.
|
Most likely there is ambiguity in the other classes. For instance if you have a `List<SomeClass>` defined in `Team`, EF can't be sure whether this property is to partner with `public Team Team` (which would create a one-many relationship) or `public List<Team> OtherTeams` (creating a many-many relationship). Either is valid.
To resolve the ambiguity, add an `[InverseProperty("OtherTeams")]` annotation to the `List<SomeClass>` in the other classes.
Also, best practice is to expose the property as an `ICollection<T>` rather than a `List<T>`, creating a `new List<T>` or whatever in the constructor. This allows you to vary implementation later, for instance use a `HashSet<T>` instead.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "c#, asp.net mvc, entity framework"
}
|
Equal integrals using Fubini
I tried to prove that $$\iint_{\Bbb{R^2}} f\left(x^3+x,{\frac{y}{3x^2+1}}\right) \, d(x,y) = \iint_{\Bbb{R^2}} f(x,y) \, d(x,y)$$ for $f$ Lipschitz/integrable function.
I know it can be proven with Fubini's theorem and $$\int_{\Bbb{R}} \int_{\Bbb{R}} f\left(x^3+x,{\frac{y}{3x^2+1}}\right) \, dx\,dy, \qquad \left[t=x^3+x, dt= 3x^2+1 \vphantom{\frac 1 1} \right]_\text{change-of-variables} $$ but don't sure how to continue from here.
Thanks ahead.
|
Using the substitution $(x,y) \mapsto \left(t=x^3 + x, u=\frac{y}{3x^2+1}\right)$ we get that the Jacobian of the transformation is given by $$ J= \begin{pmatrix} 3x^2+1 & 0 \\\ -\frac{y(6x+1)}{(3x^2+1)^2} & \frac{1}{3x^2+1} \end{pmatrix}, $$ whose determinant is just $1$. Then, (using Fubini's theorem at the beginning and at the end) we have \begin{align} \iint_{\Bbb{R^2}} f\left(x^3+x,{\frac{y}{3x^2+1}}\right) \, d(x,y) & = \int_{\Bbb{R}} f\left(x^3+x,{\frac{y}{3x^2+1}}\right) \, dx\,dy = \\\ & =\int_{\mathbb R} \int_{\mathbb R} f(t, u) |\det J| \,dt\,du = \\\ & = \iint_{\mathbb R^2} f(t, u) \,d(t,u). \end{align}
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 3,
"tags": "calculus, integration, multivariable calculus"
}
|
Is "fPrince" a real word?
I saw this on the NYT web site today (4/9/2021):
` on it to return its associated data.
However, I want to be able to load this data into a file-like object so I can read and write from it as if I was reading this attachment from my desktop.
How can I do this without actually saving the attachment on my drive?
|
cStringIO was made specifically for this purpose.
You can use `StringIO` if you need multiple encoding schemes,but cStringIO is MUCH faster.
Example usage:
import cStringIO
test = cStringIO.StringIO()
test.write("test")
test.getvalue()
>>> "test"
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "python"
}
|
Stacking Rails query with limit
I am trying to get a total of 25 associations from the database. I would like 15 to be with a count equal to 1 and the rest to have a count greater than 1 (so ten greater than 10). I have tried the following:
def self.get_specific_array
a = Association.limit(25) # I would like a total of 25 associations
a.where(["count = ?", 1]).limit(15) # I would like 15 of the associations to have a count of 1
a.where(["count > ?", 1]) # I would like the remaining 10 associations to have a count that is greater then 1
a
end
|
You can add the result arrays of queries:
a.where("count = 1").limit(15) + a.where("count > 1").limit(10)
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "mysql, ruby, ruby on rails 3, scope"
}
|
kotlinx.serialization : How to parse to different varaiable name than the exact name of JSON key
With GSON we used `@SerializedName` to parse JSON object which didn't have the same key to that of the variable name in Kotlin.
data class User (
@SerializedName("id")
long userId;
@SerializedName("fullName")
String name;
)
In `kotlinx.serialization` we can serialize an object like this but how to give different JSON key to a varaible during **(de)serialization**?
@Serializable
data class User (
long userId;
String name;
)
|
Use `@SerialName` like we used `@SerializedName` in GSON
## GSON
data class User (
@SerializedName("id")
long userId;
@SerializedName("fullName")
String name;
)
## kotlinx.serialization
@Serializable
data class User (
@SerialName("id")
long userId;
@SerialName("fullName")
String name;
)
|
stackexchange-stackoverflow
|
{
"answer_score": 41,
"question_score": 19,
"tags": "android, json, kotlin, gson, kotlinx.serialization"
}
|
Is there a easiest way to migrate Selenium 1.0 code to WebDriver?
I am having old test automation framework developed using Selenium 1.0 and now wants to migrate my code to WebDriver.
Is there any easiest method to do this migration?
I have overridden most of the methods such as type, click, getText, getSelectedLabel, assert etc etc. I see the only method is to re-write all methods again from scratch, I have already started this process but If I continue with the same method It will take many days for me.
Please suggest if anyone has any better approach.
Thanks in advance.
|
They are completely different technologies. There is no way to migrate them over to selenium 2 per se.
Luckily, the recent Selenium releases have implemented what's called "WebDriver Backed Selenium" so technically if you are using those tests, it's implicitly running them "as" WebDriver tests.
Other than that, no, there is no easy way.
I had the same issue - we are migrating our entire regression suite over to S2 now `:)`
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "java, selenium, webdriver, migrate, testautomationfx"
}
|
Max bending moment estimate
Context: I study aerodynamics and want to design and build an RC wing to put the theory I learned into practice. The essence of the theory I learned is: Given some mass of wing building material, how do we build the most efficient wing? To actually do this in practice and apply the theory, I need an estimate of the strength of my wing building material (more specifically the spar).
Question: I do not know structural mechanics but I need an estimate of the max bending moment a rod can withstand. Is there any convenient "bending strength coefficient" which I can look up for the rod material, then plug into some relatively simple equation to find the max bending moment of a given rod? If not what would be the easiest way to get this estimation without fully diving into structural mechanics.
|
The formula for bending stress of
1. Circular rod, $\sigma = \pm \dfrac{32M}{\pi d^3}$, $d$ is rod diameter.
2. Rectangular rod, $\sigma = \pm \dfrac{6M}{bh^2}$, $b$ is width, $h$ is height.
The resulting stress shall be checked against the allowable stress of the material. Once the limiting stress is known, you can plug it into the respective equation and obtain the maximum allowable bending for the rod.
|
stackexchange-engineering
|
{
"answer_score": 0,
"question_score": 0,
"tags": "structural engineering, structural analysis, beam, moments, bending"
}
|
How to run sql scripts during sbt build
I'm building my scala application with sbt. How can I run .sql script file during the build?
It is possible to run scripts with ant like this
<target name = "createTables">
<sql
classpathref="classpath"
driver="${database_driver_class_name}"
url="${database_url}"
userid="${user}"
password="${password}"
src="createTables.sql"/>
Can I do the same with sbt?
|
You can do it with an sbt plugin such as FlyWay (<
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "database, scala, sbt"
}
|
How to get nsdate with millisecond accuracy?
I need to get time in millisecond accuracy. How can I get it from `NSDate`. Currently when I `NSLog` time, it is showing only upto seconds.
|
You'll need to use the below method to convert sec. into millisecond:
([NSDate timeIntervalSinceReferenceDate] * 1000)
|
stackexchange-stackoverflow
|
{
"answer_score": 29,
"question_score": 23,
"tags": "ios, nsdate"
}
|
Save the optimization results from PyGMO by using pickle or dill
I generated a population using PyGMO. A population is a class which contains the individual results of the computation. I can iterate through the population and save the current function values and the parameter values. Unfortunately I cannot dump the whole class e.g. using pickle or dill. If I try:
with open('pop', 'wb') as f:
dill.dump(pop,f)
I do get:
RuntimeError: unregistered class - derived class not registered or exported
It would be great to serialize the whole object because I might be able to use it for a warm start.
Any Ideas ?
|
As a matter of fact, I had the same issue some days ago. Instead of saving the whole population, save the whole class (island or archipelago). I did use cPickle and pickle, and they both work fine.
The trick to declare the class of your problem before dumping or loading the object. You can see more here.
Regards!
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "python, pickle, dill"
}
|
Angularjs For Error
I have a for loop in AngularJs. My code is:
var data = $scope.dtInstance.DataTable.rows( { selected: true } ).data();
for (var i=0; i<= data.length; i++){
console.log(data[i].Id);
}
In console I see the output but I also get the error
> Error: data[i] is undefined
I do something wrong? Is another way to write for loop in AngularJs? Thank you
|
Change the for loop to:
for (var i=0; i< data.length; i++) {
Array indexes start at 0 up to array's length - 1. So if you use <= you will go passed the last index, thus having an `undefined`.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 0,
"tags": "javascript, angularjs"
}
|
How to remove curly braces from HTTP response in JavaScript when rendering on the page?
When I render a HTTP response on the page using JavaScript, it is displaying the message like so:
`{"Result":"SUCCESS"}` with curly braces.
How can I render a response message on the page without having the curly braces?
This is what I have done:
function processRequest(e) {
if (xhr.readyState == 4 && xhr.status == 200) {
var response = JSON.parse(xhr.responseText);
$("#content").text((JSON.stringify(response)));
}
|
You only need to parse json the response text and after that just use like this to get the content
$("#content").text(response.Result);
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "javascript, json, rest, http"
}
|
Output multiple instances of heredoc with for loop
I am trying to get a heredoc to echo multiple times with different id's but it seems to be overwriting the existing one and replacing it with a new instance. Maybe this is not possible to do, I would like to use this method to dynamically generate several different div's with the same class but different id's that are pulled from a MySQL DB my code is below.
<?php
$next = 10;
$i=0;
for($i=0; $i<10; $i++){
$str = <<<EOD
<div class="brandon" id="$next">
<h1>Hello World!</h1>
<p>I am a paragraph inside the brandon class div!</p>
</div>
EOD;
$next++;
}
?>
|
Do `$str .= <<<EOD ....The rest...`
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "php"
}
|
Proof that the sequence $n - n²\sin\frac{1}{n}$ converges
Have been trying to proof that the sequence is not Cauchy, but I didn't get anywhere. It seems the sequence is convergent, but I can't seem to find a solution.
|
**Hint:)**
Let $n=\dfrac1y$ and compute $\lim_{y\to0}\dfrac{y-\sin y}{y^2}$.
|
stackexchange-math
|
{
"answer_score": 7,
"question_score": 5,
"tags": "sequences and series, convergence divergence"
}
|
chemmacros 4.6: \iupac word-wrap in titles broken?
chemmacros 4.6 started complaining about `\iupac{ben\|zene}` being deprecated for using `\|` instead of `|` as a breaking point. So the following input
\documentclass[fontsize=12pt,paper=a4]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{chemmacros}
\begin{document}
\section{\iupac{ben|zene}}
\iupac{ben|zene}
\section{\iupac{ben\|zene}}
\iupac{ben\|zene}
\end{document}
leaves me with the vertical bar left in the section title for the first example: !enter image description here
So the old style continues to work while the new method of declaring the breaking point works only outside of titles and captions (not shown in this example). Compiling with pdflatex using MiKTeX 2.9 including the latest available updates.
|
This is fixed in v4.7 2015/02/08. Now the MWE
\documentclass[fontsize=12pt,paper=a4]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{chemmacros}[2015/02/08]
\begin{document}
\section{\iupac{ben|zene}}
\iupac{ben|zene}
\section{\iupac{ben\|zene}}
\iupac{ben\|zene}
\end{document}
gives the expected output:
!enter image description here
The new version will be available soon on CTAN and in TeX Live and MiKTeX a few days later.
|
stackexchange-tex
|
{
"answer_score": 2,
"question_score": 2,
"tags": "chemmacros"
}
|
How to add ordinal suffixes to date script
I have been trying to workout a script to add ordinal suffixes to my date script (seen below), but all attempts to write one or search on here for one has alas failed. Any insight to help fix the script would be greatly appreciated.
<
var months = ["Month1", "Month2", "Month3", "Month4", "Month5", "Month5", "Month7", "Month8", "Month9", "Month10", "Month11", "Month12"];
var n = new Date();
var y = n.getFullYear().toString().substr(2,2);;
var m = n.getMonth();
var d = n.getDate();
document.getElementById("date").innerHTML = "The " + d + " of " + months[m] + ", 52" + y;
|
Might help
function nth(d) {
if(d>3 && d<21) return 'th';
switch (d % 10) {
case 1: return "st";
case 2: return "nd";
case 3: return "rd";
default: return "th";
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "php, ordinal"
}
|
Atajo de teclado para un script ejecutable en ubuntu
Tengo una ejecutable alojado en mi escritorio, y me crear gustaría un atajo de excritorio para abrirlo, pero no sé como hacerlo? sí estuviera en el directorio donde se encuentra el ejecutable podría escribir dentro de la terminal `./file` pero quiero crear un atajo de escrito como el que existe en la terminal (Alt + ctrl + t) para abrirlo sin recurrir a la terminal, estoy usando ubuntu 16.04
|
Aquí tienes como crear un atajo personalizado:
<
Lo único que tienes que hacer es colocar el fichero ejecutable (acuérdate de darle permisos de ejecución) en tu directorio `home`.
De esta manera para el atajo el comando que tienes que poner es `~/.file` donde `~` hace referencia a tu home.
Si tienes problemas ponlo en los comentarios y lo miramos.
Un saludo
|
stackexchange-es_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ubuntu, bash"
}
|
why sometime my application crash on goBack() webView?
why my application crash when i call goBack() method on my WebView? I post my code
public void workork(final View v){
//my code
switch (v.getId()) {
case R.id.chiudi_webview: {
}
case R.id.back: {
myWebView.goBack();
break;
}
case R.id.forward: {
myWebView.goForward();
break;
}
}
}
|
I think you should check if you can go back (the same for goforward()):
if (myWebView.canGoBack()) {
myWebView.goBack();
}
if (myWebView.canGoForward()) {
myWebView.goForward();
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "android, android webview"
}
|
Linear combination of coordinates of random unit vector
Let $v\in \mathbb{R}^n$ be uniformly distributed on the unit sphere. Let $\lambda_1,...,\lambda_n$ be given real numbers. What is the distribution of $$X=\sum_{i=1}^n\lambda_iv_i^2\;?$$ Does it happen to belong to any known family of distributions? I think this is a very flexible way to model the distribution with compact support. When $n=2$, $X$ is just the celebrated arcsine distribution supported on $(\lambda_{\min},\lambda_{\max})$. What about for general $n$? I also think $X$ can capture the ''spreadness'' of the sequence $\lambda_1,..,\lambda_n$.
|
The distribution of $X$ is the distribution of the ratio $$\frac{\sum_{i=1}^n\lambda_iZ_i^2}{\sum_{i=1}^nZ_i^2} $$ of two quadratic forms in iid standard normal random variables $Z_1,\dots,Z_n$ (because the distribution of $(v_1,\dots,v_n)$ is the same as that of $(Z_1,\dots,Z_n)\big/\sqrt{\sum_{i=1}^nZ_i^2}$). The distribution of such ratios was studied by Gurland; also see e.g. Watson.
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 3,
"question_score": 4,
"tags": "pr.probability, st.statistics, probability distributions"
}
|
How to disable the "compile error expected end of statement" from showing in vba
Frequently when entering code I will type half of a line, for example the opening part of an if statement, but rather than type the second half I will want to copy and paste, both for convenience and to minimize the chance of a typing error. However if I move the focus away from a half completed statement I get the very annoying "compile error, expected end of statement" pop up which I must acknowledge. This is becoming very tedious when it comes up so often.
**Is there any way to tell excel not to show this error message?**
|
Annoying isn't it? Click `Tools` -> `Options` -> `Editor` Tab and uncheck _Auto syntax check_
|
stackexchange-stackoverflow
|
{
"answer_score": 9,
"question_score": 8,
"tags": "excel, vba"
}
|
casting data type in function arguments?
Does anyone know why it fails?
<?php
function data((string)$data)
{
echo $data;
}
data(123);
Here is the error:
> Parse error: syntax error, unexpected T_STRING_CAST, expecting '&' or T_VARIABLE in x.php on line 3
|
What your are trying to do is called: **Type Hinting**.
That is allowing a function or class method to dictate the type of argument it recieves.
Static type hinting was only introduced in PHP7 so using a version greater than that you can achieve whay you want with the following:
<?php
function myFunction(string $string){
echo $string;
}
Now any non string argument passed to myFunction will throw an error.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 3,
"tags": "php"
}
|
When to add fresh basil to homemade pizza
I've made pizza from scratch (dough and sauce) a few times, turns out great. I want to try fresh basil on it. Current recipe: Oven, 425° F: blind bake crust 10 minutes, add tomato sauce & fresh mozzarella, cook another 10 minutes. When would be a good time to add fresh basil? With the cheese? 5 minutes later? After it is done?
|
I cast fresh basil leaves immediately after removing the pizza from the oven. I have found that cooking them with the pizza tends to reduce some (a lot) of the basil scent and flavour.
For dried basil, I can't say as I don't use it.
|
stackexchange-cooking
|
{
"answer_score": 31,
"question_score": 18,
"tags": "pizza, basil"
}
|
PHP preg_match regex for matching a previous group in the pattern?
I saw this question in Stackoverflow but the answers didn't help. Actually i need to reference to previous group in my regex pattern.
$s = "1:1";
$p = "/([0-9]):\1/";
echo preg_match($p, $s); // False
OR
$p = "/([0-9]):$1/";
echo preg_match($p, $s); // False
|
Escape backslash
<?php
$s = "1:1";
$p = "/([0-9]):\\1/";
echo preg_match($p, $s);
// Output: 1
(all is written in comments, but anyway)
Strings in double quotes are interpreted by php. In this case \1 turns into octal 1. To make slash you need escaped it by itself `\\`.
Or you can use uninterpreted string in single quotes `'/([0-9]):\1/'`
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 2,
"tags": "php, regex, preg match"
}
|
How can I create my own BaseEntity using PanacheEntityBase?
I am using Panache ORM (with Postgresql) and I would like to add a column to every entity I have.
I have this:
@Entity
public class MyTable extends PanacheEntityBase {
// My columns
}
I would like this:
@Entity
public class MyBaseEntity extends PanacheEntityBase {
public String someId;
}
@Entity
public class MyTable extends MyBaseEntity {
// My columns
}
Now this does not work since Panache is now looking for the "base_entity" Table, which does not exist.
Can this be achieved ?
|
As `MyBaseEntity` has not table you have to replace `@Entity` with `@MappedSuperclass`
@MappedSupperclass
public class MyBaseEntity extends PanacheEntityBase {
public String someId;
}
`MappedSuperclass` tells JPA to use the attributes of this class in the subclasses.
Please also checkout the docs: <
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "jpa, quarkus panache"
}
|
Using nested functions in XSLT (function inside function)
I have the following two functions in XSLT 1.0
* ShortenDetail
* RemoveHTML
I am trying to first clean "Detail" column using RemoveHTML function and then I want to shorten it using ShortenDetail function.
This is how I am doing it but it is not working and giving error.
<xsl:call-template name="ShortenDetail">
<xsl:call-template name="RemoveHtml">
<xsl:with-param name="String" select="@Detail"/>
</xsl:call-template>
</xsl:call-template>
How do I use nested functions in XSLT?
|
It depends how `ShortenDetail` template is implemented.
For templates:
<!-- Fake ShortenDetail -->
<xsl:template name="ShortenDetail">
<xsl:param name="String" />
<xsl:value-of select="$String"/>
</xsl:template>
<!-- Fake RemoveHtml -->
<xsl:template name="RemoveHtml">
<xsl:param name="String" />
<xsl:value-of select="$String"/>
</xsl:template>
this is the correct way to chain/pipe templates:
<xsl:call-template name="ShortenDetail">
<xsl:with-param name="String">
<xsl:call-template name="RemoveHtml">
<xsl:with-param name="String" select="@Detail"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
|
stackexchange-sharepoint
|
{
"answer_score": 1,
"question_score": 1,
"tags": "sharepoint enterprise, sharepoint designer, xslt"
}
|
Order IP addresses in SQLITE3
I would like to ask you how to order IP in ascendant way in SQLITE. I tried store them like TEXT and INTEGER, but it doesn't work.
My query is:
(SELECT * FROM tbl_device ORDER BY ip ASC")
My output is:
192.168.1.1
192.168.1.10
192.168.1.11
192.168.1.111
192.168.1.12
192.168.1.120
Is there way to ORDER them like below:
192.168.1.1
192.168.1.10
192.168.1.11
192.168.1.12
192.168.1.111
192.168.1.120
Thank you very much in advance.
|
The easiest way to do this would be to store the IP addresses in a format that is sortable, i.e., as four numbers, or as a single 32-bit number. If you don't want to format the addresses every time they are displayed, use a separate column.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sqlite"
}
|
jQuery click eventhandler issues
I've build a site that has accordion sections that expand whenever someone clicks on the header section for that page, the click handler is placed on
$('.section h2').click
However, when a user is logged in as admin, there are 'EDIT' links applied to the header, so I only want the section to expand if the area clicked is not "a.edit-link".
I've tried things like `$('.section h2:not(a.edit-link)').click`... or `$('.section h2').not('a.edit-link').click`, but niether of these options are working for me..
Am I missing out on something obvious?
|
You can do it using `event.stopPropagation()`, like this:
$('.section h2').click(function() {
//do stuff
});
$('.section h2 a.edit-link').click(function(e) {
e.stopPropagation();
});
When a click on an `a.edit-link` happens, that click just won't bubble up to the `<h2>` parent, and its `click` handler won't fire.
Alternatively you could check the event target inside your handler, like this:
$('.section h2').click(function(e) {
if($(e.target).hasClass('edit-link')) return; //bomb out
//do stuff
});
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "jquery"
}
|
Request system information on a web page
I need to get system information (OS system name, logged on user name etc.) about the machine where web browser is running. Is it possible using JavaScript or Flash? Silverligth, Java?
|
I find out that you can get OS name by using Capabilities class. You need to add import:
import flash.system.Capabilities;
And than you can get OS name by such code:
var osName:String = Capabilities.os;
I think with flash you won't be able to get much more information about computer due to security restrictions and because flash runs in virtual machine. You can find a bit more info here.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, flash, browser, operating system"
}
|
preg_match_all problems
i use preg_match_all and need to grab all a href="" tags in my code, but i not relly understand how to its work.
i have this reg. exp. ( /(<([\w]+)[^>] _>)(._?)(</\2>)/ ) its take all html codes, i need only all a href tags.
i hobe i can get help :)
|
I'm not a fan of parsing HTML with RegExp, but anyway:
$input_string = file_get_contents(
"
);
preg_match_all(
'@\\<a\\b[^\\>]+\\bhref\\s*=\\s*"([^"]*)"[^\\>]*\\>@i',
$input_string,
$matches
);
var_dump( $matches ); // inspect for useful information
It expects that all hrefs are enclosed inside `"`. Won't work otherwise.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php, regex, preg match"
}
|
PHPmailer's AddEmbeddedImage method not working
I'm trying to test the PHPmailer class to embed image ( inside an e-mail
I'm using this code (along with standard one, that 100% works, mail is delivered):
`$mail->AddEmbeddedImage($src, 'test', basename($src));`
and this is placed the e-mail body:
`<img src="cid:test">`
Image is not showing up. What may I doing wrong?
|
Taken from some piece of the documentation:
> $path is the path of the filename. It can be a relative one (from your script, not the PHPMailer class) or a full path to the file you want to attach.
Have you tried using a local image?
|
stackexchange-stackoverflow
|
{
"answer_score": 9,
"question_score": 5,
"tags": "php"
}
|
How can I pipe output to another process, but retain the error state of the first process?
> **Possible Duplicate:**
> Get exit code of process that's piped to another
I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a perl script that simplifies them into something human-readable:
g++ -c source.cpp -o source.o 2>&1 | perl /bin/gSTLFilt.pl
Unfortunately, this approach "masks" the error value returned by the `g++` command. make has no idea that the `g++` command has failed, because all it gets back is the error result from the `perl` command.
Is there a way to pipe the output, and still retain the original error condition?
In case it makes a difference: I am using GNU Make 3.81 and g++ (GCC) 3.4.5 (mingw-vista special r3) in an MSYS console running GNU bash, version 2.04.0(1)-release (i686-pc-msys) on Windows XP.
|
I am not sure what shell `sh.exe` provides (since there are multiple shells that use that name for their Windows executables), but if it is `bash` or similar, you can use the `$PIPESTATUS` array. For your example, you would do:
g++ -c source.cpp -o source.o 2>&1 | perl /bin/gSTLFilt.pl
echo "${PIPESTATUS[0]}"
|
stackexchange-unix
|
{
"answer_score": 13,
"question_score": 12,
"tags": "command line, io redirection, pipe, error handling"
}
|
You tube API for getting videos from a our account in Objective C
In my iphone app i want retrieve videos list from my account in youtube, Is there any API to get this can any one help me out
Thank You
|
to get videos by user
<
the api is documented here,
<
you would make REST API requests from you iphone app
similar question with additional information
How to integrate YouTube API into my iPhone app?
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "iphone, youtube api"
}
|
AuthLogic sessions only work on localhost:3000
I'm running pow locally along with localhost:3000 (for debugging purposes). For some time I was able to create user sessions fine with authLogic on <
At some point however, I discovered that I was only able to login using < The login also doesn't work on Heroku.
I've tried messing with Rails.application.config.session_store :domain, setting it to 'app.dev'. No luck.
Any thoughts?
|
Just figured this out. I had http_basic_auth turned on and AuthLogic wasn't happy. Simply turning it off solved the problem.
Figures.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ruby on rails, ruby on rails 3"
}
|
Sharing 80Gb of data between ec2 instances
Morning,
I have an Amazon ec2 linux instance, with a separate EBS drive, 500Gb in size of which there is 80Gb of data. I want to share this data with a couple of other ec2 instances that I will be creating shortly, and just wondering what is the best way to do this.
Should I just rsync the data between them, or is there a way to mout the same EBS on two different instances at the same time?
I could also take a snapshot of the drive, and then when I provision the other instances I could specify to use that snapshot?
Which is the preferred way? The data is not going to change, it just needs read access.
|
Snapshots are definitely the way to go here.
If the data's truly unchanging, I'd also shrink the EBS volumes you're creating from the snapshots to fit the data rather than wasting (and paying for!) half a terabyte.
|
stackexchange-serverfault
|
{
"answer_score": 1,
"question_score": 0,
"tags": "amazon ec2, amazon ebs"
}
|
About this tag for C#2.0 takes me to the C tag; URL not encoding #
I hovered over the `C#2.0` tag to a question and clicked `About this tag` in the menu that appears. This took me to the `C` tag "Tagged Questions" list rather than anything about `C#2.0`. Same thing happens for any `C#` tag.
Note, the URL it navigates to is < Looks like it isn't encoding the `#`.
Google Chrome 7.0.503.0 dev.
|
This appears to be fixed now?
(Because Waffles fixed it :) )
|
stackexchange-meta
|
{
"answer_score": 2,
"question_score": 9,
"tags": "bug, status completed, stack overflow, tags"
}
|
Spring hibernate handling big html form
I am using Spring + Hibernate, and I will have a HTML from that has like 100+ fields and I must store all these values to database in a **single** table.
They are all used in one big massive calculation.
How should I handle this, I thought about creating an Entity with 100 fields and setters, getters, but is there a nicer solution for it?
EDIT:
Everytime when someone submits form, a new row will be added, so eventually there will be tens of thousands of rows.
|
I believe its not about an HTML but about the data modeling. Think about your data, who are the consumers of it, how and in which business flows you're going to query the data. In general an entity with 100 fields is not a good idea because it should be mapped to one single table with 100 columns. Its just not maintainable.
Maybe all the data should be normalized and you can store pieces of it in different tables in db with foreign keys?
Hope this helps or at least will give you some direction to think about
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "spring, hibernate, persistence, forms"
}
|
My html link only opens with open in new tab?
My code has been working fine before but since I added the onlick part, i can no longer access it on left click. I have to open it in new tab.
<a onclick="event.preventDefault(); window.parent.postMessage('link_url:'+this.href,'*');" href="?redirect=Pro" class="btn btn-accept display-5" target="_blank">I AGREE</a>
I cant remove that part since I need it otherwise my other redirect links from another php file wouldnt work. If i remove it, I cant redirect properly. Kindly asking for advice on how to fix this so I can open with left click or at least automatically open in new tab on left click. Thanks in advance.
|
Remove the event.preventDefault Function from your HTML line. Because, This will prevent your events.
<a onclick="window.parent.postMessage('link_url:'+this.href,'*');" href="?redirect=Pro" class="btn btn-accept display-5" target="_blank">I AGREE</a>
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "html, hyperlink"
}
|
Javascript focus remove text highlight
I have an input (text field) in update panel, and it autopostbacks after each change of text. I can keep focus on the same text field, but i can't get rid of text higlight which appears after calling document.getElementById('myTextField').focus(). This solution seemed to be the most accurate:
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else if (document.selection) {
document.selection.empty();
}
But it has one problem. Input remains focused, but i can't write text. I have to click on it before writing.
|
You can do it if you reset your value after focus, i.e.
**HTML**
<input id="myTextField" type="text" value="SomeValue" />
**JS**
var myInput=document.getElementById('myTextField');
var myInput_value=myInput.value;
myInput.focus();
myInput.value=myInput_value;
**Working Example.**
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "javascript, asp.net, focus, highlight"
}
|
Oracle Wallet Integration in SSIS Oracle Provider OLEDB Connector
I've successfully configured oracle wallet in my machine in windows 7. I also checked by executing the below command
sqlplus /@myoracleDB
and it gets connected to the DB successfully.
I'm trying to execute the SSIS package(DTSX) version 2012 in my machine. In the Data Flow task, I'm using Oracle Provider for OLEDB Connector. I wanted to connect the myoracleDB Database through oracle wallet in the OLEDB connector. I used the below configuration,
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;
But the Connection is failing with invalid username/password.
Please advise how to resolve this problem.
|
When I was using "externally identified" logins setup on the Oracle server (basically windows trusted authentication), I used
* `/` as login
* blank password
Inside my SSIS packages and it worked.
I don't know if this is the same as Oracle wallet - I don't think so, but try it.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "sql server, oracle, ssis, oledb, ssis 2012"
}
|
capture_haml in helper not displaying parameter values
I'm trying to use a helper in my rails view to draw some haml lines, the fact is that it is writing the html tags, but no content in them.
Here's my helper:
def detail_line(model, column, value)
capture_haml do
haml_tag :div, class: 'control-group' do
haml_tag :label, {class: 'control-label'},"#{model.class.human_attribute_name column}"
haml_tag :div, class: 'controls' do
haml_tag :div, {class: 'value'}, "#{value}"
end
end
end
end
And here's the way I'm using it:
= detail_line(@order, 'number', @order.number)
The output is the following:
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<div class="value"></div>
</div>
</div>
What am I missing or doing wrong? Thank you very much in advance!
|
def detail_line(model, column, value)
capture_haml do
haml_tag :div, class: 'control-group' do
haml_tag :label,"#{model.class.human_attribute_name column}", {class: 'control-label'}
haml_tag :div, class: 'controls' do
haml_tag :div, "#{value}", {class: 'value'}
end
end
end
end
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "ruby on rails, haml, helper"
}
|
Itemize: Identation is different between first and second line
I have this problem where it seems that itemize starts with a blank space, whereas the next line starts without it. Is there a way to have both the first and second line aligned? I am using LyX.
 hasn't been released yet, though. If you need a fix now, you can use the following temporary workaround suggested by samcarter in <
\documentclass{beamer}
\usepackage[bibstyle=authoryear]{biblatex}
\setlength \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\begin{document}
\begin{frame}{Test}
\begin{itemize}
\item Test Test Test asdjakhsdahsdk aklsdjklajsd akljsakljd
tehlasdklhasd asdhkadha asdhasdha asdhashdasd
\end{itemize}
\end{frame}
\end{document}
|
stackexchange-tex
|
{
"answer_score": 5,
"question_score": 4,
"tags": "beamer, biblatex, itemize"
}
|
JQuery debugging: how do I inspect the attached functions?
JQuery is a very powerful tool but it's hard to debug.
Have a look to the following image: !enter image description here
How can I easily find the piece of *.js file which contains the JQuery code which has been attached to this part of HTML code?
I think it's almost impossible since it could be attached through any of the CSS styles, id or other methods too.
**Looking to the attached event seem to not work correctly for JQuery attached events.**
How do you debug JQuery?
|
Not sure if this is what you want but when you inspect element, on right side panel there is an event listener tab. If that's not what you want, then other options is Monitor events
!enter image description here
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "jquery"
}
|
Непонятки с функцией connect и accept
Ребят, у меня тут назрело два вопроса:
* * *
1. Функция `connect` (`int connect(int sockfd, struct sockaddr *serv_addr, int addrlen);`) принимает во второй аргумент адрес сервера, тогда зачем мне указывать какое семейство адресов у сокета этого сервера в приложении клиенте (`addr.sin_family=AF_INET;`)? Почему нельзя просто айпишник и порт указать?
* * *
2. В строке `socket2=accept(socket1,(struct sockaddr*)&client,(socklen_t*)&len_client);` во втором аргументе указана структура, в которую записывается адрес сокета клиента. Вопрос, откуда он берет этот адрес? Я же не передаю его никак в функцию `connect`.
|
> зачем мне указывать какое семейство адресов у сокета этого сервера(addr.sin_family=AF_INET;)? Почему нельзя просто айпишник и порт указать?
Потому, что один и тот же порт, зачастую, может работать как с UDP, так и с TCP. Например:
25 порт - SMTP: UDP/TCP Может принимать пакеты на UDP порт и соединения на TCP порт.
> откуда он берет этот адрес?
Согласно "RFC 791 — Протокол IP" в заголовке **любого** пакета IP должны присутствовать как адрес получателя (т.е. алрес Вашего сервера) так и адрес **отправителя** \- клиента, пытающегося работать с Вашим сервером.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "c, сеть"
}
|
Get Integer from number-string
How can I convert words to numbers in JavaScript?
As an example is there a javascript/jQuery library/plugin that will take a string "one hundred and two" and return the int 102.
var myInt = stringToInt("one hundred and two");
console.log(myInt);
=> 102
I specifically require a string-to-number conversion and not number-to-string conversion. Suggested solutions have come up short:
jsfiddle.net/joepegler/g0vwy44n
|
While it should not be very difficult to do it yourself as an exercise, here's a script that does that
<
EDIT : I misread your question, you wanted the opposite. Well, check this answer instead then <
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "javascript, jquery"
}
|
WIndows XP: is it possible to schedule tasks just before shutdown
I need to do series of tasks like take backups just before my PC shutsdown. I am not permitted to use any downloaded tool for doing this. So my idea is to use batch files to do these repeat tasks.
My question:
is it possible to schedule tasks in windows XP just before shutdown? I donot find any option in the scheudle tasks dialog though.
|
If you have XP Pro, you there is a place in the local group policy editor (gpedit.msc) to add batchfiles to be run on shutdown.
|
stackexchange-superuser
|
{
"answer_score": 0,
"question_score": 1,
"tags": "windows, windows xp, scheduled tasks"
}
|
Using System.Globalization.CultureInfo from VBScript
I can't figure out how to use the .NET class: `System.Globalization.CultureInfo`.
According to the documentation, it has `ComVisibleAttribute = True`, which I thought meant I could use it from VBScript. However, when I try to use it like:
Set ci = CreateObject("System.Globalization.CultureInfo")
I get:
Microsoft VBScript runtime error: ActiveX component can't create object: 'System.Globalization.CultureInfo'
Perhaps I am misunderstanding something, and this class simply cannot be used from VBScript?
|
I don't think this is possible... `CultureInfo` has no parameterless constructor, and `CreateObject` doesn't allow you to specify constructor arguments
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 3,
"tags": ".net, com, vbscript, activex, cultureinfo"
}
|
Cordova android build doesn't fire deavice ready
I have ionic cordova project for iOS and Android,
I have an issue with Android build, the app doesn't fire device ready and I see the warning that it didn't fire after 5 seconds, and it never fires.
`Ionic Native: deviceready did not fire within 5000ms`
However, if I run the project to the emulator or connected device it works just fine! the issue only appears with the build and only on android.
I have tried removing the plugin and installing them again, same for the platform, I tried removing plugins and build, non changed that!
* Angular 8
* Android 10
* Ionic 5
I have no idea what else I should try, no errors!
|
After going step by step recreation I was able to find the cause in config.xml, it was this line:
`<preference name="Scheme" value="custom" />`
For more details about it <
Hope that helps other, I wasted days on this issue :(
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "android, cordova, ionic framework"
}
|
Integration of combination of Bessel Function and Exponential Function
I have read "Watson:Treatise Theory of Bessel Function", "Table of Integration, Series and Product", "Handbook of Mathematical Functions, Formulas, Graphs and Mathematical Tables" and other online literature. But I unable to solve a integration of combination of Bessel and Exponential function. The function is $$ \int_{-\frac{1}{2}}^{\frac{1}{2}}e^{-\iota \omega t} I_{0}\left [ b\sqrt{1-t^{2}} \right ]dt\ $$
I am using Walform Mathematica 9.1 for Mathematical analysis. Please Suggest me particular solution, Method or formulas to integrate this combined function. Also suggest any other Software for this type of integration.
|
This function is derived by Slepian and Pollak in 1961 and this is also know by Prolate-spheroidal wave function. For more detail read these articles
Prolate spheroidal wave functions, Fourier analysis, and uncertainty-I
Prolate spheroidal wave functions, Fourier analysis, and uncertainty-II
In 1964 J.F. kaiser introduce this function with simple approximate to family of window function nearly ideal properties
Everybody thanks for suggestions
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 6,
"tags": "integration, ordinary differential equations, definite integrals, fourier analysis, indefinite integrals"
}
|
Looking for advice setting up a new Mac Mini with Lion Server
I am setting up a new Mac Mini server which will serve as a web server (with Apache and MySQL) as well as some other pieces of functionality. I have seen little on securing OS X for such a scenario (I am running Lion - and this is not Lion Sever).
I assume it is recommended to use ipfw as opposed to the application firewall. I also assume that it makes sense to lock down SSH (put it on a non-standard port and use certificate authentication). However, should I also lock down screen sharing (and force an SSH tunnel for this)? Any tips on this are welcome.
|
Although written for 10.5, this guide by Daniel Cuthbert (PDF) is fairly comprehensive and largely still applies to Lion.
Closing off screen sharing and tunneling it (if you need it at all) through SSH is probably a good idea.
Standard rules apply:
* Only open absolutely necessary ports to the outside world
* Keep your software up to date
* Disable any unused services & Apache modules
* Disable any listeners you don't need, rebind those you do need to localhost only if they're not needed outside (`lsof -i` is your friend)
* Check that your firewall is really working as expected (`nmap` from an outside host)
Mac specific things:
* Make sure the console is password protected, locks if you're using screensharing and doesn't auto-login on startup
* You may want to enable verbose boot messages by default, it'll make debugging easier in case things go bad: `sudo nvram boot-args="-v"`
|
stackexchange-apple
|
{
"answer_score": 3,
"question_score": 1,
"tags": "security, macos"
}
|
Disable resizing snap view in Windows 8.1
I'm working with a Windows 8 app using **Java Script.**
In windows 8 there is only one snap view and that is fixed one. But when we come to the windows 8.1 we can resize the snap view. I want to do is keep that fixed size snap view in windows 8.1 also. That means, I want to stop resizing snap view when my windows 8 app running on windows 8.1..
Is there any way for it...?
Looking for example or any guide... Thank you
|
@dougajmcdonald is correct. The user is in control and will be able to resize any app to most any size, so your app will need to account for it. You can change the minimum size of your app which gives Windows a hint about where to give the user a snap point. For instance, if you say your app's minimum size is 500px then when the user is dragging the separator, it will snap to 500 pixels, but it will still allow them to resize to say 587 pixels.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, css, windows, winjs"
}
|
Using environment parameters in profile file Tibco BW6
In BW6 profile files(.substvar) we need to use substitution parameter which will be replaced by CI-CD platform just before deploy to any environment,
for example if we have three environment : dev, test, production, for those environments we have a sftp access, will have three profile files for each environment, developper will need to put values like this in profiles so the CI-CD platform replace them as needed for each environment :

|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "c#, asp.net, asp.net identity, claims based identity"
}
|
Troubleshooting Fibonacci series with python
I am reading a textbook and I have no idea why is this code compiling differently on my compiler than what it says in the book.
def fibs(number):
result = [0, 1]
for i in range(number-2):
result.append(result[-2] + result[-1])
return result
So this: `fibs(10)` should give me `[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]` but for some reason I get `[0, 1, 1]` for every number that I pass in to the function.
Any ideas?
|
The code in your post isn't valid Python. Since your code was able to run, it's probably actually like this:
def fibs(number):
result = [0, 1]
for i in range(number-2):
result.append(result[-2] + result[-1])
return result
Your `return result` is indented such that it's inside the `for` loop, instead of below it. This will cause it to only add one value to the list before returning, producing the list you see.
Unindent that line and it should work properly.
|
stackexchange-stackoverflow
|
{
"answer_score": 13,
"question_score": 2,
"tags": "python, algorithm"
}
|
Some emails fail to leave the computer
Every now and again, the Outlook 365 desktop app fails to send emails without warning when the send button is pressed. As there is no warning, it seems the email has been sent (when it hasn't), and you get into situations when the receiver is expecting an important email, you think you have sent it, and so on.
The email does not appear in the sent, draft, or outbox.
Does something exist which can track send clicks in outlook and if the email was successfully sent or not so we can see if we can find the cause of such failures?
|
You could do a message track to diagnose the outbound message leave your serve or not.
For mailbox belongs to Exchange on-pre, try the methods in the link below.
enter link description here
For mailbox belongs to Exchange Online, try the methods in the link below.
enter link description here
|
stackexchange-superuser
|
{
"answer_score": 1,
"question_score": 0,
"tags": "email, microsoft outlook, microsoft outlook 2016"
}
|
Dominating measure with bounded Radon-Nikodym density
Suppose I am given a countable family $(\mu_n)$ of finite Borel-measures on a compact interval $[0,T]$. Can I find a dominating measure $\mu$ (with $\mu_n \ll \mu$ for all $n$), such that all Radon-Nikodym densities $\frac{d\mu_n}{d\mu}$ are essentially bounded by a constant $K$ (independent of n)?
|
No, take any finite measure $\mu$ and look at the family $n \mu$ for n integral.
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 4,
"question_score": 0,
"tags": "measure theory"
}
|
Query Data from Another Backendless App
Does backendless support querying data from another Backendless App Table? If yes how.
If I have Backendless App called Music with Table songs and I have another App called Movie. I want to query the song table from the Movie app.
|
You gonna need to call `Backendless.initApp(context, {another_app_id}, {another_app_secret_key}, v1)` before each call to a different application. This way you'll be able to talk to any number of apps.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "backendless"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.