qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
9,486,446 | Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release.
EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947474/"
] | Use the gdx-freetype extension:
```
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
BitmapFont font15 = generator.generateData(15);
BitmapFont font22 = generator.generateData(22);
generator.dispose();
```
"To use gdx-freetype, grab the latest nightlies, link `gdx-freetype.jar` and `gdx-freetyp... | This is working on an S4 clone phone:
Pinewood is a downloaded font, in assets folder. See the folder structure below.
```
import android.util.Log;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL10;
import com.badl... |
9,486,446 | Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release.
EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947474/"
] | Use the gdx-freetype extension:
```
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
BitmapFont font15 = generator.generateData(15);
BitmapFont font22 = generator.generateData(22);
generator.dispose();
```
"To use gdx-freetype, grab the latest nightlies, link `gdx-freetype.jar` and `gdx-freetyp... | Did researched a lot and found this working method:
```
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("myfont.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 12; // font size
BitmapFont font12 = generator.generateFont(parameter);
generator.dispos... |
9,486,446 | Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release.
EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947474/"
] | Use the gdx-freetype extension:
```
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
BitmapFont font15 = generator.generateData(15);
BitmapFont font22 = generator.generateData(22);
generator.dispose();
```
"To use gdx-freetype, grab the latest nightlies, link `gdx-freetype.jar` and `gdx-freetyp... | you have to use FreeTypeFont library. [github](https://github.com/libgdx/libgdx/wiki/Gdx-freetype)
**1.as the github page say, for projects using gradle add this dependencies:**
Core Dependency:
```
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
```
Desktop Dependency:
```
compile "com.badlogicgames.gdx... |
9,486,446 | Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release.
EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947474/"
] | Did researched a lot and found this working method:
```
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("myfont.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 12; // font size
BitmapFont font12 = generator.generateFont(parameter);
generator.dispos... | This is working on an S4 clone phone:
Pinewood is a downloaded font, in assets folder. See the folder structure below.
```
import android.util.Log;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL10;
import com.badl... |
9,486,446 | Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release.
EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947474/"
] | This is working on an S4 clone phone:
Pinewood is a downloaded font, in assets folder. See the folder structure below.
```
import android.util.Log;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL10;
import com.badl... | you have to use FreeTypeFont library. [github](https://github.com/libgdx/libgdx/wiki/Gdx-freetype)
**1.as the github page say, for projects using gradle add this dependencies:**
Core Dependency:
```
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
```
Desktop Dependency:
```
compile "com.badlogicgames.gdx... |
9,486,446 | Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release.
EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947474/"
] | Did researched a lot and found this working method:
```
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("myfont.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 12; // font size
BitmapFont font12 = generator.generateFont(parameter);
generator.dispos... | you have to use FreeTypeFont library. [github](https://github.com/libgdx/libgdx/wiki/Gdx-freetype)
**1.as the github page say, for projects using gradle add this dependencies:**
Core Dependency:
```
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
```
Desktop Dependency:
```
compile "com.badlogicgames.gdx... |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | Escape your quotes...
```
ng-init="percentObj = [{ \"value\":40,\"color\":\"#F5A623\" },{ \"value\":60,\"color\":\"#F5A623\" }];"
``` | Try this...
```
<body ng-controller="TestController">
<div ng-init="Init()">
{{percentObj || json }}
</div>
</body>
$scope.Init = function()
{
$scope.percentObj = [{ "value":40,"color":"#F5A623" },{ "value":60,"color":"#F5A623" }]
}
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | Escape your quotes...
```
ng-init="percentObj = [{ \"value\":40,\"color\":\"#F5A623\" },{ \"value\":60,\"color\":\"#F5A623\" }];"
``` | for second one, Please check the code below
```
var obj = {};
$scope.percentObj = [];
obj.value = parseInt($scope.projectData[0].value);
obj.color = "#F5A623";
$scope.percentObj.push(obj);
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | You can use window object for set your json :
```
<script type="text/javascript">
window.data= {awesome:1};
</script>
```
view :
```
<div ng-controller="myCntrl" ng-init="init('data')">
```
controller :
```
function myCntrl($scope) {
$scope.init = function (settings) {
settings = window[settings];... | Escape your quotes...
```
ng-init="percentObj = [{ \"value\":40,\"color\":\"#F5A623\" },{ \"value\":60,\"color\":\"#F5A623\" }];"
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | Escape your quotes...
```
ng-init="percentObj = [{ \"value\":40,\"color\":\"#F5A623\" },{ \"value\":60,\"color\":\"#F5A623\" }];"
``` | Just have a JSON encoded string in some element's attribute and then catch that with Angular.
HTML
```
<div data-config="{title:'this is my title'}" my-directive></div>
```
AngularJS:
```
app.directive('myDirective', function () {
return {
restrict: 'A',
link: function (scope, element) {
... |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | Try this...
```
<body ng-controller="TestController">
<div ng-init="Init()">
{{percentObj || json }}
</div>
</body>
$scope.Init = function()
{
$scope.percentObj = [{ "value":40,"color":"#F5A623" },{ "value":60,"color":"#F5A623" }]
}
``` | for second one, Please check the code below
```
var obj = {};
$scope.percentObj = [];
obj.value = parseInt($scope.projectData[0].value);
obj.color = "#F5A623";
$scope.percentObj.push(obj);
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | You can use window object for set your json :
```
<script type="text/javascript">
window.data= {awesome:1};
</script>
```
view :
```
<div ng-controller="myCntrl" ng-init="init('data')">
```
controller :
```
function myCntrl($scope) {
$scope.init = function (settings) {
settings = window[settings];... | Try this...
```
<body ng-controller="TestController">
<div ng-init="Init()">
{{percentObj || json }}
</div>
</body>
$scope.Init = function()
{
$scope.percentObj = [{ "value":40,"color":"#F5A623" },{ "value":60,"color":"#F5A623" }]
}
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | You can use window object for set your json :
```
<script type="text/javascript">
window.data= {awesome:1};
</script>
```
view :
```
<div ng-controller="myCntrl" ng-init="init('data')">
```
controller :
```
function myCntrl($scope) {
$scope.init = function (settings) {
settings = window[settings];... | for second one, Please check the code below
```
var obj = {};
$scope.percentObj = [];
obj.value = parseInt($scope.projectData[0].value);
obj.color = "#F5A623";
$scope.percentObj.push(obj);
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | Just have a JSON encoded string in some element's attribute and then catch that with Angular.
HTML
```
<div data-config="{title:'this is my title'}" my-directive></div>
```
AngularJS:
```
app.directive('myDirective', function () {
return {
restrict: 'A',
link: function (scope, element) {
... | for second one, Please check the code below
```
var obj = {};
$scope.percentObj = [];
obj.value = parseInt($scope.projectData[0].value);
obj.color = "#F5A623";
$scope.percentObj.push(obj);
``` |
25,644,953 | Im having scenario like.
one place to another place route
if the user in way of that route
we have to fine the which one is shortest path.
Thanks in advance..! | 2014/09/03 | [
"https://Stackoverflow.com/questions/25644953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993202/"
] | You can use window object for set your json :
```
<script type="text/javascript">
window.data= {awesome:1};
</script>
```
view :
```
<div ng-controller="myCntrl" ng-init="init('data')">
```
controller :
```
function myCntrl($scope) {
$scope.init = function (settings) {
settings = window[settings];... | Just have a JSON encoded string in some element's attribute and then catch that with Angular.
HTML
```
<div data-config="{title:'this is my title'}" my-directive></div>
```
AngularJS:
```
app.directive('myDirective', function () {
return {
restrict: 'A',
link: function (scope, element) {
... |
373,176 | What is the main advantage of Switched-Capacitor filters compared with passive LC filters and active RC filters? | 2018/05/08 | [
"https://electronics.stackexchange.com/questions/373176",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/-1/"
] | A switched capacitor filter has a "building block" that is made from analogue switches and a capacitor. This building block is equivalent to a variable resistor whose value is modified by the clock frequency. You have to be aware of aliasing so you can't use the "building block" with signals that have frequencies that ... | Berkeley developed SC filters, for audio-telephone channel bandwidth control.
The telephone company used lots of SC filters.
----- absolutely predictable
----- absolutely stable in parameters (no aging, no temperature sensitivity) |
119,138 | Sometimes we open a page with evil script so that we can't click the cross icon to close.
Is there a trick to close it ? | 2010/03/12 | [
"https://superuser.com/questions/119138",
"https://superuser.com",
"https://superuser.com/users/11671/"
] | You can press [ctrl] + [w] button at the same time to close the current tab.
Much like [mouse wheel] click on the tab | You can try middle clicking the tab to close it. Middle click and clicking with the scroll wheel are the same on most mouses. |
119,138 | Sometimes we open a page with evil script so that we can't click the cross icon to close.
Is there a trick to close it ? | 2010/03/12 | [
"https://superuser.com/questions/119138",
"https://superuser.com",
"https://superuser.com/users/11671/"
] | If you visit pages with potential evil scripts you should use the extension [NoScript](https://addons.mozilla.org/fr/firefox/addon/722) to prevent them to run
To close a tab, similarly to middle click or Ctrl+W, you could use `Ctrl`+`F4` | You can try middle clicking the tab to close it. Middle click and clicking with the scroll wheel are the same on most mouses. |
18,238,228 | I'm trying to compile a C program to try parallel programming, when I try to compile it with nvcc compiler (Nvidia) it gives me those errors:
```
inicis.cu(3): error: attribute "global" does not apply here
inicis.cu(3): error: incomplete type is not allowed
inicis.cu(3): error: identifier "a" is undefined
inicis.cu... | 2013/08/14 | [
"https://Stackoverflow.com/questions/18238228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1262638/"
] | I think if you make these changes:
```
__global__ void operate(int* memoria1, int* memoria2)
^ ^
```
and:
```
cudaMalloc((void**) &memory_1, 5 * sizeof(int));
cudaMalloc((void**) &memory_2, 5 * sizeof(int));
^ ^
```
Your code will compile and run properly.
Yo... | TL:DR
Your kernel declaration is in the wrong place and the compiler is treating it as a variable instead. You need to make sure your kernel declaration is on a .cu file where it's being used. Not 100 if it need to be first declared in a file that uses it but just mess around with it's declaration spot.
I was having t... |
2,083,750 | I'm working at a small office,I have an application,it's generate a big text file with 14000 lines;
after each generate i must filter it and it's really boring;
I wanna write an application with java till I'll can handle it as soon as possible.
Please help me; I wrote an application with scanner (Of course with help... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2083750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/252518/"
] | Since your code has performance issues, you first need to find bottle neck. You can profile it with profiler available with IDE you use.
However since your code is not high in computation but IO intensive, both in reading file and output using System.out.print, that is where I would suggest you to improve on for impro... | Simple text filtering is probably easier to write in Perl (my choice because I've been using it for years) or Python (what I recommend to new people because it's a more modern language). |
9,361,156 | I have a framework with a DDD data layer which uses the service locator pattern. However, currently I use a global static `ServiceLocator` class which stores all the references. I would like to refactor this into a correct implementation where classes implement the `IServiceProvider` interface and where I remove the gl... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9361156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446261/"
] | You could embed OSGi and publish the Java EE resources as services into the OSGi framework. I wrote a blog post on this topic which may help: <http://njbartlett.name/2011/03/07/embedding-osgi.html> | GlassFish server is built using OSGi, and now supports nice integration between OSGi and Java EE services. It exposes APIs to access Java EE services as OSGi services and also supports a so called Hybrid Application bundle where you can seamlessly use OSGi services in your Java EE application. Refer to this document fo... |
9,361,156 | I have a framework with a DDD data layer which uses the service locator pattern. However, currently I use a global static `ServiceLocator` class which stores all the references. I would like to refactor this into a correct implementation where classes implement the `IServiceProvider` interface and where I remove the gl... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9361156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446261/"
] | You could embed OSGi and publish the Java EE resources as services into the OSGi framework. I wrote a blog post on this topic which may help: <http://njbartlett.name/2011/03/07/embedding-osgi.html> | The SpringSource dm Server, or dm Server for short, is the runtime portion of the SpringSource Application Platform. It is a lightweight, modular, OSGi-based runtime that provides a complete packaged solution for developing, deploying, and managing enterprise applications. By leveraging several best-of-breed technologi... |
9,361,156 | I have a framework with a DDD data layer which uses the service locator pattern. However, currently I use a global static `ServiceLocator` class which stores all the references. I would like to refactor this into a correct implementation where classes implement the `IServiceProvider` interface and where I remove the gl... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9361156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446261/"
] | If you search for 'enterprise OSGi' you may have more luck and get some more ideas. Many of the main application servers, including WebSphere, Glassfish, and JBoss now support integration between OSGi and Java EE components. One option is to use a JNDI bridge which allows your OSGi services to be looked up using JNDI. ... | GlassFish server is built using OSGi, and now supports nice integration between OSGi and Java EE services. It exposes APIs to access Java EE services as OSGi services and also supports a so called Hybrid Application bundle where you can seamlessly use OSGi services in your Java EE application. Refer to this document fo... |
9,361,156 | I have a framework with a DDD data layer which uses the service locator pattern. However, currently I use a global static `ServiceLocator` class which stores all the references. I would like to refactor this into a correct implementation where classes implement the `IServiceProvider` interface and where I remove the gl... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9361156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446261/"
] | If you search for 'enterprise OSGi' you may have more luck and get some more ideas. Many of the main application servers, including WebSphere, Glassfish, and JBoss now support integration between OSGi and Java EE components. One option is to use a JNDI bridge which allows your OSGi services to be looked up using JNDI. ... | The SpringSource dm Server, or dm Server for short, is the runtime portion of the SpringSource Application Platform. It is a lightweight, modular, OSGi-based runtime that provides a complete packaged solution for developing, deploying, and managing enterprise applications. By leveraging several best-of-breed technologi... |
9,361,156 | I have a framework with a DDD data layer which uses the service locator pattern. However, currently I use a global static `ServiceLocator` class which stores all the references. I would like to refactor this into a correct implementation where classes implement the `IServiceProvider` interface and where I remove the gl... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9361156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446261/"
] | The [Enterprise OSGI spec](http://www.osgi.org/wiki/uploads/News/2010_03_23_OSGi_Releases_Enterprise_Specification.pdf) is geared towards leveraging enterprise services. Read the [Enterprise OSGi in Action](http://www.manning.com/cummins/) book. | GlassFish server is built using OSGi, and now supports nice integration between OSGi and Java EE services. It exposes APIs to access Java EE services as OSGi services and also supports a so called Hybrid Application bundle where you can seamlessly use OSGi services in your Java EE application. Refer to this document fo... |
9,361,156 | I have a framework with a DDD data layer which uses the service locator pattern. However, currently I use a global static `ServiceLocator` class which stores all the references. I would like to refactor this into a correct implementation where classes implement the `IServiceProvider` interface and where I remove the gl... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9361156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446261/"
] | The [Enterprise OSGI spec](http://www.osgi.org/wiki/uploads/News/2010_03_23_OSGi_Releases_Enterprise_Specification.pdf) is geared towards leveraging enterprise services. Read the [Enterprise OSGi in Action](http://www.manning.com/cummins/) book. | The SpringSource dm Server, or dm Server for short, is the runtime portion of the SpringSource Application Platform. It is a lightweight, modular, OSGi-based runtime that provides a complete packaged solution for developing, deploying, and managing enterprise applications. By leveraging several best-of-breed technologi... |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | If you are using .NET 3.5 or newer you could use the extension method `Enumerable.Single`:
```
var value = dateQuery.Single();
date = value.Element("HistoryCreation").Value;
```
Then if your assumption 'there will only be one value in dateQuery' is wrong it will throw an exception. | ```
dateQuery.First().Element("HistoryCreation").Value
```
if you are able to use LINQ |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | If you are using .NET 3.5 or newer you could use the extension method `Enumerable.Single`:
```
var value = dateQuery.Single();
date = value.Element("HistoryCreation").Value;
```
Then if your assumption 'there will only be one value in dateQuery' is wrong it will throw an exception. | You can try
```
var theValue = dateQuery.FirstOrDefault();
if (theValue != null)
{
data = theValue.Element("HistoryCreation").Value;
}
else
{
//Deal with the fact that there is no data
}
```
You could use .First() or .Single(), but if there is nothing in dataQuery an exception will be thrown. |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | Try [Enumerable.Single](http://msdn.microsoft.com/en-us/library/bb155325.aspx) or [Enumerable.SingleOrDefault](http://msdn.microsoft.com/en-us/library/bb342451.aspx):
```
date = dateQuery.Single().Element("HistoryCreation").Value;
``` | that should do the trick:
```
using System.Linq;
dateQuery.Single();
``` |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | You could use:
```
dateQuery.First().Element("HistoryCreation").Value
```
This won't fail if there is multiple items in the query. If you want it to fail if there are multiple items, then use Single | that should do the trick:
```
using System.Linq;
dateQuery.Single();
``` |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | You could use:
```
dateQuery.First().Element("HistoryCreation").Value
```
This won't fail if there is multiple items in the query. If you want it to fail if there are multiple items, then use Single | Mark's Answer is by far the best, but I put mine for illustrating foreach loop.
```
foreach (var value in dateQuery) {
date = value.Element("HistoryCreation").Value;
break; // break current loop
}
``` |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | ```
date = dateQuery.Single().Element("HistoryCreation").Value;
``` | that should do the trick:
```
using System.Linq;
dateQuery.Single();
``` |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | ```
date = dateQuery.Single().Element("HistoryCreation").Value;
``` | Try [Enumerable.Single](http://msdn.microsoft.com/en-us/library/bb155325.aspx) or [Enumerable.SingleOrDefault](http://msdn.microsoft.com/en-us/library/bb342451.aspx):
```
date = dateQuery.Single().Element("HistoryCreation").Value;
``` |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | If you are using .NET 3.5 or newer you could use the extension method `Enumerable.Single`:
```
var value = dateQuery.Single();
date = value.Element("HistoryCreation").Value;
```
Then if your assumption 'there will only be one value in dateQuery' is wrong it will throw an exception. | Try [Enumerable.Single](http://msdn.microsoft.com/en-us/library/bb155325.aspx) or [Enumerable.SingleOrDefault](http://msdn.microsoft.com/en-us/library/bb342451.aspx):
```
date = dateQuery.Single().Element("HistoryCreation").Value;
``` |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | You could use:
```
dateQuery.First().Element("HistoryCreation").Value
```
This won't fail if there is multiple items in the query. If you want it to fail if there are multiple items, then use Single | Summing up:
* use First() if you want the first item and know that there is at least one (or more) items in the sequence.
* use FirstOrDefault() if the sequence can have any number of items
* use Single() if the sequence can have exactly one item
* use SingleOrDefault() if the sequence always has either zero or one it... |
3,140,880 | So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so:
```
foreach (var value in dateQuery)
date = value.Element("HistoryCreation").Value;
```
I know for a fact (Based on the way the xml file s... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3140880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/331085/"
] | ```
date = dateQuery.Single().Element("HistoryCreation").Value;
``` | Summing up:
* use First() if you want the first item and know that there is at least one (or more) items in the sequence.
* use FirstOrDefault() if the sequence can have any number of items
* use Single() if the sequence can have exactly one item
* use SingleOrDefault() if the sequence always has either zero or one it... |
17,808 | I'm not referring to actual rooms, i'm talking more about weirdness. I've been trying to use Skanner XT in reaktor (i mean, it can be any synth for that matter) to make some custom weird IRs. I'm getting some mixed results. A lot of the time it sounds like the same synth sound through reverb.
Any good tips on doing t... | 2013/01/24 | [
"https://sound.stackexchange.com/questions/17808",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/4442/"
] | The quality of the convolution can depend on a lot of factors. IRs are meant to sample a space over time. With something like a synth, the change of frequency content over time would probably be less important (compared to a reverb). I have found that chopping the length of the sample to a few milliseconds (or tens or ... | Yes. I recently wrote an article on this very subject which details creation of an impulse response to simulate a "radio" effect in a signal chain.
<http://www.greensideproductions.com.au/2013/01/04/creating-a-radio-effect-using-a-convolution-filter/>
enjoy. |
49,003,378 | Raw data looks like this and I want to sort it by visitor and time, to calculate the time difference in the rows, before saving it to a new file.
```
visitor v_time payment items
1 Jack 1/2/2018 16:07 35 3
2 Jack 1/2/2018 16:09 160 1
3 David 1/2/2018 16:12 25 2
4 Kate 1/2... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49003378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2998077/"
] | When you just add `default = strptime(v_time, "%d/%m/%Y %H:%M")[1]` to the `lag` part:
```
df <- df %>%
arrange(visitor, v_time) %>%
group_by(visitor) %>%
mutate(diff = strptime(v_time, "%d/%m/%Y %H:%M") - lag(strptime(v_time, "%d/%m/%Y %H:%M"), default = strptime(v_time, "%d/%m/%Y %H:%M")[1]),
diff_sec... | The error comes from `lag(strptime(v_time, "%d/%m/%Y %H:%M"))`
Error message:
```
# Error in format.POSIXlt(x, usetz = TRUE) :
# invalid component [[10]] in "POSIXlt" should be 'zone'
```
To avoid this, try `strptime(lag(v_time), "%d/%m/%Y %H:%M")`
```
df <- df %>%
arrange(visitor, v_time) %>%
group_by(v... |
49,003,378 | Raw data looks like this and I want to sort it by visitor and time, to calculate the time difference in the rows, before saving it to a new file.
```
visitor v_time payment items
1 Jack 1/2/2018 16:07 35 3
2 Jack 1/2/2018 16:09 160 1
3 David 1/2/2018 16:12 25 2
4 Kate 1/2... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49003378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2998077/"
] | When you just add `default = strptime(v_time, "%d/%m/%Y %H:%M")[1]` to the `lag` part:
```
df <- df %>%
arrange(visitor, v_time) %>%
group_by(visitor) %>%
mutate(diff = strptime(v_time, "%d/%m/%Y %H:%M") - lag(strptime(v_time, "%d/%m/%Y %H:%M"), default = strptime(v_time, "%d/%m/%Y %H:%M")[1]),
diff_sec... | Here's an approach with the `lubridate` package
```
library(lubridate)
df$v_time <- mdy_hm(df$v_time)
df <- df %>%
arrange(visitor, v_time) %>%
group_by(visitor)
df$diff <- rep(0,nrow(df))
for(i in 1:(nrow(df)-1)){
df$diff[i+1] <- df$v_time[i+1]-df$v_time[i]
}
write.csv(df,"C:/output.csv", row.names = F)
``` |
49,003,378 | Raw data looks like this and I want to sort it by visitor and time, to calculate the time difference in the rows, before saving it to a new file.
```
visitor v_time payment items
1 Jack 1/2/2018 16:07 35 3
2 Jack 1/2/2018 16:09 160 1
3 David 1/2/2018 16:12 25 2
4 Kate 1/2... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49003378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2998077/"
] | When you just add `default = strptime(v_time, "%d/%m/%Y %H:%M")[1]` to the `lag` part:
```
df <- df %>%
arrange(visitor, v_time) %>%
group_by(visitor) %>%
mutate(diff = strptime(v_time, "%d/%m/%Y %H:%M") - lag(strptime(v_time, "%d/%m/%Y %H:%M"), default = strptime(v_time, "%d/%m/%Y %H:%M")[1]),
diff_sec... | Here is an option with `difftime`. We convert the 'v\_time' to datetime with `dmy_hm` (from `lubridate`), then after `arrange`ing, and grouping by 'visitor', use `difftime` to the output in seconds
```
library(tidyverse)
out <- df %>%
mutate(v_time = dmy_hm(v_time)) %>%
arrange(visitor, v_time) %>%
... |
49,003,378 | Raw data looks like this and I want to sort it by visitor and time, to calculate the time difference in the rows, before saving it to a new file.
```
visitor v_time payment items
1 Jack 1/2/2018 16:07 35 3
2 Jack 1/2/2018 16:09 160 1
3 David 1/2/2018 16:12 25 2
4 Kate 1/2... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49003378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2998077/"
] | The error comes from `lag(strptime(v_time, "%d/%m/%Y %H:%M"))`
Error message:
```
# Error in format.POSIXlt(x, usetz = TRUE) :
# invalid component [[10]] in "POSIXlt" should be 'zone'
```
To avoid this, try `strptime(lag(v_time), "%d/%m/%Y %H:%M")`
```
df <- df %>%
arrange(visitor, v_time) %>%
group_by(v... | Here's an approach with the `lubridate` package
```
library(lubridate)
df$v_time <- mdy_hm(df$v_time)
df <- df %>%
arrange(visitor, v_time) %>%
group_by(visitor)
df$diff <- rep(0,nrow(df))
for(i in 1:(nrow(df)-1)){
df$diff[i+1] <- df$v_time[i+1]-df$v_time[i]
}
write.csv(df,"C:/output.csv", row.names = F)
``` |
49,003,378 | Raw data looks like this and I want to sort it by visitor and time, to calculate the time difference in the rows, before saving it to a new file.
```
visitor v_time payment items
1 Jack 1/2/2018 16:07 35 3
2 Jack 1/2/2018 16:09 160 1
3 David 1/2/2018 16:12 25 2
4 Kate 1/2... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49003378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2998077/"
] | The error comes from `lag(strptime(v_time, "%d/%m/%Y %H:%M"))`
Error message:
```
# Error in format.POSIXlt(x, usetz = TRUE) :
# invalid component [[10]] in "POSIXlt" should be 'zone'
```
To avoid this, try `strptime(lag(v_time), "%d/%m/%Y %H:%M")`
```
df <- df %>%
arrange(visitor, v_time) %>%
group_by(v... | Here is an option with `difftime`. We convert the 'v\_time' to datetime with `dmy_hm` (from `lubridate`), then after `arrange`ing, and grouping by 'visitor', use `difftime` to the output in seconds
```
library(tidyverse)
out <- df %>%
mutate(v_time = dmy_hm(v_time)) %>%
arrange(visitor, v_time) %>%
... |
51,787,036 | I have two PCs, not connected with a cable and not in a network that need to communicate with each other. I'm doing two Qt apps and wanted to make the communication via Bluetooth. However, I found out that Qt does not support Bluetooth for Windows ([Does Qt support the windows bluetooth API?](https://stackoverflow.com/... | 2018/08/10 | [
"https://Stackoverflow.com/questions/51787036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10196418/"
] | [This](https://forum.qt.io/topic/93752/qtbluetooth-on-windows-not-working) thread on the QtForum delivered the answer. It works when you switch to the MSVC compiler instead of the standard MinGW!
This is how you do it:
After installing Microsoft Visual Studio and having the MSVC package in Qt (see mentioned thread), ... | You "exactly the same windows" most likely aren't. What is the exact version? The most current Windows 10 version is 1803, and the minimum needed for fully functional Qt Bluetooth support is 1607. |
51,787,036 | I have two PCs, not connected with a cable and not in a network that need to communicate with each other. I'm doing two Qt apps and wanted to make the communication via Bluetooth. However, I found out that Qt does not support Bluetooth for Windows ([Does Qt support the windows bluetooth API?](https://stackoverflow.com/... | 2018/08/10 | [
"https://Stackoverflow.com/questions/51787036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10196418/"
] | [This](https://forum.qt.io/topic/93752/qtbluetooth-on-windows-not-working) thread on the QtForum delivered the answer. It works when you switch to the MSVC compiler instead of the standard MinGW!
This is how you do it:
After installing Microsoft Visual Studio and having the MSVC package in Qt (see mentioned thread), ... | Now it seems that QT supports Bluetooth on Windows since [version 5.14](https://doc.qt.io/qt-5/qtbluetooth-index.html) |
17,656,828 | I have a small piece of code that I want to use as a condition for a jQuery dialog. Pretty simple case, if checkboxes are checked, enable button, if not, disable it. The below code disables the button just fine, but does not enable it when checking any checkboxes.
I tried multiple variations and I cannot get this to w... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17656828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127391/"
] | You will have to use Jquery's .prop() to solve this one
```
if (button.text() == "Apply"){
if ($("selectLocation").is(':checked')){
button.prop('disabled', false);
}
else{
button.prop('disabled', true);
}
}
```
I have never been able to get .attr() to work for this situation | Try like this:
```
$("input[name=selectLocation]")
```
It's not working because you are selecting element with tag `selectLocation` not element with name `selectLocation` |
17,656,828 | I have a small piece of code that I want to use as a condition for a jQuery dialog. Pretty simple case, if checkboxes are checked, enable button, if not, disable it. The below code disables the button just fine, but does not enable it when checking any checkboxes.
I tried multiple variations and I cannot get this to w... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17656828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127391/"
] | You will have to use Jquery's .prop() to solve this one
```
if (button.text() == "Apply"){
if ($("selectLocation").is(':checked')){
button.prop('disabled', false);
}
else{
button.prop('disabled', true);
}
}
```
I have never been able to get .attr() to work for this situation | if button is a jquery element:
```
button.attr("disabled", "disabled"); //to disable it
button.removeAttr("disabled"); //to reenable it
```
In your code, it should be:
```
if (button.text() == "Apply") {
if ($("selectLocation").is(':checked'))
button.removeAttr("disabled"); //to reenable it
else
... |
17,656,828 | I have a small piece of code that I want to use as a condition for a jQuery dialog. Pretty simple case, if checkboxes are checked, enable button, if not, disable it. The below code disables the button just fine, but does not enable it when checking any checkboxes.
I tried multiple variations and I cannot get this to w... | 2013/07/15 | [
"https://Stackoverflow.com/questions/17656828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127391/"
] | You will have to use Jquery's .prop() to solve this one
```
if (button.text() == "Apply"){
if ($("selectLocation").is(':checked')){
button.prop('disabled', false);
}
else{
button.prop('disabled', true);
}
}
```
I have never been able to get .attr() to work for this situation | Not sure if jQuery is going to select the name like that, add in an ID and change the selector.
```
if (button.text() == "Apply") {
if ($("#selectLocation").is(':checked'))
button.removeAttr("disabled");
else
button.attr("disabled", "disabled");
}
<input id="selectLocation" type="checkbox" nam... |
526,752 | I forgot to put a slash before my `home` folder when downloading some files and it seems that they downloaded successfully but I can't seem to navigate before `/` within my thunar explorer so I can't get to them. My hard drive appears to have less space on it from these files being downloaded. So where did these files ... | 2019/06/25 | [
"https://unix.stackexchange.com/questions/526752",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/333478/"
] | If you didn't specify a `/` at the beginning of a path (**absolute** path), it becomes a **relative** path.
As such, it is relative to the current directory on which you are.
So for instance, when downloading a file, if you specify as destination `home/anon/foo/bar.txt` and you are in `/tmp`, the file is not downloa... | You can ask your system to list files that have recently been created/modified.
For example, in the last 24 hours (one full day)
```
find / -type f -mtime -1
```
Or in the last 60 minutes (GNU extension; not standard)
```
find / -type f -mmin -60
```
More details either here on <https://unix.stackexchange.com> o... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Parallel to Adrian's response I also cooked up my own version for reference;
```
public static Id correctCapitalizedId(String input) {
String keyString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345', result = '';
Integer i = 0, s = 15;
if (input.length() != 18) {
return null;
}
for (String seq : in... | Old thread, but new apex specific solution: As of version 54.0 you can simple use Id.valueOf(str, restoreCasing), see here for more information:
<https://developer.salesforce.com/docs/atlas.en-us.236.0.apexref.meta/apexref/apex_methods_system_id.htm#apex_System_id_valueOf_2> |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Old thread, but new apex specific solution: As of version 54.0 you can simple use Id.valueOf(str, restoreCasing), see here for more information:
<https://developer.salesforce.com/docs/atlas.en-us.236.0.apexref.meta/apexref/apex_methods_system_id.htm#apex_System_id_valueOf_2> | Given that the 18 character form of an ID is designed to be a unique identifier irrespective of the casing, I'm not sure why you would ever need to convert to a 15 digit ID.
Why not stay with the 18 character values? If you did for example need to use them as string map keys just normalise their case by using `toLower... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Old thread, but new apex specific solution: As of version 54.0 you can simple use Id.valueOf(str, restoreCasing), see here for more information:
<https://developer.salesforce.com/docs/atlas.en-us.236.0.apexref.meta/apexref/apex_methods_system_id.htm#apex_System_id_valueOf_2> | In case anyone else is using it, I took Adrian Larson's apex code and converted it to Python.
```
def getBitPatterns(c):
CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345'
index = CHARS.find(c)
result = []
for bitNumber in range(0,5):
result.append((index & (1 << bitNumber)) != 0)
return result
de... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | I ported [Daniel Ballinger](https://salesforce.stackexchange.com/users/102/daniel-ballinger)'s answer [here](https://salesforce.stackexchange.com/questions/9568/creating-a-link-using-an-18-character-id/9569#9569) to `Apex`:
```
static String CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345';
static List<Boolean> getBitPatte... | Parallel to Adrian's response I also cooked up my own version for reference;
```
public static Id correctCapitalizedId(String input) {
String keyString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345', result = '';
Integer i = 0, s = 15;
if (input.length() != 18) {
return null;
}
for (String seq : in... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | I ported [Daniel Ballinger](https://salesforce.stackexchange.com/users/102/daniel-ballinger)'s answer [here](https://salesforce.stackexchange.com/questions/9568/creating-a-link-using-an-18-character-id/9569#9569) to `Apex`:
```
static String CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345';
static List<Boolean> getBitPatte... | Given that the 18 character form of an ID is designed to be a unique identifier irrespective of the casing, I'm not sure why you would ever need to convert to a 15 digit ID.
Why not stay with the 18 character values? If you did for example need to use them as string map keys just normalise their case by using `toLower... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Parallel to Adrian's response I also cooked up my own version for reference;
```
public static Id correctCapitalizedId(String input) {
String keyString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345', result = '';
Integer i = 0, s = 15;
if (input.length() != 18) {
return null;
}
for (String seq : in... | In case anyone else is using it, I took Adrian Larson's apex code and converted it to Python.
```
def getBitPatterns(c):
CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345'
index = CHARS.find(c)
result = []
for bitNumber in range(0,5):
result.append((index & (1 << bitNumber)) != 0)
return result
de... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Parallel to Adrian's response I also cooked up my own version for reference;
```
public static Id correctCapitalizedId(String input) {
String keyString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345', result = '';
Integer i = 0, s = 15;
if (input.length() != 18) {
return null;
}
for (String seq : in... | If anyone needs to do this with PHP, I ported Adrian's answer. Requires PHP 8.0 or newer:
```php
<?php
declare(strict_types=1);
namespace Shadowhand\Salesforce;
use function assert;
use function strlen;
use function strpos;
use function strtolower;
use function strtoupper;
use function substr;
/**
* @link https:/... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | I ported [Daniel Ballinger](https://salesforce.stackexchange.com/users/102/daniel-ballinger)'s answer [here](https://salesforce.stackexchange.com/questions/9568/creating-a-link-using-an-18-character-id/9569#9569) to `Apex`:
```
static String CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345';
static List<Boolean> getBitPatte... | In case anyone else is using it, I took Adrian Larson's apex code and converted it to Python.
```
def getBitPatterns(c):
CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345'
index = CHARS.find(c)
result = []
for bitNumber in range(0,5):
result.append((index & (1 << bitNumber)) != 0)
return result
de... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Old thread, but new apex specific solution: As of version 54.0 you can simple use Id.valueOf(str, restoreCasing), see here for more information:
<https://developer.salesforce.com/docs/atlas.en-us.236.0.apexref.meta/apexref/apex_methods_system_id.htm#apex_System_id_valueOf_2> | If anyone needs to do this with PHP, I ported Adrian's answer. Requires PHP 8.0 or newer:
```php
<?php
declare(strict_types=1);
namespace Shadowhand\Salesforce;
use function assert;
use function strlen;
use function strpos;
use function strtolower;
use function strtoupper;
use function substr;
/**
* @link https:/... |
123,220 | The standard field Email on CampaignMember object is not available through API, for which we use the workaround of having another custom field so that its accessible through API.
Is there any way to check from salesforce UI/ workbench for a fields accessibility through API? Something like, creatable, updateable that w... | 2016/05/24 | [
"https://salesforce.stackexchange.com/questions/123220",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/31829/"
] | Parallel to Adrian's response I also cooked up my own version for reference;
```
public static Id correctCapitalizedId(String input) {
String keyString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345', result = '';
Integer i = 0, s = 15;
if (input.length() != 18) {
return null;
}
for (String seq : in... | Given that the 18 character form of an ID is designed to be a unique identifier irrespective of the casing, I'm not sure why you would ever need to convert to a 15 digit ID.
Why not stay with the 18 character values? If you did for example need to use them as string map keys just normalise their case by using `toLower... |
19,598,982 | I'm new in regular expressions. I've got a little problem and i can't find the answer. I'm looking for redundant brackets using this regular espression:
```
public Regex RedundantBrackets = new Regex("[(](\\s?)[a-z](\\s?)[)]");
```
When i find something i want to modife string in this way:
`text1 (text2) text3 => t... | 2013/10/25 | [
"https://Stackoverflow.com/questions/19598982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try this replace
```
Regex.Replace("text1 (text2) text3", // Input
@"([()])", // Pattern to match
string.Empty) // Item to replace
/* result: text1 text2 text3*/
```
### Explanation
Regex replace looks across the whole string for a match. If it finds a match it will... | First off, it can be handy to use verbatim strings so you don't have to escape the slashes etc.
```
public Regex RedundantBrackets = new Regex(@"[(]\s?([a-z]+)\s?[)]");
```
We want to wrap `[a-z]` in parenthesis because that's what we're trying to capture. We can then use `$1` to place that capture into the replacem... |
19,598,982 | I'm new in regular expressions. I've got a little problem and i can't find the answer. I'm looking for redundant brackets using this regular espression:
```
public Regex RedundantBrackets = new Regex("[(](\\s?)[a-z](\\s?)[)]");
```
When i find something i want to modife string in this way:
`text1 (text2) text3 => t... | 2013/10/25 | [
"https://Stackoverflow.com/questions/19598982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try this replace
```
Regex.Replace("text1 (text2) text3", // Input
@"([()])", // Pattern to match
string.Empty) // Item to replace
/* result: text1 text2 text3*/
```
### Explanation
Regex replace looks across the whole string for a match. If it finds a match it will... | this will remove all charaters using regex
finalString = Regex.Replace(finalString, @"[^\w ]", ""); |
3,615,348 | I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?
For that, ... | 2010/09/01 | [
"https://Stackoverflow.com/questions/3615348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267269/"
] | What you need are the best-practices (JAVA) and how it works.
I will recommend an older [post](https://stackoverflow.com/questions/3421047/good-java-code-examples/3421057#3421057)
as [Macarse](https://stackoverflow.com/users/119895/macarse) said:
>
> Have you read Effective Java?
> <http://java.sun.com/docs/books/... | <http://www.oracle.com/technetwork/java/codeconvtoc-136057.html>
If a project you're already working on has coding standards defined, use that. Otherwise, you can follow standards like the one I linked above and make sure you're consistent in using it. It'll help make your programs readable for yourself and others. |
3,615,348 | I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?
For that, ... | 2010/09/01 | [
"https://Stackoverflow.com/questions/3615348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267269/"
] | <http://www.oracle.com/technetwork/java/codeconvtoc-136057.html>
If a project you're already working on has coding standards defined, use that. Otherwise, you can follow standards like the one I linked above and make sure you're consistent in using it. It'll help make your programs readable for yourself and others. | Here are few more links for Java coding standards. You will notice that it is not a hard and fast rule that these conventions needs to be followed, Developer community just adopts subset of these or whatever fits best as per their needs.
<http://www.ontko.com/java/java_coding_standards.html>
<http://www.javarmi.com/2... |
3,615,348 | I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?
For that, ... | 2010/09/01 | [
"https://Stackoverflow.com/questions/3615348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267269/"
] | <http://www.oracle.com/technetwork/java/codeconvtoc-136057.html>
If a project you're already working on has coding standards defined, use that. Otherwise, you can follow standards like the one I linked above and make sure you're consistent in using it. It'll help make your programs readable for yourself and others. | There are many coding standards for Java. I.e.: [OpenJDK](http://cr.openjdk.java.net/~alundblad/styleguide/index-v6.html) (this is my preferred one) or [Google](https://google.github.io/styleguide/javaguide.html) ones.
Unfortunately if you search Internet you will find the [outdated Sun guidelines](https://www.oracle.... |
3,615,348 | I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?
For that, ... | 2010/09/01 | [
"https://Stackoverflow.com/questions/3615348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267269/"
] | What you need are the best-practices (JAVA) and how it works.
I will recommend an older [post](https://stackoverflow.com/questions/3421047/good-java-code-examples/3421057#3421057)
as [Macarse](https://stackoverflow.com/users/119895/macarse) said:
>
> Have you read Effective Java?
> <http://java.sun.com/docs/books/... | Here are few more links for Java coding standards. You will notice that it is not a hard and fast rule that these conventions needs to be followed, Developer community just adopts subset of these or whatever fits best as per their needs.
<http://www.ontko.com/java/java_coding_standards.html>
<http://www.javarmi.com/2... |
3,615,348 | I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?
For that, ... | 2010/09/01 | [
"https://Stackoverflow.com/questions/3615348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267269/"
] | What you need are the best-practices (JAVA) and how it works.
I will recommend an older [post](https://stackoverflow.com/questions/3421047/good-java-code-examples/3421057#3421057)
as [Macarse](https://stackoverflow.com/users/119895/macarse) said:
>
> Have you read Effective Java?
> <http://java.sun.com/docs/books/... | There are many coding standards for Java. I.e.: [OpenJDK](http://cr.openjdk.java.net/~alundblad/styleguide/index-v6.html) (this is my preferred one) or [Google](https://google.github.io/styleguide/javaguide.html) ones.
Unfortunately if you search Internet you will find the [outdated Sun guidelines](https://www.oracle.... |
13,824,051 | I'm developing a small app mainly for self education purposes and I've decided to code the app in HTML / JS and use phonegap to convert it to a "native" app.
This is all working perfectly fine and I've successfully installed a HelloWorld app on my phone.
Besides as a native app I also want to make my project availabl... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13824051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1259801/"
] | For creating video= n no of Image + Audio
**Step 1)**
You will create Video of these Images, as
```
Process proc = Runtime.getRuntime().exec(ffmpeg + " -y -r "+duration +" -i " + imagePath + " -c:v libx264 -r 15 -pix_fmt yuv420p -vf fps=90 " + imageVideoPath);
InputStream stderr = proc.getErrorStrea... | This should help: <http://ffmpeg.org/trac/ffmpeg/wiki/Create%20a%20video%20slideshow%20from%20images>
Using `-r`, you can set the number of seconds you want each image to appear. |
13,824,051 | I'm developing a small app mainly for self education purposes and I've decided to code the app in HTML / JS and use phonegap to convert it to a "native" app.
This is all working perfectly fine and I've successfully installed a HelloWorld app on my phone.
Besides as a native app I also want to make my project availabl... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13824051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1259801/"
] | FFMPEG version: 3.2.1-1
UBUNTU 16.04.1
Imagine, you have an mp3 audio file named wow.mp3 In that case, the following command will get the duration of the mp3 in seconds.
```
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 wow.mp3
```
Once you have the duration in seconds (imag... | This should help: <http://ffmpeg.org/trac/ffmpeg/wiki/Create%20a%20video%20slideshow%20from%20images>
Using `-r`, you can set the number of seconds you want each image to appear. |
13,824,051 | I'm developing a small app mainly for self education purposes and I've decided to code the app in HTML / JS and use phonegap to convert it to a "native" app.
This is all working perfectly fine and I've successfully installed a HelloWorld app on my phone.
Besides as a native app I also want to make my project availabl... | 2012/12/11 | [
"https://Stackoverflow.com/questions/13824051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1259801/"
] | FFMPEG version: 3.2.1-1
UBUNTU 16.04.1
Imagine, you have an mp3 audio file named wow.mp3 In that case, the following command will get the duration of the mp3 in seconds.
```
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 wow.mp3
```
Once you have the duration in seconds (imag... | For creating video= n no of Image + Audio
**Step 1)**
You will create Video of these Images, as
```
Process proc = Runtime.getRuntime().exec(ffmpeg + " -y -r "+duration +" -i " + imagePath + " -c:v libx264 -r 15 -pix_fmt yuv420p -vf fps=90 " + imageVideoPath);
InputStream stderr = proc.getErrorStrea... |
58,196,826 | I have three columns
PID, AppNo and ProcessedDate
I need a query to update the AppNo in the format below
```
PID AppNo ProcessedDate
11 1 09/30/2019 18:21
3 1 09/25/2019 08:37
3 2 09/25/2019 08:37
11 1 09/25/2019 08:39
11 2 09/25/2019 08:40
7 1 09/26/2019 14:19
7 2 09/26... | 2019/10/02 | [
"https://Stackoverflow.com/questions/58196826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6220983/"
] | You seem to be looking to update your original table. You can use `ROW_NUMBER()` in a CTE to rank records with groups having the same date (without time) and pid, ordered by date (with time) and then do the update on the fly:
```
WITH cte AS (
SELECT
pid,
ProcessedDate,
AppNo,
R... | Query.
```
SELECT pid as ProjectID
, Row_Number() OVER(PARTITION BY pid, ProcessedDate ORDER BY ProcessedDate) AS AppNo
, ProcessedDate
FROM table
``` |
58,196,826 | I have three columns
PID, AppNo and ProcessedDate
I need a query to update the AppNo in the format below
```
PID AppNo ProcessedDate
11 1 09/30/2019 18:21
3 1 09/25/2019 08:37
3 2 09/25/2019 08:37
11 1 09/25/2019 08:39
11 2 09/25/2019 08:40
7 1 09/26/2019 14:19
7 2 09/26... | 2019/10/02 | [
"https://Stackoverflow.com/questions/58196826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6220983/"
] | You seem to be looking to update your original table. You can use `ROW_NUMBER()` in a CTE to rank records with groups having the same date (without time) and pid, ordered by date (with time) and then do the update on the fly:
```
WITH cte AS (
SELECT
pid,
ProcessedDate,
AppNo,
R... | convert `ProcessedDate` to date if row\_number shouldn't consider time as:
```
SELECT AppNo, ProcessedDate,pid
,Row_Number() OVER(PARTITION BY pid, convert (date,ProcessedDate)
ORDER BY ProcessedDate) AS rn
from @T
```
You can write an Update as:
```
with CTE as(
SELECT ProcessedDate,pid
,Row_... |
58,196,826 | I have three columns
PID, AppNo and ProcessedDate
I need a query to update the AppNo in the format below
```
PID AppNo ProcessedDate
11 1 09/30/2019 18:21
3 1 09/25/2019 08:37
3 2 09/25/2019 08:37
11 1 09/25/2019 08:39
11 2 09/25/2019 08:40
7 1 09/26/2019 14:19
7 2 09/26... | 2019/10/02 | [
"https://Stackoverflow.com/questions/58196826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6220983/"
] | You seem to be looking to update your original table. You can use `ROW_NUMBER()` in a CTE to rank records with groups having the same date (without time) and pid, ordered by date (with time) and then do the update on the fly:
```
WITH cte AS (
SELECT
pid,
ProcessedDate,
AppNo,
R... | you must use partition just with date part like this :
```
SELECT AppNo, ProcessedDate,pid
,Row_Number() OVER(PARTITION BY pid, CONVERT(VARCHAR(10), ProcessedDate, 111) ORDER BY ProcessedDate) AS rn
select * FROM table
``` |
58,196,826 | I have three columns
PID, AppNo and ProcessedDate
I need a query to update the AppNo in the format below
```
PID AppNo ProcessedDate
11 1 09/30/2019 18:21
3 1 09/25/2019 08:37
3 2 09/25/2019 08:37
11 1 09/25/2019 08:39
11 2 09/25/2019 08:40
7 1 09/26/2019 14:19
7 2 09/26... | 2019/10/02 | [
"https://Stackoverflow.com/questions/58196826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6220983/"
] | You seem to be looking to update your original table. You can use `ROW_NUMBER()` in a CTE to rank records with groups having the same date (without time) and pid, ordered by date (with time) and then do the update on the fly:
```
WITH cte AS (
SELECT
pid,
ProcessedDate,
AppNo,
R... | if `ProcessedDate` is of type `DATETIME` you can just do
```
SELECT
pid,
ROW_NUMBER() OVER (
PARTITION BY pid, convert(date, ProcessedDate)
ORDER BY pid, ProcessedDate
) AppNo,
ProcessedDate
FROM table
```
if `ProcessedDate` is of type `VARCHAR` you can just do
```
;WITH
t as (
... |
57,157,037 | When running the app on the iPhone X simulator the Material Top Tab Navigator cuts into the notch and bottom button.
To fix this I have tried to implement the SafeAreaView before applying the App Container and to wrap each individual screen in SafeAreaViews. This works to keep the text away from these areas but not th... | 2019/07/23 | [
"https://Stackoverflow.com/questions/57157037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10925260/"
] | give `SafeAreaView` a size
```
<SafeAreaView style={{ flex: 1 }}>
<AppContainer/>
</SafeAreaView>
```
if AppContainer still spreads full screen,
change `import { SafeAreaView } from 'react-navigation'`
to `import { SafeAreaView } from 'react-native'` | You need to provide `flex: 1` as style to the `SafeAreaView` Component
```
<SafeAreaView style={{flex: 1}}>
{/* Component here */}
</SafeAreaView>
``` |
35,087,204 | This question is to confirm I understood the concept right and take expert opinion on the style of usages and possible optimization.
I am trying to understand "placement new" and following is the program I came up with...
```
#include <iostream>
#include <new>
class A {
int *_a;
public:
A(int v) {std::cout<<"A... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35087204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1320956/"
] | It's really, really simple: `new` can be thought of as doing two things:
1. Allocating the memory.
2. Placement-constructing the object in the allocated memory.
There's no guarantee that `malloc` is actually used by the implementation, but typically it is. You cannot assume it about the implementation, but for the pu... | This is probably something for [CodeReview.SE](https://codereview.stackexchange.com/), let me comment your sourcecode a bit before I answer your questions.
```
A *obj1 = new A(21);
std::cout<<"Object allocated at "<<obj1<<std::endl;
obj1->~A();
```
You'd normally never call the destructor on a object *not* created w... |
35,087,204 | This question is to confirm I understood the concept right and take expert opinion on the style of usages and possible optimization.
I am trying to understand "placement new" and following is the program I came up with...
```
#include <iostream>
#include <new>
class A {
int *_a;
public:
A(int v) {std::cout<<"A... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35087204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1320956/"
] | This is probably something for [CodeReview.SE](https://codereview.stackexchange.com/), let me comment your sourcecode a bit before I answer your questions.
```
A *obj1 = new A(21);
std::cout<<"Object allocated at "<<obj1<<std::endl;
obj1->~A();
```
You'd normally never call the destructor on a object *not* created w... | >
> How C++ placement new works?
>
>
> ...
>
>
> I am trying to understand "placement new" and following is the program I came up with...
>
>
>
The two answers are both excellent. But you also wonder how it works, so, I will add explanation from the assembly:
---
* `A *obj1 = new A(21);`:
---
```
call oper... |
35,087,204 | This question is to confirm I understood the concept right and take expert opinion on the style of usages and possible optimization.
I am trying to understand "placement new" and following is the program I came up with...
```
#include <iostream>
#include <new>
class A {
int *_a;
public:
A(int v) {std::cout<<"A... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35087204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1320956/"
] | It's really, really simple: `new` can be thought of as doing two things:
1. Allocating the memory.
2. Placement-constructing the object in the allocated memory.
There's no guarantee that `malloc` is actually used by the implementation, but typically it is. You cannot assume it about the implementation, but for the pu... | >
> How C++ placement new works?
>
>
> ...
>
>
> I am trying to understand "placement new" and following is the program I came up with...
>
>
>
The two answers are both excellent. But you also wonder how it works, so, I will add explanation from the assembly:
---
* `A *obj1 = new A(21);`:
---
```
call oper... |
17,276,894 | My Categories Dictionary is like this
```
"category": {
"position": 1,
"updated_at": "2012-11-21T11:02:14+05:30",
"is_default": false,
"name": "Ge",
"folders": [
{
```
How can i delete a particular Category object alone which has is\_default as true?
I tried ... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17276894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764164/"
] | First thing first: ***You can not delete object from Dictionary(or Array Or Set) while Enumerating.***
But it is not impossible.
Try this:
```
NSArray *keys = [category allKeys];
for(NSString *key in keys )
{
obj = [category objectForKey:key];
if([key isEqualToString:@"is_default"] && [[category obje... | You can get the keys (an object may be stored in the dictionary multiple times, using different keys) that your object is stored at like this:
```
NSArray *keys = [myDictionary allKeysForObject:obj];
```
Now that you have the key(s), it's easy to delete the object:
```
if (keys.count > 0) {
[myDictionary remove... |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | I solved this by delete this file `.firebaserc` .
Steps:
1. Find file `.firebaserc` at Your Application Folder.
2. Delete it.
3. Try again at CMD. `firebase init`
Good luck | Re-installing the firebase-tools on npm worked! However, if anybody know how to fix the project scope without re-installing npm firebase-tools then please let me know. |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | To me, I was using the wrong Google Account, to solve I used the command
`firebase logout`, and after `firebase login` | Deleting the [hidden] `.firebaserc` file, (that's generated via the Firebase CLI tool), should solve the issue for most people, although as previously mentioned, you may need to delete the `.firebase.json` file too.
*However*, Firebase will still look for this file, so you'll need to have one. The file is very minimal... |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | I solved this by delete this file `.firebaserc` .
Steps:
1. Find file `.firebaserc` at Your Application Folder.
2. Delete it.
3. Try again at CMD. `firebase init`
Good luck | Delete the two files, .firebaserc and firebase.json
Then redo the process it will fix it. |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | I solved this by delete this file `.firebaserc` .
Steps:
1. Find file `.firebaserc` at Your Application Folder.
2. Delete it.
3. Try again at CMD. `firebase init`
Good luck | To me, I was using the wrong Google Account, to solve I used the command
`firebase logout`, and after `firebase login` |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | Now you can do this only online because you need to accept terms and conditions to get permission.
link to page:
<https://console.firebase.google.com/> | Deleting the [hidden] `.firebaserc` file, (that's generated via the Firebase CLI tool), should solve the issue for most people, although as previously mentioned, you may need to delete the `.firebase.json` file too.
*However*, Firebase will still look for this file, so you'll need to have one. The file is very minimal... |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | I solved this by delete this file `.firebaserc` .
Steps:
1. Find file `.firebaserc` at Your Application Folder.
2. Delete it.
3. Try again at CMD. `firebase init`
Good luck | Deleting the [hidden] `.firebaserc` file, (that's generated via the Firebase CLI tool), should solve the issue for most people, although as previously mentioned, you may need to delete the `.firebase.json` file too.
*However*, Firebase will still look for this file, so you'll need to have one. The file is very minimal... |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | I solved this by delete this file `.firebaserc` .
Steps:
1. Find file `.firebaserc` at Your Application Folder.
2. Delete it.
3. Try again at CMD. `firebase init`
Good luck | Now you can do this only online because you need to accept terms and conditions to get permission.
link to page:
<https://console.firebase.google.com/> |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | To me, I was using the wrong Google Account, to solve I used the command
`firebase logout`, and after `firebase login` | Re-installing the firebase-tools on npm worked! However, if anybody know how to fix the project scope without re-installing npm firebase-tools then please let me know. |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | To me, I was using the wrong Google Account, to solve I used the command
`firebase logout`, and after `firebase login` | Now you can do this only online because you need to accept terms and conditions to get permission.
link to page:
<https://console.firebase.google.com/> |
54,396,551 | My error when using firebase init --debug
```
[2019-01-28T05:32:18.956Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
"error": {
"code": 403,
"message": "The caller do... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54396551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5224944/"
] | Delete the two files, .firebaserc and firebase.json
Then redo the process it will fix it. | Re-installing the firebase-tools on npm worked! However, if anybody know how to fix the project scope without re-installing npm firebase-tools then please let me know. |
49,696,620 | I want to make a counter remains dynamic and non-bootable when updating
web page,
here is my code the problem is that when I refresh the page the counter(setTimeout) will count again from zero to 5 I want it to count from the last value before
the refresh
```
<html>
<head>
<meta charset="utf-8"/>
<title>Insert title ... | 2018/04/06 | [
"https://Stackoverflow.com/questions/49696620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9475140/"
] | You will have to manually store the counter value in the client's browser; by default, browsers will not retain any of a webpage's state when it is closed (or refreshed). For example, you may use the [localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage):
```
const STORAGE_KEY = 'coun... | You could store the last timer iteration using localStorage before the user closes or navigates away from the tab, and resume when needed.
[More about localStorage](https://www.w3schools.com/html/html5_webstorage.asp) |
18,819 | I was attempting to replace my faucet sprayer and hose today and discovered that the hose I bought was not compatible with the faucet. I bought a hose that screws on, the one on the faucet has some sort of connector and a plastic latch and wire holding it together...
So, I have managed to reconnect the old hose and ju... | 2012/10/10 | [
"https://diy.stackexchange.com/questions/18819",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/7730/"
] | There is no water pressure to the sprayer unless the faucet itself is turned on. You can verify this by simply depressing the handle on the sprayer while the faucet it off. | If the faucet is turned off, no water is going to come out of the sprayer or the spout.
If you are concerned then just test it out - turn the faucet off and disconnect the hose. |
18,819 | I was attempting to replace my faucet sprayer and hose today and discovered that the hose I bought was not compatible with the faucet. I bought a hose that screws on, the one on the faucet has some sort of connector and a plastic latch and wire holding it together...
So, I have managed to reconnect the old hose and ju... | 2012/10/10 | [
"https://diy.stackexchange.com/questions/18819",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/7730/"
] | There is no water pressure to the sprayer unless the faucet itself is turned on. You can verify this by simply depressing the handle on the sprayer while the faucet it off. | Typically the faucet valves control the flow and mix function. However the hose will be pressureized any time the faucet is used. This means if you use the faucet there is a chance the hose can come off and cause a small flood. |
1,385,014 | ```
var func = function()
{
$(this).hide();
$parent = $(this).parent();
$parent.removeClass('my_signature_mouseover');
var text = $(this).val();
var $span = $("#status span");
$span.text(text);
$span.show();
};
$("#status input").keyup(function (e) {
var keyCode = e.keyCode || e.which;
... | 2009/09/06 | [
"https://Stackoverflow.com/questions/1385014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104015/"
] | You are calling the `func`, with a normal function call, that causes inside `func`, the `this` variable will refer to the global object (window).
You have to execute the function with [`call`](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference:Global_Objects:Function:call), in order to preserve the context... | Try this:
```
var func = function(elem)
{
elem.hide();
var $parent = elem.parent();
$parent.removeClass('my_signature_mouseover');
var text = elem.val();
var $span = $("#status span");
$span.text(text);
$span.show();
};
$("#status input").keyup(function (e) {
var keyCode = e.keyCode || ... |
15,872 | Is there some sort of standard for expansion slots in laptops? I know in PCs there is the PCIe standard used for pretty much all expansion cards. But in a laptop, if I took out my 802.11ac NIC, would I be able to use the same slot for a Bluetooth module, for example?
tl;dr is there a standard for laptop expansion card... | 2022/03/31 | [
"https://hardwarerecs.stackexchange.com/questions/15872",
"https://hardwarerecs.stackexchange.com",
"https://hardwarerecs.stackexchange.com/users/20900/"
] | You should tell us your laptop model number and ask for a recommendation for specifically what you want to add to the laptop. As of right now the question isn't really on topic but it can be if you provide that info.
I will edit my answer with a recommendation if you update the question.
---
There are a few standard... | No, except if you count USB.
Laptop manufacturers like Dell, HP and Apple try to make their laptops thinner, lighter, and faster. To make them thinner and lighter, they do not include bulky expantion like PCI-e. |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | with jquery you can hide the print button when clicked and show it back after print with:
```
$('#PrintDiv').click(function(){
$(this).hide();
var contents = document.getElementById("wrapper").innerHTML;
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.style... | simply add hide() function.
```
$('#PrintDiv').click(function(){
$(this).hide();
``` |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | Change your print function to :
```
window.print();
```
Add css below :
```
@media print {
#button-container {
display : none !important;
}
}
``` | With media queries, you could add css rules such as `display:none;` when the page is being printed.
```css
@media print {
/* All your print styles go here */
#PrintDiv{
display:none !important;
}
}
```
This way, you could also hide the page's banner or remove the background, make the text c... |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | Change your print function to :
```
window.print();
```
Add css below :
```
@media print {
#button-container {
display : none !important;
}
}
``` | Here is a CSS to achieve what you want to do (hide print button and any other content on print page)
Please add **no-print** class to any element that you want to hide on a print page.
```
@media print {
.no-print
{
display: none !important;
}
}
``` |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | Change your print function to :
```
window.print();
```
Add css below :
```
@media print {
#button-container {
display : none !important;
}
}
``` | simply add hide() function.
```
$('#PrintDiv').click(function(){
$(this).hide();
``` |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | with jquery you can hide the print button when clicked and show it back after print with:
```
$('#PrintDiv').click(function(){
$(this).hide();
var contents = document.getElementById("wrapper").innerHTML;
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.style... | Change your print function to :
```
window.print();
```
Add css below :
```
@media print {
#button-container {
display : none !important;
}
}
``` |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | with jquery you can hide the print button when clicked and show it back after print with:
```
$('#PrintDiv').click(function(){
$(this).hide();
var contents = document.getElementById("wrapper").innerHTML;
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.style... | Maybe you can try `document.getElementById("print").style.display = 'none';` |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | with jquery you can hide the print button when clicked and show it back after print with:
```
$('#PrintDiv').click(function(){
$(this).hide();
var contents = document.getElementById("wrapper").innerHTML;
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.style... | With media queries, you could add css rules such as `display:none;` when the page is being printed.
```css
@media print {
/* All your print styles go here */
#PrintDiv{
display:none !important;
}
}
```
This way, you could also hide the page's banner or remove the background, make the text c... |
42,229,078 | I am trying to hide print button and some text when print a page. I have following files:
test.html
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067148/"
] | Change your print function to :
```
window.print();
```
Add css below :
```
@media print {
#button-container {
display : none !important;
}
}
``` | You seem to use Bootstrap.
Did you try to use the helper classes ?
<http://getbootstrap.com/css/#responsive-utilities-print>
```
<div id="button-container" class="hidden-print">
<a href="#" id="PrintDiv" class="btn btn-success btn-primary"><span class="glyphicon glyphicon-print" aria-hidden="true"></span>Print</a>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.