qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
74,959
What color should a deletion confirmation message be? This is related to the question *[Should 'yes, delete it' be red, or green?](//ux.stackexchange.com/questions/49991/should-yes-delete-it-be-red-or-green)*, but different because this question asks about a passive confirmation message and not the active delete butto...
2015/03/17
[ "https://ux.stackexchange.com/questions/74959", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/17283/" ]
Don't start with choosing colors! --------------------------------- ### 1. First, distinguish notifications from errors This is a common point of confusion with UX. Consider these two messages: * `Sorry, the app has crashed` - This is an error, and should be highlighted as an error (i.e. pop up alert, dialog, red bu...
**The message indicates a successful action, so if you're using color cues, this message should use the color of success: green, in your case**. The danger color (red, in this example) should be used when the user is *about to do* something destructive (e.g. "Are you sure you want to delete this?"), but the message you...
74,959
What color should a deletion confirmation message be? This is related to the question *[Should 'yes, delete it' be red, or green?](//ux.stackexchange.com/questions/49991/should-yes-delete-it-be-red-or-green)*, but different because this question asks about a passive confirmation message and not the active delete butto...
2015/03/17
[ "https://ux.stackexchange.com/questions/74959", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/17283/" ]
Don't start with choosing colors! --------------------------------- ### 1. First, distinguish notifications from errors This is a common point of confusion with UX. Consider these two messages: * `Sorry, the app has crashed` - This is an error, and should be highlighted as an error (i.e. pop up alert, dialog, red bu...
Already there are couple of good answers urging you from moving away from colors. I do agree with them. Considering the color blindness/cultural relations, **colors should always be used as a secondary mode of conveying any information**. But then again, if you are working with an application which already has alerts f...
53,345,705
I'm new to ARM assembly and am trying to translate some easy code snippets from C to assembly. I'm not sure if I am using ldr and str correctly (although I feel like ive tried everything) and I keep getting seg fault when I try to run it. The C code is ``` int main() { int x = 10; int y = 5; int z = 20; ...
2018/11/16
[ "https://Stackoverflow.com/questions/53345705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665000/" ]
OK, for each of your variables, you have to decide where you are going to store it: * you can store it in a register, which is OK as long as you have enough spare registers; * you can store it at a fixed address, which is fine for global and static variables but no good for local variables; * you can store it on the s...
TonyK's [answer](https://stackoverflow.com/a/53347221/605307) covers the source of your mistakes pretty well. It strikes me that it might benefit you to see how a *compiler* would deal with the compilation of a simple program like this; seeing the compiler allocate space on the stack for these variables, and seeing how...
53,345,705
I'm new to ARM assembly and am trying to translate some easy code snippets from C to assembly. I'm not sure if I am using ldr and str correctly (although I feel like ive tried everything) and I keep getting seg fault when I try to run it. The C code is ``` int main() { int x = 10; int y = 5; int z = 20; ...
2018/11/16
[ "https://Stackoverflow.com/questions/53345705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665000/" ]
> > The C code is > > > ``` int main() { int x = 10; int y = 5; int z = 20; int min = y; if (x < min) {min = x;} if (z < min) {min = z;} return min; } ``` Don't use `ldr` and `str` as these store a registers value to memory. For example `str rX, [rY]` means to use the value of 'rY'...
TonyK's [answer](https://stackoverflow.com/a/53347221/605307) covers the source of your mistakes pretty well. It strikes me that it might benefit you to see how a *compiler* would deal with the compilation of a simple program like this; seeing the compiler allocate space on the stack for these variables, and seeing how...
740,432
I bought a new HD (1 TB) which was my D drive. I want the new HD to be C drive and someone helped me to change that. Now my new HD is C drive but with 2 OS (Windows 7 and Vista). My old HD is now D drive also with Windows 7 on it. So now I have 3 OS on my PC. How can I delete Vista on drive C and the other Win 7 on dri...
2014/04/11
[ "https://superuser.com/questions/740432", "https://superuser.com", "https://superuser.com/users/314769/" ]
Boot up the machine using a Linux LiveCD, such as Ubuntu. Then you should be able to edit the disk partitions with `gparted` and delete one. You can then create a new partition in the free space, or expand one of the other ones to fill it. The problem with using Disk Manager through Windows, is you may find it imp...
When you install another copy of windows on partition which already contains windows, the old one is moved to windows.old directory. All you have to do to get rid of it is deleting this directory. Second step is fixing your boot.ini file. The easiest way is using 3rd party software like easyBCD to remove spare entrie...
740,432
I bought a new HD (1 TB) which was my D drive. I want the new HD to be C drive and someone helped me to change that. Now my new HD is C drive but with 2 OS (Windows 7 and Vista). My old HD is now D drive also with Windows 7 on it. So now I have 3 OS on my PC. How can I delete Vista on drive C and the other Win 7 on dri...
2014/04/11
[ "https://superuser.com/questions/740432", "https://superuser.com", "https://superuser.com/users/314769/" ]
Boot up the machine using a Linux LiveCD, such as Ubuntu. Then you should be able to edit the disk partitions with `gparted` and delete one. You can then create a new partition in the free space, or expand one of the other ones to fill it. The problem with using Disk Manager through Windows, is you may find it imp...
If you want to delete vista then log in using windows 7 and go to run and type `msconfig`without quote. **System Configuration** windows will be open then see in **Boot**. If there is vista present in the list then you can delete it. and after restart you can format your vista drive using cmd. In case Vista is not pr...
37,117,514
i've designed a organization table as per below: ``` Name Supervisor Manager David - - Josseph David - Jenny Josseph David Step Josseph David Mike Josseph David steven David ``` The Chart above explain that, D...
2016/05/09
[ "https://Stackoverflow.com/questions/37117514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3431239/" ]
<http://sqlfiddle.com/#!9/f39ce/2> ``` SELECT SUM(IF(Supervisor='David',1,0)), SUM(IF(manager='David',1,0)) FROM mytable ``` and here is an example of grouping query, if you ever need one: <http://sqlfiddle.com/#!9/bdd738/5> ``` SELECT t1.name, SUM(IF(t1.name=t2.Supervisor,1,0)), SUM(IF(t1.name=t2.manager,1,...
It can: ``` select Name as BossName, sum( case when Supervisor = Name then 1 else 0 end) as Supervises, sum( case when Manager = Name then 1 else 0 end) as Manages from your_table group by Name; ``` This will get you something like: ``` BossName Supervises Manages David 2 3 Josseph 3 ...
37,117,514
i've designed a organization table as per below: ``` Name Supervisor Manager David - - Josseph David - Jenny Josseph David Step Josseph David Mike Josseph David steven David ``` The Chart above explain that, D...
2016/05/09
[ "https://Stackoverflow.com/questions/37117514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3431239/" ]
It can: ``` select Name as BossName, sum( case when Supervisor = Name then 1 else 0 end) as Supervises, sum( case when Manager = Name then 1 else 0 end) as Manages from your_table group by Name; ``` This will get you something like: ``` BossName Supervises Manages David 2 3 Josseph 3 ...
Use the below query ``` select name,(select count(*) from <table> where supervisor=name) as supervisor, (select count(*) from <table> where manager=name) as manager from <table> ```
37,117,514
i've designed a organization table as per below: ``` Name Supervisor Manager David - - Josseph David - Jenny Josseph David Step Josseph David Mike Josseph David steven David ``` The Chart above explain that, D...
2016/05/09
[ "https://Stackoverflow.com/questions/37117514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3431239/" ]
<http://sqlfiddle.com/#!9/f39ce/2> ``` SELECT SUM(IF(Supervisor='David',1,0)), SUM(IF(manager='David',1,0)) FROM mytable ``` and here is an example of grouping query, if you ever need one: <http://sqlfiddle.com/#!9/bdd738/5> ``` SELECT t1.name, SUM(IF(t1.name=t2.Supervisor,1,0)), SUM(IF(t1.name=t2.manager,1,...
Use the below query ``` select name,(select count(*) from <table> where supervisor=name) as supervisor, (select count(*) from <table> where manager=name) as manager from <table> ```
1,874,696
Five boys and three girls are to be seated in a row such that no two girls sit side by side?
2016/07/29
[ "https://math.stackexchange.com/questions/1874696", "https://math.stackexchange.com", "https://math.stackexchange.com/users/356805/" ]
I'm assuming there is individuality between the girls and the boys, so we can generalize arrangements such that there is no need to remove cases of congruent order. The above scenario is identical to the statement: arrange 8 people in 8 seats, remove scenarios where 3 girls are sitting side by side. To arrange 8 peop...
So you should first try to count how many ways can everybody be seated without any constraint. Keep in mind that we don't care about specific people, namely (boy 1 on chair 1, boy 2 on chair 2) is exactly the same as (boy 2 on chair 1, boy 1 on chair 2). Then you can just remove from this total the number of ways you...
25,425,060
Hi everybody out there, I have configured my page template so that I can create FAL relations. I'm able to read the data of the current page and spit out the image. But what I really want is that I can slide up - if there is no FAL relation at the current page then I would like to look in the parent page for an image...
2014/08/21
[ "https://Stackoverflow.com/questions/25425060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2428627/" ]
You can use the vhs viewhelper [v:page.resource](https://fluidtypo3.org/viewhelpers/vhs/2.3.3/Page/Resources/FalViewHelper.html#argument-slide) in combination with the slide argument, wich is supported from vhs version 2.3.3. ``` {namespace v=FluidTYPO3\Vhs\ViewHelpers} <v:page.resources.fal table="pages" field="medi...
It's not possible with a VHS ViewHelper because Resource / Record / FalViewHelper doesn't support content sliding like Content / GetViewHelper does. What you can do: Write a feature request or make a pull request with your solution. or Write your own ViewHelper. or Use good old (or bad?) typoscript for it: ``` li...
25,425,060
Hi everybody out there, I have configured my page template so that I can create FAL relations. I'm able to read the data of the current page and spit out the image. But what I really want is that I can slide up - if there is no FAL relation at the current page then I would like to look in the parent page for an image...
2014/08/21
[ "https://Stackoverflow.com/questions/25425060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2428627/" ]
It's not possible with a VHS ViewHelper because Resource / Record / FalViewHelper doesn't support content sliding like Content / GetViewHelper does. What you can do: Write a feature request or make a pull request with your solution. or Write your own ViewHelper. or Use good old (or bad?) typoscript for it: ``` li...
For `TYPO3 8.7` you have to use TypoScript, `vhs` with `v:page.resources.fal` is not working anymore ([issue](https://github.com/FluidTYPO3/vhs/issues/1520)) - in my case. See example from N1ck above. I use a Subpage-Sitemap with images from page properties (media/resources). FLUID: ``` <f:if condition="{menu}"> ...
25,425,060
Hi everybody out there, I have configured my page template so that I can create FAL relations. I'm able to read the data of the current page and spit out the image. But what I really want is that I can slide up - if there is no FAL relation at the current page then I would like to look in the parent page for an image...
2014/08/21
[ "https://Stackoverflow.com/questions/25425060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2428627/" ]
You can use the vhs viewhelper [v:page.resource](https://fluidtypo3.org/viewhelpers/vhs/2.3.3/Page/Resources/FalViewHelper.html#argument-slide) in combination with the slide argument, wich is supported from vhs version 2.3.3. ``` {namespace v=FluidTYPO3\Vhs\ViewHelpers} <v:page.resources.fal table="pages" field="medi...
For `TYPO3 8.7` you have to use TypoScript, `vhs` with `v:page.resources.fal` is not working anymore ([issue](https://github.com/FluidTYPO3/vhs/issues/1520)) - in my case. See example from N1ck above. I use a Subpage-Sitemap with images from page properties (media/resources). FLUID: ``` <f:if condition="{menu}"> ...
3,845,972
I'm aware of both `setInterval` and `setTimeout` functions but it's not suitable for my case, because I need to create an `img` DOM element in the interval of 7 seconds. * The count of images are not predefined (varies daily). When I use `setInterval`, I cannot *completely* stop it after certain limit (daily count). ...
2010/10/02
[ "https://Stackoverflow.com/questions/3845972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/166476/" ]
> > What's the best way to implement a sleep function JavaScript? > > > JavaScript code has to be non-blocking, because any code that blocks, like a loop that waits for something to happen, will make the whole browser unresponsive. JavaScript in web browsers not only runs in a single thread, but it actually shares...
This is quite simple and also has been answered before. See the answers to this question: * [Want a javascript function to run every minute, but max 3 times.](https://stackoverflow.com/questions/1245617/want-a-javascript-function-to-run-every-minute-but-max-3-times)
3,845,972
I'm aware of both `setInterval` and `setTimeout` functions but it's not suitable for my case, because I need to create an `img` DOM element in the interval of 7 seconds. * The count of images are not predefined (varies daily). When I use `setInterval`, I cannot *completely* stop it after certain limit (daily count). ...
2010/10/02
[ "https://Stackoverflow.com/questions/3845972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/166476/" ]
> > What's the best way to implement a sleep function JavaScript? > > > JavaScript code has to be non-blocking, because any code that blocks, like a loop that waits for something to happen, will make the whole browser unresponsive. JavaScript in web browsers not only runs in a single thread, but it actually shares...
You're complaining about setTimeout and setInterval, but then describing how you are using them badly. Either user setTimeout **not in a loop** and have it call another setTimeout if there is more to do, or use setInterval and call clearInterval after a maintained count is reached.
3,845,972
I'm aware of both `setInterval` and `setTimeout` functions but it's not suitable for my case, because I need to create an `img` DOM element in the interval of 7 seconds. * The count of images are not predefined (varies daily). When I use `setInterval`, I cannot *completely* stop it after certain limit (daily count). ...
2010/10/02
[ "https://Stackoverflow.com/questions/3845972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/166476/" ]
This is quite simple and also has been answered before. See the answers to this question: * [Want a javascript function to run every minute, but max 3 times.](https://stackoverflow.com/questions/1245617/want-a-javascript-function-to-run-every-minute-but-max-3-times)
You're complaining about setTimeout and setInterval, but then describing how you are using them badly. Either user setTimeout **not in a loop** and have it call another setTimeout if there is more to do, or use setInterval and call clearInterval after a maintained count is reached.
727,903
I have at this time two remote machines to which I am connecting. For one I am using private key with passphrase, and another one I am using root password. Now, when I want to connect to machine with root password authentication, first ssh asks me for passphrase for machine which private key is inside my ~/.ssh direc...
2016/01/31
[ "https://askubuntu.com/questions/727903", "https://askubuntu.com", "https://askubuntu.com/users/343796/" ]
You can use a per-user ssh-config file located in ``` ~/.ssh/config ``` or a system-global one in ``` /etc/ssh/ssh_config ``` that stores the basic settings for each connection. Example: ``` Host example_host User foo HostName example.com IdentityFile ~/.ssh/foo.key Port 23421 ``` Having this...
There is `~/.ssh/config` as pointed out in the manual pages for [`ssh`](http://manpages.ubuntu.com/manpages/lucid/man1/ssh.1.html). It is well described there and in `man ssh_config` and also many times answered on askubuntu. TL;DR: ``` # to preserve connections: ControlMaster auto ControlPath ~/.ssh/controlmasters/%...
45,350,828
I apologize in advance for being weak English :( My website looks like this: <https://scr.hu/LoDJpD> ```html <div class="container-fluid"> <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1 text-center"> <div class="card col-md-6 col-sm-6 row-2"> <div class="card-bg"> <div class...
2017/07/27
[ "https://Stackoverflow.com/questions/45350828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8375924/" ]
An array is an `Object`, and you can make lists of any object type - so you can make a `List` of arrays without doing anything special: ``` // Declare it and initialise as an empty list List<Integer[]> list = new ArrayList<>(); // Add an item -- it's a new array list.add(new Integer[5]); // Access an item -- it's an...
If we want [Arrays](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html) inside [List](https://docs.oracle.com/javase/7/docs/api/java/util/List.html) then - ``` class Test { private final List<int[]> myList; public Test() { myList = new ArrayList<>(); } public void add(int[] myArray)...
45,350,828
I apologize in advance for being weak English :( My website looks like this: <https://scr.hu/LoDJpD> ```html <div class="container-fluid"> <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1 text-center"> <div class="card col-md-6 col-sm-6 row-2"> <div class="card-bg"> <div class...
2017/07/27
[ "https://Stackoverflow.com/questions/45350828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8375924/" ]
Looks like you want to create a 2-dimansional integer array. I assume you have a special use case in which you need a primitive array ob ArrayList-Objects. Anyways you can create such a thing like any other primitive array like ``` ArrayList<Integer>[] test = new ArrayList[2]; ``` and access/set it by index.. ``...
If we want [Arrays](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html) inside [List](https://docs.oracle.com/javase/7/docs/api/java/util/List.html) then - ``` class Test { private final List<int[]> myList; public Test() { myList = new ArrayList<>(); } public void add(int[] myArray)...
45,350,828
I apologize in advance for being weak English :( My website looks like this: <https://scr.hu/LoDJpD> ```html <div class="container-fluid"> <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1 text-center"> <div class="card col-md-6 col-sm-6 row-2"> <div class="card-bg"> <div class...
2017/07/27
[ "https://Stackoverflow.com/questions/45350828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8375924/" ]
An array is an `Object`, and you can make lists of any object type - so you can make a `List` of arrays without doing anything special: ``` // Declare it and initialise as an empty list List<Integer[]> list = new ArrayList<>(); // Add an item -- it's a new array list.add(new Integer[5]); // Access an item -- it's an...
Looks like you want to create a 2-dimansional integer array. I assume you have a special use case in which you need a primitive array ob ArrayList-Objects. Anyways you can create such a thing like any other primitive array like ``` ArrayList<Integer>[] test = new ArrayList[2]; ``` and access/set it by index.. ``...
45,350,828
I apologize in advance for being weak English :( My website looks like this: <https://scr.hu/LoDJpD> ```html <div class="container-fluid"> <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1 text-center"> <div class="card col-md-6 col-sm-6 row-2"> <div class="card-bg"> <div class...
2017/07/27
[ "https://Stackoverflow.com/questions/45350828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8375924/" ]
An array is an `Object`, and you can make lists of any object type - so you can make a `List` of arrays without doing anything special: ``` // Declare it and initialise as an empty list List<Integer[]> list = new ArrayList<>(); // Add an item -- it's a new array list.add(new Integer[5]); // Access an item -- it's an...
u can use like this for do this ``` private ArrayList<Integer>[] test ; private void test(int n){ test=new ArrayList[n]; for(int i=0;i<n;i++){ test[i]=new ArrayList<Integer>(); test[i].add(100); test[i].add(10); test[i].add(10000); test[i].add(1); .... ...
45,350,828
I apologize in advance for being weak English :( My website looks like this: <https://scr.hu/LoDJpD> ```html <div class="container-fluid"> <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1 text-center"> <div class="card col-md-6 col-sm-6 row-2"> <div class="card-bg"> <div class...
2017/07/27
[ "https://Stackoverflow.com/questions/45350828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8375924/" ]
Looks like you want to create a 2-dimansional integer array. I assume you have a special use case in which you need a primitive array ob ArrayList-Objects. Anyways you can create such a thing like any other primitive array like ``` ArrayList<Integer>[] test = new ArrayList[2]; ``` and access/set it by index.. ``...
u can use like this for do this ``` private ArrayList<Integer>[] test ; private void test(int n){ test=new ArrayList[n]; for(int i=0;i<n;i++){ test[i]=new ArrayList<Integer>(); test[i].add(100); test[i].add(10); test[i].add(10000); test[i].add(1); .... ...
26,030,579
Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code? ``` String id = scan.nextLine(); File file = new File(id.txt); FileWriter fileWrite = new FileWriter(file); BufferedWriter b...
2014/09/25
[ "https://Stackoverflow.com/questions/26030579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3926372/" ]
You should also surround the creation of the file with a try and catch block, and when you're done with the file close it like so: ``` Scanner scan = new Scanner(System.in); String id = scan.nextLine(); File file = new File(id + ".txt"); FileWriter fileWrite = null; BufferedWriter bufferedWriter = ...
you can't use `File file = new File(id.txt);` as it takes string argument.so you can make a `string` like `id+".txt"` and then pass it to `new file();` ``` String id = scan.nextLine(); File file = new File(id+".txt"); FileWriter fileWrite = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileW...
26,030,579
Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code? ``` String id = scan.nextLine(); File file = new File(id.txt); FileWriter fileWrite = new FileWriter(file); BufferedWriter b...
2014/09/25
[ "https://Stackoverflow.com/questions/26030579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3926372/" ]
you can't use `File file = new File(id.txt);` as it takes string argument.so you can make a `string` like `id+".txt"` and then pass it to `new file();` ``` String id = scan.nextLine(); File file = new File(id+".txt"); FileWriter fileWrite = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileW...
This is a different approach by using [try with resource](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) ``` String id = scan.nextLine(); try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File(id + ".txt"))) { } catch(Exception e) { } ```
26,030,579
Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code? ``` String id = scan.nextLine(); File file = new File(id.txt); FileWriter fileWrite = new FileWriter(file); BufferedWriter b...
2014/09/25
[ "https://Stackoverflow.com/questions/26030579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3926372/" ]
You should also surround the creation of the file with a try and catch block, and when you're done with the file close it like so: ``` Scanner scan = new Scanner(System.in); String id = scan.nextLine(); File file = new File(id + ".txt"); FileWriter fileWrite = null; BufferedWriter bufferedWriter = ...
You need to create a `String` for the file name with the expected format. To do this, you can simply use the `+` operator which concatenates `String`s (and automatically converts non-Strings to Strings): ``` String filename = id + ".txt"; ```
26,030,579
Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code? ``` String id = scan.nextLine(); File file = new File(id.txt); FileWriter fileWrite = new FileWriter(file); BufferedWriter b...
2014/09/25
[ "https://Stackoverflow.com/questions/26030579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3926372/" ]
You need to create a `String` for the file name with the expected format. To do this, you can simply use the `+` operator which concatenates `String`s (and automatically converts non-Strings to Strings): ``` String filename = id + ".txt"; ```
This is a different approach by using [try with resource](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) ``` String id = scan.nextLine(); try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File(id + ".txt"))) { } catch(Exception e) { } ```
26,030,579
Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code? ``` String id = scan.nextLine(); File file = new File(id.txt); FileWriter fileWrite = new FileWriter(file); BufferedWriter b...
2014/09/25
[ "https://Stackoverflow.com/questions/26030579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3926372/" ]
You should also surround the creation of the file with a try and catch block, and when you're done with the file close it like so: ``` Scanner scan = new Scanner(System.in); String id = scan.nextLine(); File file = new File(id + ".txt"); FileWriter fileWrite = null; BufferedWriter bufferedWriter = ...
This is a different approach by using [try with resource](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) ``` String id = scan.nextLine(); try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File(id + ".txt"))) { } catch(Exception e) { } ```
1,263,427
You can see what I'm trying to do below: ``` typedef struct image_bounds { int xmin, ymin, xmax, ymax; } image_bounds; #define IMAGE_BOUNDS(X) ((image_bounds *)(X)); typedef struct { image_bounds bounds; float dummy; } demo; int main(void) { demo my_image; /* this works fine */ ((image_boun...
2009/08/11
[ "https://Stackoverflow.com/questions/1263427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66725/" ]
You need to lose the semicolon from the definition of IMAGE\_BOUNDS: ``` #define IMAGE_BOUNDS(X) ((image_bounds *)(X)) ```
In the version without macros you have `->xmin` before the `=`, in the one with macros you don't.
129,425
I think the following sample says it all. I need to get the item bullet in the right place on the same line as the equation, and have this followed by an normal equation number. Someone asked the same question but the answers all give one of the undesired results exhibited below. This problem crops up a lot if you are ...
2013/08/21
[ "https://tex.stackexchange.com/questions/129425", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/35498/" ]
The following example defines `\itemequation` that sets an `\item` with a simulated equation. The equation is centered in the same way as it would be done by environment `equation`. Also text can be added in front of the equation. ``` \documentclass{article} % \itemequation[label]{text before}{equation} \makeatletter...
Here's a manual not-too-hacky way: ![enter image description here](https://i.stack.imgur.com/LmSLi.png) ``` \documentclass{article} \begin{document} \begin{itemize} \item This item looks fine in terms of both number and bullet because the bullet sensibly appears on a line with some text on it, preceeding an ...
44,349,121
Lets take a look at my program. That have some imaginary .txt file with car models. ``` public class Car { private String model; public String getModel() { return this.model; } } public class Main { public static void Main(String[] args) { ArrayList<Car> cars = loadCars(path); //imagi...
2017/06/03
[ "https://Stackoverflow.com/questions/44349121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5562157/" ]
You can use Predicate interface to pass a function (or lambda) as parameter to your function: <https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html> With a predicate you can rewrite your function in a following way: ``` public static void printCars(Predicate<Car> filter) { for (Car c : car...
In case you need to compare you cars with multiple attributes, you need just to override **equals** method for *Car* class. ``` @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Car) { Car anotherCar = (Car)obj; ...
44,349,121
Lets take a look at my program. That have some imaginary .txt file with car models. ``` public class Car { private String model; public String getModel() { return this.model; } } public class Main { public static void Main(String[] args) { ArrayList<Car> cars = loadCars(path); //imagi...
2017/06/03
[ "https://Stackoverflow.com/questions/44349121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5562157/" ]
You can use Predicate interface to pass a function (or lambda) as parameter to your function: <https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html> With a predicate you can rewrite your function in a following way: ``` public static void printCars(Predicate<Car> filter) { for (Car c : car...
If you are on Java 8, you could use the [`Stream`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html) API with a [`Predicate`](https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html): ``` cars.stream() .filter(c -> c.getModel().equals(someModel)) .forEach(c -> System.o...
44,349,121
Lets take a look at my program. That have some imaginary .txt file with car models. ``` public class Car { private String model; public String getModel() { return this.model; } } public class Main { public static void Main(String[] args) { ArrayList<Car> cars = loadCars(path); //imagi...
2017/06/03
[ "https://Stackoverflow.com/questions/44349121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5562157/" ]
If you are on Java 8, you could use the [`Stream`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html) API with a [`Predicate`](https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html): ``` cars.stream() .filter(c -> c.getModel().equals(someModel)) .forEach(c -> System.o...
In case you need to compare you cars with multiple attributes, you need just to override **equals** method for *Car* class. ``` @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Car) { Car anotherCar = (Car)obj; ...
136,838
I want to start learning Python - and I'm having trouble getting scripts to load up in a browser (using Wamp). So far I've tried the following: 1: add the following lines to httpd.conf: ``` AddHandler cgi-script .py Options ExecCGI ``` I navigate to ``` http://localhost/path/to/script/myscript.py ``` * but get ...
2010/04/29
[ "https://serverfault.com/questions/136838", "https://serverfault.com", "https://serverfault.com/users/21540/" ]
You're mixing your goals. if you > > want to learn the language in a relatively raw context before digging into a framework > > > then forget about the browser for a while. Open a text editor, a command window and the interpreter (or a nice shell on the interpreter, like [ipython](http://ipython.scipy.org/)). W...
You can't feed CGI scripts into mod\_wsgi for a start. Also, because you didn't bother providing the exact configuration you used, including the URL, one can only guess what you have done wrong. For mod\_wsgi make sure you read: <http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide>
62,533,880
I'm writing a flutter method in which I want to parse a simple JSON data ``` {"alm":3,"co2":1,"hu":2,"temp":32,"th":11,"tm":31,"ts":41} ``` I tried to parse it in a simple get class ``` List data; Future<String> getData() async { http.Response response = await http.get( Uri.encodeFull("http://chicken2...
2020/06/23
[ "https://Stackoverflow.com/questions/62533880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13739812/" ]
First thing the response from API is not a json list, its a simple json object. If you wanna iterate over the keys of the above object you can create a list with all the keys and then use key index to get the actual key name in the response. ``` final List<String> keys = ["alm","co2","hu","temp","th","tm","ts"]; ``` ...
Your Url hai double 'n' in json. are you sure about that?
62,533,880
I'm writing a flutter method in which I want to parse a simple JSON data ``` {"alm":3,"co2":1,"hu":2,"temp":32,"th":11,"tm":31,"ts":41} ``` I tried to parse it in a simple get class ``` List data; Future<String> getData() async { http.Response response = await http.get( Uri.encodeFull("http://chicken2...
2020/06/23
[ "https://Stackoverflow.com/questions/62533880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13739812/" ]
First thing the response from API is not a json list, its a simple json object. If you wanna iterate over the keys of the above object you can create a list with all the keys and then use key index to get the actual key name in the response. ``` final List<String> keys = ["alm","co2","hu","temp","th","tm","ts"]; ``` ...
You're getting a `Map` from your API. you cannot use that on a `ListView.builder`. You can use a regular `ListView` and add the ListTiles manually. Create the `ListView` and add the ListTiles manually using each key in the map. ```dart body: ListView( children: <Widget>[ buildTile('alm'), ...
55,753,276
Disclaimer: I am a first time "programmer" and this is my first project. Please be patient as I am still learning terminology along with everything else that goes with it. I am trying to capture specific data from my CSV and input that data into my python script to tweet it out. (Im making a Twitter bot). This is the...
2019/04/18
[ "https://Stackoverflow.com/questions/55753276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11360716/" ]
I would recommend using a `while` loop. A `for` loop is best when you know how many times you need to repeat the operation, but a `while` loop is good for repeating an unknown amount of times. It could run 0 to many times. As for the condition of your `while` loop, you just want to check if the email address is invali...
Something like this should work: ``` // While email does not contain the two characters.. // Keep asking the user to enter the correct email. while(!emailAddress.contains("@") || !emailAddress.contains(".")){ System.out.print("\nYou have entered an invalid email address."); // Add line of code here to ask for...
14,819,201
I have coded ui tests for standalone application. I think that we have memory leaks. Does anybody have any ideas how to catch this using coded ui? I know that we don't have any build-in feature to do this but maybe somebody faced the same problem before...
2013/02/11
[ "https://Stackoverflow.com/questions/14819201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574853/" ]
``` var select1 = $('#firstbox'); var select2 = $('#secondbox'); $([select1, select2]).change(function () { if ( select1.val() == 2 && select2.val() == 3 ) { // run your code here... } }); ```
You need to either bind the click event to the third select box or bind to the change event of the first two boxes and callback a common function which updates the third one.
14,819,201
I have coded ui tests for standalone application. I think that we have memory leaks. Does anybody have any ideas how to catch this using coded ui? I know that we don't have any build-in feature to do this but maybe somebody faced the same problem before...
2013/02/11
[ "https://Stackoverflow.com/questions/14819201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574853/" ]
``` var select1 = $('#firstbox'); var select2 = $('#secondbox'); $([select1, select2]).change(function () { if ( select1.val() == 2 && select2.val() == 3 ) { // run your code here... } }); ```
``` $("#firstbox, #secondbox").change(UpdateThird); function UpdateThird() { var a = $("#firstbox").val(); var b = $("#secondbox").val(); if (a == 2 && b == 3) { // ... } } ```
14,819,201
I have coded ui tests for standalone application. I think that we have memory leaks. Does anybody have any ideas how to catch this using coded ui? I know that we don't have any build-in feature to do this but maybe somebody faced the same problem before...
2013/02/11
[ "https://Stackoverflow.com/questions/14819201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574853/" ]
``` var select1 = $('#firstbox'); var select2 = $('#secondbox'); $([select1, select2]).change(function () { if ( select1.val() == 2 && select2.val() == 3 ) { // run your code here... } }); ```
assuming ``` <select id="firstbox"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select id="secondbox"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> ``` script: ``` $('#secondbox, #firstbox').on(...
56,401,413
I would like a help, I converted the input string from date to array and if I do not input for example 05/26/2019, all 3 fields did an explode to flip an array, then this error occurs. what can I do? escola.php ``` <form method="POST" class="PesquisarData"> <h5>Pesquisar Data:</h5> <input type="text" id="dat...
2019/05/31
[ "https://Stackoverflow.com/questions/56401413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11541715/" ]
Check that `$data` has 3 elements before trying to use it. ``` $data = explode('/', addslashes($_POST['data'])); if (count($data) != 3) { die('Invalid date ' . $_POST['data']); } $data = $data[2].'-'.$data[1].'-'.$data[0]; ```
Your programming assumes that the user also uses the slash that you explode! You have to check before the sender whether he slashed these 2 - which you require - also enters
40,776,543
I have been searching the web left right and center for a solution to get the `wp_enqueue_style()` function to work but I just can't get it. **Code Snippet** ``` //Add some styles to the script function sreub_enqueue_styles() { //Use it! wp_enqueue_style ( 'sreubmainstyle', plugin_dir_url(__FILE__) . 'sreubm...
2016/11/24
[ "https://Stackoverflow.com/questions/40776543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7202834/" ]
This might be a verbatim answer to your question: ``` UPDATE yourTable SET gender = $gender, full_name = $full_name WHERE gender IS NULL AND full_name IS NULL ``` However, it seems to make more sense to update a record if *either* the gender or full name be `NULL`. In this case, you can try: ``` UPDATE yourTabl...
The `if` in `update` statement in `SQL` gets into the `WHERE` part of the query: ``` UPDATE table_name SET gender = $gender WHERE gender IS NULL AND full_name IS NULL ``` > > I would add also `AND id = $id_you_want_to_update` > > >
12,783,299
I am using xCode for the first time - since 1986 I've used other IDE's (turboPascal, JBuilder, Eclipse, NetBeans, Tibco BW...) but to the uninitiated Xcode seems reach new levels of awkwardness. Every time I access help e.g 'API documentation help' the documentation screen obscures all other windows. Presumably there ...
2012/10/08
[ "https://Stackoverflow.com/questions/12783299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/820757/" ]
Not elegant, but the only thing I could find. I know people are going to comment about using an interval that never ends, but until a better solution is found this is what we have. ``` setInterval(function () { var resultInfo = $('.gsc-result:first'); if (resultInfo.length && !resultInfo.data('isOld')) { ...
You can determine that search results have changed by watching the results HTML code using MutationObserver. ``` // Where to put search results var resultsElement = document.getElementById('results'); // Creating results box window.google.search.cse.element.render({ div: resultsElement, tag: 'searchresults-on...
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
The problem is this line: ``` return View(Users.AsEnumerable()); ``` The enumeration is lazily evaluated, and since your MatchGamingEntities is disposed of before your view can cycle through the enumeration, the code dies when it tries to do just that. You will either have to find a way to manage the lifetime of yo...
The problem is that you are issuing a Shallow Copy when you do: ``` var Users = from m in db.Users join m2 in db.MyProfiles on m.UserId equals m2.UserId where m.UserName == SearchUserName.UserName select new UserViewModel { UserName =...
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
Your **using** clause is disposing of (read: destroying) the *MatchGamingEntities* db context before the **View** has a chance to use it. So while you can just enumerate the items before (or as) you pass the *Users* to the **View**, a better approach is to ***drop your use*** of the **using** clause and let natural gar...
The problem is that you are issuing a Shallow Copy when you do: ``` var Users = from m in db.Users join m2 in db.MyProfiles on m.UserId equals m2.UserId where m.UserName == SearchUserName.UserName select new UserViewModel { UserName =...
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
I am guessing that the problem is that the execution of your LINQ query has been deferred until starting to access them on your view. At this point `db` has already been disposed. Try this: ``` return View(Users.ToList()); ``` *Added ToList()* That will force the fetch from the DB before disposing `db`.
Your **using** clause is disposing of (read: destroying) the *MatchGamingEntities* db context before the **View** has a chance to use it. So while you can just enumerate the items before (or as) you pass the *Users* to the **View**, a better approach is to ***drop your use*** of the **using** clause and let natural gar...
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
I am guessing that the problem is that the execution of your LINQ query has been deferred until starting to access them on your view. At this point `db` has already been disposed. Try this: ``` return View(Users.ToList()); ``` *Added ToList()* That will force the fetch from the DB before disposing `db`.
In case you are having problem displaying child property i.e Line items. Here is the dirty fix that worked for me. Fixed my problem of not retrieving the child items of an object: header.MachineDataLines = header.MachineDataLines;
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
A bad practice, but you can set ``` this.ContextOptions.LazyLoadingEnabled = false; ``` in the `constructor` of the `Context`
The problem is that you are issuing a Shallow Copy when you do: ``` var Users = from m in db.Users join m2 in db.MyProfiles on m.UserId equals m2.UserId where m.UserName == SearchUserName.UserName select new UserViewModel { UserName =...
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
Your **using** clause is disposing of (read: destroying) the *MatchGamingEntities* db context before the **View** has a chance to use it. So while you can just enumerate the items before (or as) you pass the *Users* to the **View**, a better approach is to ***drop your use*** of the **using** clause and let natural gar...
A bad practice, but you can set ``` this.ContextOptions.LazyLoadingEnabled = false; ``` in the `constructor` of the `Context`
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
I am guessing that the problem is that the execution of your LINQ query has been deferred until starting to access them on your view. At this point `db` has already been disposed. Try this: ``` return View(Users.ToList()); ``` *Added ToList()* That will force the fetch from the DB before disposing `db`.
A bad practice, but you can set ``` this.ContextOptions.LazyLoadingEnabled = false; ``` in the `constructor` of the `Context`
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
A bad practice, but you can set ``` this.ContextOptions.LazyLoadingEnabled = false; ``` in the `constructor` of the `Context`
In case you are having problem displaying child property i.e Line items. Here is the dirty fix that worked for me. Fixed my problem of not retrieving the child items of an object: header.MachineDataLines = header.MachineDataLines;
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
The problem is this line: ``` return View(Users.AsEnumerable()); ``` The enumeration is lazily evaluated, and since your MatchGamingEntities is disposed of before your view can cycle through the enumeration, the code dies when it tries to do just that. You will either have to find a way to manage the lifetime of yo...
In case you are having problem displaying child property i.e Line items. Here is the dirty fix that worked for me. Fixed my problem of not retrieving the child items of an object: header.MachineDataLines = header.MachineDataLines;
5,360,372
I have this view: ``` @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = "Index"; } <h2>Index</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> ...
2011/03/19
[ "https://Stackoverflow.com/questions/5360372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
I am guessing that the problem is that the execution of your LINQ query has been deferred until starting to access them on your view. At this point `db` has already been disposed. Try this: ``` return View(Users.ToList()); ``` *Added ToList()* That will force the fetch from the DB before disposing `db`.
The problem is this line: ``` return View(Users.AsEnumerable()); ``` The enumeration is lazily evaluated, and since your MatchGamingEntities is disposed of before your view can cycle through the enumeration, the code dies when it tries to do just that. You will either have to find a way to manage the lifetime of yo...
12,493,320
I need some help with RGB capture in a image. I am using impixel to manualy get RGB from a picture, but i would like to create a grid of let's say 20x20 px boxes where it will automatically tell me for each box a RGB value. So in a picture lets say i have 20 boxes it will tell me 20 RGB values. Yeah an if there is 20% ...
2012/09/19
[ "https://Stackoverflow.com/questions/12493320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/625383/" ]
Depending on your exact needs I see two solutions: Downscale the image using `impyramid(img, 'reduce'`). This gives you a smaller image consisting of average values of the original image. Then do what you did before to access single pixels. Repeat as often as necessary to get 2x2, 4x4, 8x8 or larger "boxes". Or you c...
This is my complete code for automatic color grabing from pictures in folder. So the program asks you to chose a folder and after that you get a table full of information about color and roundess. I am using this code to get color from fruits that have white background . It does everything by itself. Hope it helps some...
41,071,114
I am working in Opencart 2.3 & I have run into a situation where we need decimals converted into fractions. I am working with the category.tpl page, and we have our products outputted into a list on the page. The Attributes vary per product. Example; One page has the Attributes Color, Length A, and Length B. Product A...
2016/12/10
[ "https://Stackoverflow.com/questions/41071114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7275075/" ]
You can put your `require("./path/to/css")` inside of your index.js or any other top-level React component. It will get bundled in your web pack for all child components from there. Make sure you have your loaders installed in your package.json file and youur webpack.config.js file calls the loaders. A barebones webpa...
Upon further reading, I realized normalize.css is very static and webpack works with more dynamic files. So instead, I just got the cdn for normalize.css and use semantic-ui-react
7,542,530
Basically, let's say I declare an array in int main() and then pass it to another function, can i then change what values the array holds? Something like: ``` int main() { myarray[3] = {4, 5, 6}; myfunc(myarray); return 0; } int myfunc(int myarray[]) { int x cout << "Choose a number"; cin >> x if (x =...
2011/09/24
[ "https://Stackoverflow.com/questions/7542530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/962962/" ]
You can modify elements in the array however initializer lists like this: ``` myarray[] = {0, 1, 3} ``` can only be used when you declare the array. To assign to the array you will have to assign each element individually: ``` myarray[0] = 0; myarray[1] = 1; myarray[2] = 3; ```
``` if (x == 1) { myarray[] = {0, 1, 3} // {0,1,3} is an initializer list. } ``` Initializer lists are allowed only at the point of declaration. They are not allowed in assignments. And in the if statement, you are doing an assignment. The only way of modifying the array elements is by changing element at each in...
7,542,530
Basically, let's say I declare an array in int main() and then pass it to another function, can i then change what values the array holds? Something like: ``` int main() { myarray[3] = {4, 5, 6}; myfunc(myarray); return 0; } int myfunc(int myarray[]) { int x cout << "Choose a number"; cin >> x if (x =...
2011/09/24
[ "https://Stackoverflow.com/questions/7542530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/962962/" ]
With the existing function signature there's no way to safely change the values. Normally you 'd do something like ``` myarray[0] = 0; myarray[1] = 1; //etc ``` There are many other ways to approach this as well, depending on how the values to go into the array are stored (either [`std::copy`](http://en.cppreferenc...
``` if (x == 1) { myarray[] = {0, 1, 3} // {0,1,3} is an initializer list. } ``` Initializer lists are allowed only at the point of declaration. They are not allowed in assignments. And in the if statement, you are doing an assignment. The only way of modifying the array elements is by changing element at each in...
7,542,530
Basically, let's say I declare an array in int main() and then pass it to another function, can i then change what values the array holds? Something like: ``` int main() { myarray[3] = {4, 5, 6}; myfunc(myarray); return 0; } int myfunc(int myarray[]) { int x cout << "Choose a number"; cin >> x if (x =...
2011/09/24
[ "https://Stackoverflow.com/questions/7542530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/962962/" ]
You can modify elements in the array however initializer lists like this: ``` myarray[] = {0, 1, 3} ``` can only be used when you declare the array. To assign to the array you will have to assign each element individually: ``` myarray[0] = 0; myarray[1] = 1; myarray[2] = 3; ```
This: `myarray[] = {0, 1, 3}` - is wrong. You should pass the length of the array, and run a loop that would change its values, instead. You should never assume a size of the array you get in a function. If the size is constant - make it `myfunc(int myarray[THE_SIZE])`, otherwise it has to be `myfunc(int myarray[], i...
7,542,530
Basically, let's say I declare an array in int main() and then pass it to another function, can i then change what values the array holds? Something like: ``` int main() { myarray[3] = {4, 5, 6}; myfunc(myarray); return 0; } int myfunc(int myarray[]) { int x cout << "Choose a number"; cin >> x if (x =...
2011/09/24
[ "https://Stackoverflow.com/questions/7542530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/962962/" ]
With the existing function signature there's no way to safely change the values. Normally you 'd do something like ``` myarray[0] = 0; myarray[1] = 1; //etc ``` There are many other ways to approach this as well, depending on how the values to go into the array are stored (either [`std::copy`](http://en.cppreferenc...
This: `myarray[] = {0, 1, 3}` - is wrong. You should pass the length of the array, and run a loop that would change its values, instead. You should never assume a size of the array you get in a function. If the size is constant - make it `myfunc(int myarray[THE_SIZE])`, otherwise it has to be `myfunc(int myarray[], i...
7,542,530
Basically, let's say I declare an array in int main() and then pass it to another function, can i then change what values the array holds? Something like: ``` int main() { myarray[3] = {4, 5, 6}; myfunc(myarray); return 0; } int myfunc(int myarray[]) { int x cout << "Choose a number"; cin >> x if (x =...
2011/09/24
[ "https://Stackoverflow.com/questions/7542530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/962962/" ]
You can modify elements in the array however initializer lists like this: ``` myarray[] = {0, 1, 3} ``` can only be used when you declare the array. To assign to the array you will have to assign each element individually: ``` myarray[0] = 0; myarray[1] = 1; myarray[2] = 3; ```
With the existing function signature there's no way to safely change the values. Normally you 'd do something like ``` myarray[0] = 0; myarray[1] = 1; //etc ``` There are many other ways to approach this as well, depending on how the values to go into the array are stored (either [`std::copy`](http://en.cppreferenc...
26,681
I created a few macros in Excel 2007 and I saved them in the **personal macro workbook**. Since then, I've deleted the macros. *Note: You have to unhide the workbook, delete the macro and then hide it again to accomplish this.* Now, every time I open Excel, create/edit a workbook and click the close/exit (red X) butt...
2009/08/20
[ "https://superuser.com/questions/26681", "https://superuser.com", "https://superuser.com/users/45675/" ]
If you have deleted all the macros from the personal macro workbook, you can delete the file `PERSONAL.XLSB`. This should cause Excel to stop doing what you described. The file should be in one of: > > C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB > > > or > > C:\Documents and Setting...
You can also hold down Shift as you click the "X" to close all open workbooks and Excel completely.
26,681
I created a few macros in Excel 2007 and I saved them in the **personal macro workbook**. Since then, I've deleted the macros. *Note: You have to unhide the workbook, delete the macro and then hide it again to accomplish this.* Now, every time I open Excel, create/edit a workbook and click the close/exit (red X) butt...
2009/08/20
[ "https://superuser.com/questions/26681", "https://superuser.com", "https://superuser.com/users/45675/" ]
If you have deleted all the macros from the personal macro workbook, you can delete the file `PERSONAL.XLSB`. This should cause Excel to stop doing what you described. The file should be in one of: > > C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB > > > or > > C:\Documents and Setting...
One more solution: click on the 'Office Button' in the upper left hand corner of your screen - right click on 'Exit Excel' - then choose 'Add to Quick Access Toolbar'. This will place an 'X' on your toolbar which only needs to be clicked once to close Excel completely.
26,681
I created a few macros in Excel 2007 and I saved them in the **personal macro workbook**. Since then, I've deleted the macros. *Note: You have to unhide the workbook, delete the macro and then hide it again to accomplish this.* Now, every time I open Excel, create/edit a workbook and click the close/exit (red X) butt...
2009/08/20
[ "https://superuser.com/questions/26681", "https://superuser.com", "https://superuser.com/users/45675/" ]
If you have deleted all the macros from the personal macro workbook, you can delete the file `PERSONAL.XLSB`. This should cause Excel to stop doing what you described. The file should be in one of: > > C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB > > > or > > C:\Documents and Setting...
You can close Excel using ALT F4 - this will close Excel completely
26,681
I created a few macros in Excel 2007 and I saved them in the **personal macro workbook**. Since then, I've deleted the macros. *Note: You have to unhide the workbook, delete the macro and then hide it again to accomplish this.* Now, every time I open Excel, create/edit a workbook and click the close/exit (red X) butt...
2009/08/20
[ "https://superuser.com/questions/26681", "https://superuser.com", "https://superuser.com/users/45675/" ]
You can also hold down Shift as you click the "X" to close all open workbooks and Excel completely.
You can close Excel using ALT F4 - this will close Excel completely
26,681
I created a few macros in Excel 2007 and I saved them in the **personal macro workbook**. Since then, I've deleted the macros. *Note: You have to unhide the workbook, delete the macro and then hide it again to accomplish this.* Now, every time I open Excel, create/edit a workbook and click the close/exit (red X) butt...
2009/08/20
[ "https://superuser.com/questions/26681", "https://superuser.com", "https://superuser.com/users/45675/" ]
One more solution: click on the 'Office Button' in the upper left hand corner of your screen - right click on 'Exit Excel' - then choose 'Add to Quick Access Toolbar'. This will place an 'X' on your toolbar which only needs to be clicked once to close Excel completely.
You can close Excel using ALT F4 - this will close Excel completely
16,190,077
I'm able to successfully integrate barcode scanner using zxing library to make a standalone scanner. The problem that is coming in my application is the **autofocus**. Camera in my app is taking the initial focus and is not resetting. for eg. if initially I point my camera to dark surface and then I focus it to the pag...
2013/04/24
[ "https://Stackoverflow.com/questions/16190077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/878213/" ]
I had commented out the part ``` task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args); ``` Thanks for pointing out `AutofocusManager` I added ``` if (Build.VERSION.SDK_INT >= 11 ) { // changed to 11 as Build.VERSION_CODES.HONEYCOMB is not // accessible on an...
You probably modified the scan-focus loop and caused it to stop working. Look at how `AutofocusManager` triggers focus, waits for the preview frame, and then is triggered again. You need to debug this part to see what you changed.
4,495,097
For exam preparations we got some integrals to practice on but we can figure out whether or not this integral exists or not: $$\int\_e^x \frac{dt}{\sqrt{(t\ln(t^3))^2-9t^2}}$$ Since it is an exam question it should be easily shown via Direction Comparison Test, Integral Test or any other method, but we can't figure i...
2022/07/18
[ "https://math.stackexchange.com/questions/4495097", "https://math.stackexchange.com", "https://math.stackexchange.com/users/730740/" ]
Assuming that $x>e$, look at $$t^2 \log ^2\left(t^3\right)-9 t^2$$ and use Taylor series around $t=e$. This gives $$t^2 \log ^2\left(t^3\right)-9 t^2=18 e (t-e)+36 (t-e)^2+O\left((t-e)^3\right)$$ $$\sqrt{t^2 \log ^2\left(t^3\right)-9 t^2 }=3 \sqrt{2 e} \sqrt{t-e}+3 \sqrt{\frac{2}{e}} (t-e)^{3/2}+O\left((t-e)^{5/2}\righ...
Assuming $x>e$ we may utilize the properties of logarithms to write $$ I=\int\_e^x \frac{\mathrm dt}{\sqrt{(t\ln(t^3))^2-9t^2}}=\int\_e^x \frac{\mathrm dt}{3t\sqrt{\ln^2 t-1}}=\int\_e^x \frac{\mathrm dt}{3t\sqrt{\ln t+1}\sqrt{\ln t-1}}. $$ The integrand is positive for all $x>e$ so we can then bound $I$ from above with...
12,533,868
I'm stuck for a while, I try to display the result of a variable that executes a sql query in an html table, here is my code; ``` $REQUT = Doctrine_Query::create() ->select('DISTINCT r.prod , r.di, COUNT(*) as Result') ->from('tabl r') ->groupBy('r.di') ->orderBy('Result ASC') ; $REQUT->fetchArray(); ``` PS : I wor...
2012/09/21
[ "https://Stackoverflow.com/questions/12533868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1689282/" ]
You need to loop through the result set. I don't know this particular API, but assuming it works similarly to others: ``` $REQUT = // all that query stuff while($ROW = $REQUT->fetchArray()) { // do something var_dump($ROW); } ```
You can try this to display as a html table... ``` $REQUT = Doctrine_Query::create() ->select('DISTINCT r.prod , r.di, COUNT(*) as Result') ->from('tabl r') ->groupBy('r.di') ->orderBy('Result ASC') ; echo "<table>"; while($ROW = $REQUT->fetchArray()) { echo "<tr><td>".$ROW["prod"]."<td>"; echo "<td>".$ROW["di"]....
44,928,029
For example this matrix: ``` 3 2 2 2 1 2 ``` Writed as this: ``` IEnumerable<IEnumerable<int>> inputRows = ...; ``` Must become: ``` 1 2 2 2 2 3 ``` So, all biggest numbers will be concentrated in the down right corner. First, I need to sort **column numbers** (not entire columns), which is pretty easy to do: ...
2017/07/05
[ "https://Stackoverflow.com/questions/44928029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5639688/" ]
You will need a row comparer. We'll keep in mind that all rows have same length: ``` public class RowComparer : IComparer<IEnumerable<int>> { public int Compare(IEnumerable<int> x, IEnumerable<int> y) { // TODO: throw ArgumentNullException return x.Zip(y, (xItem, yItem) => xItem.CompareTo(yIte...
Maybe this? ``` var result = inputRows.Select(row => row.OrderBy(col => col)).OrderBy(row => row.Sum()); ``` It's not clear how do you want order rows: by the whole row or by each cell?
85,729
So I took this digital LPF from some website: [![enter image description here](https://i.stack.imgur.com/ZISAW.png)](https://i.stack.imgur.com/ZISAW.png) And tried implement it first in MatLab to see how it goes, here's the code used: ``` x=[0 0 0 0 0 0 0 0 0 0 0]; y=[0 0 0 0 0 0 0 0 0 0 0]; t = linspace(0,1,100); ...
2022/12/12
[ "https://dsp.stackexchange.com/questions/85729", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/65706/" ]
> > The signal appears to be already attenuated at a frequency if 10Hz, how is that possible? > > > Well, if the input signal is correct (which it is) and the filter coefficients are correct (which they are) and the output is wrong (which it is), the only possibility is that your filter code is wrong (which it is)...
Your code performs filtering correctly. One problem is your input signal frequencies ($f\_1 = 100\,\text{Hz}$ and $f\_2 = 1000\,\text{Hz}$) are too high with regards to your sampling frequency ($f\_s = 100\,\text{Hz}$), violating [Nyquist](https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem), and in...
19,210
My PC's ATX power supply stopped working. I opened it and noticed that it makes a high pitch sound when turned on. I can't figure out which component in the power supply makes that sound, so that I can replace it.
2011/09/08
[ "https://electronics.stackexchange.com/questions/19210", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/4906/" ]
**Instant Death:** **WARNING - PC Power supplies have lethal voltages internally both when mains voltage is applied and also for a variable period of time after being turned off.** **Lurking death** **A power supply that has been turned off for many minutes MAY contain voltages that can kill you.** If you don't k...
The sound could come from a capacitor or a transformer, though that is not necessarily the part that is defective. Personally I wouldn't mess with a switched power supply (it is very dangerous and a repair is unlikely to succeed) and buy a new one.
19,210
My PC's ATX power supply stopped working. I opened it and noticed that it makes a high pitch sound when turned on. I can't figure out which component in the power supply makes that sound, so that I can replace it.
2011/09/08
[ "https://electronics.stackexchange.com/questions/19210", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/4906/" ]
The sound could come from a capacitor or a transformer, though that is not necessarily the part that is defective. Personally I wouldn't mess with a switched power supply (it is very dangerous and a repair is unlikely to succeed) and buy a new one.
How exactly has it stopped working? Have you tested the output for voltage? Is the fan working? It is quite likely a coil/transformer that is whining due to a e.g. shorted output transistor, bad capacitors or faulty load, causing excess current/pulse skipping which produces audible frequencies. Make sure you have ...
19,210
My PC's ATX power supply stopped working. I opened it and noticed that it makes a high pitch sound when turned on. I can't figure out which component in the power supply makes that sound, so that I can replace it.
2011/09/08
[ "https://electronics.stackexchange.com/questions/19210", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/4906/" ]
**Instant Death:** **WARNING - PC Power supplies have lethal voltages internally both when mains voltage is applied and also for a variable period of time after being turned off.** **Lurking death** **A power supply that has been turned off for many minutes MAY contain voltages that can kill you.** If you don't k...
How exactly has it stopped working? Have you tested the output for voltage? Is the fan working? It is quite likely a coil/transformer that is whining due to a e.g. shorted output transistor, bad capacitors or faulty load, causing excess current/pulse skipping which produces audible frequencies. Make sure you have ...
37,492,708
I have a log file like this: ``` [2016/05/27 23:46:13.554-04:00][VERBOSE] 5.0.0 : AzCopy /Source:c:\test /Dest:https://mywebsite.blob.core.windows.net/monitoring /DestKey:****** /S /SetContentType /V:C:\azcopy1.log [2016/05/27 23:46:14.179-04:00][VERBOSE] Start transfer: testfolder\file1.txt => testfolder/file1.txt [2...
2016/05/27
[ "https://Stackoverflow.com/questions/37492708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403422/" ]
try something like this ``` $a = '[2016/05/27 23:46:19.335-04:00][VERBOSE] Finished transfer: testfolder\file2.png => testfolder/file2.png' $a | ? {$_.Contains("Finished transfer:")} | % {'https://mywebsite.blob.core.windows.net/monitoring/' + ($_ -replace '.*=> (.*)', '$1').trim()} ```
I know almost nothing about poweshell commands (or any commands in general), so all i can do is to find codes on internet for individual operations and run them 1 by 1 to get the desired result, so my code is very long, but it does what i need, here is how i managed to get the desired result: First i extracted the lin...
114,190
I'm making something using butter beans (*fasiola gigandes*) which will be cooked for a long time (12+ hours) in a casserole dish with liquid covering them. Normally I would soak the beans first for a long time before discarding the water and using them. Can I reduce/skip the soaking stage given that they will be soak...
2021/02/09
[ "https://cooking.stackexchange.com/questions/114190", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/36356/" ]
I use a slow cooker almost every time I cook dried beans, and I don't recommend cutting down on soaking. I typically soak overnight (with a little bicarbonate of soda), and start cooking in the morning, so 10-12 hours soaking + 8-12 hours cooking, avoiding adding (much) acid/salt until towards the end. It's possible y...
**I have gotten away with no soak many times.** I often cook beans overnight. I think if you cook for 6 hours + the beans are so soft that soaking in advance does not make much difference. Usually for long cooks I use kidney, red, pinto, turtle beans or black eyed peas. Even with those tough beans and no soak about h...
52,721,578
I am trying to create a one to many relationship between medication table and side effects table. `RealmObject` is a custom class created from `Object` class. Model definitions: ``` class Medication: RealmObject { @objc dynamic var name : String? @objc dynamic var form : String? @objc dynamic var id : St...
2018/10/09
[ "https://Stackoverflow.com/questions/52721578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6700116/" ]
You can Destruct it directly, like the following ``` signup: async ({ email, password, privacyPolicyConsent, username }) => { const user = new User(email,password,privacyPolicyConsent,userName); } signUp(userInfo); ``` **UPDATE** This will prevent to handle destruct error if it is sent undefined so you need to ...
Ooh so would I. This is what I tend to do (an immediately invoked function): ``` signup: async userInfo => { const user = new User((({ email, password, privacyPolicyConsent, username }) => ({ email, password, privacyPolicyConsent, username }) ))(userInfo)); } ``` It reduces it to one statement, but doesn't ...
37,861
I'm doing a website in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? **jQuery:** ``` // Another question here: how can I group the repeated code in a function: $(function() { var control = '../Indoamericana/Intranet/index/Proceso/';...
2013/12/20
[ "https://codereview.stackexchange.com/questions/37861", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33874/" ]
You might already know this but you can add a library class called 'template' it allows you to make a kind of a masterpage where you can load all different php files, for example your header - content - footer or anything else, seperately into one page. Your controller will look like this for example: ``` public fun...
Only addressing the jQuery part - One way to simplify the code is by using the `Function.prototype.bind()` method. ``` $(function () { var control = '../Indoamericana/Intranet/index/Proceso/'; var loadPage = function (process) { var page = control + process; $(".page-content").load(page); ...
103,740
I have this question: since the CMO on board a starship is generally the captain's own private physician, is there anything in the regulations that says a CMO can't call the captain by his real first name in certain instances? Like when the captain feels stressed, or is afraid about something? I"m not talking about me...
2015/09/26
[ "https://scifi.stackexchange.com/questions/103740", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/44166/" ]
How the captain is addressed, based on the various series we have available, is dependent on your relationship with said captain. As you said, Bones and Kirk have an informal relationship. Most captains in the Star Trek franchise (who are a main character) have at least one member of the crew they are particularly clos...
I think the answer is in the respective ranks. As CMO, the doctor is usually a captain in their own right. This is a command safety procedure. The CMO has the right, even the duty, to place the captain on administrative leave if he/she deems it necessary. This is a current naval safety procedure. Therefore, unless...
103,740
I have this question: since the CMO on board a starship is generally the captain's own private physician, is there anything in the regulations that says a CMO can't call the captain by his real first name in certain instances? Like when the captain feels stressed, or is afraid about something? I"m not talking about me...
2015/09/26
[ "https://scifi.stackexchange.com/questions/103740", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/44166/" ]
In most cases, the medical staff on a starship are outside the chain of command as they are specialists with their own command structure headed by Star Fleet's Surgeon General. In some cases, medical officers can take command courses if they wish (both Deanna Troi and Beverly Crusher do so at one point if I remember co...
I think the answer is in the respective ranks. As CMO, the doctor is usually a captain in their own right. This is a command safety procedure. The CMO has the right, even the duty, to place the captain on administrative leave if he/she deems it necessary. This is a current naval safety procedure. Therefore, unless...
103,740
I have this question: since the CMO on board a starship is generally the captain's own private physician, is there anything in the regulations that says a CMO can't call the captain by his real first name in certain instances? Like when the captain feels stressed, or is afraid about something? I"m not talking about me...
2015/09/26
[ "https://scifi.stackexchange.com/questions/103740", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/44166/" ]
How the captain is addressed, based on the various series we have available, is dependent on your relationship with said captain. As you said, Bones and Kirk have an informal relationship. Most captains in the Star Trek franchise (who are a main character) have at least one member of the crew they are particularly clos...
In most cases, the medical staff on a starship are outside the chain of command as they are specialists with their own command structure headed by Star Fleet's Surgeon General. In some cases, medical officers can take command courses if they wish (both Deanna Troi and Beverly Crusher do so at one point if I remember co...
49,903,265
``` function func(str) { var a = "" , c; var b = 0; for(var i = 0; i < str.length; i++) { c = str.charAt(i); if((str[i] != ' ' && str[i] != '\n' && str[i] != '\t') || b > 0) { a += c; b++; } return a; } ``` So far the functi...
2018/04/18
[ "https://Stackoverflow.com/questions/49903265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9654528/" ]
I think it's cleanest if you don't try to do it all in one loop. I'd use a loop to find the start, to find the end, and to copy the part of the string you want. You're still pretty much just iterating once, but you have each task separate from the others. ```js function isSpace(c) { return c == ' ' || c == '\n' || ...
Use the same logic you already have to do the end of the string, but just loop starting at the end and change how you build 'a': ``` function reverseFunc(str) { var a = "" , c; var b = 0; for(var i = str.length-1; i >=0; i--) { c = str.charAt(i); if((str[i] != ' ' && str[i]...
3,563,022
**Question**: Find a vector that is perpendicular to both $2\underset{\sim}{i}+\underset{\sim}{j}-\underset{\sim}{k}$ and $\underset{\sim}{i}-2\underset{\sim}{j}+\underset{\sim}{k}$. This is for the 3D topic of the Extension 2 HSC maths course. This belongs to a section introducing the scaler product. I have tried us...
2020/02/28
[ "https://math.stackexchange.com/questions/3563022", "https://math.stackexchange.com", "https://math.stackexchange.com/users/728182/" ]
This just means that teh third order is not sufficient in particular because $-1.09$ is very far away from $-2$. To make the story short, what you have is $$x^2 \cos(x)=\sum\_{n=0}^\infty \frac{\left(-n^2+n+4\right) \cos \left(2-\frac{\pi n}{2}\right)+4 n \sin \left(2-\frac{\pi n}{2}\right)}{n!}(x+2)^n$$ So, if you tr...
Expand just the cosine series around $x=-2$ and you will have: $$x^2cos x = x^2\left(cos(2) + sin(2)[x+2] - \frac{cos(2)[x+2]^2}{2} - \frac{sin(2)[x+2]^3}{6}\right )$$ $$\\$$ (Expanding the $x^2$ in a Taylor polynomial and multiplying everything by brute force also works, but the Taylor series for $x^2$ will just reduc...
10,980,105
My text file has a few lines like this... ``` some data here Waiting on job_bba6b2a1589b4535a804e7877dc1fe11 ... (409s) Current status: DONE some data there Waiting on job_xyz ... (240s) Current status: DONE ``` I need to find the job id. In the example mentioned above... ``` bba6b2a1589b4535a804e7877dc1fe11 xyz ...
2012/06/11
[ "https://Stackoverflow.com/questions/10980105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/139150/" ]
if this is what you need? ``` kent$ echo "some data here Waiting on job_bba6b2a1589b4535a804e7877dc1fe11 ... (409s)"|grep -oP "(?<=Waiting on job_)[^ ]*" bba6b2a1589b4535a804e7877dc1fe11 ```
``` sed 's/.*Waiting on job_\([^ ]*\).*/\1/' ``` For each line containing `Waiting on job_` followed by 0 or more non-space characters, this will substitute the whole line (because starting and ending `.*` are going to greedily take as many characters as possible) using back-reference `\1` to recall everything that w...
10,980,105
My text file has a few lines like this... ``` some data here Waiting on job_bba6b2a1589b4535a804e7877dc1fe11 ... (409s) Current status: DONE some data there Waiting on job_xyz ... (240s) Current status: DONE ``` I need to find the job id. In the example mentioned above... ``` bba6b2a1589b4535a804e7877dc1fe11 xyz ...
2012/06/11
[ "https://Stackoverflow.com/questions/10980105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/139150/" ]
if this is what you need? ``` kent$ echo "some data here Waiting on job_bba6b2a1589b4535a804e7877dc1fe11 ... (409s)"|grep -oP "(?<=Waiting on job_)[^ ]*" bba6b2a1589b4535a804e7877dc1fe11 ```
``` perl -lne 'print $1 if m/(?<=Waiting on job_)([^ ]*)/' inputfile ```
10,980,105
My text file has a few lines like this... ``` some data here Waiting on job_bba6b2a1589b4535a804e7877dc1fe11 ... (409s) Current status: DONE some data there Waiting on job_xyz ... (240s) Current status: DONE ``` I need to find the job id. In the example mentioned above... ``` bba6b2a1589b4535a804e7877dc1fe11 xyz ...
2012/06/11
[ "https://Stackoverflow.com/questions/10980105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/139150/" ]
``` sed 's/.*Waiting on job_\([^ ]*\).*/\1/' ``` For each line containing `Waiting on job_` followed by 0 or more non-space characters, this will substitute the whole line (because starting and ending `.*` are going to greedily take as many characters as possible) using back-reference `\1` to recall everything that w...
``` perl -lne 'print $1 if m/(?<=Waiting on job_)([^ ]*)/' inputfile ```
3,569,599
The equation is $$y'' + y=p(x)$$ Let $p(x)=\sum\limits\_{k=0}^n a\_k x^k$ The homogeneous solution to the equation is $y\_h = a\cos(x)+b\sin(x)$. I can look for a particular solution of the form $y\_p=\sum\limits\_{k=0}^n b\_k x^k$. We get $$\sum\limits\_{k=0}^{n-2} ((k+2)(k+1)b\_{k+2}+b\_k)x^k+b\_{n-1}x^{n-1}+b\_n...
2020/03/04
[ "https://math.stackexchange.com/questions/3569599", "https://math.stackexchange.com", "https://math.stackexchange.com/users/376394/" ]
As you said $\lim\limits\_{n\to \infty}\ln^n 2=0$. Let: $$I\_n = \int\_2^e\ln^n x\,dx$$ $I\_n$ is decreasing because: $$I\_{n}-I\_{n+1}=\int\_2^e\ln^n x(1-\ln x)\,dx \geq 0$$ Integrating by parts: $$ \begin{aligned} \displaystyle\int\_2^e \ln^n x\, dx &= \displaystyle\int\_2^e \ln^n x \cdot (x)'\, dx\\ &=x\ln^n x...
Use $t = \log^{n+1}(x) \implies \frac{1}{n+1}e^{t^{\frac{1}{n+1}}}dt = \log^n(x)dx$: $$I = \lim\_{n\to\infty} \frac{n}{n+1}\int\_{\log^{n+1}(2)}^1 e^{t^{\frac{1}{n+1}}}\:dt \longrightarrow \int\_0^1 e\:dt = e$$ by dominated convergence.
3,569,599
The equation is $$y'' + y=p(x)$$ Let $p(x)=\sum\limits\_{k=0}^n a\_k x^k$ The homogeneous solution to the equation is $y\_h = a\cos(x)+b\sin(x)$. I can look for a particular solution of the form $y\_p=\sum\limits\_{k=0}^n b\_k x^k$. We get $$\sum\limits\_{k=0}^{n-2} ((k+2)(k+1)b\_{k+2}+b\_k)x^k+b\_{n-1}x^{n-1}+b\_n...
2020/03/04
[ "https://math.stackexchange.com/questions/3569599", "https://math.stackexchange.com", "https://math.stackexchange.com/users/376394/" ]
Use $t = \log^{n+1}(x) \implies \frac{1}{n+1}e^{t^{\frac{1}{n+1}}}dt = \log^n(x)dx$: $$I = \lim\_{n\to\infty} \frac{n}{n+1}\int\_{\log^{n+1}(2)}^1 e^{t^{\frac{1}{n+1}}}\:dt \longrightarrow \int\_0^1 e\:dt = e$$ by dominated convergence.
Fixed $\epsilon\in(0,1-\ln2)$. Let $u=\ln x$ and then $$ n\int\_2^e (\ln x)^n dx=n \int\_{\ln 2}^1 u^ne^u du=n \int\_{\ln 2}^{1-\epsilon} u^ne^u du+n \int^1\_{1-\epsilon} u^ne^u du.$$ For the 1st part, $$ 0\le n \int\_{\ln 2}^{1-\epsilon} u^ne^u du\le 3n(1-\epsilon)^n $$ and one has $$ \lim\_{n\to\infty} n \int\_{\ln 2...
3,569,599
The equation is $$y'' + y=p(x)$$ Let $p(x)=\sum\limits\_{k=0}^n a\_k x^k$ The homogeneous solution to the equation is $y\_h = a\cos(x)+b\sin(x)$. I can look for a particular solution of the form $y\_p=\sum\limits\_{k=0}^n b\_k x^k$. We get $$\sum\limits\_{k=0}^{n-2} ((k+2)(k+1)b\_{k+2}+b\_k)x^k+b\_{n-1}x^{n-1}+b\_n...
2020/03/04
[ "https://math.stackexchange.com/questions/3569599", "https://math.stackexchange.com", "https://math.stackexchange.com/users/376394/" ]
Use $t = \log^{n+1}(x) \implies \frac{1}{n+1}e^{t^{\frac{1}{n+1}}}dt = \log^n(x)dx$: $$I = \lim\_{n\to\infty} \frac{n}{n+1}\int\_{\log^{n+1}(2)}^1 e^{t^{\frac{1}{n+1}}}\:dt \longrightarrow \int\_0^1 e\:dt = e$$ by dominated convergence.
Let $\epsilon $ be any fixed number such that $0<\epsilon <e-2$ and we split the integral as a sum of two integrals using intervals $[2,e-\epsilon]$ and $[e-\epsilon, e] $. The first integral tends to $0$ as integrand uniformly tends to $0$. For the second integral we need to bound it suitably. We have via integration...
3,569,599
The equation is $$y'' + y=p(x)$$ Let $p(x)=\sum\limits\_{k=0}^n a\_k x^k$ The homogeneous solution to the equation is $y\_h = a\cos(x)+b\sin(x)$. I can look for a particular solution of the form $y\_p=\sum\limits\_{k=0}^n b\_k x^k$. We get $$\sum\limits\_{k=0}^{n-2} ((k+2)(k+1)b\_{k+2}+b\_k)x^k+b\_{n-1}x^{n-1}+b\_n...
2020/03/04
[ "https://math.stackexchange.com/questions/3569599", "https://math.stackexchange.com", "https://math.stackexchange.com/users/376394/" ]
As you said $\lim\limits\_{n\to \infty}\ln^n 2=0$. Let: $$I\_n = \int\_2^e\ln^n x\,dx$$ $I\_n$ is decreasing because: $$I\_{n}-I\_{n+1}=\int\_2^e\ln^n x(1-\ln x)\,dx \geq 0$$ Integrating by parts: $$ \begin{aligned} \displaystyle\int\_2^e \ln^n x\, dx &= \displaystyle\int\_2^e \ln^n x \cdot (x)'\, dx\\ &=x\ln^n x...
Fixed $\epsilon\in(0,1-\ln2)$. Let $u=\ln x$ and then $$ n\int\_2^e (\ln x)^n dx=n \int\_{\ln 2}^1 u^ne^u du=n \int\_{\ln 2}^{1-\epsilon} u^ne^u du+n \int^1\_{1-\epsilon} u^ne^u du.$$ For the 1st part, $$ 0\le n \int\_{\ln 2}^{1-\epsilon} u^ne^u du\le 3n(1-\epsilon)^n $$ and one has $$ \lim\_{n\to\infty} n \int\_{\ln 2...
3,569,599
The equation is $$y'' + y=p(x)$$ Let $p(x)=\sum\limits\_{k=0}^n a\_k x^k$ The homogeneous solution to the equation is $y\_h = a\cos(x)+b\sin(x)$. I can look for a particular solution of the form $y\_p=\sum\limits\_{k=0}^n b\_k x^k$. We get $$\sum\limits\_{k=0}^{n-2} ((k+2)(k+1)b\_{k+2}+b\_k)x^k+b\_{n-1}x^{n-1}+b\_n...
2020/03/04
[ "https://math.stackexchange.com/questions/3569599", "https://math.stackexchange.com", "https://math.stackexchange.com/users/376394/" ]
As you said $\lim\limits\_{n\to \infty}\ln^n 2=0$. Let: $$I\_n = \int\_2^e\ln^n x\,dx$$ $I\_n$ is decreasing because: $$I\_{n}-I\_{n+1}=\int\_2^e\ln^n x(1-\ln x)\,dx \geq 0$$ Integrating by parts: $$ \begin{aligned} \displaystyle\int\_2^e \ln^n x\, dx &= \displaystyle\int\_2^e \ln^n x \cdot (x)'\, dx\\ &=x\ln^n x...
Let $\epsilon $ be any fixed number such that $0<\epsilon <e-2$ and we split the integral as a sum of two integrals using intervals $[2,e-\epsilon]$ and $[e-\epsilon, e] $. The first integral tends to $0$ as integrand uniformly tends to $0$. For the second integral we need to bound it suitably. We have via integration...
3,569,599
The equation is $$y'' + y=p(x)$$ Let $p(x)=\sum\limits\_{k=0}^n a\_k x^k$ The homogeneous solution to the equation is $y\_h = a\cos(x)+b\sin(x)$. I can look for a particular solution of the form $y\_p=\sum\limits\_{k=0}^n b\_k x^k$. We get $$\sum\limits\_{k=0}^{n-2} ((k+2)(k+1)b\_{k+2}+b\_k)x^k+b\_{n-1}x^{n-1}+b\_n...
2020/03/04
[ "https://math.stackexchange.com/questions/3569599", "https://math.stackexchange.com", "https://math.stackexchange.com/users/376394/" ]
Let $\epsilon $ be any fixed number such that $0<\epsilon <e-2$ and we split the integral as a sum of two integrals using intervals $[2,e-\epsilon]$ and $[e-\epsilon, e] $. The first integral tends to $0$ as integrand uniformly tends to $0$. For the second integral we need to bound it suitably. We have via integration...
Fixed $\epsilon\in(0,1-\ln2)$. Let $u=\ln x$ and then $$ n\int\_2^e (\ln x)^n dx=n \int\_{\ln 2}^1 u^ne^u du=n \int\_{\ln 2}^{1-\epsilon} u^ne^u du+n \int^1\_{1-\epsilon} u^ne^u du.$$ For the 1st part, $$ 0\le n \int\_{\ln 2}^{1-\epsilon} u^ne^u du\le 3n(1-\epsilon)^n $$ and one has $$ \lim\_{n\to\infty} n \int\_{\ln 2...
2,599,830
How to solve this summation? > > Evaluate > $$ > \sum\_{k=1}^n \frac{12^k}{(4^k - 3^k)(4^{k+1} - 3^{k+1})} > $$ > > > [![my attempt](https://i.stack.imgur.com/3z4Kn.jpg)](https://i.stack.imgur.com/3z4Kn.jpg)
2018/01/10
[ "https://math.stackexchange.com/questions/2599830", "https://math.stackexchange.com", "https://math.stackexchange.com/users/455366/" ]
You were close. You should write $$12^k=[(4^{k+1}-3^{k+1})-4(4^k-3^k)]\cdot[(4^{k+1}-3^{k+1})-3(4^k-3^k)]$$
As expected the series telescopes and therefore can be readily summed. From a partial fraction decomposition we have $$\frac{1}{(4^k - 3^k)(4^{k + 1} - 3^{k + 1})} = \frac{3^{-k}}{4^k - 3^k} - \frac{4 \cdot 3^{-k}}{4^{k + 1} - 3^{k + 1}}.$$ Thus the sum becomes $$S = \sum\_{k = 1}^n \left (\frac{4^k}{4^k - 3^k} - \fr...
2,090,218
> > Hi guys, what is the difference exactly between the both edge sets **V\*V** and **[V]^2**? > [![enter image description here](https://i.stack.imgur.com/34UPm.png)](https://i.stack.imgur.com/34UPm.png) > [![enter image description here](https://i.stack.imgur.com/Tljal.png)](https://i.stack.imgur.com/Tljal.png) > ...
2017/01/09
[ "https://math.stackexchange.com/questions/2090218", "https://math.stackexchange.com", "https://math.stackexchange.com/users/238131/" ]
$[V]^2$ is the family of unordered $2$-element subsets of $V$; $V\times V$ is set of ordered pairs of elements of $V$. > > **Example:** If $V=\{0,1,2\}$, then $$[V]^2=\big\{\{0,1\},\{0,2\},\{1,2\}\big\}\;,$$ corresponding to the three possible edges between vertices in $V$. But $$V\times V=\{\langle 0,0\rangle,\lang...
In an undirected graph the edge $(a,b)$ is an arc or line joining vertices $a$ and $b$ without any direction. Moreover, $(a,b)$ and $(b,a)$ has same representation in graph. In a directed graph the edge $(a,b)$ is an arc or line pointing from vertex $a$ to vertex $b$. Here $(b,a)$ is the reverse edge pointing from $b$...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
This problem is solved by implementing `HashLocationStrategy` which adds `#` to all your routes. You achieve this by adding `HashLocationStrategy` to `AppModule` `providers`. ```js providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}], ``` and add the corresponding import ```js import { HashLocat...
For Apache Server ----------------- * Create a file name `.htaccess` * Edit that file and write `index.html` instead of `index.php` * For those who dont have any code, can write the code below in your `.htaccess` file : `RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond ...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
This is because http-server does not support **fallback** like lite-server or web pack-dev server. This is why it shows **404 not found**. There are two solution to resolve this issue: 1. you can use **HashLocationStrategy** like mentioned above. 2. If you are deploying it to Apache or IIS server then you can simply a...
The exact reason why this particular issue is being faced is because of your server settings. So when you implement the application there are certain steps that you will have to take. One of the essential steps is to mark a particular segment of your path say: <http://domain-name/main> where **main** being the path s...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
**For Apache server:** *in the Production servers* Add or create ".htaccess" file into the project root, add a rewrite rule to the .htaccess file as shown ``` RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] RewriteCond %{DOC...
Add a dot in your base href strings. Correct ``` <base href="./home"> ``` Wrong ``` <base href="/home"> ``` <http://www.wisdomofjim.com/blog/solved-problems-with-resource-loading-failures-when-deploying-angular-2-webapps-live>
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
If you, like me, want to make no code changes at all, simply use this instead: <https://www.npmjs.com/package/angular-http-server>
For Apache Server ----------------- * Create a file name `.htaccess` * Edit that file and write `index.html` instead of `index.php` * For those who dont have any code, can write the code below in your `.htaccess` file : `RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond ...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
I've resolved this problem with adding this in AppModule Providers: ``` providers: [{provide: LocationStrategy, useClass: PathLocationStrategy}] ``` and importing ``` import { PathLocationStrategy, LocationStrategy } from '@angular/common'; ``` Then I created .htaccess: ``` RewriteEngine On # If an existing asse...
For Apache Server ----------------- * Create a file name `.htaccess` * Edit that file and write `index.html` instead of `index.php` * For those who dont have any code, can write the code below in your `.htaccess` file : `RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond ...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
This is because http-server does not support **fallback** like lite-server or web pack-dev server. This is why it shows **404 not found**. There are two solution to resolve this issue: 1. you can use **HashLocationStrategy** like mentioned above. 2. If you are deploying it to Apache or IIS server then you can simply a...
in the project folder create .htaccess file an then write ``` RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.html [L] ``` follow this link: <htt...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
I also faced this issue and found a solution that does not require HashLocationStrategy solution. Issue is, a server like tomcat looks for a actual folder (for eg : /about ) which does not exist in angular app, as its a single page application. So every request needs to be redirected to index.html. Easiest way to fi...
For Apache Server ----------------- * Create a file name `.htaccess` * Edit that file and write `index.html` instead of `index.php` * For those who dont have any code, can write the code below in your `.htaccess` file : `RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond ...
43,535,048
I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using 'ng generate component ' command. Then I specified routing in the **app-routing.module.ts** as following. ``` import { NgModule } from '@angular/core'; import { R...
2017/04/21
[ "https://Stackoverflow.com/questions/43535048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1697885/" ]
If you use href, change them to routerlink.
in the project folder create .htaccess file an then write ``` RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.html [L] ``` follow this link: <htt...