qid
int64 1
74.6M
| question
stringlengths 45
24.2k
| date
stringlengths 10
10
| metadata
stringlengths 101
178
| response_j
stringlengths 32
23.2k
| response_k
stringlengths 21
13.2k
|
---|---|---|---|---|---|
2,677,956 | So basically what I'm working with is a database full of phone numbers.
if I get one of those users from that phone database and they sign up to my website I want to automatically associate the number from the database that is already present, how would I go about linking those 2 tables together once a user signs up? | 2010/04/20 | ['https://Stackoverflow.com/questions/2677956', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/301252/'] | Assuming that you have phone number table and users table you need to store the primary keys of both table together
You can do it:
* In a user table, but then you will be able to link only one phone number to a user (and later if you will have to add more then one phone you might end up adding fields like phone\_number\_1, phone\_number\_2, etc... which is quite horrible)
* In a phone number table, but then you will be able to link only one user to a phone number (same problem may arise as in point one)
* In a separate table, but then you will have to use a join every time you need to get a user or phone number
The right choice depends on the relationships between the data that you are trying to model. | So, the database would be structured using composition. Keep a `phone_numbers` table w/ `phone_number_id`, the `users` table w/ `user_id`, and then a `customer_phone_numbers` table that maps user\_ids to phone\_number\_ids. Then your PHP code would do something like this:
```
<?php
$user->save(); // save normal user data
$phoneNumbers = array();
foreach($user->getPhoneNumbers() as $phoneNumber) {
$phoneId = getPhoneNumberId($phoneNumber); // get the phone number, or save a new record if necessary, and return that number
$phoneNumbers[] = $phoneId;
}
$user->savePhoneNumbers( $phoneNumbers ); // adds or removes phone numbers as necessary
```
---
EDIT: Based on your feedback, it doesn't sound so much like you are just looking for a way to associate the data. If I understand you correctly, the user will sign up for your website via their phone, then later register on the website. You want to combine the two registrations when this happens.
Are users creating a complete profile from their phone? Do you have a process in place to verify that the phone number provided by the user is actually theirs?
If the user is not creating a full profile via the phone, it sounds like there are two types of "profiles" being stored, a complete website profile, and a telephone profile. This way, you would have a phone profile w/ a `phone_profile_id` and a regular user record w/ a `user_id`. Then, let users verify their telephone information and associate them to a `phone_profile_id` using a composition table as above.
Is that a little closer?
Thanks,
Joe |
47,883,939 | I need to generate a `TSQL` query like this:
```
IF @GenderOfEmployee IS NOT NULL
CASE @GenderOfEmployee = 1
THEN INSERT INTO @NotAllowedGenderOfJobPost (TagID) values (139)
ELSE INSERT INTO @NotAllowedGenderOfJobPost (TagID) values (138)
END;
```
I mean I want have a `CASE` statement in `IF` statement.
Is it possible?
Consider I don't want other similar ways to provide that query.
Thanks for your advanced help. | 2017/12/19 | ['https://Stackoverflow.com/questions/47883939', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/'] | Change like this
```
IF @GenderOfEmployee IS NOT NULL
BEGIN
INSERT INTO @NotAllowedGenderOfJobPost (TagID) SELECT CASE WHEN @GenderOfEmployee = 1
THEN 139
ELSE 138
END
END;
``` | There is no need for a `select` to insert the result of a `case` expression:
```
declare @NotAllowedGenderOfJobPost as Table ( TagId Int );
declare @GenderOfEmployee as Int = NULL;
-- Try NULL.
if @GenderOfEmployee is not NULL
insert into @NotAllowedGenderOfJobPost (TagId ) values
( case when @GenderOfEmployee = 1 then 139 else 138 end );
select * from @NotAllowedGenderOfJobPost;
-- Try 0.
set @GenderOfEmployee = 0;
if @GenderOfEmployee is not NULL
insert into @NotAllowedGenderOfJobPost (TagId ) values
( case when @GenderOfEmployee = 1 then 139 else 138 end );
select * from @NotAllowedGenderOfJobPost;
-- Try 1.
set @GenderOfEmployee = 1;
if @GenderOfEmployee is not NULL
insert into @NotAllowedGenderOfJobPost (TagId ) values
( case when @GenderOfEmployee = 1 then 139 else 138 end );
select * from @NotAllowedGenderOfJobPost;
``` |
53,849,604 | how to make regex for number from -100 to 100? Thanks in advance | 2018/12/19 | ['https://Stackoverflow.com/questions/53849604', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9328454/'] | You can use a regex range generator, such as <http://gamon.webfactional.com/regexnumericrangegenerator/>
I think this regular expression will do it:
```
/^-?([0-9]|[1-8][0-9]|9[0-9]|100)$/
``` | use <https://regex101.com/> for checking your regex.
and use `(?:\b|-)([1-9]{1,2}[0]?|100)\b` expression to print numbers from -100 to 100 |
39,895,319 | I am looking at making a navbar like this in android:
[Scketch of navbar](http://i.stack.imgur.com/NsRSO.png)
Everything is straight forward beside the months.
I want to be able to scroll through the months by dragging or by clicking a month.
I also want the current month to be the one centered on start.
Any suggestions on how to make this is welcome. | 2016/10/06 | ['https://Stackoverflow.com/questions/39895319', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5326910/'] | Coverted the above comment as answer. Hope it solves your problem.
Use TabLayout with **app:tabMode=”scrollable”**. You'll find the implementation and code under the topic **Scrollable Tabs** [here](http://www.androidhive.info/2015/09/android-material-design-working-with-tabs/). | ```
ActionBar mActionBar = getActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
mActionBar.setCustomView(mCustomView);
mActionBar.setDisplayShowCustomEnabled(true);
```
make Horizontal scrollview in custom layout. |
43,918,993 | I get the following error installing sasl in my Bluemix app:
```
Installing collected packages: sasl, thrift-sasl
Running setup.py install for sasl: started
Running setup.py install for sasl: finished with status 'error'
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9mi8225r/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3l4o04ga-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9mi8225r/sasl/
running install
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/sasl
copying sasl/__init__.py -> build/lib.linux-x86_64-3.5/sasl
running egg_info
writing dependency_links to sasl.egg-info/dependency_links.txt
writing top-level names to sasl.egg-info/top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'sasl.egg-info/SOURCES.txt'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-3.5/sasl
copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.5/sasl
building 'sasl.saslwrapper' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/sasl
gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/app/.heroku/python/include/python3.5m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.5/sasl/saslwrapper.o
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
```
I'm using the buildpack: `python 1.5.5`
My runtime.txt contains: `python-3.5.0`
How can I install the necessary headers in the buildpack?
---
**Update:**
It looks as though the latest cloud foundry stack has the sasl library: <https://github.com/cloudfoundry/cflinuxfs2/blob/1.119.0/cflinuxfs2/build/install-packages.sh#L98>.
How can I use this stack on Bluemix? | 2017/05/11 | ['https://Stackoverflow.com/questions/43918993', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1033422/'] | Maybe you should install some system libraries before you can install **sasl** refer to <https://pypi.python.org/pypi/sasl/0.1.3>
>
> This library contains C++ code, and will require some additional
> system libraries installed.
>
>
> *Debian/Ubuntu*
>
>
> apt-get install python-dev libsasl2-dev gcc
>
>
> *CentOS/RHEL*
>
>
> yum install gcc-c++ python-devel.x86\_64
> cyrus-sasl-devel.x86\_64
>
>
> | The solution for me was to use pure-sasl and install imypla and thrift\_sasl from application code rather than my requirements.txt:
```
try:
import impyla
except ImportError:
print("Installing missing impyla")
import pip
pip.main(['install', '--no-deps', 'impyla'])
try:
import thrift_sasl
except ImportError:
print("Installing missing thrift_sasl")
import pip
# need a patched version of thrift_sasl. see https://github.com/cloudera/impyla/issues/238
pip.main(['install', '--no-deps', 'git+https://github.com/snowch/thrift_sasl'])
```
I added this code to a view in my flask application: <https://github.com/snowch/movie-recommender-demo/blob/master/web_app/app/main/views.py> |
43,918,993 | I get the following error installing sasl in my Bluemix app:
```
Installing collected packages: sasl, thrift-sasl
Running setup.py install for sasl: started
Running setup.py install for sasl: finished with status 'error'
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9mi8225r/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3l4o04ga-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9mi8225r/sasl/
running install
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/sasl
copying sasl/__init__.py -> build/lib.linux-x86_64-3.5/sasl
running egg_info
writing dependency_links to sasl.egg-info/dependency_links.txt
writing top-level names to sasl.egg-info/top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'sasl.egg-info/SOURCES.txt'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-3.5/sasl
copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.5/sasl
building 'sasl.saslwrapper' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/sasl
gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/app/.heroku/python/include/python3.5m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.5/sasl/saslwrapper.o
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
```
I'm using the buildpack: `python 1.5.5`
My runtime.txt contains: `python-3.5.0`
How can I install the necessary headers in the buildpack?
---
**Update:**
It looks as though the latest cloud foundry stack has the sasl library: <https://github.com/cloudfoundry/cflinuxfs2/blob/1.119.0/cflinuxfs2/build/install-packages.sh#L98>.
How can I use this stack on Bluemix? | 2017/05/11 | ['https://Stackoverflow.com/questions/43918993', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1033422/'] | The solution for me was to use pure-sasl and install imypla and thrift\_sasl from application code rather than my requirements.txt:
```
try:
import impyla
except ImportError:
print("Installing missing impyla")
import pip
pip.main(['install', '--no-deps', 'impyla'])
try:
import thrift_sasl
except ImportError:
print("Installing missing thrift_sasl")
import pip
# need a patched version of thrift_sasl. see https://github.com/cloudera/impyla/issues/238
pip.main(['install', '--no-deps', 'git+https://github.com/snowch/thrift_sasl'])
```
I added this code to a view in my flask application: <https://github.com/snowch/movie-recommender-demo/blob/master/web_app/app/main/views.py> | I was having similar error -
```
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
```
Try this thread it was helpful for me
[I can't install python-ldap](https://stackoverflow.com/questions/4768446/i-cant-install-python-ldap) |
43,918,993 | I get the following error installing sasl in my Bluemix app:
```
Installing collected packages: sasl, thrift-sasl
Running setup.py install for sasl: started
Running setup.py install for sasl: finished with status 'error'
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9mi8225r/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3l4o04ga-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9mi8225r/sasl/
running install
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/sasl
copying sasl/__init__.py -> build/lib.linux-x86_64-3.5/sasl
running egg_info
writing dependency_links to sasl.egg-info/dependency_links.txt
writing top-level names to sasl.egg-info/top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'sasl.egg-info/SOURCES.txt'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-3.5/sasl
copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.5/sasl
building 'sasl.saslwrapper' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/sasl
gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/app/.heroku/python/include/python3.5m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.5/sasl/saslwrapper.o
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
```
I'm using the buildpack: `python 1.5.5`
My runtime.txt contains: `python-3.5.0`
How can I install the necessary headers in the buildpack?
---
**Update:**
It looks as though the latest cloud foundry stack has the sasl library: <https://github.com/cloudfoundry/cflinuxfs2/blob/1.119.0/cflinuxfs2/build/install-packages.sh#L98>.
How can I use this stack on Bluemix? | 2017/05/11 | ['https://Stackoverflow.com/questions/43918993', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1033422/'] | Maybe you should install some system libraries before you can install **sasl** refer to <https://pypi.python.org/pypi/sasl/0.1.3>
>
> This library contains C++ code, and will require some additional
> system libraries installed.
>
>
> *Debian/Ubuntu*
>
>
> apt-get install python-dev libsasl2-dev gcc
>
>
> *CentOS/RHEL*
>
>
> yum install gcc-c++ python-devel.x86\_64
> cyrus-sasl-devel.x86\_64
>
>
> | I was having similar error -
```
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
```
Try this thread it was helpful for me
[I can't install python-ldap](https://stackoverflow.com/questions/4768446/i-cant-install-python-ldap) |
18,342,961 | I have a copy text button that I'm using ZeroClipboard with in order to copy certain text on the page. It works in Chrome and IE but it doesn't copy text in Firefox and the `complete` event is never fired.
My JavaScript for setting up the button looks something like this:
```
ZeroClipboard.setDefaults({
moviePath: '/js/zeroclipboard/ZeroClipboard.swf',
allowScriptAccess: 'always',
forceHandCursor: true
});
function enableCopyButton(container) {
var button = container.find('.text-copy'),
source = container.find('.text'),
clip = new ZeroClipboard(button);
clip.setText(source.val());
clip.on('load', function (client) {
console.log('ZeroClipboard loaded.');
client.on('complete', function (client, args) {
console.log('Text copied: ' + args.text);
});
});
clip.on('noFlash', function () {
console.error('No Flash installed!');
});
clip.on('wrongFlash', function () {
console.error('Wrong Flash installed!');
});
}
```
The console ends up showing `"ZeroClipboard loaded."` and nothing else. No errors are thrown, and I've confirmed that `ZeroClipboard.swf` is being loaded and placed on the page. The `mousedown` and `mouseup` events are being fired, as well. The page this is running on is using a valid SSL certificate, and all assets on the page are loaded via HTTPS.
The library's demo page on GitHub works fine in FireFox, so I suspect it's something I'm doing. | 2013/08/20 | ['https://Stackoverflow.com/questions/18342961', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/784368/'] | I'm not sure if this would help, but recently I have been working on using zeroclipboard for more than a month. Sometimes it works but sometimes it fails due to some very tiny things(maybe because I'm very new to javascript and html stuff)...and I understand the upset very well...
In your case, have you ever tried this event before?
Instead using clip.setText(source.val()) alone, move it inside a 'dataRequested' event like this:
```
clip.on('dataRequested', function(client, args) {
client.setText(source.val());
});
```
Then after clicking on the button, see if the complete event gets fired.
BTW, I'm wondering if your 'noflash' or 'wrongflash' got fired normally? In my case, if users don't have flash installed, the event is still not fired...not sure what's wrong with it...
Anyways, good luck :) | My dev environment:
* .NET 4.5
* ASP.NET MVC4 with Razor engine
* jQuery
Here is what I did to get Copy to Clipboard to work across 5 browsers:
* FF 23
* IE 10
* Chrome 29
* Safari 5.1.7
* Opera 16
My scenario:
The text I want to copy to clipboard is generated an put in a Div along with html breaks (br).
For the Copy, I needed to remove these html breaks and replace them with /r/n.
The copy is via a Button click.
Not this might not be the best way to code this up but it worked for me.
Grab latest ZeroClipboard from [github](https://github.com/zeroclipboard/zeroclipboard)
In my .cshtml file, I define the button and div and include the ZeroClipboard.min.js file.
```
<!-- language-all: lang-html -->
<button id="btCopyToClipboard" name="btCopyToClipboard" type="button">Copy To Clipboard</button>
<div id="Basket" ></div>
```
Javascript portion:
```
<!-- language: lang-js -->
<script type="text/javascript">
$(document).ready(function () {
//"style" the buttons
$("#btCopyToClipboard").button();
//ZeroClipboard code
var clip = new ZeroClipboard(document.getElementById('btCopyToClipboard'), {
moviePath: "/Scripts/ZeroClipboard.swf", // URL to movie
trustedOrigins: null, //null Page origins that the SWF should trust (single string or array of strings)
hoverClass: "", // The class used to hover over the object
activeClass: "", // The class used to set object active
allowScriptAccess: "always", //sameDomain SWF outbound scripting policy
useNoCache: true, // Include a nocache query parameter on requests for the SWF
forceHandCursor: true //false Forcibly set the hand cursor ("pointer") for all glued elements
});
//if just using var clip = new ZeroClipboard(); then need to use .glue(..)
//clip.glue(document.getElementById('btCopyToClipboard'));
clip.on('load', function (client, args) {
DebugLog("ZeroClipboard.swf is loaded and user's flash version is: " + args.flashVersion);
});
//The complete event is fired when the text is successfully copied to the clipboard.
clip.on('complete', function (client, args) {
//alert("clip.onComplete(..) -- Copied text to clipboard args.text: " + args.text);
});
clip.on('mouseover', function (client) {
// alert("mouse over");
});
clip.on('mouseout', function (client) {
//alert("mouse out");
});
clip.on('mousedown', function (client) {
//alert("mouse down");
});
clip.on('mouseup', function (client) {
//alert("mouse up");
});
clip.on('dataRequested', function (client, args) {
//get text from basket
var txt = $("#Basket").html();
//to make Notepad honour line breaks, we have to do some magic
var windowsText = txt.replace(/\n/g, '\r\n');
//replace html break with line breaks
windowsText = windowsText.replace(/<br\s*\/?>/g, "\r\n");
client.setText(windowsText);
});
clip.on('noflash', function (client, args) {
var msg = "You don't support flash, therefore the Copy To Clipboard will not work.";
DebugLog(msg);
alert(msg);
});
clip.on('wrongflash', function (client, args) {
var msg = 'Your flash is too old ' + args.flashVersion + '. The Copy To Clipboard supports version 10 and up.';
DebugLog(msg);
alert(msg);
});
function DebugLog(message) {
if (console && console.log) {
console.log(message);
}
}
});//eof $(document).ready
</script>
``` |
18,342,961 | I have a copy text button that I'm using ZeroClipboard with in order to copy certain text on the page. It works in Chrome and IE but it doesn't copy text in Firefox and the `complete` event is never fired.
My JavaScript for setting up the button looks something like this:
```
ZeroClipboard.setDefaults({
moviePath: '/js/zeroclipboard/ZeroClipboard.swf',
allowScriptAccess: 'always',
forceHandCursor: true
});
function enableCopyButton(container) {
var button = container.find('.text-copy'),
source = container.find('.text'),
clip = new ZeroClipboard(button);
clip.setText(source.val());
clip.on('load', function (client) {
console.log('ZeroClipboard loaded.');
client.on('complete', function (client, args) {
console.log('Text copied: ' + args.text);
});
});
clip.on('noFlash', function () {
console.error('No Flash installed!');
});
clip.on('wrongFlash', function () {
console.error('Wrong Flash installed!');
});
}
```
The console ends up showing `"ZeroClipboard loaded."` and nothing else. No errors are thrown, and I've confirmed that `ZeroClipboard.swf` is being loaded and placed on the page. The `mousedown` and `mouseup` events are being fired, as well. The page this is running on is using a valid SSL certificate, and all assets on the page are loaded via HTTPS.
The library's demo page on GitHub works fine in FireFox, so I suspect it's something I'm doing. | 2013/08/20 | ['https://Stackoverflow.com/questions/18342961', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/784368/'] | I'm not sure if this would help, but recently I have been working on using zeroclipboard for more than a month. Sometimes it works but sometimes it fails due to some very tiny things(maybe because I'm very new to javascript and html stuff)...and I understand the upset very well...
In your case, have you ever tried this event before?
Instead using clip.setText(source.val()) alone, move it inside a 'dataRequested' event like this:
```
clip.on('dataRequested', function(client, args) {
client.setText(source.val());
});
```
Then after clicking on the button, see if the complete event gets fired.
BTW, I'm wondering if your 'noflash' or 'wrongflash' got fired normally? In my case, if users don't have flash installed, the event is still not fired...not sure what's wrong with it...
Anyways, good luck :) | Latest version of zeroclipboard uses event.stopImmediatePropagation which not exists in firefox before version 28.0, it fails with error:
```
event.stopImmediatePropagation is not a function
```
You can see browser comparison here:
<http://compatibility.shwups-cms.ch/de/home?&property=TrackEvent.prototype.stopImmediatePropagation>
I use this polifil to add missing functionality:
<https://github.com/mattcg/stopImmediatePropagation> |
15,178,165 | I would like to know if there is any IDE or Eclipse Plugin that supports mixed mode debugging. As I searched the term mixed mode, found lot of references debugging VM languages alongside with native code.
But I referring to a feature that is similar to the one available in compiled languages such as C where an user can see both C source line along side with the corresponding assembly line and will be able to step in even at assembly level. (please excuse If I had made a nomenclature mistake by calling the feature as mixed mode)
In other words I am looking for a following features while debugging java:
1. Ability to the java source code and the corresponding byte codes during program execution
2. Ability to see JVM PC registers and Operand stacks
3. Ability to view other JVM specific data structures (for example constant pools)
This is to understand how the Java source code maps to byte codes and how the various JVM associated data structures are affected while stepping in. | 2013/03/02 | ['https://Stackoverflow.com/questions/15178165', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1391837/'] | I'm a DSL developer and have sort of run into this same issue a number of times.
The only tool i've found has been the [Dr. Garbage](http://www.drgarbage.com/bytecode-visualizer/) tools.
At the current moment, they don't seem to be the best maintained, but they do work with appropriate versions of eclipse. | You don't need debugger to understand how Java code maps to compiled native code. You can use `-XX:+PrintCompilation` JVM flag. See mode info on that in [Stephen Colebourne's blog post](http://blog.joda.org/2011/08/printcompilation-jvm-flag.html) and more detail in Kris Mok [reply to that post](https://gist.github.com/rednaxelafx/1165804#file_notes.md).
You may also find [HotSpot Internals Wiki](https://wikis.oracle.com/display/HotSpotInternals/Home) useful. |
1,864,869 | Sorry, my English is poor, but I have a question. It is usual to find the definition of subgroup as: "We define a subgroup $H$ of a group $G$ to be a nonempty subset $H$ of $G$ such that when the group operation of $G$ is restricted to $H$, $H$ is a group in its own right". But it is known that $A=\left\{\begin{pmatrix}a & a\\a& a\end{pmatrix} \mbox{ with } a \in R \mbox{ and } a\neq 0 \right\}$ is a group with the usual product of matrices but it is not a subgroup of $M\_{2\times2}$. Do you know another examples of subsets like this?
**Edit:** I'll try to change a little the question: In the set of matrices $M\_{2\times2}$ there are subsets which are groups in regard to the usual matrix product but have a different neutral element. An example would be the group of all nonsingular matrices over $\mathbb R$, $GL(2,\mathbb R)$ and $H=\left\{\begin{pmatrix}a & a\\a& a\end{pmatrix} \mbox{ with } a \in \mathbb R \mbox{ and } a\neq 0 \right\}$. Do you know of other examples of subsets (groups) with elements of the same nature, that given the same operation have a different neutral element? | 2016/07/19 | ['https://math.stackexchange.com/questions/1864869', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/85966/'] | >
> Can two function be Big-O of each other?
>
>
>
The answer is yes.
One may take $f(n)=n$ and $g(n)=2n+1$, as $ n \to \infty$, one has
$$
\left|\frac{f(n)}{g(n)}\right|=\frac{n}{2n+1}\le \frac12 \implies f=O(g)
$$ and
$$
\left|\frac{g(n)}{f(n)}\right|=\frac{2n+1}{n}\le 3 \implies g=O(f).
$$ | **Is it possible?** Yes. A simple example: $f=g$.
**What does it imply**? This is equivalent to saying that $f=\Theta(g)$. To see why:
If $f=O(g)$, there exists $c>0$ and $N \geq 0$ such that
$$
\forall n \geq N, \qquad f(n) \leq c\cdot g(n) \tag{1}
$$
If $g=O(f)$, there exists $c'>0$ and $N' \geq 0$ such that
$$
\forall n \geq N', \qquad g(n) \leq c'\cdot f(n) \tag{2}
$$
Combining (1) and (2), and choosing $M\stackrel{\rm def}{=}\max(N,N')$, $\alpha\stackrel{\rm def}{=}\frac{1}{c} > 0$, $\beta \stackrel{\rm def}{=} c'$, we get that there exist $M\geq 0$, constants $\alpha,\beta>0$ such that
$$
\forall n \geq M, \qquad \alpha f(n) \leq g(n) \leq \beta f(n) \tag{3}
$$
which by definition means $f=\Theta(g)$. This should answer both your questions. |
1,864,869 | Sorry, my English is poor, but I have a question. It is usual to find the definition of subgroup as: "We define a subgroup $H$ of a group $G$ to be a nonempty subset $H$ of $G$ such that when the group operation of $G$ is restricted to $H$, $H$ is a group in its own right". But it is known that $A=\left\{\begin{pmatrix}a & a\\a& a\end{pmatrix} \mbox{ with } a \in R \mbox{ and } a\neq 0 \right\}$ is a group with the usual product of matrices but it is not a subgroup of $M\_{2\times2}$. Do you know another examples of subsets like this?
**Edit:** I'll try to change a little the question: In the set of matrices $M\_{2\times2}$ there are subsets which are groups in regard to the usual matrix product but have a different neutral element. An example would be the group of all nonsingular matrices over $\mathbb R$, $GL(2,\mathbb R)$ and $H=\left\{\begin{pmatrix}a & a\\a& a\end{pmatrix} \mbox{ with } a \in \mathbb R \mbox{ and } a\neq 0 \right\}$. Do you know of other examples of subsets (groups) with elements of the same nature, that given the same operation have a different neutral element? | 2016/07/19 | ['https://math.stackexchange.com/questions/1864869', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/85966/'] | >
> Can two function be Big-O of each other?
>
>
>
The answer is yes.
One may take $f(n)=n$ and $g(n)=2n+1$, as $ n \to \infty$, one has
$$
\left|\frac{f(n)}{g(n)}\right|=\frac{n}{2n+1}\le \frac12 \implies f=O(g)
$$ and
$$
\left|\frac{g(n)}{f(n)}\right|=\frac{2n+1}{n}\le 3 \implies g=O(f).
$$ | The following are equivalent:
1. $f(n) = O(g(n))$ and $g(n) = O(f(n))$
2. $f(n) = \Omega(g(n))$ and $g(n) = \Omega(f(n))$ (using the definition from computational complexity theory, not the one from analytic number theory)
3. $f(n) = \Theta(g(n))$. |
1,864,869 | Sorry, my English is poor, but I have a question. It is usual to find the definition of subgroup as: "We define a subgroup $H$ of a group $G$ to be a nonempty subset $H$ of $G$ such that when the group operation of $G$ is restricted to $H$, $H$ is a group in its own right". But it is known that $A=\left\{\begin{pmatrix}a & a\\a& a\end{pmatrix} \mbox{ with } a \in R \mbox{ and } a\neq 0 \right\}$ is a group with the usual product of matrices but it is not a subgroup of $M\_{2\times2}$. Do you know another examples of subsets like this?
**Edit:** I'll try to change a little the question: In the set of matrices $M\_{2\times2}$ there are subsets which are groups in regard to the usual matrix product but have a different neutral element. An example would be the group of all nonsingular matrices over $\mathbb R$, $GL(2,\mathbb R)$ and $H=\left\{\begin{pmatrix}a & a\\a& a\end{pmatrix} \mbox{ with } a \in \mathbb R \mbox{ and } a\neq 0 \right\}$. Do you know of other examples of subsets (groups) with elements of the same nature, that given the same operation have a different neutral element? | 2016/07/19 | ['https://math.stackexchange.com/questions/1864869', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/85966/'] | **Is it possible?** Yes. A simple example: $f=g$.
**What does it imply**? This is equivalent to saying that $f=\Theta(g)$. To see why:
If $f=O(g)$, there exists $c>0$ and $N \geq 0$ such that
$$
\forall n \geq N, \qquad f(n) \leq c\cdot g(n) \tag{1}
$$
If $g=O(f)$, there exists $c'>0$ and $N' \geq 0$ such that
$$
\forall n \geq N', \qquad g(n) \leq c'\cdot f(n) \tag{2}
$$
Combining (1) and (2), and choosing $M\stackrel{\rm def}{=}\max(N,N')$, $\alpha\stackrel{\rm def}{=}\frac{1}{c} > 0$, $\beta \stackrel{\rm def}{=} c'$, we get that there exist $M\geq 0$, constants $\alpha,\beta>0$ such that
$$
\forall n \geq M, \qquad \alpha f(n) \leq g(n) \leq \beta f(n) \tag{3}
$$
which by definition means $f=\Theta(g)$. This should answer both your questions. | The following are equivalent:
1. $f(n) = O(g(n))$ and $g(n) = O(f(n))$
2. $f(n) = \Omega(g(n))$ and $g(n) = \Omega(f(n))$ (using the definition from computational complexity theory, not the one from analytic number theory)
3. $f(n) = \Theta(g(n))$. |
52,294 | I am a Linux user with a frequent need to ssh into remote computers and keep my session there running while disconnecting. And then later connect back to it from the same or a different 'client' computers. There are a number of programs, *terminal multiplexers*, that solves this problem. I frequently use gnu screen, tmux, etc.
However, they all seem designed around the idea of taking over rendering of the text surface available to them to do a form of 'screen management'. In doing so they override tasks normally handled by the terminal window on the client computer (i.e., the xterm, gnome terminal, etc. from which I am running the ssh). This means that once I start the multiplexer, I can no longer use, e.g., the scrollbar to access the scrollback history, or the search menu of my graphical terminal. I can no longer mouse mark and drag in the window and have it scroll back by itself, etc. Instead, these terminal multiplexer provide their own keyboard-based user interfaces to handle such tasks. I would much prefer if I could keep using the UI of my client terminal as usual.
Hence, is there a terminal multiplexer that provides the function of a virtual tty, which one can attach and detach from at will, but when one is connected it simply just outputs all text into the console "the normal way"? I.e., without doing any form of "screen management"? (I'm imagining that it could still keep a log of recent history internally, so that when one connects, it can spit out this log to provide context to a newly connected client.)
(Answers that point to ways to configure well-known multiplexers to do this are of course acceptable.) | 2018/09/21 | ['https://softwarerecs.stackexchange.com/questions/52294', 'https://softwarerecs.stackexchange.com', 'https://softwarerecs.stackexchange.com/users/40595/'] | You might want to clarify what Kind oft "remote desktop" you want:
1. Mirror the screen, i.e. interact with the user session which is currently active on the physical screen.
2. Open a New session exclusively for the remote user.
1.) is the target oft VNC, but also TeamViewer and the likes. It is useful for remote assistance, but not well suited for remote working. 2.) is RDP, and NX as well, IIRC. This is useful for (multiple) remote workers.
Back in the days, remote working in UNIX was very common, with thin Clients connected to a central Workstation. After all, that's what the X window system client server model was made for. This is now very uncommon. If you're looking for some remote assistance tool (case 1), then I think VNC+SSH is still the best option. If you're looking for something like windows remote desktop services, then I am afraid there is none. | Even today tunneling an X session over SSH works just fine.
On a Mac, you can install the X server from the apple store, Linux/BSD you have it native, and for Windows there are X servers in the app store, or other commercial offerings, or you can use `cygwin-x` |
52,294 | I am a Linux user with a frequent need to ssh into remote computers and keep my session there running while disconnecting. And then later connect back to it from the same or a different 'client' computers. There are a number of programs, *terminal multiplexers*, that solves this problem. I frequently use gnu screen, tmux, etc.
However, they all seem designed around the idea of taking over rendering of the text surface available to them to do a form of 'screen management'. In doing so they override tasks normally handled by the terminal window on the client computer (i.e., the xterm, gnome terminal, etc. from which I am running the ssh). This means that once I start the multiplexer, I can no longer use, e.g., the scrollbar to access the scrollback history, or the search menu of my graphical terminal. I can no longer mouse mark and drag in the window and have it scroll back by itself, etc. Instead, these terminal multiplexer provide their own keyboard-based user interfaces to handle such tasks. I would much prefer if I could keep using the UI of my client terminal as usual.
Hence, is there a terminal multiplexer that provides the function of a virtual tty, which one can attach and detach from at will, but when one is connected it simply just outputs all text into the console "the normal way"? I.e., without doing any form of "screen management"? (I'm imagining that it could still keep a log of recent history internally, so that when one connects, it can spit out this log to provide context to a newly connected client.)
(Answers that point to ways to configure well-known multiplexers to do this are of course acceptable.) | 2018/09/21 | ['https://softwarerecs.stackexchange.com/questions/52294', 'https://softwarerecs.stackexchange.com', 'https://softwarerecs.stackexchange.com/users/40595/'] | I think X2Go fits your requirements, based on NX3. <https://wiki.x2go.org/doku.php/start>
I use it and while it's not perfect, it's the best I've found so far.
It may be in your distro's repository. X support only, no Wayland.
Uses ssh, logs in to existing sessions or creates new sessions using remote system accounts, and has a cool "seamless" application mode for running a remote program in a local window.
Problems I've encountered are mostly with keymaps. i.e. in session mode, some keys don't register correctly for me. | You might want to clarify what Kind oft "remote desktop" you want:
1. Mirror the screen, i.e. interact with the user session which is currently active on the physical screen.
2. Open a New session exclusively for the remote user.
1.) is the target oft VNC, but also TeamViewer and the likes. It is useful for remote assistance, but not well suited for remote working. 2.) is RDP, and NX as well, IIRC. This is useful for (multiple) remote workers.
Back in the days, remote working in UNIX was very common, with thin Clients connected to a central Workstation. After all, that's what the X window system client server model was made for. This is now very uncommon. If you're looking for some remote assistance tool (case 1), then I think VNC+SSH is still the best option. If you're looking for something like windows remote desktop services, then I am afraid there is none. |
52,294 | I am a Linux user with a frequent need to ssh into remote computers and keep my session there running while disconnecting. And then later connect back to it from the same or a different 'client' computers. There are a number of programs, *terminal multiplexers*, that solves this problem. I frequently use gnu screen, tmux, etc.
However, they all seem designed around the idea of taking over rendering of the text surface available to them to do a form of 'screen management'. In doing so they override tasks normally handled by the terminal window on the client computer (i.e., the xterm, gnome terminal, etc. from which I am running the ssh). This means that once I start the multiplexer, I can no longer use, e.g., the scrollbar to access the scrollback history, or the search menu of my graphical terminal. I can no longer mouse mark and drag in the window and have it scroll back by itself, etc. Instead, these terminal multiplexer provide their own keyboard-based user interfaces to handle such tasks. I would much prefer if I could keep using the UI of my client terminal as usual.
Hence, is there a terminal multiplexer that provides the function of a virtual tty, which one can attach and detach from at will, but when one is connected it simply just outputs all text into the console "the normal way"? I.e., without doing any form of "screen management"? (I'm imagining that it could still keep a log of recent history internally, so that when one connects, it can spit out this log to provide context to a newly connected client.)
(Answers that point to ways to configure well-known multiplexers to do this are of course acceptable.) | 2018/09/21 | ['https://softwarerecs.stackexchange.com/questions/52294', 'https://softwarerecs.stackexchange.com', 'https://softwarerecs.stackexchange.com/users/40595/'] | I think X2Go fits your requirements, based on NX3. <https://wiki.x2go.org/doku.php/start>
I use it and while it's not perfect, it's the best I've found so far.
It may be in your distro's repository. X support only, no Wayland.
Uses ssh, logs in to existing sessions or creates new sessions using remote system accounts, and has a cool "seamless" application mode for running a remote program in a local window.
Problems I've encountered are mostly with keymaps. i.e. in session mode, some keys don't register correctly for me. | Even today tunneling an X session over SSH works just fine.
On a Mac, you can install the X server from the apple store, Linux/BSD you have it native, and for Windows there are X servers in the app store, or other commercial offerings, or you can use `cygwin-x` |
33,053,891 | I'm working with this tutorial which uses lambda expressions.
[Spring Boot - Bookmarks](http://spring.io/guides/tutorials/bookmarks/)
But IntelliJ says always: `cannot resolve method(<lambda expression>)`.
What do I have to check?
```
this.accountRepository.findByUsername(userId).orElseThrow(() -> new UserNotFoundException(userId));
``` | 2015/10/10 | ['https://Stackoverflow.com/questions/33053891', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2715720/'] | It looks like your IntelliJ or your project is not setup to use Java 8.
1. Open **Project Structure**
2. Look into **Project Settings | Project**, the value of **Project SDK** should be 1.8
3. Look into **Platform Settings | SDK**, there should be 1.8 listed
It should look something like this:
[![enter image description here](https://i.stack.imgur.com/jaAE9.png)](https://i.stack.imgur.com/jaAE9.png) | You need to change the "Project language level" to "8 - Lambdas, type annotations etc.". You can find this option in "Project Settings" -> "Project" |
33,053,891 | I'm working with this tutorial which uses lambda expressions.
[Spring Boot - Bookmarks](http://spring.io/guides/tutorials/bookmarks/)
But IntelliJ says always: `cannot resolve method(<lambda expression>)`.
What do I have to check?
```
this.accountRepository.findByUsername(userId).orElseThrow(() -> new UserNotFoundException(userId));
``` | 2015/10/10 | ['https://Stackoverflow.com/questions/33053891', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2715720/'] | It looks like your IntelliJ or your project is not setup to use Java 8.
1. Open **Project Structure**
2. Look into **Project Settings | Project**, the value of **Project SDK** should be 1.8
3. Look into **Platform Settings | SDK**, there should be 1.8 listed
It should look something like this:
[![enter image description here](https://i.stack.imgur.com/jaAE9.png)](https://i.stack.imgur.com/jaAE9.png) | In addition to the answers above look into you pom.xml file. Source and target should be 1.8 or higher. e.g.
```
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
``` |
33,053,891 | I'm working with this tutorial which uses lambda expressions.
[Spring Boot - Bookmarks](http://spring.io/guides/tutorials/bookmarks/)
But IntelliJ says always: `cannot resolve method(<lambda expression>)`.
What do I have to check?
```
this.accountRepository.findByUsername(userId).orElseThrow(() -> new UserNotFoundException(userId));
``` | 2015/10/10 | ['https://Stackoverflow.com/questions/33053891', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2715720/'] | You need to change the "Project language level" to "8 - Lambdas, type annotations etc.". You can find this option in "Project Settings" -> "Project" | In addition to the answers above look into you pom.xml file. Source and target should be 1.8 or higher. e.g.
```
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
``` |
11,232,845 | I used some relative url in my project like `<img src="../images/portal_header.jpg" .../>`, but our consultant insist to ask me change every url to `~/images/...`, and because they are html control, I have to add `runat="server"` tag for each one, So my question is that is it necessary? I have couple master page, it makes all the js link and css link unreached. Thanks | 2012/06/27 | ['https://Stackoverflow.com/questions/11232845', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1202242/'] | A control can live in any subfolder and be referenced by many different pages in many different subfolders. `../` will not work in every case.
For that reason, you shuold resolve the URLs:
```
ResolveUrl("~/images/myimage.jpg")
```
And, no, you don't have to add `runat="server"`, you could do it like so:
```
<img src="<% =ResolveUrl("~/images/portal_header.jpg") %>" .../>
``` | It depends greatly on context. Using relative URLs works fine as long as the location of the dependent resources isn't expected to change. Turning all of your image tags into controls does give you the benefit of using "~" (App Root) but it also adds overhead to processing on the server.
Your consultant is likely trying to protect you from a common problem. All your relative links work fine in development ("http://localhost/site") but break when you move to production ("http://www.yourdomain.com/somelocation/"). |
11,232,845 | I used some relative url in my project like `<img src="../images/portal_header.jpg" .../>`, but our consultant insist to ask me change every url to `~/images/...`, and because they are html control, I have to add `runat="server"` tag for each one, So my question is that is it necessary? I have couple master page, it makes all the js link and css link unreached. Thanks | 2012/06/27 | ['https://Stackoverflow.com/questions/11232845', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1202242/'] | A control can live in any subfolder and be referenced by many different pages in many different subfolders. `../` will not work in every case.
For that reason, you shuold resolve the URLs:
```
ResolveUrl("~/images/myimage.jpg")
```
And, no, you don't have to add `runat="server"`, you could do it like so:
```
<img src="<% =ResolveUrl("~/images/portal_header.jpg") %>" .../>
``` | Not sure which ASP version you're working in, but I use `@Url.Content("~/relativepath")` for ASP4 using MVC3 w/Razor
or `<img src="@Url.Content("~/relativepath")" alt="" />` |
32,505,666 | I'm developing a package and want to import all of the `dplyr` functions, so I added
`#' @import dplyr`
To my function and which generated a namespace which looks like this:
```
`# Generated by roxygen2 (4.1.1): do not edit by hand
export(process_text)
export(quick_match)
import(dplyr)`
```
But then when I load the package using `devtools::load_all()` I get an error:
>
> the dplyr functions are not availiable.
>
>
>
What am I doing wrong? | 2015/09/10 | ['https://Stackoverflow.com/questions/32505666', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1499416/'] | You also need to import it in your DESCRIPTION file. Something like this:
```
Package: <name>
Version: <version>
Date: <date>
Title: <title>
Author: <author>
Maintainer: <maintainer>
Depends:
R (>= 2.13.0)
Imports:
dplyr
Description: <description>
License: GPL (>= 2)
``` | Turns out that you need the package to be listed in the Depends as well as the Imports section of the DESCRIPTION file. The following resolved the issue for me.
```
Package: stringmatch
Title: Q-Gram filtering for approximate string matching
Version: 0.0.0.9000
Authors@R:
Description: An implementation of q-gram filtering for fast levenstein distance matching
Depends:R (>= 3.2.2),
dplyr
Imports:
dplyr,
``` |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | ```
/**
* Change the view's z order in the tree, so it's on top of other sibling
* views. This ordering change may affect layout, if the parent container
* uses an order-dependent layout scheme (e.g., LinearLayout). Prior
* to {@link android.os.Build.VERSION_CODES#KITKAT} this
* method should be followed by calls to {@link #requestLayout()} and
* {@link View#invalidate()} on the view's parent to force the parent to redraw
* with the new child ordering.
*
* @see ViewGroup#bringChildToFront(View)
*/
public void bringToFront() {
if (mParent != null) {
mParent.bringChildToFront(this);
}
}
```
according to this I was simply missing the line
```
((View)myView.getParent()).requestLayout();
```
and it worked! | According to this I was simply missing the line
This Simple line work for you
```
yourView.bringToFront();
``` |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | I tried all that. A RelativeLayout was supposed to be on top of a Button but it just didn't want to obey.
In the end I solved it by adding `android:elevation="2dp"` to the RelativeLayout.
The elevation value is only used in API level 21 and higher. In my case everything below the API level 21 was fine and everything above wasn't.
Hope this might help someone :) | I hope this will be useful for somebody.
None of the above solutions worked for me. Why? Because my view that I wanted to be in the frond had an elevation smaller than other view. So the view with bigger elevation was always in front, no matter what. |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | I tried all that. A RelativeLayout was supposed to be on top of a Button but it just didn't want to obey.
In the end I solved it by adding `android:elevation="2dp"` to the RelativeLayout.
The elevation value is only used in API level 21 and higher. In my case everything below the API level 21 was fine and everything above wasn't.
Hope this might help someone :) | For Api's 21 or above There is an xml attribute known as `translateZ` which lets you define the elevation level on the view.
You can pretty much use that too.
>
> android:translateZ="30dp"
>
>
>
\*APIs >=21 |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | For Api's 21 or above There is an xml attribute known as `translateZ` which lets you define the elevation level on the view.
You can pretty much use that too.
>
> android:translateZ="30dp"
>
>
>
\*APIs >=21 | According to this I was simply missing the line
This Simple line work for you
```
yourView.bringToFront();
``` |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | ```
/**
* Change the view's z order in the tree, so it's on top of other sibling
* views. This ordering change may affect layout, if the parent container
* uses an order-dependent layout scheme (e.g., LinearLayout). Prior
* to {@link android.os.Build.VERSION_CODES#KITKAT} this
* method should be followed by calls to {@link #requestLayout()} and
* {@link View#invalidate()} on the view's parent to force the parent to redraw
* with the new child ordering.
*
* @see ViewGroup#bringChildToFront(View)
*/
public void bringToFront() {
if (mParent != null) {
mParent.bringChildToFront(this);
}
}
```
according to this I was simply missing the line
```
((View)myView.getParent()).requestLayout();
```
and it worked! | If the parent view is a relativelayout, then it might work or it might not work. I tried `bringToFront`, `requestLayout`, and `removeView; addView`, but no luck. My solution was to put everything inside a framelayout. What I needed on top was moved the buttom of the framelayout with visibility invisible, and then in code it was made visible. |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | I hope this will be useful for somebody.
None of the above solutions worked for me. Why? Because my view that I wanted to be in the frond had an elevation smaller than other view. So the view with bigger elevation was always in front, no matter what. | For Api's 21 or above There is an xml attribute known as `translateZ` which lets you define the elevation level on the view.
You can pretty much use that too.
>
> android:translateZ="30dp"
>
>
>
\*APIs >=21 |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | I hope this will be useful for somebody.
None of the above solutions worked for me. Why? Because my view that I wanted to be in the frond had an elevation smaller than other view. So the view with bigger elevation was always in front, no matter what. | According to this I was simply missing the line
This Simple line work for you
```
yourView.bringToFront();
``` |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | ```
/**
* Change the view's z order in the tree, so it's on top of other sibling
* views. This ordering change may affect layout, if the parent container
* uses an order-dependent layout scheme (e.g., LinearLayout). Prior
* to {@link android.os.Build.VERSION_CODES#KITKAT} this
* method should be followed by calls to {@link #requestLayout()} and
* {@link View#invalidate()} on the view's parent to force the parent to redraw
* with the new child ordering.
*
* @see ViewGroup#bringChildToFront(View)
*/
public void bringToFront() {
if (mParent != null) {
mParent.bringChildToFront(this);
}
}
```
according to this I was simply missing the line
```
((View)myView.getParent()).requestLayout();
```
and it worked! | I hope this will be useful for somebody.
None of the above solutions worked for me. Why? Because my view that I wanted to be in the frond had an elevation smaller than other view. So the view with bigger elevation was always in front, no matter what. |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | I hope this will be useful for somebody.
None of the above solutions worked for me. Why? Because my view that I wanted to be in the frond had an elevation smaller than other view. So the view with bigger elevation was always in front, no matter what. | If the parent view is a relativelayout, then it might work or it might not work. I tried `bringToFront`, `requestLayout`, and `removeView; addView`, but no luck. My solution was to put everything inside a framelayout. What I needed on top was moved the buttom of the framelayout with visibility invisible, and then in code it was made visible. |
25,306,180 | I want to change z order of some views during animation
On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.
This is what i am trying.
```
myView.bringToFront();
((View)myView.getParent()).invalidate();
```
How to make it work on older devices ? | 2014/08/14 | ['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/'] | If the parent view is a relativelayout, then it might work or it might not work. I tried `bringToFront`, `requestLayout`, and `removeView; addView`, but no luck. My solution was to put everything inside a framelayout. What I needed on top was moved the buttom of the framelayout with visibility invisible, and then in code it was made visible. | According to this I was simply missing the line
This Simple line work for you
```
yourView.bringToFront();
``` |
17,133,430 | I have a UTF-8 text file which starts with this line:
```
<HEAD><META name=GENERATOR content="MSHTML 10.00.9200.16521"><body>
```
When I read this file with `TFile.ReadAllText` with TEncoding.UTF8:
```
MyStr := TFile.ReadAllText(ThisFileNamePath, TEncoding.UTF8);
```
then the first 3 characters of the text file are omitted, so MyStr results in:
```
'AD><META name=GENERATOR content="MSHTML 10.00.9200.16521"><body>...'
```
However, when I read this file with `TFile.ReadAllText` without TEncoding.UTF8:
```
MyStr := TFile.ReadAllText(ThisFileNamePath);
```
then the file is read completely and correctly:
```
<HEAD><META name=GENERATOR content="MSHTML 10.00.9200.16521"><body>...
```
Does `TFile.ReadAllText` have a bug? | 2013/06/16 | ['https://Stackoverflow.com/questions/17133430', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1580348/'] | The first three bytes are skipped because the RTL code assumes that the file contains a UTF-8 BOM. Clearly your file does not.
The `TUTF8Encoding` class implements a `GetPreamble` method that specifies the `UTF-8` BOM. And `ReadAllBytes` skips the preamble specified by the encoding that you pass.
One simple solution would be to read the file into a byte array and then use `TEncoding.UTF8.GetString` to decode it into a string.
```
var
Bytes: TBytes;
Str: string;
....
Bytes := TFile.ReadAllBytes(FileName);
Str := TEncoding.UTF8.GetString(Bytes);
```
An more comprehensive alternative would be to make a `TEncoding` instance that ignored the UTF-8 BOM.
```
type
TUTF8EncodingWithoutBOM = class(TUTF8Encoding)
public
function Clone: TEncoding; override;
function GetPreamble: TBytes; override;
end;
function TUTF8EncodingWithoutBOM.Clone: TEncoding;
begin
Result := TUTF8EncodingWithoutBOM.Create;
end;
function TUTF8EncodingWithoutBOM.GetPreamble: TBytes;
begin
Result := nil;
end;
```
Instantiate one of these (you only need one instance per process) and pass it to `TFile.ReadAllText`.
The advantage of using a singleton instance of `TUTF8EncodingWithoutBOM` is that you can use it anywhere that expects a `TEncoding`. | Actually the value you pass to ReadAllText is not the Default Encoding (when you check how it's implemented), it's an enforced encoding if you pass something other than Nil. Internally it calls other method of TEncoding that does have an extra default encoding parameter (for when the foundEncoding var parameter is set to nil and no encoding could be detected)
I was trying to make methods to work with Stream, based on the TFile.ReadAllText code and ended up with this, note the "DefaultEncoding=nil" (=nil so that no extra overloaded method needed) I use and the "ForceDefaultEncoding=false" (to say we always want to use that encoding)
```
function ReadAllBytes(const Stream: TStream): TBytes;
begin
var LFileSize := Stream.Size;
{$IFDEF CPU32BITS}
if LFileSize > MaxInt then
raise EInOutError.CreateRes(@SFileTooLong);
{$ENDIF}
SetLength(Result, LFileSize);
Stream.ReadBuffer(result, Length(result));
end;
function ReadAllText(const Stream: TStream; const DefaultEncoding: TEncoding = nil; const ForceDefaultEncoding: Boolean = false): string;
var FoundEncoding: TEncoding;
begin
if ForceDefaultEncoding then
FoundEncoding := DefaultEncoding;
var Buff := ReadAllBytes(Stream);
var BOMLength := TEncoding.GetBufferEncoding(Buff, FoundEncoding, DefaultEncoding);
result := FoundEncoding.GetString(Buff, BOMLength, Length(Buff) - BOMLength);
end;
``` |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | You do not need to use milestones to show the task relationships. In your schedule, once you have determined the sequence of work, based on BOTH hard and soft logic, link them. Link them using FS, SS, FF, with the appropriate leads and lags as appropriate. Baseline it and go.
This should provide you with the control you need. | I tend to use milestones to mark key meetings or approvals of work. If there is some sort of formal cut-over process, make it a milestone. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | I've used (and like) a section at the top of the schedule for milestones. This keeps the key milestones visible and easily reportable.
If you really want to use milestones to show links between teams, I would suggest first that the teams -really- be separate teams and not just different roles. For teams that each manage their own schedule, I have found milestone linking like you are describing moderately helpful. Here is how I have done it
Warning - this requires a -ton- of overhead to maintain, I strongly suggest you really understand why this level of tracking is needed...
Give each team their own project file. Each project file has three major "sections"
* **Published Milestones** - List of milestones from the local schedule file that are reported up and to other projects
* **External Milestones** -List of milestones from other teams or external sources.
* **Schedule** - where the actual tasks are for the team
You then control a master schedule that takes each team's schedule and "creates the links" between their milestones. That is, you need to use the "Published Milestones" to drive the "External Milestones" across all of the teams' project files. This is time consuming and for five teams takes a good few days to set up, plus the communication needed to ensure everyone understands the structure.
Each week (or whatever your timeframe is for managing the schedule) you need to pull in the teams' projects into the master, observe the links changing, and resolve the issues.
Again, I can't stress enough that this requires a -huge- commitment to the project schedule. I wouldn't attempt this without some of the teams each having their own PM who understands this and can help you work with it.
If you can live without a Gantt chart, you might just keep a list of Excel milestones that can be used to communicate across the teams and trust each team to update the milestone list. This gives you 90% of the benefit with 2% of the effort. | I tend to use milestones to mark key meetings or approvals of work. If there is some sort of formal cut-over process, make it a milestone. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | Actually, I like how you're planning it. I think part of the problem is that you're now focusing on the aesthetics of the gantt chart as opposed to what it's being used for. Who cares if it 'looks' cluttered? The only real question is - does it make sense to you, and can you quickly and easily see and find the information you need? | I tend to use milestones to mark key meetings or approvals of work. If there is some sort of formal cut-over process, make it a milestone. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | You do not need to use milestones to show the task relationships. In your schedule, once you have determined the sequence of work, based on BOTH hard and soft logic, link them. Link them using FS, SS, FF, with the appropriate leads and lags as appropriate. Baseline it and go.
This should provide you with the control you need. | How about tracking deliveries between teams and as a separate list? This list would be managed by the program office. Each party would need to mutually agree upon what each delivery will contain and when it will be made. Once they sign up these agreements would be as binding as schedule milestones. This list would be used in addition to a master schedule - it does not replace a schedule.
The number and status of these hand-offs also makes a useful metric. The practice provides teams a way to ask for and get attention for things they need from one another. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | I've used (and like) a section at the top of the schedule for milestones. This keeps the key milestones visible and easily reportable.
If you really want to use milestones to show links between teams, I would suggest first that the teams -really- be separate teams and not just different roles. For teams that each manage their own schedule, I have found milestone linking like you are describing moderately helpful. Here is how I have done it
Warning - this requires a -ton- of overhead to maintain, I strongly suggest you really understand why this level of tracking is needed...
Give each team their own project file. Each project file has three major "sections"
* **Published Milestones** - List of milestones from the local schedule file that are reported up and to other projects
* **External Milestones** -List of milestones from other teams or external sources.
* **Schedule** - where the actual tasks are for the team
You then control a master schedule that takes each team's schedule and "creates the links" between their milestones. That is, you need to use the "Published Milestones" to drive the "External Milestones" across all of the teams' project files. This is time consuming and for five teams takes a good few days to set up, plus the communication needed to ensure everyone understands the structure.
Each week (or whatever your timeframe is for managing the schedule) you need to pull in the teams' projects into the master, observe the links changing, and resolve the issues.
Again, I can't stress enough that this requires a -huge- commitment to the project schedule. I wouldn't attempt this without some of the teams each having their own PM who understands this and can help you work with it.
If you can live without a Gantt chart, you might just keep a list of Excel milestones that can be used to communicate across the teams and trust each team to update the milestone list. This gives you 90% of the benefit with 2% of the effort. | You do not need to use milestones to show the task relationships. In your schedule, once you have determined the sequence of work, based on BOTH hard and soft logic, link them. Link them using FS, SS, FF, with the appropriate leads and lags as appropriate. Baseline it and go.
This should provide you with the control you need. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | You do not need to use milestones to show the task relationships. In your schedule, once you have determined the sequence of work, based on BOTH hard and soft logic, link them. Link them using FS, SS, FF, with the appropriate leads and lags as appropriate. Baseline it and go.
This should provide you with the control you need. | Actually, I like how you're planning it. I think part of the problem is that you're now focusing on the aesthetics of the gantt chart as opposed to what it's being used for. Who cares if it 'looks' cluttered? The only real question is - does it make sense to you, and can you quickly and easily see and find the information you need? |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | I've used (and like) a section at the top of the schedule for milestones. This keeps the key milestones visible and easily reportable.
If you really want to use milestones to show links between teams, I would suggest first that the teams -really- be separate teams and not just different roles. For teams that each manage their own schedule, I have found milestone linking like you are describing moderately helpful. Here is how I have done it
Warning - this requires a -ton- of overhead to maintain, I strongly suggest you really understand why this level of tracking is needed...
Give each team their own project file. Each project file has three major "sections"
* **Published Milestones** - List of milestones from the local schedule file that are reported up and to other projects
* **External Milestones** -List of milestones from other teams or external sources.
* **Schedule** - where the actual tasks are for the team
You then control a master schedule that takes each team's schedule and "creates the links" between their milestones. That is, you need to use the "Published Milestones" to drive the "External Milestones" across all of the teams' project files. This is time consuming and for five teams takes a good few days to set up, plus the communication needed to ensure everyone understands the structure.
Each week (or whatever your timeframe is for managing the schedule) you need to pull in the teams' projects into the master, observe the links changing, and resolve the issues.
Again, I can't stress enough that this requires a -huge- commitment to the project schedule. I wouldn't attempt this without some of the teams each having their own PM who understands this and can help you work with it.
If you can live without a Gantt chart, you might just keep a list of Excel milestones that can be used to communicate across the teams and trust each team to update the milestone list. This gives you 90% of the benefit with 2% of the effort. | How about tracking deliveries between teams and as a separate list? This list would be managed by the program office. Each party would need to mutually agree upon what each delivery will contain and when it will be made. Once they sign up these agreements would be as binding as schedule milestones. This list would be used in addition to a master schedule - it does not replace a schedule.
The number and status of these hand-offs also makes a useful metric. The practice provides teams a way to ask for and get attention for things they need from one another. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | Actually, I like how you're planning it. I think part of the problem is that you're now focusing on the aesthetics of the gantt chart as opposed to what it's being used for. Who cares if it 'looks' cluttered? The only real question is - does it make sense to you, and can you quickly and easily see and find the information you need? | How about tracking deliveries between teams and as a separate list? This list would be managed by the program office. Each party would need to mutually agree upon what each delivery will contain and when it will be made. Once they sign up these agreements would be as binding as schedule milestones. This list would be used in addition to a master schedule - it does not replace a schedule.
The number and status of these hand-offs also makes a useful metric. The practice provides teams a way to ask for and get attention for things they need from one another. |
2,109 | **Background**
I'm building a project Gantt, involving multiple teams. In the past I've had a good experience with a Gantt as a means of planning a project but not so much as a means of tracking a project's progress.
I'm trying to figure out what would be the best way to reflect the integration points and dependencies between teams and then track it as easily as possible.
**Current approach**
Right now, what I have in mind is creating tasks for teams' activities and after each task that indicates a delivery to another team I creating a milestone, with the task as its predecessor. The receiving team's task depends on the milestone.
Example:
```
==== [Team A develops]
+-> * [Team A development complete]
+-> ==== [Team B develops]
```
The downside of this approach is that the Gantt gets cluttered with a lot of milestones. The upside is that I get more control down the road around team delivery tracking and an easier way to filter the deliveries of each of the teams. Also, a side benefit is to avoid messing with weird task updates, splits, etc. I would ask for updates to estimated delivery dates.
I'd be happy to hear your thoughts and ideas around this issue. How would you approach this? | 2011/05/08 | ['https://pm.stackexchange.com/questions/2109', 'https://pm.stackexchange.com', 'https://pm.stackexchange.com/users/44/'] | I've used (and like) a section at the top of the schedule for milestones. This keeps the key milestones visible and easily reportable.
If you really want to use milestones to show links between teams, I would suggest first that the teams -really- be separate teams and not just different roles. For teams that each manage their own schedule, I have found milestone linking like you are describing moderately helpful. Here is how I have done it
Warning - this requires a -ton- of overhead to maintain, I strongly suggest you really understand why this level of tracking is needed...
Give each team their own project file. Each project file has three major "sections"
* **Published Milestones** - List of milestones from the local schedule file that are reported up and to other projects
* **External Milestones** -List of milestones from other teams or external sources.
* **Schedule** - where the actual tasks are for the team
You then control a master schedule that takes each team's schedule and "creates the links" between their milestones. That is, you need to use the "Published Milestones" to drive the "External Milestones" across all of the teams' project files. This is time consuming and for five teams takes a good few days to set up, plus the communication needed to ensure everyone understands the structure.
Each week (or whatever your timeframe is for managing the schedule) you need to pull in the teams' projects into the master, observe the links changing, and resolve the issues.
Again, I can't stress enough that this requires a -huge- commitment to the project schedule. I wouldn't attempt this without some of the teams each having their own PM who understands this and can help you work with it.
If you can live without a Gantt chart, you might just keep a list of Excel milestones that can be used to communicate across the teams and trust each team to update the milestone list. This gives you 90% of the benefit with 2% of the effort. | Actually, I like how you're planning it. I think part of the problem is that you're now focusing on the aesthetics of the gantt chart as opposed to what it's being used for. Who cares if it 'looks' cluttered? The only real question is - does it make sense to you, and can you quickly and easily see and find the information you need? |
354,242 | I want to `\foreach` on a list and create task (via package [`tasks`](https://www.ctan.org/pkg/tasks)) inside a question. A MWE:
```
\documentclass{article}
\usepackage[magyar]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{t1enc}
\usepackage{exsheets}
\usepackage{pgffor}
\usepackage{fp}
\def\pontlist{
2/3/1/4/,
5/1/-4/3/,
2/7/11/10/,
4/-3/5/7/,
-4/4/5/-7/,
-4/-4/4/4/,
3/7/-3/10/,
-1/-2/3/4/,
-1/3/-2/1/
}
\newcommand{\felezopont}[4]{
\FPeval{\resx}{round( ( (#1)+(#3) )/2,1)}
\FPeval{\resy}{round( ( (#2)+(#4) )/2,1)}
\task $A(#1;#2)$, $B(#3;#4)$
{$(\resx;\resy)$}
}
\begin{document}
\begin{question}
Határozd meg a következő pontpárok felezőpontját!
\begin{tasks}
\foreach \ax/\ay/\bx/\by in \pontlist {
\felezopont{\ax}{\ay}{\bx}{\by}
}
\end{tasks}
\end{question}
\end{document}
```
Without `\begin{tasks} ... \end{tasks}` works well but the use of `tasks` environment causes an error:
```
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.33 \end{question}
```
What do I use wrong? | 2017/02/16 | ['https://tex.stackexchange.com/questions/354242', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/8836/'] | It is a question of whether your text font has such a character. If you look in the log file you will find
>
> `Missing character: There is no π (U+03C0) in font [lmroman12-regular]:+tlig;!`
>
>
>
In your case pi represents a mathematical entity and in normal text with unicode input you can use
```
This is $π$.
```
if you load the package `unicode-math`.
The `siunitx` package provides a direct interpretation of `\pi` in numbers so you can write
```
\SI{\pi/2}{\radian}
```
If you insert the pi character, even with `unicode-math` it will complain with
>
> `! Invalid token 'π' in numerical input.`
>
>
>
in the log file. | This typesets pi and gives an error message when using \SI. SI does not recognize pi as the number 3.14159....
```
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\setmainfont{DejaVu Serif}
\usepackage{siunitx} %Einheiten
\begin{document}
This is π.
\SI{π/2}{\radian} %Here latex hangs up
\end{document}
``` |
354,242 | I want to `\foreach` on a list and create task (via package [`tasks`](https://www.ctan.org/pkg/tasks)) inside a question. A MWE:
```
\documentclass{article}
\usepackage[magyar]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{t1enc}
\usepackage{exsheets}
\usepackage{pgffor}
\usepackage{fp}
\def\pontlist{
2/3/1/4/,
5/1/-4/3/,
2/7/11/10/,
4/-3/5/7/,
-4/4/5/-7/,
-4/-4/4/4/,
3/7/-3/10/,
-1/-2/3/4/,
-1/3/-2/1/
}
\newcommand{\felezopont}[4]{
\FPeval{\resx}{round( ( (#1)+(#3) )/2,1)}
\FPeval{\resy}{round( ( (#2)+(#4) )/2,1)}
\task $A(#1;#2)$, $B(#3;#4)$
{$(\resx;\resy)$}
}
\begin{document}
\begin{question}
Határozd meg a következő pontpárok felezőpontját!
\begin{tasks}
\foreach \ax/\ay/\bx/\by in \pontlist {
\felezopont{\ax}{\ay}{\bx}{\by}
}
\end{tasks}
\end{question}
\end{document}
```
Without `\begin{tasks} ... \end{tasks}` works well but the use of `tasks` environment causes an error:
```
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.33 \end{question}
```
What do I use wrong? | 2017/02/16 | ['https://tex.stackexchange.com/questions/354242', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/8836/'] | It is a question of whether your text font has such a character. If you look in the log file you will find
>
> `Missing character: There is no π (U+03C0) in font [lmroman12-regular]:+tlig;!`
>
>
>
In your case pi represents a mathematical entity and in normal text with unicode input you can use
```
This is $π$.
```
if you load the package `unicode-math`.
The `siunitx` package provides a direct interpretation of `\pi` in numbers so you can write
```
\SI{\pi/2}{\radian}
```
If you insert the pi character, even with `unicode-math` it will complain with
>
> `! Invalid token 'π' in numerical input.`
>
>
>
in the log file. | TeX only loops if you respond to the error message
```
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! siunitx error: "invalid-token-in-number"
!
! Invalid token 'π' in numerical input.
!
! See the siunitx documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.7 \SI{π/2}{\radian}
%Here latex hangs up
?
```
with a return and then do the same again on the following error. (Or equivalently if you choose to run in scrollmode automatically ignoring all errors)
If you do carry on it eventually will end up expanding `\q_no_value` which expands to itself and tex then loops. (You should never reach such a "quark" in an error free document, but after an error more or less any behaviour is possible). |
23,231,397 | I want to find out which widget is in a given direction in GTK+, i.e. doing what the "move-focus" signal does, but without actually changing the focus. What I have in mind is a function that takes a GtkWidget \* and a GtkDirectionType and returns the GtkWidget in the given direction (if any).
What I want this for is to ultimately enumerate the widgets inside a specific GtkFrame in my UI definition, in order from left to right. I.e. basically create a list of widgets from leftmost to rightmost, inside my GtkFrame (or in the general case, inside any container).
I've tried to search the GTK documentation but haven't found anything that doesn't also change focus. | 2014/04/22 | ['https://Stackoverflow.com/questions/23231397', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3332264/'] | Failing any other approach, the way I'm going forward with is to copy a selected set of static functions from the library implementation of GtkContainer and put them in a file in my own application, modifying them to suit my needs.
More specifically, the function gtk\_container\_focus\_sort\_left\_right() and any local functions that it depends on. This includes the GCompareFunc left\_right\_compare() and get\_allocation\_coords(). | Assuming the directions you care about are "Forward" and "Backward", it sounds like you want to use [`gtk_container_get_focus_chain()`](https://developer.gnome.org/gtk3/stable/GtkContainer.html#gtk-container-get-focus-chain) on the frame: it does pretty much what it says on the tin: you get a list of widgets in order of focus when tabbing. |
41,768,980 | I'm currently using SQL server 2008 R2(SP1) and SQL server 2008 (SP3) and the applications using these servers are storing the credentials in a plain text json file. My issue is I need to store user credentials as access is only allowed to authorized users.
How should I go about this? Could I sub out the credentials with the hashed version? | 2017/01/20 | ['https://Stackoverflow.com/questions/41768980', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5537602/'] | You can create alert window outside your application by using WindowManager api
[What is WindowManager in android?](https://stackoverflow.com/questions/19846541/what-is-windowmanager-in-android)
Code Snippet
```
WindowManager.LayoutParams p = new WindowManager.LayoutParams(
// Shrink the window to wrap the content rather than filling the screen
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
// Display it on top of other application windows, but only for the current user
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
// Don't let it grab the input focus
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
// Make the underlying application window visible through any transparent parts
PixelFormat.TRANSLUCENT);
// Define the position of the window within the screen
p.gravity = Gravity.TOP | Gravity.RIGHT;
p.x = 0;
p.y = 100;
WindowManager windowManager = (WindowManager)getSystemService(WINDOW_SERVICE);
windowManager.addView(myView, p);
```
Add this to manifest
`<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>`
For Auto close message you can use handler to dimiss after delta of time. | make a consistent alarm manager service class, and research on alert.dialogue activity. After displaying message through box check this link below
[Execute function after 5 seconds in Android](https://stackoverflow.com/questions/31041884/execute-function-after-5-seconds-in-android)
and call finish(); function to close your message box. |
15,210,996 | I am getting the result set from the controller to the jsp page where I have a table.
I inserted all the data coming from resultset to the of that table.
**The problem I am having is that data is coming in only one column.** What I want to do is just limit the data to 5 in each column (5 in col 1, 5 in col 2, 5 in col3 of the same row).
Associated ID's:
```
AKR
AK
AKRBS
AKRB
AKBS
AKRB
AKRBS
AKRBSW
AK
AKRE
```
and so on..... | 2013/03/04 | ['https://Stackoverflow.com/questions/15210996', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1847801/'] | The syntax error is irrelevant in the long run.
In Android your *must* start an Activity with an Intent. (See [this Developer's Guide article](https://developer.android.com/guide/components/activities.html#StartingAnActivity).) When you want to start Game use:
```
Intent intent = new Intent(this, Game.class);
startActivity(intent);
```
---
Also you declare `KEY_DIFFICULTY` as `final` (unchangeable):
```
public static final String KEY_DIFFICULTY = "org.example.sudoku.difficulty";
```
So your if-else block will never be true in any of these cases:
```
if (KEY_DIFFICULTY == String.valueOf(1))
```
*And* to compare Strings in Java you *must* use `equals()`, `==` will give inaccurate results. ([How do I compare strings in Java?](https://stackoverflow.com/q/513832/1267661))
---
If you want to pass the level of difficulty from one Activity to another use the Intent's extras, a `public` class variable, or another approach found in: [How do I pass data between Activities in Android application?](https://stackoverflow.com/q/2091465/1267661)
---
**Addition**
You just added more code to your question and you have circular logic.
```
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- ...
```
This will only stop when your app throws a StackOverflowException. | ```
number = num.Game(value);
```
I don't see a method `Game(int value)` in your `Game` class. You need to create this method in your class:
```
public int Game(int value){
//code
}
```
I am also not sure you can name a method the same name as your class. I assume the fact it has a return value in the signature, it would be valid, but it would be bad practice to have a method name the same as your class anyway. |
15,210,996 | I am getting the result set from the controller to the jsp page where I have a table.
I inserted all the data coming from resultset to the of that table.
**The problem I am having is that data is coming in only one column.** What I want to do is just limit the data to 5 in each column (5 in col 1, 5 in col 2, 5 in col3 of the same row).
Associated ID's:
```
AKR
AK
AKRBS
AKRB
AKBS
AKRB
AKRBS
AKRBSW
AK
AKRE
```
and so on..... | 2013/03/04 | ['https://Stackoverflow.com/questions/15210996', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1847801/'] | The syntax error is irrelevant in the long run.
In Android your *must* start an Activity with an Intent. (See [this Developer's Guide article](https://developer.android.com/guide/components/activities.html#StartingAnActivity).) When you want to start Game use:
```
Intent intent = new Intent(this, Game.class);
startActivity(intent);
```
---
Also you declare `KEY_DIFFICULTY` as `final` (unchangeable):
```
public static final String KEY_DIFFICULTY = "org.example.sudoku.difficulty";
```
So your if-else block will never be true in any of these cases:
```
if (KEY_DIFFICULTY == String.valueOf(1))
```
*And* to compare Strings in Java you *must* use `equals()`, `==` will give inaccurate results. ([How do I compare strings in Java?](https://stackoverflow.com/q/513832/1267661))
---
If you want to pass the level of difficulty from one Activity to another use the Intent's extras, a `public` class variable, or another approach found in: [How do I pass data between Activities in Android application?](https://stackoverflow.com/q/2091465/1267661)
---
**Addition**
You just added more code to your question and you have circular logic.
```
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- When you create RandomMathQuestionGenerator object, you will create a Game object
- When you create Game object, you will create a RandomMathQuestionGenerator object
- ...
```
This will only stop when your app throws a StackOverflowException. | Case - In `<init>`
------------------
Here's my modified proposed code for `RandomMathQuestionGenerator`:
```
public class RandomMathQuestionGenerator {
private Game num;
private int number;
public RandomMathQuestionGenerator() {
num = new Game();
number = num.value;
// Existing code here
}
// Existing code here
}
```
Case - In method code
---------------------
```
Game num = new Game();
int number = num.value;
```
Here's what's wrong:
* `public Game` - `public` is a *field* modifier, not a *variable* modifier, and is invalid in the middle of method code. Note that `final` is a valid modifier - it means that re-assigning the variable is a compile error.
* Creating number with a placeholder value, then assigning to it - that `0` will never be used
* num does not have a method Game, and value is not defined in this code. value is a property of Game objects, of which num is one. I **strongly** recommend renaming this variable - maybe `gameInst` would work.
Summary
-------
(in progress) |
15,136,935 | What will be the C++ equivalemt command for below mentioned php command:
```
$command = shell_exec("sqlldr {$connect_string} control={$ctl_file_name} log={$log_file_name}");
``` | 2013/02/28 | ['https://Stackoverflow.com/questions/15136935', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2107491/'] | So based on your comments a solution that would work would be to use popen(3):
```
#include <cstdio>
#include <iostream>
#include <string>
int main()
{
// Set file names based on your input etc... just using dummies below
std::string
ctrlFileName = "file1",
logFileName = "file2",
cmd = "sqlldr usr/pwd@LT45 control=" + ctrlFileName + " log=" + logFileName ;
std::cout << "Executing Command: " << cmd << std::endl ;
FILE* pipe = popen(cmd.c_str(), "r");
if (pipe == NULL)
{
return -1;
}
char buffer[128];
std::string result = "";
while(!feof(pipe))
{
if(fgets(buffer, 128, pipe) != NULL)
{
result += buffer;
}
}
std::cout << "Results: " << std::endl << result << std::endl ;
pclose(pipe);
}
``` | Try `forkpty`, you get a file descriptor which you can use to read from the other pseudoterminal. |
1,731,818 | This is one of those "there's gotta be a better way" questions. Let me set up the problem, then I'll give you my hacked solution, and perhaps you can suggest a better solution. Thanks!
Lets take this little tidbit of PL/SQL
```
DECLARE
TYPE foo_record IS RECORD (foo%type, bar%type);
TYPE foo_records IS TABLE OF foo_record INDEX BY PLS_INTEGER;
arr_foos foo_records;
CURSOR monkeys is SELECT primates FROM zoo;
row_monkey monkeys%rowtype;
BEGIN
FOR row_monkey IN monkeys loop
/*
at this point in each iteration I need to have the associative array
arr_foos in its original state. if this were java, I'd declare it
right here and its scope would be limited to this iteration. However,
this is not java, so the scope of the array is effectively global and
I can't have one iteration's data meddle with the next.
*/
null;
END LOOP;
END;
```
Does that make sense? I basically need to reset it to something. If it was a number that starts at zero, I could just say number:=0; at the top of every iteration and be done with it. But this is not a number, it's a type that I can just reset with a clean :=0.
Anyway, onto my hack:
```
DECLARE
TYPE foo_record IS RECORD (foo%type, bar%type);
TYPE foo_records IS TABLE OF foo_record INDEX BY PLS_INTEGER;
arr_foos foo_records;
arr_foos_reset foo_records;
CURSOR monkeys is SELECT primates FROM zoo;
row_monkey monkeys%rowtype;
BEGIN
FOR row_monkey IN monkeys loop
arr_foos := arr_foos_reset;
null;
END LOOP;
END;
```
I figured that if I can manage to preserve a member of the same type in an original state, then I can just set the working variable back to whatever the value is of the original. And, surprisingly enough, it works (I think.) But there's gotta be a better way. Can anyone help?
T'anks! | 2009/11/13 | ['https://Stackoverflow.com/questions/1731818', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1181/'] | The easiest way:
```
arr_foos.Delete();
```
Other way is to declare the variable inside the `FOR` loop. This way it will be recreated for each pass.
Like this:
```
DECLARE
TYPE foo_record IS RECORD (foo%type, bar%type);
TYPE foo_records IS TABLE OF foo_record INDEX BY PLS_INTEGER;
CURSOR monkeys is SELECT primates FROM zoo;
row_monkey monkeys%rowtype;
BEGIN
FOR row_monkey IN monkeys loop
DECLARE
arr_foos foo_records;
BEGIN
null;
END;
END LOOP;
END;
``` | Are you going to read data from zoo table into a collection? Then there's a better way:
```
DECLARE
type foos_ts is table of zoo.foo%type index by pls_integer;
foos foos_t;
BEGIN
select foo
bulk collect into foos
from zoo;
...
END;
```
Bulk collect automatically clears the collection before fetching, and it works faster then reading row-by-row in loop. Unfortunately, it does'n work with records, so you'll need several PL/SQL tables for each of field.
You can find additional information here: [Retrieving Query Results into Collections with the BULK COLLECT Clause](http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#28329) |
23,235,122 | I'm making Json format data editor with Qt treeview and Qt Json support.
I wanna pass QJsonObject or QJsonArray reference parameter to function.
This works:
```
void makeJsonData(QJsonObject &obj) {
obj.insert("key", 1234);
}
//call makeJsonData()
QJsonObject jobj;
makeJsonData(jobj);
int keysize = jobj.keys().size(); //1, OK.
```
But not with this:
```
//QJsonValue, because it can handle both QJsonObject and QJsonArray
void makeJsonData(QJsonValue &obj) {
obj.toObject().insert("key", 1234); //obj is QJsonObject
}
//call makeJsonData()
QJsonObject jobj;
makeJsonData(QJsonValue::fromVariant(jobj)); //fromVariant() to cast QJsonObject to QJsonValue
int keysize = jobj.keys().size(); //0, Fail.
```
It looks like QJsonValue::toObject() just copies parameter..
How can I use reference of both QJsonObject and QJsonArray with one parameter type? | 2014/04/23 | ['https://Stackoverflow.com/questions/23235122', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1391099/'] | There are a couple ways I see to solve your problem:
**Option 1** (as mentioned in my comment)
A dynamic cast can be used like so:
```
bool makeJsonData(void* obj) {
QJsonObject* asObj = dynamic_cast<QJsonObject*>(obj);
QJsonArray* asArray = dynamic_cast<QJsonArray*>(obj);
if (asObj) {
//do what you would if it were an object
}
else if (asArray) {
//do what you would if it were an array
}
else {
//cast fail. Returning false to tell the caller that they passed bad data
//an alternate (probably better) would be to throw an exception
return false;
}
}
```
**Option 2**
I honestly feel that this business with `void*` is the wrong way to do it. Doing `void*` stuff is almost always a code smell (it removes compile-time checks that save us from stepping on their own feet) and in this case I think that the way you are doing this needs work. Also, `dynamic_cast` requires [RTTI](http://en.wikipedia.org/wiki/Run-time_type_information) which may not always be turned on (compiler support, performance issues, etc).
I took a look at the Qt headers on my machine and as far as I can tell, `QJsonObject` and `QJsonArray` don't really inherit from anything, so going down the route of changing the `void*` to a base type in order to keep a semblance of type checking won't quite work.
What I would do would be this:
* Make two separate methods. One for handling arrays and one for handling objects. They have different methods and different things you can do, so this makes sense to me. You could even keep the same name so that they are overloaded.
* Have another method with your common stuff in it. I assume that your function is trying to add some data to either the array or object that is passed. Make a method that *creates* the data (i.e. `QJsonObject createJsonData()`) and call it inside both of your methods mentioned above.
The idea is to keep code repetition down while still preserving type checking. The time you spend making the one extra method to handle both cases could be far less than the time you will spend debugging code after accidentally passing in something to a `void*` pointer that you never meant to pass.
**Option 3**
Alternately, you could use `QJsonValue`, change the return type of the function to `QJsonValue`, and make it return the new object without modifying the original. Further, the `QJsonValue` class has those fun `isArray`/`isObject` methods that you could use to do something like mentioned earlier. An example:
```
QJsonValue makeJsonData(const QJsonValue& val) {
if (val.isObject()) {
QJsonObject obj = val.toObject();
//do your stuff, modifying obj as you please (perhaps calling another method so that this can have less repetition
return QJsonValue(obj);
}
else if (val.isArray()) {
QJsonArray arr = val.toArray();
//do your stuff, modifying arr as you please (perhaps calling another method so that this can have less repetition
return QJsonValue(arr);
}
else {
throw "Invalid Value Type";
}
}
```
I honestly prefer this pattern, but I know there are reasons for going the way you have mentioned such as avoiding gratuitous memory allocations. | You may need to add this:
```
#include <QJsonArray>
``` |
40,441,026 | My bootstrap navbar that i got from the bootstrap jumbotron example won't collapse. If it is that i dont have the right javascript, css or Jquery links pls send me the right ones. I am kinda new to the navbar thing so i really need some help. Thank you!
Here is my code:
```
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".nav-collapse" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../navbar/">Default</a></li>
<li><a href="./">Static top <span class="sr-only">(current)</span></a></li>
<li><a href="../navbar-fixed-top/">Fixed top</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
``` | 2016/11/05 | ['https://Stackoverflow.com/questions/40441026', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6355698/'] | Just figured out, since the object of the shape `(362L,)` is really a pandas series, I just need to change it to dataframe, like this:
```
pd.DataFrame(df)
```
That's it! | use
```
df.iloc[:, 0].apply(pd.Series)
``` |
32,995,441 | So I have a table (table A) with a list of drivers and the races they entered and their finishing position
Fields are
```
Date of race
Driver id
Finishing position
```
I want to create a left join query where I can have the above 3 fields and then then joined on them the previous race that the driver entered and its date , finishing position
So a table that has the headers below…………
```
Date of race | Driver id | Finishing position | prev race date | prev race id | prev finishing position
```
I want it to only return the previous and not races prior to the last race
I want to use the date and or driver id as my variable that I will use to input prior to running query.
Any support or thoughts would be grateful
FYI - i am using SSMS 2008 | 2015/10/07 | ['https://Stackoverflow.com/questions/32995441', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5094247/'] | You could try multiple (say, 1000) values per INSERT:
```
START TRANSACTION;
CREATE TABLE foo (a INTEGER, b STRING);
INSERT INTO foo VALUES (1, 'a'), (2, 'b'), (3, 'c');
COMMIT;
```
But really, bulk load with `COPY INTO` is generally a much better idea... | <https://www.nuget.org/packages/MonetDb.Mapi>
```
int count;
string tableName; // "\"MyTable\""
string columns; // '"' + string.Join("\", \"", columnArray) + '"'
dbCommand.Execute($"COPY {count} RECORDS INTO {tableName} FROM STDIN ({columns}) DELIMITERS ',','\\n','\\'';");
string records; // string.Join('\n', recArrayOfArray.Select(x => string.Join("," x))
dbCommand.Execute(records);
``` |
10,037,932 | I'm trying to access the JSON response from the Bing API using Knockout.js. Below is my javascript code and the corresponding Knockoutjs bindings I'm using in the html. I also included a screenshot of the object I'm trying to access. From the object I need to get Thumbnail.Url and assign that value to the HREF attributes on the page. Can someone spot what I've done wrong? I think the problem is likely in my attr bindings.
JS
```
function bindModel(data) {
var viewModel = ko.mapping.fromJSON(data);
ko.applyBindings(viewModel);
}
$.ajax({
url: fullUri,
type: 'post',
dataType: 'jsonp',
jsonp: true,
jsonpCallback: 'searchDone',
success: function(data, textStatus, jqXHR){
console.log(data);
bindModel(data);
}
})
```
HTML
```
<ul class="thumbnails" data-bind="foreach: Image.Results">
<li class="span2"><img data-bind="attr: {href: Thumbnail.Url}"></img></li>
</ul>
```
CONSOLE SCREENSHOT
![enter image description here](https://i.stack.imgur.com/I6yez.png) | 2012/04/06 | ['https://Stackoverflow.com/questions/10037932', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/549273/'] | Couple of things.
If you are binding the object in your console directly then you will need to be referencing from the property `SearchResponse` since that would be the first property in your viewModel.
Also an image tag is normally self closing, minor gripe, it does however not use `href` instead you should be setting `src`.
The correct markup would be.
```
<ul class="thumbnails" data-bind="foreach: SearchResponse.Image.Results">
<li class="span2"><img data-bind="attr: {src: Thumbnail.Url}" /></li>
</ul>
```
Your use of the mapping plugin I believe should be using fromJS since I'm pretty sure jquery will take care of parsing the json string into an object so your data value is not a raw string anymore at this point.
The correct bind method would therefore be.
```
function bindModel(data) {
viewModel = ko.mapping.fromJS(data);
console.log(viewModel);
ko.applyBindings(viewModel);
}
```
Here's a fiddle.
<http://jsfiddle.net/madcapnmckay/udDGP/>
Hope this helps. | `img` tags use `src` instead of `href`. You would want to do `attr: { src: Thumbnail.Url }` |
40,451,226 | I have one page where I've put three tabs. After clicking on each tab, the related text gets changed. I want to put three images for each of the tab so when a user clicks the tab, the image should get changed.
Sharing the theme link:
<https://www.themographics.com/wordpress/docdirect/>
Here's how the text gets changed on tabs with each click.. Sharing JS
//Swap Titles
```
jQuery(document).on('click','.current-directory',function(){
jQuery(this).parents('ul').find('li').removeClass('active');
jQuery(this).addClass('active');
var dir_name = jQuery(this).data('dir_name');
var id = jQuery(this).data('id');
jQuery(this).parents('.tg-banner-content').find('em.current_directory').html(dir_name);
if( Z_Editor.elements[id] ) {
var load_subcategories = wp.template( 'load-subcategories' );
var data = [];
data['childrens'] = Z_Editor.elements[id];
data['parent'] = dir_name;
var _options = load_subcategories(data);
jQuery( '.subcats' ).html(_options);
}
});
//Prepare Subcatgories
jQuery(document).on('change','.directory_type', function (event) {
var id = jQuery('option:selected', this).attr('id');
var dir_name = jQuery(this).find(':selected').data('dir_name');
if( jQuery( '.dynamic-title' ).length ){
jQuery( '.dynamic-title' ).html(dir_name);
}
if( Z_Editor.elements[id] ) {
var load_subcategories = wp.template( 'load-subcategories' );
var data = [];
data['childrens'] = Z_Editor.elements[id];
data['parent'] = dir_name;
var _options = load_subcategories(data);
jQuery( '.subcats' ).html(_options);
}
});
```
Here's thee CSS which I tried to modify but I'm only able to add one image to the background, which is static. I want to add 3 images that should change with the text.
Here's the CSS
```
.tg-homebanner{position: relative;}
.tg-homebanner figure{
width: 100%;
float: left;
margin: 0;
z-index: 1;
position: relative;
}
.tg-homebanner figure img{
display: block;
width: 100%;
/*min-height: 650px;*/
}
.tg-banner-content{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
background: rgba(0, 0, 0, 0.9);
}
/*Here I've made changes and successfully added a background image, but the problem is I want to put 3 images that should be changed with each click*/
.tg-banner-content .form-searchdoctors .tg-btn{color: #fff;}
.tg-homebanner .tg-searchform .tg-btn{color: #fff;}
.tg-homebanner .tg-location-map{height: 800px;}
.tg-mapbox .tg-location-map{
height: 100%;
position: absolute;
}
.show-search{
position: absolute;
height: 100%;
width: 70px;
right: 0;
top: 0;
background: rgba(0, 0, 0, 0.5);
color: #fff;
font-size: 24px;
text-align: center;
display: none;
cursor: pointer;
}
.show-search i{
position: relative;
top: 50%;
}
```
Here's the changes I've made as mentioned above:
```
.tg-banner-content{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
background: url('URL OF MY IMAGE') center center no-repeat;
background-size: cover;
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-image:linear-gradient(to bottom right,#002f4b,#dc20000);
opacity: 1;
}
```
But it only puts a single background image that doesn't change with clicks. | 2016/11/06 | ['https://Stackoverflow.com/questions/40451226', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5997920/'] | Add the following line to your **.htaccess**, so the server can recognize svg files from your css file (background: url("images/CC\_logo.svg") no-repeat center top;), Insert this line:
```
RewriteRule !\.(js|ico|gif|jpg|jpeg|svg|bmp|png|css|pdf|swf|mp3|mp4|3gp|flv|avi|rm|mpeg|wmv|xml|doc|docx|xls|xlsx|csv|ppt|pptx|zip|rar|mov)$ index.php
```
No need to have so many rules as above but depends on what you need for the format you would like to have on your site, but for your current question here, please make sure there is "**svg**" in the rule of your .htaccess file.
It works, try it! :) | Make sure that your SVG was exported properly. I've found problems with Photoshop images exported as SVGs but I've never had an issue with Illustrator files exported as SVGs. |
66,035,511 | I get the title and the text below when I try and fail to build an .aab file using flutter build appbundle:
>
> java.util.concurrent.ExecutionException: java.lang.RuntimeException: jarsignerfailed with exit code 1 :
> jarsigner: Certificate chain not found for: keystore. keystore must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
>
>
>
I had to reset my signing key. The google developer support had me generate a new .jks file with the following command line which I ran from within my project folder:
```
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
```
He then instructed me to convert this file into a .pem file using this command:
```
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
```
I then emailed him the upload\_certificate.pem file. I immediately noticed that the keystore.jks file was red in the sidebar and I get this upon clicking on it:
"The file 'keystore.jks' is not associated with any file type. Please define the association:"
The .pem file is also red, but clicking on it shows the text that makes up the key.
Do I need to reset the signing key again and do something different? Is there a way to fix the issue causing this error? | 2021/02/03 | ['https://Stackoverflow.com/questions/66035511', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7311347/'] | As dumb as this may sound, I spent 24 hours on this and all I had to was enter `flutter clean` | You have `keyAlias=keystore` in your key.properties while it looks like the alias you created is named `upload` (see in your `keytool export` command).
Repleace with `keyAlias=upload` and that should work if your password is correct. |
728,190 | I am having problem with the find and grep commands. I want to find the files which are `*.doc` and match the pattern `Danish` from that file with grep command. I am using -exec to combine them but it give an error i do not know what is that. It said that the `-exec` argument is missing.
![screen shot](https://i.stack.imgur.com/HWKSw.jpg) | 2016/02/01 | ['https://askubuntu.com/questions/728190', 'https://askubuntu.com', 'https://askubuntu.com/users/500055/'] | You have to escape the `;`:
```
find -iname .... -exec echo {} \;
```
Will do what you want. | Unless you put a backslash before the `;`, the shell will interpret that as a command separator, not as an argument to `find` command. |
135 | What should I be aware of when buying a zoom lens (other than that it will fit my camera)? What specs should I pay close attention to? | 2010/07/15 | ['https://photo.stackexchange.com/questions/135', 'https://photo.stackexchange.com', 'https://photo.stackexchange.com/users/54/'] | One consideration (this is a generalization, but most generalizations are based on some facts) is that usually the longer the zoom range, the quality of the image will suffer. As an example, the mega-zooms (28-300mm for example) will usually result in softer images (especially at either end of the zoom range) than a lens with a narrower zoom range (such as 24-70mm).
In any case, look for real-world reviews and photo samples before making a purchase.
I really like the lens [review section of FredMiranda.com](http://www.fredmiranda.com/reviews/) for getting real-world reviews. | 1. The zoom factor of course
2. Aperture, if aperture value is low you will either be able to take better photo in darkness and/or do blur effect in lower focus distance
3. Min. focus distance, you will not be able to take a correct shoot if subject is closer than this distance
4. Weight depending of your need you might not want something too heavy
Each time you want to buy a lens, try to find some review on Internet ! |
135 | What should I be aware of when buying a zoom lens (other than that it will fit my camera)? What specs should I pay close attention to? | 2010/07/15 | ['https://photo.stackexchange.com/questions/135', 'https://photo.stackexchange.com', 'https://photo.stackexchange.com/users/54/'] | 1. The zoom factor of course
2. Aperture, if aperture value is low you will either be able to take better photo in darkness and/or do blur effect in lower focus distance
3. Min. focus distance, you will not be able to take a correct shoot if subject is closer than this distance
4. Weight depending of your need you might not want something too heavy
Each time you want to buy a lens, try to find some review on Internet ! | If you know someone with the lens you are interested in, or a similar one, borrow and use it if you can. That goes way beyond reviews! |
135 | What should I be aware of when buying a zoom lens (other than that it will fit my camera)? What specs should I pay close attention to? | 2010/07/15 | ['https://photo.stackexchange.com/questions/135', 'https://photo.stackexchange.com', 'https://photo.stackexchange.com/users/54/'] | 1. The zoom factor of course
2. Aperture, if aperture value is low you will either be able to take better photo in darkness and/or do blur effect in lower focus distance
3. Min. focus distance, you will not be able to take a correct shoot if subject is closer than this distance
4. Weight depending of your need you might not want something too heavy
Each time you want to buy a lens, try to find some review on Internet ! | I'm a big fan of Thom Hogan's lens reviews. <http://bythom.com/nikon.htm> |
135 | What should I be aware of when buying a zoom lens (other than that it will fit my camera)? What specs should I pay close attention to? | 2010/07/15 | ['https://photo.stackexchange.com/questions/135', 'https://photo.stackexchange.com', 'https://photo.stackexchange.com/users/54/'] | One consideration (this is a generalization, but most generalizations are based on some facts) is that usually the longer the zoom range, the quality of the image will suffer. As an example, the mega-zooms (28-300mm for example) will usually result in softer images (especially at either end of the zoom range) than a lens with a narrower zoom range (such as 24-70mm).
In any case, look for real-world reviews and photo samples before making a purchase.
I really like the lens [review section of FredMiranda.com](http://www.fredmiranda.com/reviews/) for getting real-world reviews. | If you know someone with the lens you are interested in, or a similar one, borrow and use it if you can. That goes way beyond reviews! |
135 | What should I be aware of when buying a zoom lens (other than that it will fit my camera)? What specs should I pay close attention to? | 2010/07/15 | ['https://photo.stackexchange.com/questions/135', 'https://photo.stackexchange.com', 'https://photo.stackexchange.com/users/54/'] | One consideration (this is a generalization, but most generalizations are based on some facts) is that usually the longer the zoom range, the quality of the image will suffer. As an example, the mega-zooms (28-300mm for example) will usually result in softer images (especially at either end of the zoom range) than a lens with a narrower zoom range (such as 24-70mm).
In any case, look for real-world reviews and photo samples before making a purchase.
I really like the lens [review section of FredMiranda.com](http://www.fredmiranda.com/reviews/) for getting real-world reviews. | I'm a big fan of Thom Hogan's lens reviews. <http://bythom.com/nikon.htm> |
135 | What should I be aware of when buying a zoom lens (other than that it will fit my camera)? What specs should I pay close attention to? | 2010/07/15 | ['https://photo.stackexchange.com/questions/135', 'https://photo.stackexchange.com', 'https://photo.stackexchange.com/users/54/'] | If you know someone with the lens you are interested in, or a similar one, borrow and use it if you can. That goes way beyond reviews! | I'm a big fan of Thom Hogan's lens reviews. <http://bythom.com/nikon.htm> |
14,582,431 | Did anyone managed to use @Convert annotation with DataNucleus? Do you have a working example or a documentation link?
I tried to implement it this way
```
...
@Convert(converter = MyAttributeConverter.class)
private String[] aField;
...
```
`MyAttributeConverter` implements `javax.persistence.jpa21.AttributeConverter<String[], String>`.
When I run the DataNucleus Enhancer I get this error
```
WARN [main] (Log4JLogger.java:96) - Class "XXX" has an annotation "javax.persistence.jpa21.Convert" specified with property "converter" yet this is invalid. Please check the specification for that annotation class. Errors were encountered when loading the specified MetaData files and classes. See the nested exceptions for details
ERROR [main] (Log4JLogger.java:125) - DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors Errors were encountered when loading the specified MetaData files and classes. See the nested exceptions for details org.datanucleus.exceptions.NucleusUserException: Errors were encountered when loading the specified MetaData files and classes. See the nested exceptions for details
at org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:536)
...
```
According to DataNucleus documentation seems fine: <http://www.datanucleus.org/products/accessplatform/jpa/annotations.html#Convert>, though googling I found an issue report in which things are a little bit different: <http://www.datanucleus.org/servlet/jira/browse/NUCJPA-164>.
I'm using DataNucleus 3.1.3. | 2013/01/29 | ['https://Stackoverflow.com/questions/14582431', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1210071/'] | Turn on [logging](http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html) for the S3 bucket, then (optionally) send the client directly to the bucket.
The log format includes "Bytes Sent" as well as "Object Size" and a number of other goodies including the remote IP, referring page, and request URI with query string.
Logs are not real-time of course, but you'll find a new log dropped into your bucket every few minutes. Retrieve it, parse it, store the interesting content if you want to, and then delete it if you don't want to pay monthly storage costs on the logs. | Keep the request URLs the same, pointing to your EC2 instance. But instead of proxying the content from S3 to the client through your EC2 instance, have your EC2 instance redirect the user to the S3 URL.
Use an expiring signed URL for the redirect. Your EC2 instance can create the appropriate URL on each request, expiring in a few minutes. That way there's time for the client to fetch the S3 resource but bookmarking it won't work because it will have expired when they try it later. So they always have to go to your EC2 instance to get the resource, allowing you to control and log access, but you don't have to proxy the content itself. |
58,184,449 | In `moodle 3.6` the `enrol_manual_enrol_user` does not work every time!
```
{
"exception": "moodle_exception",
"errorcode": "wsusercannotassign",
"message": "You don't have the permission to assign this role (383) to this user (2) in this course(28)."
}
``` | 2019/10/01 | ['https://Stackoverflow.com/questions/58184449', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8031441/'] | I fell in the same error message.
If someone faced it, the permission to give to your integration user is:
moodle/role:assign
That solve the "wsusercannotassign" problem. | It took me two days to find a way to solve this problem.
In my case the web service user had all required privileges to enroll a user. The confusing thing was that the same web service user was able to create a new moodle user via the API.
After checking all those role specific right ("allow roles assignments", "allow role overrides", "allow role switches") multiple times I found one relevant hint in a tutorial: the user who wants to enroll another user to a course has to be member of this course (?!?).
So I put my web service user to each course I have and gave him in addition the "trainer"-role. And now enrollment works even via the API. |
2,626,838 | Let $a\_{n} = 2^{-\frac {n}{2}}(1+i)^{n} \frac {1+n}{n}$ for n$ \in \mathbb N.$
In order to prove the $i$ is a point of accumulation of the sequence ${a\_{n}}$, I realize that I need to construct/find a subsequence $a\_{l}$ where $l \in \mathbb N$. I am perplexed with regards to $(1+i)^n$ as it does not seem to maintain an $i$ for any such $a\_{l}$.
Am I on the right track? Any help would be greatly appreciated. | 2018/01/29 | ['https://math.stackexchange.com/questions/2626838', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/512018/'] | You can first integrate by parts for $X > \pi$
>
> $$
> \int\_{\pi}^{X}\frac{\cos\left(x\right)}{x}\text{d}x=\left[\frac{\sin\left(x\right)}{x}\right]^{X}\_{\pi}+\int\_{\pi}^{X}\frac{\sin\left(x\right)}{x^2}\text{d}x
> $$
>
>
>
Then you can apply your inequality
$$
\left|\frac{\sin\left(X\right)}{X}\right| \leq \frac{1}{X} \underset{X \rightarrow +\infty}{\rightarrow}0
$$
and then
$$
\left|\frac{\sin\left(x\right)}{x^2}\right| \leq \frac{1}{x^2}
$$
which is integrable on $\left[\pi, +\infty\right[$. Letting $X \rightarrow +\infty$ gives you the convergence of the first integral because the three terms you find that one is constant, one tends to a constant and the last tends to $0$. | $\sum\_\limits{n=2}^{\infty} \int\_{(n-\frac 12)\pi}^{(n+\frac 12)\pi} \frac {\cos x}{x} dx$ produces an alternating series.
if $a\_n$ is an alternating series
$\sum\_\limits{n=1}^{\infty} a\_n$ converges if:
$\lim\_\limits{n\to \infty}a\_n = 0$ and for some $N, n>N \implies|a\_{n+1}| < |a\_n|$ |
2,626,838 | Let $a\_{n} = 2^{-\frac {n}{2}}(1+i)^{n} \frac {1+n}{n}$ for n$ \in \mathbb N.$
In order to prove the $i$ is a point of accumulation of the sequence ${a\_{n}}$, I realize that I need to construct/find a subsequence $a\_{l}$ where $l \in \mathbb N$. I am perplexed with regards to $(1+i)^n$ as it does not seem to maintain an $i$ for any such $a\_{l}$.
Am I on the right track? Any help would be greatly appreciated. | 2018/01/29 | ['https://math.stackexchange.com/questions/2626838', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/512018/'] | **Hint:**
$$
\begin{align}
\int\_\pi^\infty\frac{\cos(x)}{x}\,\mathrm{d}x
&=\sum\_{k=1}^\infty\int\_{(2k-1)\pi}^{(2k+1)\pi}\frac{\cos(x)}{x}\,\mathrm{d}x\\
&=\sum\_{k=1}^\infty\int\_{-\pi}^\pi\frac{\cos(x)}{x+2k\pi}\,\mathrm{d}x\\
&=\sum\_{k=1}^\infty\int\_0^\pi\left[\frac{\cos(x)}{x+2k\pi}-\frac{\cos(x)}{x+(2k-1)\pi}\right]\mathrm{d}x\\
&=-\pi\sum\_{k=1}^\infty\int\_0^\pi\frac{\cos(x)}{(x+2k\pi)(x+(2k-1)\pi)}\,\mathrm{d}x\\
\end{align}
$$
and
$$
\left|\,\frac{\cos(x)}{(x+2k\pi)(x+(2k-1)\pi)}\,\right|\le\frac1{2k(2k-1)\pi^2}
$$ | $\sum\_\limits{n=2}^{\infty} \int\_{(n-\frac 12)\pi}^{(n+\frac 12)\pi} \frac {\cos x}{x} dx$ produces an alternating series.
if $a\_n$ is an alternating series
$\sum\_\limits{n=1}^{\infty} a\_n$ converges if:
$\lim\_\limits{n\to \infty}a\_n = 0$ and for some $N, n>N \implies|a\_{n+1}| < |a\_n|$ |
2,626,838 | Let $a\_{n} = 2^{-\frac {n}{2}}(1+i)^{n} \frac {1+n}{n}$ for n$ \in \mathbb N.$
In order to prove the $i$ is a point of accumulation of the sequence ${a\_{n}}$, I realize that I need to construct/find a subsequence $a\_{l}$ where $l \in \mathbb N$. I am perplexed with regards to $(1+i)^n$ as it does not seem to maintain an $i$ for any such $a\_{l}$.
Am I on the right track? Any help would be greatly appreciated. | 2018/01/29 | ['https://math.stackexchange.com/questions/2626838', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/512018/'] | You can first integrate by parts for $X > \pi$
>
> $$
> \int\_{\pi}^{X}\frac{\cos\left(x\right)}{x}\text{d}x=\left[\frac{\sin\left(x\right)}{x}\right]^{X}\_{\pi}+\int\_{\pi}^{X}\frac{\sin\left(x\right)}{x^2}\text{d}x
> $$
>
>
>
Then you can apply your inequality
$$
\left|\frac{\sin\left(X\right)}{X}\right| \leq \frac{1}{X} \underset{X \rightarrow +\infty}{\rightarrow}0
$$
and then
$$
\left|\frac{\sin\left(x\right)}{x^2}\right| \leq \frac{1}{x^2}
$$
which is integrable on $\left[\pi, +\infty\right[$. Letting $X \rightarrow +\infty$ gives you the convergence of the first integral because the three terms you find that one is constant, one tends to a constant and the last tends to $0$. | $$\int\_{\pi}^{+\infty}\frac{\cos x}{x}\,dx $$
is convergent by [Dirichlet's test](https://en.wikipedia.org/wiki/Dirichlet%27s_test) since $\left|\int\_I\cos(x)\,dx\right|\leq 2$ and $\frac{1}{x}$ decreases to zero on $x\geq \pi$.
Accurate upper bounds can be deduced [from the Laplace transform](https://en.wikipedia.org/wiki/Laplace_transform#Evaluating_integrals_over_the_positive_real_axis) and Holder's inequality. Indeed
$$ \int\_{\pi}^{+\infty}\frac{\cos(x)}{x}\,dx = \int\_{0}^{+\infty}\frac{-\cos x}{x+\pi}\,dx = -\int\_{0}^{+\infty}\frac{s e^{-\pi s}}{1+s^2}\,ds<0 $$
but
$$ \int\_{0}^{+\infty}\frac{s e^{-\pi s}}{1+s^2}\,ds = \int\_{0}^{+\infty}\left(\frac{s^{1/4}}{1+s^2}\right)^1\cdot\left(s^{1/4} e^{-\pi s/3}\right)^3\,ds $$
is bounded by
$$ \left[\int\_{0}^{+\infty}\frac{s\,ds}{(1+s^2)^4}\right]^{1/4}\cdot\left[\int\_{0}^{+\infty}s e^{-4\pi s/3}\,ds\right]^{3/4}=\sqrt[4]{\frac{3^5}{2^{13}\,\pi^6}}\leq\frac{3}{40}. $$ |
2,626,838 | Let $a\_{n} = 2^{-\frac {n}{2}}(1+i)^{n} \frac {1+n}{n}$ for n$ \in \mathbb N.$
In order to prove the $i$ is a point of accumulation of the sequence ${a\_{n}}$, I realize that I need to construct/find a subsequence $a\_{l}$ where $l \in \mathbb N$. I am perplexed with regards to $(1+i)^n$ as it does not seem to maintain an $i$ for any such $a\_{l}$.
Am I on the right track? Any help would be greatly appreciated. | 2018/01/29 | ['https://math.stackexchange.com/questions/2626838', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/512018/'] | You can first integrate by parts for $X > \pi$
>
> $$
> \int\_{\pi}^{X}\frac{\cos\left(x\right)}{x}\text{d}x=\left[\frac{\sin\left(x\right)}{x}\right]^{X}\_{\pi}+\int\_{\pi}^{X}\frac{\sin\left(x\right)}{x^2}\text{d}x
> $$
>
>
>
Then you can apply your inequality
$$
\left|\frac{\sin\left(X\right)}{X}\right| \leq \frac{1}{X} \underset{X \rightarrow +\infty}{\rightarrow}0
$$
and then
$$
\left|\frac{\sin\left(x\right)}{x^2}\right| \leq \frac{1}{x^2}
$$
which is integrable on $\left[\pi, +\infty\right[$. Letting $X \rightarrow +\infty$ gives you the convergence of the first integral because the three terms you find that one is constant, one tends to a constant and the last tends to $0$. | **Hint:**
$$
\begin{align}
\int\_\pi^\infty\frac{\cos(x)}{x}\,\mathrm{d}x
&=\sum\_{k=1}^\infty\int\_{(2k-1)\pi}^{(2k+1)\pi}\frac{\cos(x)}{x}\,\mathrm{d}x\\
&=\sum\_{k=1}^\infty\int\_{-\pi}^\pi\frac{\cos(x)}{x+2k\pi}\,\mathrm{d}x\\
&=\sum\_{k=1}^\infty\int\_0^\pi\left[\frac{\cos(x)}{x+2k\pi}-\frac{\cos(x)}{x+(2k-1)\pi}\right]\mathrm{d}x\\
&=-\pi\sum\_{k=1}^\infty\int\_0^\pi\frac{\cos(x)}{(x+2k\pi)(x+(2k-1)\pi)}\,\mathrm{d}x\\
\end{align}
$$
and
$$
\left|\,\frac{\cos(x)}{(x+2k\pi)(x+(2k-1)\pi)}\,\right|\le\frac1{2k(2k-1)\pi^2}
$$ |
2,626,838 | Let $a\_{n} = 2^{-\frac {n}{2}}(1+i)^{n} \frac {1+n}{n}$ for n$ \in \mathbb N.$
In order to prove the $i$ is a point of accumulation of the sequence ${a\_{n}}$, I realize that I need to construct/find a subsequence $a\_{l}$ where $l \in \mathbb N$. I am perplexed with regards to $(1+i)^n$ as it does not seem to maintain an $i$ for any such $a\_{l}$.
Am I on the right track? Any help would be greatly appreciated. | 2018/01/29 | ['https://math.stackexchange.com/questions/2626838', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/512018/'] | **Hint:**
$$
\begin{align}
\int\_\pi^\infty\frac{\cos(x)}{x}\,\mathrm{d}x
&=\sum\_{k=1}^\infty\int\_{(2k-1)\pi}^{(2k+1)\pi}\frac{\cos(x)}{x}\,\mathrm{d}x\\
&=\sum\_{k=1}^\infty\int\_{-\pi}^\pi\frac{\cos(x)}{x+2k\pi}\,\mathrm{d}x\\
&=\sum\_{k=1}^\infty\int\_0^\pi\left[\frac{\cos(x)}{x+2k\pi}-\frac{\cos(x)}{x+(2k-1)\pi}\right]\mathrm{d}x\\
&=-\pi\sum\_{k=1}^\infty\int\_0^\pi\frac{\cos(x)}{(x+2k\pi)(x+(2k-1)\pi)}\,\mathrm{d}x\\
\end{align}
$$
and
$$
\left|\,\frac{\cos(x)}{(x+2k\pi)(x+(2k-1)\pi)}\,\right|\le\frac1{2k(2k-1)\pi^2}
$$ | $$\int\_{\pi}^{+\infty}\frac{\cos x}{x}\,dx $$
is convergent by [Dirichlet's test](https://en.wikipedia.org/wiki/Dirichlet%27s_test) since $\left|\int\_I\cos(x)\,dx\right|\leq 2$ and $\frac{1}{x}$ decreases to zero on $x\geq \pi$.
Accurate upper bounds can be deduced [from the Laplace transform](https://en.wikipedia.org/wiki/Laplace_transform#Evaluating_integrals_over_the_positive_real_axis) and Holder's inequality. Indeed
$$ \int\_{\pi}^{+\infty}\frac{\cos(x)}{x}\,dx = \int\_{0}^{+\infty}\frac{-\cos x}{x+\pi}\,dx = -\int\_{0}^{+\infty}\frac{s e^{-\pi s}}{1+s^2}\,ds<0 $$
but
$$ \int\_{0}^{+\infty}\frac{s e^{-\pi s}}{1+s^2}\,ds = \int\_{0}^{+\infty}\left(\frac{s^{1/4}}{1+s^2}\right)^1\cdot\left(s^{1/4} e^{-\pi s/3}\right)^3\,ds $$
is bounded by
$$ \left[\int\_{0}^{+\infty}\frac{s\,ds}{(1+s^2)^4}\right]^{1/4}\cdot\left[\int\_{0}^{+\infty}s e^{-4\pi s/3}\,ds\right]^{3/4}=\sqrt[4]{\frac{3^5}{2^{13}\,\pi^6}}\leq\frac{3}{40}. $$ |
482,562 | I am facing an issue that some packets sent out to internet from inside network were missing. The pattern we are using is like:
```
Client A ←→ Switch A ← Router A:NAT ← .. Network ..
→ Router B:NAT → Switch B ←→ Server B
```
I want to do below two steps to track the issue:
1. Capture the packets which are from Client A on Router B.
2. Check the translation table of Router B.
Are both actions possible?
More information:
1. Client A is running on Windows XP
2. Server B is running on Linux (Fedora exactly).
3. The Router B use static port and address translation table which means incoming packets
to specific port will be forwarded to Server B.
4. Both Router A and Router B are TPLink WR340+ products.
5. Both Router A and Router B have Full-cone NAT.
6. Switch A is DLink DES-1024R and Switch B is DLink DES-1016D.
The reason why I want to perform the two actions is that we found packets were sent out of the network interface of ClientA, but due to unknown reason the TCP kernel of ClientA machine never receives any ACK packet from the other endpoint, thus it enters data transmission until timeout. And from the server side, also using Tool WireShark we found the network interface of Server B machine never receives the packet sent from client A. I guess the packets were dropped by Router B, so I wonder if it is possible to capture packets at Router B.
Actually the issue only happened when we have two clients, say they are Client A and Client C. The Client A and Client C don't communicate with each other directly, but communicate with Server B instead.
Problem happened when we unplug the network cable of Client A machine and on another machine log in Client A in about 30 seconds, client A on the new machine will start TCP communication with server B, the first many commands are OK, but after that server can't receive any command from Client A anymore. | 2013/02/24 | ['https://serverfault.com/questions/482562', 'https://serverfault.com', 'https://serverfault.com/users/161970/'] | >
> Server B never received the packet
>
>
>
If you run Wireshark from Server B is ok; if not please consider you would need a managed switch configuring a "mirror/span/monitor" port where you connect to Wireshark's PC.
I would stick with Wireshark moving it to see packets between the Router B and the Switch B (can you add a hub in between to insert wireshark's PC?)
if the packet does not make it to the segment RouterB-SwitchB then your port forwarding at Router B (in order to bypass its NAT services) could be not working right or the router is just not routing your traffic. | I think it is important to get more information, switches don't do NAT (but routers do), and different routers have widely varying abilities. I've never heard the term "checking the translation table" when referring to switches or routers, but I do understand what you mean with respect of routers.
You will most likely find knowledge of NAT and checking translation tables etc a lot less valuable then using simple network tools. The first tool I would use is "WinMTR" from the Client A. Leave that running for a little (minutes ?) while and see if and where packet loss occurs. This will give you a very good idea where to look further. [ Looking at latencies and spikes in latencies will also give you some hints if you know what to look at ].
For someone to provide more help, you might want to provide more detail as to why you believe packets are going missing, and the characteristics of the problem. |
482,562 | I am facing an issue that some packets sent out to internet from inside network were missing. The pattern we are using is like:
```
Client A ←→ Switch A ← Router A:NAT ← .. Network ..
→ Router B:NAT → Switch B ←→ Server B
```
I want to do below two steps to track the issue:
1. Capture the packets which are from Client A on Router B.
2. Check the translation table of Router B.
Are both actions possible?
More information:
1. Client A is running on Windows XP
2. Server B is running on Linux (Fedora exactly).
3. The Router B use static port and address translation table which means incoming packets
to specific port will be forwarded to Server B.
4. Both Router A and Router B are TPLink WR340+ products.
5. Both Router A and Router B have Full-cone NAT.
6. Switch A is DLink DES-1024R and Switch B is DLink DES-1016D.
The reason why I want to perform the two actions is that we found packets were sent out of the network interface of ClientA, but due to unknown reason the TCP kernel of ClientA machine never receives any ACK packet from the other endpoint, thus it enters data transmission until timeout. And from the server side, also using Tool WireShark we found the network interface of Server B machine never receives the packet sent from client A. I guess the packets were dropped by Router B, so I wonder if it is possible to capture packets at Router B.
Actually the issue only happened when we have two clients, say they are Client A and Client C. The Client A and Client C don't communicate with each other directly, but communicate with Server B instead.
Problem happened when we unplug the network cable of Client A machine and on another machine log in Client A in about 30 seconds, client A on the new machine will start TCP communication with server B, the first many commands are OK, but after that server can't receive any command from Client A anymore. | 2013/02/24 | ['https://serverfault.com/questions/482562', 'https://serverfault.com', 'https://serverfault.com/users/161970/'] | >
> Server B never received the packet
>
>
>
If you run Wireshark from Server B is ok; if not please consider you would need a managed switch configuring a "mirror/span/monitor" port where you connect to Wireshark's PC.
I would stick with Wireshark moving it to see packets between the Router B and the Switch B (can you add a hub in between to insert wireshark's PC?)
if the packet does not make it to the segment RouterB-SwitchB then your port forwarding at Router B (in order to bypass its NAT services) could be not working right or the router is just not routing your traffic. | Here is an outline of a few ideas, and perhaps others know of how to do it in detail.
Use a linux machine router.
Perhaps Tomato or DDWRT can. So if your router supports that firmware / if you bought one that supports it, you could try that.
You commented `"The reason why I want to perform the two actions is that we found packets were sent out of the network interface of ClientA, but due to unknown reason the TCP kernel of ClientA machine never receives any ACK packet from the other endpoint, thus it enters data transmission until timeout. And from the server side, also using Tool WireShark we found the network interface of Server B machine never receives the packet sent from client A, of course it was not able to send any ACK packet back to ClientA."`
Maybe a router is damaged, or you have a faulty cable.
I love the fun ideas of how to see what is happening at your router, it may be possible with a fancier router, or better firmware. But if you can/want to do that, then you'd probably have or need a better router, or a replacement one to try. Don't overlook basic troubleshooting techniques, monkey type logic, like swapping parts!
Is it just one way that has an issue? like A->B. Or B->A too? You could troubleshoot a bit there like swapping the cables around. swapping the ports they're connected to. |
37,704,027 | I was trying to bootstrap my application using code below in a `boot.ts` file:
```
import {bootstrap} from 'angular2/platform/browser'
import {ROUTER_PROVIDERS} from 'angular2/router'
import {AppComponent} from './app.component'
bootstrap(AppComponent,[ROUTER_PROVIDERS]);
```
It worked fine.
Now I wanted to try and add Google Maps so imported `angular2-google-maps` package , created a `map.component.ts` file and added this to the router mapping (defined in the `app.component.ts` file).
For the above package, `import {bootstrap} from '@angular/platform-browser-dynamic';`
is used in the [plunker code](http://plnkr.co/edit/YX7W20?p=preview) (provided as a starter code).
Now the map is displaying if I add a `<map>` selector in my `index.html` page.
I want it to follow the routing which was defined earlier.
Bootstrapping is also happening twice (once for the `AppComponent` and once for the `Map`)
How to bootstrap the map component properly so that bootstrapping happens only for the Main app?
Also what is the difference between `@angular` and `angular2` packages and when to use them? | 2016/06/08 | ['https://Stackoverflow.com/questions/37704027', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1572356/'] | `@angular` is for RC (release candidate) versions and `angular2` for beta versions.
In RC versions, for example, `angular2/core` becomes `@angular/core`. You can also notice that the SystemJS configuration is different since you don't have bundled JS files.
Now you need to configure Angular2 modules into map and packages blocks of your SystemJS configuration. See this link for more details:
* <https://angular.io/guide/quickstart> | This is new for Angular2 versions after beta.x, and therefore `=> Angular2 RC.0`
Versions `<= Angular2 beta.x` use `angular2` |
31,412,283 | I have a CMS that I intend to use for a number of websites on Azure.
I want to be able to create clones of the website easily and have them deployed to Azure.
Azure Automation was suggested as one possible solution, does this service fit my need?
Which Azure service should I use to do this? | 2015/07/14 | ['https://Stackoverflow.com/questions/31412283', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4429847/'] | Use `lapply`, not `sapply`, along with creating a custom environment:
```
O_envir<-new.env()
O_envir$Orig<-.45
func<-function(n){
O_envir$Orig<-pmin(O_envir$Orig*(1+Adjusted[n,]),100)
return(O_envir$Orig)
}
rbind(O_envir$Orig,
do.call(rbind,lapply(1:12,func)))
``` | Here's an [Rcpp](http://cran.r-project.org/web/packages/Rcpp/index.html) implementation:
```
library('Rcpp');
cppFunction('
NumericMatrix makeOriginal(double orig, int NR, int NC ) {
NumericMatrix m(NR,NC);
for (size_t c = 0; c < NC; ++c)
m[c*NR] = orig;
for (size_t r = 1; r < NR; ++r) for (size_t c = 0; c < NC; ++c) {
size_t i = r+c*NR;
m[i] = std::min<double>(m[i-1]*(i+1),100);
}
return m;
}
');
makeOriginal(0.45,13L,10L);
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## [1,] 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
## [2,] 0.90 6.75 12.60 18.45 24.30 30.15 36.00 41.85 47.70 53.55
## [3,] 2.70 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [4,] 10.80 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [5,] 54.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [6,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [7,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [8,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [9,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [10,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [11,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [12,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [13,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
```
**Edit:** Another approach, but similar:
```
cppFunction('
NumericMatrix makeOriginal(double orig, int NR, int NC ) {
NumericMatrix m(NR,NC);
size_t len = NR*NC;
for (size_t i = 0; i < len; ++i)
m[i] = i%NR == 0 ? orig : std::min<double>(m[i-1]*(1+i),100);
return m;
}
');
``` |
31,412,283 | I have a CMS that I intend to use for a number of websites on Azure.
I want to be able to create clones of the website easily and have them deployed to Azure.
Azure Automation was suggested as one possible solution, does this service fit my need?
Which Azure service should I use to do this? | 2015/07/14 | ['https://Stackoverflow.com/questions/31412283', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4429847/'] | No need for sapply, as far as I can see. Try something like this.
```
adj1 <- 1 + rbind(0, Adjusted)
adjprod <- apply(adj1, 2, cumprod)
result <- Orig * adjprod
result[result > 100] <- 100
result
``` | Here's an [Rcpp](http://cran.r-project.org/web/packages/Rcpp/index.html) implementation:
```
library('Rcpp');
cppFunction('
NumericMatrix makeOriginal(double orig, int NR, int NC ) {
NumericMatrix m(NR,NC);
for (size_t c = 0; c < NC; ++c)
m[c*NR] = orig;
for (size_t r = 1; r < NR; ++r) for (size_t c = 0; c < NC; ++c) {
size_t i = r+c*NR;
m[i] = std::min<double>(m[i-1]*(i+1),100);
}
return m;
}
');
makeOriginal(0.45,13L,10L);
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## [1,] 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
## [2,] 0.90 6.75 12.60 18.45 24.30 30.15 36.00 41.85 47.70 53.55
## [3,] 2.70 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [4,] 10.80 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [5,] 54.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [6,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [7,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [8,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [9,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [10,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [11,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [12,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
## [13,] 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
```
**Edit:** Another approach, but similar:
```
cppFunction('
NumericMatrix makeOriginal(double orig, int NR, int NC ) {
NumericMatrix m(NR,NC);
size_t len = NR*NC;
for (size_t i = 0; i < len; ++i)
m[i] = i%NR == 0 ? orig : std::min<double>(m[i-1]*(1+i),100);
return m;
}
');
``` |
2,235,118 | >
> Suppose that polynomial $x^4+x+1$ has multiple roots over a field of
> characteristic $p$ . What are the possible values of $p$?
>
>
>
My solution :
Set $f=x^4+x+1$. Suppose the multiple root is $m$ . So $f,f'$ (the formal derivative of $f$) have root $m$ in the field of characteristic $p$.
Hence $m^4+m+1=0 \pmod{p} $ and $4m^3+1=0 \pmod{p}$
So $3m+4=4(m^4+m+1)-m(4m^3+1)=0 \pmod{p}$ .
From here it is easy to to see that $p\neq 3$. I have no idea if it is possible to proceed any further. Please provide a solution. | 2017/04/15 | ['https://math.stackexchange.com/questions/2235118', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/71612/'] | Hint:
Find the quotient and remainder when $(27)(4m^3 + 1)$ is divided by $3m+4$. | Using the [extended Euclidean algorithm](http://www.wolframalpha.com/input/?i=PolynomialExtendedGCD%5Bx%5E4+%2B+x+%2B+1,+4+x%5E3+%2B+1%5D) we get
$$
229 = (x^4 + x + 1)(144 x^2 - 192 x + 256)+(4 x^3 + 1)(-36 x^3 + 48 x^2 - 64 x - 27)
$$
This can also be found by computing the [resultant](http://www.wolframalpha.com/input/?i=resutant%5Bx%5E4+%2B+x+%2B+1,+4+x%5E3+%2B+1%5D) of $x^4 + x + 1$ and $4 x^3 + 1$, that is, the discriminant of $x^4 + x + 1$. |
2,235,118 | >
> Suppose that polynomial $x^4+x+1$ has multiple roots over a field of
> characteristic $p$ . What are the possible values of $p$?
>
>
>
My solution :
Set $f=x^4+x+1$. Suppose the multiple root is $m$ . So $f,f'$ (the formal derivative of $f$) have root $m$ in the field of characteristic $p$.
Hence $m^4+m+1=0 \pmod{p} $ and $4m^3+1=0 \pmod{p}$
So $3m+4=4(m^4+m+1)-m(4m^3+1)=0 \pmod{p}$ .
From here it is easy to to see that $p\neq 3$. I have no idea if it is possible to proceed any further. Please provide a solution. | 2017/04/15 | ['https://math.stackexchange.com/questions/2235118', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/71612/'] | Hint:
Find the quotient and remainder when $(27)(4m^3 + 1)$ is divided by $3m+4$. | $$3m+4 \equiv 0 \pmod{p} \\
3m \equiv -4 \pmod{p} \\
27m^3 \equiv -64 \pmod{p}$$
You also have
$$4m^3\equiv -1 \pmod{p}$$
Denote $m^3=:x$ then
$$27x \equiv -64 \pmod{p} \\
4x \equiv -1 \pmod{p}$$
Multiply first equation by 4, second by 27 and subtract. |
63,792,397 | It's well documented that Chrome and Firefox ignore the standard autocomplete="off" attribute in html as they (Google) feel it wasn't being used correctly. They have even come up with workarounds and their own set of values for autofilling fields.
However, We need to prevent users passwords from being auto-filled for a website we're working on, and none of the suggestions put forward by Google appear to work.
The current situation on our website is that login names and passwords are stored by the browser, and so when a user visits the site and they're forced to login, their username and passwords are pre-populated in the relevant fields and they simply click the login button to login.
This has been deemed insecure, and while the infosec team are happy for the username to be pre-populated, they insist the password field is not.
To start with I tried adding the autocomplete="off" attribute to the password fields, but the password was still pre-populated. After some googling I found this link that shows Google decided to ignore this value and come up with a list of their own values for the autocomplete attribute...
[Google ignores autocomplete="off"](https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164)
They state that if we add our own, non-recognised value (such as autocomplete="please-dont-auto-fill-me") if shouldnt auto fill as it wouldnt know what that value is for.
However, I added something more meaningful - autocomplete="non-filled-value" - and it still populated the field. I've since tried a number of other things, such as renaming the password input control (removing the word "password" from the control name) etc and nothing seems to work. every time I load the login page, the password is pre-populated.
The issue I have is that my login form will be loaded on multiple browsers as different users from around the world login, and I need a solution that works for all browsers, not just Chrome.
Does anyone have any experience of this, and has a working solution for preventing fields being pre-populated/auto-filled that works cross browser? Everything I've tried (renaming fields, adding hidden fields, setting obscure autocomplete attribute values) fails to work, and whatever I try, the password is pre-populated.
Obviously, I have no control over the users actual browser settings and cant force them all to change their own personal settings. | 2020/09/08 | ['https://Stackoverflow.com/questions/63792397', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/564297/'] | ### New approach
I know how frustrating it is to try all solutions and seeing user and password fields ignore them.
Unforturnately, I haven't found a straightforward way of doing this, but I have a workaround for avoiding user password fields getting autofilled.
### The problem
The main problem is that if you set input type="password", browsers automatically try fo autofill the field with saved passwords and users for the webapp, and nothing seems to work in order to stop it.
### The solution
My approach is to avoid setting input type="passoword", but making the field look like a password field.
The way I found to achieve this was to build a font composed only by discs, so when you type anything in the input field, it looks like a password field, but you will never be prompted with saved user and password credentials.
I've tested this solution on Chrome, Firefox and Microsoft Edge, please let me know if is something worong with other browsers.
I know the solution is awful, but seems to work.
Link to the font, made by me using Font Forge: <https://drive.google.com/file/d/1xWGciDI-cQVxDP_H8s7OfdJt44ukBWQl/view?usp=sharing>
**Example**
Browsers will not fill in the input elements because none of them is type="password"
Place the .ttf file in the same directory where you create the following html file:
```
<!DOCTYPE html>
<html>
<head>
<title>Font Test</title>
</head>
<body>
<span>Name: </span><input type="text"/>
<span>Password: </span><input class="disk-font" type="text"/>
</body>
<style>
@font-face {
font-family: disks;
src: url(disks.ttf);
}
.disk-font{
font-family: disks;
}
</style>
</html>
```
Hope this is helpful, feel free to comment any issue. | Actually, i've recently faced this issue, and a workaround which worked form me is just setting the value as an empty string on a method (can be onload, for example if the input is in your main screen). Would be something like:
```
let login = document.querySelector('#inputLogin');
let password = document.querySelector('#inputPassword');
function someFun () {
login.value = '';
password.value = '';
}
```
Also I've already tried to put `autocomplete="false"` but didn't work. |
11,289,956 | I wanted to know in what language has the desktop application of Dropbox been coded?
Is it Python or Ruby? | 2012/07/02 | ['https://Stackoverflow.com/questions/11289956', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1495471/'] | Replace this lines
```
File myFile = new File("sdcard/mysdfile.txt");
if(!myFile.exists()){
myFile.mkdirs();
}
myFile = new File("sdcard/mysdfile.txt");
```
with
//Saving the parsed data.........
```
File myFile = new File(Environment.getExternalStorageDirectory()+"/mysdfile.txt");
myFile.createNewFile();
``` | ```
File myFile = new File("sdcard/mysdfile.txt");
```
Should be changed to
```
File myFile = new File("/mnt/sdcard/mysdfile.txt");
``` |
11,289,956 | I wanted to know in what language has the desktop application of Dropbox been coded?
Is it Python or Ruby? | 2012/07/02 | ['https://Stackoverflow.com/questions/11289956', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1495471/'] | First thing, your `AndroidManifest.xml` file is correct. So no need to correct that. Though I would recommend organizing your permissions in one place.
### Writing File to Internal Storage
```
FileOutputStream fOut = openFileOutput("myinternalfile.txt",MODE_WORLD_READABLE);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
//---write the contents to the file---
osw.write(strFileData);
osw.flush();
osw.close();
```
### Writing File to External SD Card
```
//This will get the SD Card directory and create a folder named MyFiles in it.
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard.getAbsolutePath() + "/MyFiles");
directory.mkdirs();
//Now create the file in the above directory and write the contents into it
File file = new File(directory, "mysdfile.txt");
FileOutputStream fOut = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(strFileData);
osw.flush();
osw.close();
```
**Note: If running on an emulator, ensure that you have enabled SD Card support in the AVD properties and allocated it appropriate space.** | Replace this lines
```
File myFile = new File("sdcard/mysdfile.txt");
if(!myFile.exists()){
myFile.mkdirs();
}
myFile = new File("sdcard/mysdfile.txt");
```
with
//Saving the parsed data.........
```
File myFile = new File(Environment.getExternalStorageDirectory()+"/mysdfile.txt");
myFile.createNewFile();
``` |
11,289,956 | I wanted to know in what language has the desktop application of Dropbox been coded?
Is it Python or Ruby? | 2012/07/02 | ['https://Stackoverflow.com/questions/11289956', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1495471/'] | First thing, your `AndroidManifest.xml` file is correct. So no need to correct that. Though I would recommend organizing your permissions in one place.
### Writing File to Internal Storage
```
FileOutputStream fOut = openFileOutput("myinternalfile.txt",MODE_WORLD_READABLE);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
//---write the contents to the file---
osw.write(strFileData);
osw.flush();
osw.close();
```
### Writing File to External SD Card
```
//This will get the SD Card directory and create a folder named MyFiles in it.
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard.getAbsolutePath() + "/MyFiles");
directory.mkdirs();
//Now create the file in the above directory and write the contents into it
File file = new File(directory, "mysdfile.txt");
FileOutputStream fOut = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(strFileData);
osw.flush();
osw.close();
```
**Note: If running on an emulator, ensure that you have enabled SD Card support in the AVD properties and allocated it appropriate space.** | ```
File myFile = new File("sdcard/mysdfile.txt");
```
Should be changed to
```
File myFile = new File("/mnt/sdcard/mysdfile.txt");
``` |
682,211 | I'm having a bit of difficulty with Cisco AnyConnect v3.1 in regards to automatic login. I have to stay connected to a single server all day every day, and it would be super if I didn't have to dig up my 16 char password each and every day. I'd love for the client to log on automatically, but I'm not even sure at this point that it's a possibility.
I should note that the AnyConnect software is provided to me by our hosting company, and I nor anyone at my organization has access to the management side of things. I did see that there is such a piece of software on the interwebs called the "AnyConnect Profile Editor," but Cisco wouldn't let me download without a valid login.
I've been into `%appdata%\local\cisco\cisco anyconnect secure mobility client\preferences.xml` to review my preferences as well as `%programdata%\Cisco\Cisco AnyConnect Secure Mobility Client\Profile\ANYCONNECT.XML` to review my profile settings. Neither of these showed anywhere that I would be able to store my credentials. I even broke my profile a few times by trying to shoe-horn my password in places. That didn't work, go figure.
Lastly, I found [this forum post](https://supportforums.cisco.com/thread/2148440#discussion-action-div-3994840) which seemed to specify client and server certificate "thumbprints" as well as something called an SDI token.
*Disclaimer: I'm a front-end web developer by day and it's been quite a long time since I've had to do any network management for myself, sorry for the noob question!* | 2013/11/29 | ['https://superuser.com/questions/682211', 'https://superuser.com', 'https://superuser.com/users/278026/'] | Here is my script to launch Cisco AnyConnect Mobility Client v3.1 and log in automatically. Save this script as *FILENAME.vbs*, replace *PASSWORD* with your password, replace the path to the VPN Client exe if needed (probably not), and you may also need to adjust the 2nd sleep time as well depending on your connection speed (mine works reliably at 5000 but yours may need less/more time to dial home). I have mine pinned to my task bar but you can hotkey it as well.
```
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """%PROGRAMFILES(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe"""
WScript.Sleep 3000
WshShell.AppActivate "Cisco AnyConnect Secure Mobility Client"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 5000
WshShell.SendKeys "PASSWORD"
WshShell.SendKeys "{ENTER}"
``` | I'm answering my own question with this "meh" answer - it's not what I was after, and I'll gladly accept another answer that can better answer my original question.
Since I didn't have any luck with automatic logins, the next best thing I could think of was to have my ridiculously long password automatically copied to my clipboard. In Windows, I created a `.bat` file with this in the body:
```
echo|set /p=MyPassword|clip
```
Where "MyPassword" is your actual password.
When double-clicked, this file will copy your password into your clipboard for a quick login. Better than nothing! |
682,211 | I'm having a bit of difficulty with Cisco AnyConnect v3.1 in regards to automatic login. I have to stay connected to a single server all day every day, and it would be super if I didn't have to dig up my 16 char password each and every day. I'd love for the client to log on automatically, but I'm not even sure at this point that it's a possibility.
I should note that the AnyConnect software is provided to me by our hosting company, and I nor anyone at my organization has access to the management side of things. I did see that there is such a piece of software on the interwebs called the "AnyConnect Profile Editor," but Cisco wouldn't let me download without a valid login.
I've been into `%appdata%\local\cisco\cisco anyconnect secure mobility client\preferences.xml` to review my preferences as well as `%programdata%\Cisco\Cisco AnyConnect Secure Mobility Client\Profile\ANYCONNECT.XML` to review my profile settings. Neither of these showed anywhere that I would be able to store my credentials. I even broke my profile a few times by trying to shoe-horn my password in places. That didn't work, go figure.
Lastly, I found [this forum post](https://supportforums.cisco.com/thread/2148440#discussion-action-div-3994840) which seemed to specify client and server certificate "thumbprints" as well as something called an SDI token.
*Disclaimer: I'm a front-end web developer by day and it's been quite a long time since I've had to do any network management for myself, sorry for the noob question!* | 2013/11/29 | ['https://superuser.com/questions/682211', 'https://superuser.com', 'https://superuser.com/users/278026/'] | I use something along these lines:
```
set FILE=%TEMP%\tmp
echo connect your.host.name> %FILE%
(echo 0)>> %FILE%
echo yourUserName>> %FILE%
echo yourPassWord>> %FILE%
"C:\Program Files\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" -s < %FILE%
```
(**Update:** Why the parentheses around `echo 0`? This should remind you, when making a different choice than `0`, that `1>` or `2>` have a special meaning, redirecting `stdout` or `stderr`, respectively - but not echoing `1` or `2`. So we stay on the safe side with (`echo 0)`.)
This is a little more concise:
```
(echo connect your.host.name& echo 0& echo yourUserName& echo yourPassWord& echo.) > %FILE%
more %FILE% | "C:\Program Files\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" -s
```
However, if you want to achieve the same thing without a temporary file, this does not work for me - I would be interested, why:
```
(echo connect your.host.name& echo 0& echo yourUserName& echo yourPassWord) | "%ProgramFiles(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" -s
```
**Update:** This works, found via <https://stackoverflow.com/a/29747723/880783>:
```
(echo connect your.host.name^& echo 0^& echo yourUserName^&echo yourPassWord^&rem.) | "%ProgramFiles(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" -s
```
All these variants depend of course on your server's configuration (especially the VPN group you have to chose). To find out what you need to input, call `vpncli.exe` without any parameters once, start with `connect your.host.name`, and then note what you are prompted for.
**Update:** This has the added advantage of offering complete freedom with regard to server, username and password, and does not rely on any sleep values (which is always difficult if your system tends to be busy with something else). | I'm answering my own question with this "meh" answer - it's not what I was after, and I'll gladly accept another answer that can better answer my original question.
Since I didn't have any luck with automatic logins, the next best thing I could think of was to have my ridiculously long password automatically copied to my clipboard. In Windows, I created a `.bat` file with this in the body:
```
echo|set /p=MyPassword|clip
```
Where "MyPassword" is your actual password.
When double-clicked, this file will copy your password into your clipboard for a quick login. Better than nothing! |
240,450 | I am trying to mount a disk image (consisting of MBR, fat, ext4 partitions) so I can modify the layout using `gparted`. (I am trying to move the partition to a 4M boundary.)
I have tried `sudo mount img mountpoint -o loop` without success.
How can I achieve this? | 2015/11/03 | ['https://unix.stackexchange.com/questions/240450', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/47111/'] | Normally partitioning tools require that partitions are not mounted. You should use `parted` or `gparted` directly on the image file using:
```
parted /path/to/disk.img
```
Sample output:
```
$ parted VirtualBox\ VMs/centos/VMDK-test-flat.vmdk
WARNING: You are not superuser. Watch out for permissions.
GNU Parted 2.3
Using /home/testuser/VirtualBox VMs/centos/VMDK-test-flat.vmdk
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: (file)
Disk /home/testuser/VirtualBox VMs/centos/VMDK-test-flat.vmdk: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32,3kB 535MB 535MB primary ext4
2 535MB 1069MB 535MB primary ext4
(parted)
``` | I don't know if you may resize or move your partition on an image, but there is a tool for mounting partitions within an image file, **kpartx**. I never used it, but you can take a look here: <http://robert.penz.name/73/kpartx-a-tool-for-mounting-partitions-within-an-image-file/> |
240,450 | I am trying to mount a disk image (consisting of MBR, fat, ext4 partitions) so I can modify the layout using `gparted`. (I am trying to move the partition to a 4M boundary.)
I have tried `sudo mount img mountpoint -o loop` without success.
How can I achieve this? | 2015/11/03 | ['https://unix.stackexchange.com/questions/240450', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/47111/'] | You don't have to mount image to edit its partition table. Make `gparted` work directly with your image:
```
sudo gparted /path/to/img
```
EDIT: `mount` is a term related to file systems. You can mount an image of file system. Image of disk containing partition table is an image of block device, which is generally not a valid file system. | I don't know if you may resize or move your partition on an image, but there is a tool for mounting partitions within an image file, **kpartx**. I never used it, but you can take a look here: <http://robert.penz.name/73/kpartx-a-tool-for-mounting-partitions-within-an-image-file/> |
27,188,074 | I have table structre like this:
Table `MainTable`
Columns:
```
Id INT,
TableName Varchar(50),
StartValue VARCHAR(50)
```
Here TableName column have names of all the tables present in the database
Now I need to update "StartValue" column in `MainTable` from corresponding tables. Any idea how to achieve this?
Example
`MainTable`
```
Id TableName StartValue
----------------------
1 table1 NULL
2 Table2 Null
```
I need to update `StartValue` column of `MainTable` by getting top 1 value from table name present in the tables
Means record 1 will get first value from table1 and record 2 will get first value from table2
Any idea how to achieve this? | 2014/11/28 | ['https://Stackoverflow.com/questions/27188074', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1654393/'] | Adding a check for `EXISTS` on the `INSERT` statement should not have a significant effect on performance.
```
INSERT INTO Employee ([Name] ,[Lname] ,[Code])
SELECT [Name] ,[Lname] ,@Code
FROM @tblEmp AS t
WHERE NOT EXISTS
( SELECT 1
FROM Employee AS e
WHERE e.Name = t.Name
AND e.Lname = t.Lname
);
```
This is *fairly* safe, but still vulnerable to a [race condition](http://en.wikipedia.org/wiki/Race_condition). I think the safest way to do the insert, with is to use `MERGE` with the locking hint `HOLDLOCK`:
```
MERGE Employee WITH(HOLDLOCK) AS t
USING @tbl AS s
ON s.Name = t.Name
AND s.LName = t.LName
WHEN NOT MATCHED THEN
INSERT ([Name] ,[Lname] ,[Code])
VALUES (s.Name, s.Lname, @Code);
``` | If the table has a primary key that is not set to auto generate then it will error when you try to insert a record without the key. You will need to either set the primary key field as an identity seed or you can include the primary key with the insert. |
2,704,534 | Does the following converge or diverge?
$$
\sum\_{n=2}^{\infty} a\_n^{-n},
$$
where$$
a\_n = \int\_1^n \sin{\left(\frac{1}{\sqrt{x}}\right)} \,\mathrm{d}x.
$$
My friends thought this sum would converge. I think we should do the square root test, checking the value of $t=\lim\limits\_{n \to \infty} \dfrac{1}{a\_n}$. And we knew that this goes to $0$. So, that would make the sum to converge…
Is there any problem in my ideas? Some said that this sum diverges, which I can never understand why…
It will be great if someone can explain me on this… Better with some proofs I can understand. (We are students learning calculus.) | 2018/03/23 | ['https://math.stackexchange.com/questions/2704534', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/544878/'] | Your approach is correct: $a\_n$ is positive and by applying the root test the convergence of the series $\sum\_n (1/a\_n)^{n}$ follows as soon as you show that $1/a\_n\to L<1$. Here we have that $1/a\_n\to 0$ so $\sum\_n (1/a\_n)^{n}$ converges.
In fact, $\sin(t)\geq 2t/\pi$ for $t\in [0,\pi/2]$ ($\sin(x)$ is concave in that interval). Hence for $n>1$,
$$a\_n = \int\_1^n \sin{\left(\frac{1}{\sqrt{x}}\right)} \,dx\geq \frac{2}{\pi}\int\_1^n \frac{1}{\sqrt{x}}\, dx =\frac{4(\sqrt{n}-1)}{\pi}\implies 0<\frac{1}{a\_n}\leq \frac{\pi}{4(\sqrt{n}-1)}$$
which implies that $1/a\_n\to 0$ as $n$ goes to infinity.
P.S. By the way $\sin(t)\leq t$ for $t\geq 0$ implies that
$$a\_n = \int\_1^n \sin{\left(\frac{1}{\sqrt{x}}\right)} \,dx\leq \int\_1^n \frac{1}{\sqrt{x}}\, dx ={2(\sqrt{n}-1)}\implies \frac{1}{a\_n}\geq \frac{1}{2(\sqrt{n}-1)}$$
which implies that $\sum\_n (1/a\_n)=+\infty$. | As $n\to +\infty$ you have that asymptotically
$$\int\_1^n\sin\frac{1}{\sqrt{x}} \sim 2\sqrt{n}$$
Thence the related series goes like $\frac{1}{n^{n+1/2}}$ which converges. |
2,704,534 | Does the following converge or diverge?
$$
\sum\_{n=2}^{\infty} a\_n^{-n},
$$
where$$
a\_n = \int\_1^n \sin{\left(\frac{1}{\sqrt{x}}\right)} \,\mathrm{d}x.
$$
My friends thought this sum would converge. I think we should do the square root test, checking the value of $t=\lim\limits\_{n \to \infty} \dfrac{1}{a\_n}$. And we knew that this goes to $0$. So, that would make the sum to converge…
Is there any problem in my ideas? Some said that this sum diverges, which I can never understand why…
It will be great if someone can explain me on this… Better with some proofs I can understand. (We are students learning calculus.) | 2018/03/23 | ['https://math.stackexchange.com/questions/2704534', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/544878/'] | From $\sin x<x$, and for $n>4$,
$$\left(\int\_1^n\sin\frac1{\sqrt x}dx\right)^{-n}<\left(2\sqrt n\right)^{-n}<\frac1{n^2}$$
and the series converges. | As $n\to +\infty$ you have that asymptotically
$$\int\_1^n\sin\frac{1}{\sqrt{x}} \sim 2\sqrt{n}$$
Thence the related series goes like $\frac{1}{n^{n+1/2}}$ which converges. |
15,855,762 | I need to include and/or statement to an if condition in google script. I am new to script and am not able to find a way to do so. Please help
```
if (dateval<>"") and (repval<>"") {condition if true}
```
Thank you for the help. | 2013/04/06 | ['https://Stackoverflow.com/questions/15855762', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2252756/'] | you can find all the infos on [that subject](http://www.w3schools.com/js/js_comparisons.asp) (and others ) [on this site.](http://www.w3schools.com/js/)
in your example the answer is
```
if (dateval!="" && repval!="") {do something}
``` | Logic Symbol
Or ||
And &&
Equal ==
Not !=
<https://www.w3schools.com/js/js_comparisons.asp> |
15,855,762 | I need to include and/or statement to an if condition in google script. I am new to script and am not able to find a way to do so. Please help
```
if (dateval<>"") and (repval<>"") {condition if true}
```
Thank you for the help. | 2013/04/06 | ['https://Stackoverflow.com/questions/15855762', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2252756/'] | you can find all the infos on [that subject](http://www.w3schools.com/js/js_comparisons.asp) (and others ) [on this site.](http://www.w3schools.com/js/)
in your example the answer is
```
if (dateval!="" && repval!="") {do something}
``` | I tried [Serge insas's answer](https://stackoverflow.com/a/15855859) and found out that it did not compile.
I messed around, modifying the line as follows:
```
if ((dateval<>"") and (repval<>"")) {condition if true}
```
I finally got this to work. Apparently, it needs the extra parentheses. |
15,855,762 | I need to include and/or statement to an if condition in google script. I am new to script and am not able to find a way to do so. Please help
```
if (dateval<>"") and (repval<>"") {condition if true}
```
Thank you for the help. | 2013/04/06 | ['https://Stackoverflow.com/questions/15855762', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2252756/'] | Logic Symbol
Or ||
And &&
Equal ==
Not !=
<https://www.w3schools.com/js/js_comparisons.asp> | I tried [Serge insas's answer](https://stackoverflow.com/a/15855859) and found out that it did not compile.
I messed around, modifying the line as follows:
```
if ((dateval<>"") and (repval<>"")) {condition if true}
```
I finally got this to work. Apparently, it needs the extra parentheses. |
4,900 | In the lyrics of *Friends Will Be Friends* by *Queen*:
>
> Another red letter day
>
> So the pound has dropped and **the children are creating**.
>
>
>
What does the phrase highlighted in bold mean? | 2010/11/10 | ['https://english.stackexchange.com/questions/4900', 'https://english.stackexchange.com', 'https://english.stackexchange.com/users/2038/'] | Queen is a British band, and this usage of the intransitive *create* is British colloquial for "create a fuss", "make noise", or nearly, as ukayer says, "create havoc". The [*Compact Oxford Dictionary* has this](http://www.oxforddictionaries.com/definition/create?view=uk):
>
> 2 [*no object*] *British informal* make a fuss; complain:
>
> *little kids create because they hate being ignored*
>
>
>
The [*Cambridge Advanced Learner's Dictionary* has this](http://dictionary.cambridge.org/dictionary/british/create_2):
>
> **create** *verb* (BE ANGRY) /kriˈeɪt/
>
> [I] UK *old-fashioned* to show that you are angry
>
> *If she sees you with an ice cream she'll only start creating.*
>
>
>
The [*Collins Pocket English Dictionary* has this](http://www.collinslanguage.com/results.aspx?context=3&reversed=False&action=define&homonym=-1&text=create):
>
> 4. (Brit slang) to make an angry fuss,
>
>
>
[*Dictionary.com*](http://dictionary.reference.com/browse/Create?r=66) (based on [*Random House*](http://dictionary.infoplease.com/create) dictionary) has this:
>
> –*verb (used without object)*
>
> 8. *British*. to make a fuss.
>
>
>
The [*Collins English Dictionary — Complete and Unabridged*](http://www.thefreedictionary.com/create) also has this:
>
> 6. *(intr) Brit slang* to make a fuss or uproar
>
>
>
See also [this post by lynneguist](http://separatedbyacommonlanguage.blogspot.com/2009/04/to-create-intransitive.html) on *Separated By a Common Language*, where I first encountred the term. It's used mostly for little children (or those considered little children), rather than adults. | Creating as in "creating havoc", i.e. helping to make the day even worse. |
29,598,991 | Here's a code
```
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
I want the link1's color to be changed when link2 is hovered.
Is it possible with css?. | 2015/04/13 | ['https://Stackoverflow.com/questions/29598991', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4466855/'] | Since CSS does not seem to be able to handle this, try JavaScript
```js
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
document.getElementById("link1").style.color="red";
}
document.getElementById("link2").onmouseout=function() {
document.getElementById("link1").style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
Or using siblings
```js
function prevSib(elem) {do { elem = elem.previousSibling;} while ( elem && elem.nodeType !== 1 ); return elem; }
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
prevSib(this).style.color="red";
}
document.getElementById("link2").onmouseout=function() {
prevSib(this).style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
``` | Using pure css it is not possible go backward. You can go in cascading ways.
But, you can do it with JQuery. like:
```js
$(document).ready(function(){
$(".link2").mouseover(function(){
$(".link1").css("color", "red");
});
$(".link2").mouseout(function(){
$(".link1").css("color", "black");
});
});
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a id="link1" class="link1" href="#" >About</a>
<a id="link2" class="link2" href="#">Contact us</a>
```
Hope it helps. |
29,598,991 | Here's a code
```
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
I want the link1's color to be changed when link2 is hovered.
Is it possible with css?. | 2015/04/13 | ['https://Stackoverflow.com/questions/29598991', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4466855/'] | Since CSS does not seem to be able to handle this, try JavaScript
```js
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
document.getElementById("link1").style.color="red";
}
document.getElementById("link2").onmouseout=function() {
document.getElementById("link1").style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
Or using siblings
```js
function prevSib(elem) {do { elem = elem.previousSibling;} while ( elem && elem.nodeType !== 1 ); return elem; }
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
prevSib(this).style.color="red";
}
document.getElementById("link2").onmouseout=function() {
prevSib(this).style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
``` | CSS can't select the previous siblings. You can use JavaScript:
```
var links = [].slice.call(document.querySelectorAll('.menu_item'));
function hover(event) {
var pre = this.previousElementSibling,
method = event.type === 'mouseenter' ? 'add' : 'remove';
if (pre) {
pre.classList[method]('active');
}
}
links.forEach(function(el) {
el.addEventListener('mouseenter', hover);
el.addEventListener('mouseleave', hover);
});
```
The above code assumes that the `a` elements have class of `menu_item` and class of `active` should be added to the previous sibling of the hovered element.
[Here is a demo](http://jsfiddle.net/dxxbkLzt/). |
29,598,991 | Here's a code
```
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
I want the link1's color to be changed when link2 is hovered.
Is it possible with css?. | 2015/04/13 | ['https://Stackoverflow.com/questions/29598991', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4466855/'] | Since CSS does not seem to be able to handle this, try JavaScript
```js
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
document.getElementById("link1").style.color="red";
}
document.getElementById("link2").onmouseout=function() {
document.getElementById("link1").style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
Or using siblings
```js
function prevSib(elem) {do { elem = elem.previousSibling;} while ( elem && elem.nodeType !== 1 ); return elem; }
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
prevSib(this).style.color="red";
}
document.getElementById("link2").onmouseout=function() {
prevSib(this).style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
``` | Use JavaScript to do that( `link1`'s color to be changed when `link2` is hovered ). You need to use html tag attributes like `onmouseover` and `onmouseout`.
Try this code. For changing color of `link1` when `link2` is hovered.
```
<html>
<head>
<script>
function colorchange(){
document.getElementById("link1").style.color="red";
}
function colorchange2(){
document.getElementById("link1").style.color="blue";
}
</script>
</head>
<body>
<a id="link1" href="#" >About</a>
<a id="link2" onmouseover="colorchange()" onmouseout="colorchange2()" href="#">Contact us</a>
</body>
</html>
``` |
29,598,991 | Here's a code
```
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
I want the link1's color to be changed when link2 is hovered.
Is it possible with css?. | 2015/04/13 | ['https://Stackoverflow.com/questions/29598991', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4466855/'] | Since CSS does not seem to be able to handle this, try JavaScript
```js
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
document.getElementById("link1").style.color="red";
}
document.getElementById("link2").onmouseout=function() {
document.getElementById("link1").style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
```
Or using siblings
```js
function prevSib(elem) {do { elem = elem.previousSibling;} while ( elem && elem.nodeType !== 1 ); return elem; }
window.onload=function() {
document.getElementById("link2").onmouseover=function() {
prevSib(this).style.color="red";
}
document.getElementById("link2").onmouseout=function() {
prevSib(this).style.color="blue";
}
}
```
```html
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
``` | I suppose this is what are you looking for.
First you need to wrap your links inside a container like this
```
<div class='container'>
<a id="link1" href="#" >About</a>
<a id="link2" href="#">Contact us</a>
</div>
```
and then apply this styles
```
.container:hover a:not(:hover){
color:red;
}
```
[css only demo here](https://jsfiddle.net/g39yyk9n/)
**UPDATE**
As I said in may comment bellow I supposed you wanted to change the style of all unhovered links, however if you want to change only link1 when link2 is hovered , but not change style of link2 when link1 is hovered you could write you css like this
[second demo](https://jsfiddle.net/g39yyk9n/1/)
```
.container:hover a:first-child:not(:hover){
color:red;
}
``` |
68,178,782 | I am trying to plot two columns from my dataset (the columns are 'cases' and 'vaccinations') on the same line graph. The x-axis only has one column (that is, 'country') that I want them to share. Is it possible to do this in Dash/Plotly? I can't find any solutions using Dash. Here's a snippet of my code:
```
html.Div(
children=dcc.Graph(
id="cases-chart",
config={"displayModeBar": False},
figure={
"data": [
{
"x": data["country"],
"y": data["cases"],
"type": "lines",
},
],
"layout": {
"title": {
"text": "Cases by Country",
"x": 0.05,
"xanchor": "left",
},
"xaxis": {"fixedrange": True},
"yaxis": {"fixedrange": True},
"colorway": ["#17B897"],
},
},
),
className="card",
),
```
Thanks. | 2021/06/29 | ['https://Stackoverflow.com/questions/68178782', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11845398/'] | I hope this solves your problem.
This is implemented in Python.
First, we use imageio to import the image as an array. We need to use a modified version of your image (I filled the interior region in white).
[![enter image description here](https://i.stack.imgur.com/rVHKd.png)](https://i.stack.imgur.com/rVHKd.png)
Then, we transform the RGBA matrix into a binary matrix with a 0 contour defining your interface (phi in the code snippet)
Here's phi from the snippet below (interior region value = +0.5, exterior region value = -0.5):
[![enter image description here](https://i.stack.imgur.com/lNR1m.png)](https://i.stack.imgur.com/lNR1m.png)
```py
import imageio
import numpy as np
import matplotlib.pyplot as plt
import skfmm
# Load image
im = imageio.imread("0WmVI_filled.png")
ima = np.array(im)
# Differentiate the inside / outside region
phi = np.int64(np.any(ima[:, :, :3], axis = 2))
# The array will go from - 1 to 0. Add 0.5(arbitrary) so there 's a 0 contour.
phi = np.where(phi, 0, -1) + 0.5
# Show phi
plt.imshow(phi)
plt.xticks([])
plt.yticks([])
plt.colorbar()
plt.show()
# Compute signed distance
# dx = cell(pixel) size
sd = skfmm.distance(phi, dx = 1)
# Plot results
plt.imshow(sd)
plt.colorbar()
plt.show()
```
Finally, we use the scikit-fmm module to compute the signed distance.
Here's the resulting signed distance field:
[![enter image description here](https://i.stack.imgur.com/w1iJQ.png)](https://i.stack.imgur.com/w1iJQ.png) | For closed, non-intersecting and well oriented polygons, you can speed up the calculation of a signed distance field by limiting the work to feature extrusions based on [this paper](https://www.researchgate.net/publication/2393786_A_Fast_Algorithm_for_Computing_the_Closest_Point_and_Distance_Transform).
The closest point to a line lies within the edge extrusion as you have shown in your image (regions A and E). The closest feature for the points in B, C and D are not the edges but the vertex.
The algorithm is:
* for each edge and vertex construct negative and positive extrusions
* for each point, determine which extrusions they are in and find the smallest magnitude distance of the correct sign.
The work is reduced to a point-in-polygon test and distance calculations to lines and points. For reduced work, you can consider limited extrusions of the same size to define a thin shell where distance values are calculated. This seems the desired functionality for your halo shading example.
While you still have to iterate over all features, both extrusion types are always convex so you can have early exits from quad trees, half-plane tests and other optimisations, especially with limited extrusion distances.
The extrusions of edges are rectangles in the surface normal direction (negative normal for interior distances).
From [1](https://www.researchgate.net/publication/2393786_A_Fast_Algorithm_for_Computing_the_Closest_Point_and_Distance_Transform):
[![edge extrusions](https://i.stack.imgur.com/GtE3e.png)](https://i.stack.imgur.com/GtE3e.png)
The extrusions for vertices are wedges whose sides are the normals of the edges that meet at that vertex. Vertices have either positive or negative extrusions depending on the angle between the edges. Flat vertices will have no extrusions as the space is covered by the edge extrusions.
From [1](https://www.researchgate.net/publication/2393786_A_Fast_Algorithm_for_Computing_the_Closest_Point_and_Distance_Transform):
[![enter image description here](https://i.stack.imgur.com/s9xS1.png)](https://i.stack.imgur.com/s9xS1.png) |
69,151,019 | I'm working on Google Colab and when I type
`model.compile(optimizer=tf.keras.optimizers.Adam(lr=1e-6), loss=tf.keras.losses.BinaryCrossentropy())`
it doesn't work and I get the following error message
`Could not interpret optimizer identifier: <keras.optimizer_v2.adam.Adam object at 0x7f21a9b34d50>` | 2021/09/12 | ['https://Stackoverflow.com/questions/69151019', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16871891/'] | Generally, Maybe you used a different version for the layers import and the optimizer import.
tensorflow.python.keras API for model and layers and keras.optimizers for SGD. They are two different Keras versions of TensorFlow and pure Keras. They could not work together. You have to change everything to one version. Then it should work.
Maybe try import:
```
from tensorflow.keras.optimizers import Adam
model.compile(optimizer=Adam(lr=1e-6),loss=tf.keras.losses.BinaryCrossentropy())
``` | Actually I am using
```
keras===2.7.0
tensorflow==2.8.0
```
and it worked for me when I used :
```
from keras.optimizers import adam_v2
```
Then
```
optimizer = adam_v2.Adam(lr=learning_rate)
model.compile(loss="binary_crossentropy", optimizer=optimizer)
```
Instead of using `tf.keras.optimizers.Adam` |
59,499,652 | I'm currently struggling with a display issue only in Firefox Android.
I have no problem on desktop neither in Android Chrome.
I'm using Angular 8 and mat-toolbar.
I wanted to use a bottom navigation bar but this flickering issue is making it look bad.
It is only when I scroll up/down fast.
The code I'm using is pretty simple:
```
<div class="container">
<div id="lipsum">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut neque ipsum. Proin dolor ipsum, mattis non suscipit eget, condimentum id mauris. Vestibulum orci lectus, pretium et dictum ut, efficitur eget augue. Fusce dolor enim, maximus et justo eu, condimentum ornare ex. Nulla facilisi. Fusce ut enim est. Curabitur scelerisque, odio eu pretium blandit, nunc justo elementum nulla, vitae dignissim nisl tortor at augue.
</p>
<p>
Vestibulum nunc enim, porttitor vel nunc ultrices, facilisis dapibus lectus. Aliquam at gravida dui. Cras tincidunt malesuada mattis. Donec vitae magna convallis, suscipit lacus non, tincidunt lacus. Praesent faucibus et nulla non hendrerit. Nam tempus tincidunt viverra. Donec a justo ut sem porta malesuada. Nulla vestibulum, odio ac ornare ultrices, quam lectus vestibulum lectus, quis dignissim erat urna eget erat. Ut sed dui elementum, pellentesque libero sit amet, faucibus diam. Donec euismod purus nisi, ut fringilla erat pellentesque ut.
</p>
<p>
Cras gravida augue vel arcu scelerisque malesuada. Pellentesque sagittis quam a dolor gravida auctor. Curabitur elit elit, auctor eget ex quis, placerat aliquam ipsum. Ut efficitur dui id metus commodo congue. Nulla id lacus fringilla, semper augue vel, tincidunt eros. Ut non felis elit. Morbi nulla dui, tincidunt et dapibus sodales, condimentum et augue. Sed condimentum diam magna, non sollicitudin lorem pharetra id. Integer posuere pellentesque dolor, dapibus dignissim purus bibendum at. Donec vel diam a velit mattis fermentum. Sed semper aliquam ante, iaculis fermentum neque tincidunt vitae.
</p>
<p>
Fusce auctor iaculis elit nec elementum. Suspendisse non ante faucibus, convallis enim sed, cursus orci. Vestibulum a dolor pellentesque dui bibendum dictum. Phasellus venenatis arcu ut metus aliquam bibendum. Suspendisse sagittis leo felis, in sollicitudin nisl efficitur vel. Nulla feugiat varius elementum. Pellentesque at sem sit amet lacus suscipit dapibus. Mauris porta risus finibus volutpat ullamcorper. Nulla consequat augue quis efficitur rutrum. Cras fermentum dui elementum nisl porttitor, non sollicitudin mauris scelerisque. Donec a sollicitudin quam, eleifend gravida nisl.
</p>
<p>
Aenean eu sapien eleifend, posuere magna vel, ultricies ante. Aliquam nec urna magna. In in eros tellus. Donec a enim eget lorem venenatis feugiat vestibulum pulvinar leo. Morbi et odio lacinia, maximus lacus quis, bibendum ante. Mauris ut ligula quam. Ut tempor nisi in semper iaculis. Etiam ultrices magna quis auctor porttitor. Aliquam mattis, libero ornare tincidunt fermentum, ex leo fringilla neque, consectetur aliquet dolor lorem quis purus. Nam ligula felis, dictum sit amet maximus eu, tristique eu velit.
</p>
<p>
Duis lacinia eu felis et elementum. Suspendisse sed sem augue. Nullam tortor turpis, condimentum sed arcu eu, euismod lobortis odio. Quisque eu interdum purus, non tincidunt neque. Quisque tincidunt dolor vitae ipsum scelerisque, ac facilisis magna viverra. Phasellus malesuada velit nunc, vel ultrices urna sodales vitae. Praesent maximus aliquam tempor. Mauris accumsan imperdiet sodales. Suspendisse potenti. Nulla facilisi. Vestibulum vitae vehicula ipsum. Vivamus sed diam finibus, blandit enim in, commodo massa. Aliquam porttitor lectus sed tellus hendrerit, vitae blandit nisl placerat. Morbi laoreet neque quam, eu blandit dolor venenatis sit amet. Duis quam purus, viverra nec quam id, imperdiet suscipit felis. Nulla rhoncus purus a diam vestibulum dictum.
</p>
<p>
Suspendisse id libero ut ipsum ullamcorper suscipit. Duis sed vehicula leo. Aenean ullamcorper elementum est eu commodo. Curabitur consectetur nibh purus, at elementum magna iaculis eu. Vestibulum sit amet purus nec enim mattis pulvinar. Sed lobortis odio id quam sodales elementum. Nam facilisis aliquam pellentesque. Etiam non mauris eu magna scelerisque varius. Suspendisse non aliquam tellus, sed ullamcorper elit. Nullam id mattis est, quis euismod massa. Pellentesque vestibulum molestie felis nec condimentum. Pellentesque non lacus cursus, pulvinar purus a, ultricies dui. Pellentesque at erat leo. Nullam placerat pharetra est vitae pharetra.
</p>
<p>
Mauris rutrum nunc non sem feugiat vulputate. Vestibulum pulvinar consectetur turpis vitae placerat. Praesent sit amet felis varius, euismod enim nec, finibus diam. Aliquam sed nisi in lorem faucibus ultrices. Aenean aliquam tempor tortor. Sed dapibus blandit arcu, quis dapibus dui egestas vel. Nullam mattis, nulla a ultrices efficitur, turpis ligula rhoncus ligula, vel tristique orci risus sit amet urna.
</p>
<p>
Praesent porttitor facilisis dapibus. Quisque feugiat nec enim ut iaculis. Mauris feugiat, libero non porta suscipit, diam sapien aliquet est, et semper nunc ex nec quam. Etiam ut nulla id mauris placerat commodo. Vestibulum id iaculis libero, sit amet tempus leo. Morbi ullamcorper efficitur enim in mattis. Suspendisse imperdiet dui vitae lorem porta iaculis. Aenean lobortis quam lacus, sit amet rhoncus libero auctor ut. Nullam facilisis felis in fermentum luctus. Fusce odio mi, vehicula vitae suscipit ac, venenatis eget elit. Phasellus laoreet nec elit quis consectetur.
</p>
<p>
Integer justo enim, ornare eget lacus vel, ultricies tincidunt massa. Donec varius odio sed viverra fringilla. Sed lobortis nisi sed commodo posuere. Cras consectetur congue ipsum non pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque ullamcorper tortor et urna vestibulum, finibus finibus ex laoreet. Integer aliquam ex at mi tristique, in viverra diam pharetra. Etiam id venenatis arcu. Vivamus et diam eget est mollis volutpat.
</p>
<p>
Pellentesque vulputate porttitor magna sed semper. Cras vehicula sem eget mattis accumsan. Proin maximus ultrices finibus. Proin et elit magna. Curabitur eget fermentum sem. Aliquam laoreet felis id justo tincidunt blandit. Donec finibus erat vitae nisi pellentesque facilisis. Pellentesque porttitor eget purus mollis consectetur. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent eu blandit justo. Vivamus nec libero ornare, tempus ex quis, varius dolor. Fusce eu imperdiet arcu. Nam egestas lectus nec mauris volutpat accumsan. Donec risus est, aliquet in eros ac, condimentum porta erat. Ut sagittis, ante sed rutrum vulputate, turpis augue fringilla eros, id dignissim nisi ex id dui. Nulla blandit ut leo at malesuada.
</p>
<p>
Nam quis euismod metus, sed consectetur odio. Ut id lacinia ante. Nulla molestie massa ligula, sed ornare purus euismod nec. Aliquam id quam auctor, aliquet leo vel, imperdiet quam. Nam eros nisi, ultrices nec facilisis sit amet, viverra sed dolor. Integer laoreet nunc quam, sit amet iaculis libero pharetra vitae. Quisque vel posuere diam, eget fermentum est.
</p>
<p>
Etiam nec volutpat urna. Pellentesque tempor sodales libero, non viverra nibh varius quis. Aenean hendrerit egestas molestie. Praesent tincidunt at lectus in sodales. Etiam rhoncus turpis vitae suscipit porttitor. Nulla est erat, pharetra ut tellus fringilla, pharetra consequat leo. Praesent sed finibus tellus, nec tincidunt velit. In pulvinar consequat neque id vulputate. Cras luctus finibus purus, a ultricies augue varius pellentesque. Aenean vehicula, nulla eget gravida euismod, ipsum nibh sollicitudin odio, convallis malesuada turpis elit non quam. Donec ac hendrerit felis.
</p>
<p>
Phasellus eget auctor lorem. Donec ut congue lectus. Fusce est nunc, fringilla at metus ac, volutpat pellentesque turpis. Curabitur elit leo, tincidunt nec velit non, vestibulum condimentum nibh. Maecenas varius justo ligula, quis hendrerit risus elementum quis. Integer felis eros, cursus non euismod vel, tempor sit amet metus. Nulla congue neque lobortis, sagittis purus finibus, pharetra augue. Sed dignissim rhoncus maximus. Fusce eros augue, iaculis sit amet pretium quis, dignissim sed lacus. Proin non tortor eros. Nulla sagittis ligula nec egestas egestas.
</p>
<p>
Vestibulum non nulla ultricies, convallis ante quis, interdum dui. Praesent maximus pulvinar nibh. Aliquam venenatis ante felis, eget ultrices neque posuere quis. Nam auctor in nisl quis vulputate. Donec venenatis ligula at nisi eleifend tincidunt. Fusce augue nibh, pharetra ullamcorper tellus rhoncus, tristique imperdiet massa. Phasellus at elit at risus sodales porta a ut metus. Quisque sodales nisi ac egestas auctor. Quisque hendrerit et risus sed consequat. Nullam ultrices metus elit, at egestas lectus pellentesque vitae. Donec eu vehicula ligula. Nam mattis pharetra arcu et imperdiet. Cras eget dignissim elit, quis porta elit. Vestibulum mollis nec leo in dignissim. Aliquam lacinia gravida dolor a sollicitudin.
</p></div>
<mat-toolbar color="primary">
<button mat-button routerLink="/home" routerLinkActive="active" fxLayout="column" fxLayoutAlign="center center" fxLayoutGap="2px">
<span>Home</span>
</button>
</mat-toolbar>
</div>
```
And my .scss file looks like this:
```
#lipsum {
background-color: #f5f5f6;
}
.mat-toolbar {
position: fixed;
bottom: 0;
left: 0;
z-index: 2;
width: 100%;
}
.container {
height: 100%;
width: 100%;
display: flex; flex-direction: column;
}
```
I tooked a screenshot: [here](https://i.stack.imgur.com/Gd246.png)
It seemed that the issue is that the mat-toolbar is not following instantly the bottom of the page.
There is a micro-lag causing the flickering.
Do you have any idea how to fix this ? | 2019/12/27 | ['https://Stackoverflow.com/questions/59499652', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12606878/'] | I changed a little bit my way of thinking.
Instead of trying to overlay the navigation menu in the bottom of the screen, I used [this method](https://moduscreate.com/blog/how-to-fix-overflow-issues-in-css-flex-layouts/).
It uses a container and allow to overflow the content by displaying a scroll bar and the bottom is used by the menu navigation. No more problem of flickering now. | Your mat-toolbar is not a class in the html but an element, and if you have flex on it's parent you are best to use margin-top: auto on it instead of position fixed
html
```
<div class="mat-toolbar" color="primary">
<button mat-button routerLink="/home" routerLinkActive="active" fxLayout="column" fxLayoutAlign="center center" fxLayoutGap="2px">
<span>Home</span>
</button>
</div>
```
css
```
.mat-toolbar {
margin-top:auto; /* this pushes this div to the bottom of it's parent div that is display flex */
z-index: 2;
width: 100%;
}
``` |
560,893 | I want to ask a question about thin provisioning. `get-vm` commandlet can easly give us real space used by a vm totally. Assume that you have a virtual machine which has more than one thin disk. If we want to get more detail so as to calculate each disk real used space which powercli command does this? I do not prefer getting it by datastore browser for performance issues. | 2013/12/12 | ['https://serverfault.com/questions/560893', 'https://serverfault.com', 'https://serverfault.com/users/202314/'] | The actual used disk space is retrievable without accessing the datastore separately, but you won't find the information in the disk object, but rather in the VM object. It is hidden in `$vm.ExtensionData.LayoutEx.File`, which contains information about all files related to the VM, not only the disk files. So the trick is to get the file information that relates to the queried disk.
If you only want the actual size, and nothing else, you can do it really quick like this:
```powershell
(get-vm vmname).ExtensionData.LayoutEx.File |
Where-Object { $_.name -like '*-flat.vmdk' } |select Name,Size
Name Size
---- ----
[Datastore1] vmname/vmname-flat.vmdk 53895368934
[Datastore1] vmname/vmname_1-flat.vmdk 73348843320
[Datastore1] vmname/vmname_2-flat.vmdk 268902888606
[Datastore1] vmname/vmname_3-flat.vmdk 37724234832
```
If you want some more information about the disks:
```powershell
get-vm $vmname |Get-HardDisk |
Select name,capacitygb,StorageFormat,@{name="UsedSpaceGB";e={
$disk=$_;
[math]::Round(($disk.Parent.ExtensionData.LayoutEx.File |
Where-Object {
$_.name -eq $disk.Filename.Replace(".","-flat.")
}).Size/1GB,2)
}}
Name CapacityGB StorageFormat UsedSpaceGB
---- ---------- ------------- -----------
Hard disk 1 50 EagerZeroedThick 50,19
Hard disk 2 100 Thin 68,31
Hard disk 3 300 Thin 250,44
Hard disk 4 60 Thin 35,13
``` | I found the following solution:
```
(Get-VM -Name $YourVmName).Extensiondata.Guest.Disk
```
This command will give you all the disks of this vm with the provisioned size and the free space - with that you can calculate the real used size.
Source (with a complete script to list all disks): <http://www.vstrong.info/2014/03/28/vmware-powercli-script-to-list-thin-provisioned-virtual-disks-vmdk/> |