qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
26,555,757
I'm a jQuery noob and I haven't been able to find what I want in the documentation, perhaps because I do not know what to search for. I need to get ALL values of a dropdown list. I am currently doing: ``` <select id="cars" multiple="multiple" class="form-control"> <option value="volvo">Volvo</option> <option valu...
2014/10/24
[ "https://Stackoverflow.com/questions/26555757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1472409/" ]
If you want to do something like get all the values and put them in an array, you could do: ``` $("#cars option").map(function(){ return this.value }).get() ```
You can get the children of the div id **cars** by using `.children()`, or simply `$(#cars option)`: ``` var ary = []; $('#cars').children().each(function () { ary.push($(this).val()); //put them in array }); ``` And you can access the children with `$(this).val()`, and store them in an array
41,716,396
Suppose we have a pretty big amount of files in a project, so writing #include "somefile" to all of them will take a long time, so it there a way to include "somefile" into all files in the project?
2017/01/18
[ "https://Stackoverflow.com/questions/41716396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7322200/" ]
If it is visual studio, use the /FI option (force include). <https://msdn.microsoft.com/en-us/library/8c5ztk84.aspx>
Some compilers have an option for this. For example, the option for GCC is `-include`. > > ### `-include` *`file`* > > > Process file as if "`#include "file"`" appeared as the first line of the primary source file. However, the first directory searched for file is the preprocessor's working directory instead of the...
41,716,396
Suppose we have a pretty big amount of files in a project, so writing #include "somefile" to all of them will take a long time, so it there a way to include "somefile" into all files in the project?
2017/01/18
[ "https://Stackoverflow.com/questions/41716396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7322200/" ]
Some compilers have an option for this. For example, the option for GCC is `-include`. > > ### `-include` *`file`* > > > Process file as if "`#include "file"`" appeared as the first line of the primary source file. However, the first directory searched for file is the preprocessor's working directory instead of the...
If you are working with an IDE surely there must be a mechanism of "find and replace" that you can use! The idea here would be to find a string (another `#include` for example) that you know that exists in the same place that you want to put the `#include`'s and replace it with your new `#include` concatenated with a ...
41,716,396
Suppose we have a pretty big amount of files in a project, so writing #include "somefile" to all of them will take a long time, so it there a way to include "somefile" into all files in the project?
2017/01/18
[ "https://Stackoverflow.com/questions/41716396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7322200/" ]
If it is visual studio, use the /FI option (force include). <https://msdn.microsoft.com/en-us/library/8c5ztk84.aspx>
If you are working with an IDE surely there must be a mechanism of "find and replace" that you can use! The idea here would be to find a string (another `#include` for example) that you know that exists in the same place that you want to put the `#include`'s and replace it with your new `#include` concatenated with a ...
3,489,451
I am creating a .png file like this: ``` import pygraphviz as pgv G = pgv.AGraph() G.add_nodes("a") G.add_edge("b", "c") G.layout() G.draw("output.png") ``` How can I set the size of the output image?
2010/08/15
[ "https://Stackoverflow.com/questions/3489451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230636/" ]
You can set the maximum size of your output image, by setting **size**, which is an attribute of the *graph object*. E.g., ``` digraph "my_graph" { graph[ fontname = "Helvetica-Oblique", fontsize = 12, label = "some label", size = "7.75,10.25" ]; node [ shape = polygon, ...
In addition to setting the size, you might want to enforce a particular aspect ratio too. To set a ratio of 1:1.4 (width=1, height=1.4, i.e. that of an A4 page, approximately), you can do this (with a maximum dimension of 10 inches): ``` G.draw('output.png', args='-Gsize=10 -Gratio=1.4', prog='dot') ``` The format ...
33,273,523
I want to play recorded mp4 data using Android Media Player,but when try to play this error showed : > > java.io.IOException: setDataSource failed. > > > at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1086) > > > at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1032) > > > This is my c...
2015/10/22
[ "https://Stackoverflow.com/questions/33273523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3167956/" ]
I just solved this problem yesterday Instead of giving direct path to setDataSource, give the path to File ``` try { Log.d("SetDatasource path", playRecordPath); File filePath = new File(playRecordPath); if (!filePath.exists()) ...
dont forget to add internet permission in the AndroidManifest.xml ``` <uses-permission android:name="android.permission.INTERNET" /> ```
371,971
I'm upgrading a computer. Among other things it now has 8GB of memory instead of 2. Currently it runs Windows Seven 32bits, but to support that much memory I need to install the 64bits version. So here comes the question: I have only one hard drive with no free partitions so I'd like to just install Windows Seven 64 ...
2011/12/27
[ "https://superuser.com/questions/371971", "https://superuser.com", "https://superuser.com/users/111112/" ]
You need to look at the specifications for this laptop. According to the [information](http://www.lapspecs.com/wiki/fujitsu+amilo+xa3530) I could find, this laptop can only use a MAX of 4GB of DDR2 800MHz.
I gave it a shot and I bought a cheap 4GB DDR2 PC-5200 So-Dimm and my bios is showing me 6144 MB ram and I can boot into Windows 7. But if I knew this before I would have bought a PC-6400 because it's faster.
371,971
I'm upgrading a computer. Among other things it now has 8GB of memory instead of 2. Currently it runs Windows Seven 32bits, but to support that much memory I need to install the 64bits version. So here comes the question: I have only one hard drive with no free partitions so I'd like to just install Windows Seven 64 ...
2011/12/27
[ "https://superuser.com/questions/371971", "https://superuser.com", "https://superuser.com/users/111112/" ]
Crucial and SATech.com both report that 4GB is the hardware limit for the FSC Amilo XA 3530. You could try a SSD replacement for your spinning disk and see if that helps performance. The ***first*** thing to do for performance improvement is to profile to find out where the bottlenecks (if any) are located. In other ...
I gave it a shot and I bought a cheap 4GB DDR2 PC-5200 So-Dimm and my bios is showing me 6144 MB ram and I can boot into Windows 7. But if I knew this before I would have bought a PC-6400 because it's faster.
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The robot general pressed the button to launch the nuke aimed at a mountain top a 1000 miles away, minutes later the sole surviour of humanity and his pathetic EMP shield melted with the mountain top.
Probably not. Most modern things are hardened especially military equipment. You would have better luck with a paintball gun or exploding paint grenades to robots than with conventional weapons. Paint will blind spot the boston robots dog for example. Probably more effective and easier to get a hold of. It is also l...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The killer robots can deploy a faraday cage around your Electro Magnetic Pulse (EMP) generator and defeat it. This would be if they are unable to launch an all-out offensive against the generator in the first place to remove it's ability to stop them. Alternatively, the robots could wear their own faraday cage suits w...
Modern military equipment is hardened against EMP, and that shiny metal shell around a Terminator probably functions as a Faraday cage and protects them. However, all protection has its limits, and a powerful enough EMP generator will keep them at a certain distance. (arbitrary as we are talking SF technology) However...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The killer robots can deploy a faraday cage around your Electro Magnetic Pulse (EMP) generator and defeat it. This would be if they are unable to launch an all-out offensive against the generator in the first place to remove it's ability to stop them. Alternatively, the robots could wear their own faraday cage suits w...
Probably not. Most modern things are hardened especially military equipment. You would have better luck with a paintball gun or exploding paint grenades to robots than with conventional weapons. Paint will blind spot the boston robots dog for example. Probably more effective and easier to get a hold of. It is also l...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
There are several problems with this, not the least of which is that you've just created an EMP that is comparable to a [lightning](https://news.nationalgeographic.com/news/2004/06/flash-facts-about-lightning/) generator in terms of range, but your lightning is not a ranged weapon; it strikes specific points where resi...
Modern military equipment is hardened against EMP, and that shiny metal shell around a Terminator probably functions as a Faraday cage and protects them. However, all protection has its limits, and a powerful enough EMP generator will keep them at a certain distance. (arbitrary as we are talking SF technology) However...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
There are several problems with this, not the least of which is that you've just created an EMP that is comparable to a [lightning](https://news.nationalgeographic.com/news/2004/06/flash-facts-about-lightning/) generator in terms of range, but your lightning is not a ranged weapon; it strikes specific points where resi...
Tough. Because the EMP decays with the square of the radius (distance from source). You should've prepared yourself with a bunch of [explosive EMP grenades](https://en.wikipedia.org/wiki/Explosively_pumped_flux_compression_generator) and invest into a grenade launcher or mortar. It would have bought you a few days mor...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The robot general pressed the button to launch the nuke aimed at a mountain top a 1000 miles away, minutes later the sole surviour of humanity and his pathetic EMP shield melted with the mountain top.
Modern military equipment is hardened against EMP, and that shiny metal shell around a Terminator probably functions as a Faraday cage and protects them. However, all protection has its limits, and a powerful enough EMP generator will keep them at a certain distance. (arbitrary as we are talking SF technology) However...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The killer robots can deploy a faraday cage around your Electro Magnetic Pulse (EMP) generator and defeat it. This would be if they are unable to launch an all-out offensive against the generator in the first place to remove it's ability to stop them. Alternatively, the robots could wear their own faraday cage suits w...
Tough. Because the EMP decays with the square of the radius (distance from source). You should've prepared yourself with a bunch of [explosive EMP grenades](https://en.wikipedia.org/wiki/Explosively_pumped_flux_compression_generator) and invest into a grenade launcher or mortar. It would have bought you a few days mor...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The killer robots can deploy a faraday cage around your Electro Magnetic Pulse (EMP) generator and defeat it. This would be if they are unable to launch an all-out offensive against the generator in the first place to remove it's ability to stop them. Alternatively, the robots could wear their own faraday cage suits w...
The T-800 model and Skynet itself are quite intelligent. If your EMP field hurts even one robot, what they will do is staying away from the mountain and finding other ways to get at you. The [152 mm towed gun-howitzer M1955](https://en.wikipedia.org/wiki/152_mm_towed_gun-howitzer_M1955_(D-20)) has a range of up to 17....
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
The robot general pressed the button to launch the nuke aimed at a mountain top a 1000 miles away, minutes later the sole surviour of humanity and his pathetic EMP shield melted with the mountain top.
Tough. Because the EMP decays with the square of the radius (distance from source). You should've prepared yourself with a bunch of [explosive EMP grenades](https://en.wikipedia.org/wiki/Explosively_pumped_flux_compression_generator) and invest into a grenade launcher or mortar. It would have bought you a few days mor...
140,310
Set in the near future, thousands of killer robots resemble those featured in the terminator film, I'm referring to the 800 series model are now marching in as we speaks. I am a sole survivor on a tall mountain and I have put up a powerful emp with effective range of 10km, is it sufficient to deter the killer robots? I...
2019/02/28
[ "https://worldbuilding.stackexchange.com/questions/140310", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/8400/" ]
There are several problems with this, not the least of which is that you've just created an EMP that is comparable to a [lightning](https://news.nationalgeographic.com/news/2004/06/flash-facts-about-lightning/) generator in terms of range, but your lightning is not a ranged weapon; it strikes specific points where resi...
Probably not. Most modern things are hardened especially military equipment. You would have better luck with a paintball gun or exploding paint grenades to robots than with conventional weapons. Paint will blind spot the boston robots dog for example. Probably more effective and easier to get a hold of. It is also l...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I didn't understand what's your problem but I think that your code could be improved. I think that you don't need to use directly the `Matrix` class. There are some functions that does this work for you. Infact the only things you need are: set the point of the rotation as the center, rotate the graphics and draw on it...
Have you tried RotateFlip? ``` public partial class Form1 : Form { Image myImage; AnimatedGif myGif; Bitmap bitmap; public Form1() { InitializeComponent(); myImage = Image.FromFile(@"D:\fananimation.gif"); bitmap = new Bitmap(myImage); bitmap.RotateFlip(System.Drawin...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
Have you tried RotateFlip? ``` public partial class Form1 : Form { Image myImage; AnimatedGif myGif; Bitmap bitmap; public Form1() { InitializeComponent(); myImage = Image.FromFile(@"D:\fananimation.gif"); bitmap = new Bitmap(myImage); bitmap.RotateFlip(System.Drawin...
I checked the answers and they all have at least one of the following problems: * Cropping/incorrect centering * Unnecessary margin * Errors with some angle ranges * Unnecessarily complicated calculations/code This solution can handle any angle (positive, negative, over 360° etc.). There is no cropping or excessive m...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
Based on the previous answers I created this code that doesn't cut the image (the other examples were not working for me) ``` private Bitmap RotateImage(Bitmap bmp, float angle) { float height = bmp.Height; float width = bmp.Width; int hypotenuse = System.Convert.ToInt32(System.Math.Flo...
I checked the answers and they all have at least one of the following problems: * Cropping/incorrect centering * Unnecessary margin * Errors with some angle ranges * Unnecessarily complicated calculations/code This solution can handle any angle (positive, negative, over 360° etc.). There is no cropping or excessive m...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I was using this function in VB: ``` Public Function RotateImage(ByRef image As Image, ByVal angle As Single) As Drawing.Bitmap If image Is Nothing Then Throw New ArgumentNullException("image") End If Dim pi2 As Single = Math.PI / 2.0 Dim oldWidth As Single = image.Width Dim oldHeight ...
Depending on Timo's code, i made some improvements, with improvement, negative angles (up to -360) can be give as a parameter succesfully ``` private static Bitmap RotateImage(Bitmap bmp, float angle) { float alpha = angle; //edit: negative angle +360 while (alpha < 0) alpha += 360; ...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I didn't understand what's your problem but I think that your code could be improved. I think that you don't need to use directly the `Matrix` class. There are some functions that does this work for you. Infact the only things you need are: set the point of the rotation as the center, rotate the graphics and draw on it...
Depending on Timo's code, i made some improvements, with improvement, negative angles (up to -360) can be give as a parameter succesfully ``` private static Bitmap RotateImage(Bitmap bmp, float angle) { float alpha = angle; //edit: negative angle +360 while (alpha < 0) alpha += 360; ...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I didn't understand what's your problem but I think that your code could be improved. I think that you don't need to use directly the `Matrix` class. There are some functions that does this work for you. Infact the only things you need are: set the point of the rotation as the center, rotate the graphics and draw on it...
Based on the previous answers I created this code that doesn't cut the image (the other examples were not working for me) ``` private Bitmap RotateImage(Bitmap bmp, float angle) { float height = bmp.Height; float width = bmp.Width; int hypotenuse = System.Convert.ToInt32(System.Math.Flo...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I tried the answer of @Omar myself and realized, that the original image gets cut at the sides ... i've rewritten it so it resizes the image to the new sizes: ``` private static Bitmap RotateImage(Bitmap bmp, float angle) { float alpha = angle; //edit: negative angle +360 while(alpha <0) alpha +=360; ...
I checked the answers and they all have at least one of the following problems: * Cropping/incorrect centering * Unnecessary margin * Errors with some angle ranges * Unnecessarily complicated calculations/code This solution can handle any angle (positive, negative, over 360° etc.). There is no cropping or excessive m...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I didn't understand what's your problem but I think that your code could be improved. I think that you don't need to use directly the `Matrix` class. There are some functions that does this work for you. Infact the only things you need are: set the point of the rotation as the center, rotate the graphics and draw on it...
I was using this function in VB: ``` Public Function RotateImage(ByRef image As Image, ByVal angle As Single) As Drawing.Bitmap If image Is Nothing Then Throw New ArgumentNullException("image") End If Dim pi2 As Single = Math.PI / 2.0 Dim oldWidth As Single = image.Width Dim oldHeight ...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
I checked the answers and they all have at least one of the following problems: * Cropping/incorrect centering * Unnecessary margin * Errors with some angle ranges * Unnecessarily complicated calculations/code This solution can handle any angle (positive, negative, over 360° etc.). There is no cropping or excessive m...
Depending on Timo's code, i made some improvements, with improvement, negative angles (up to -360) can be give as a parameter succesfully ``` private static Bitmap RotateImage(Bitmap bmp, float angle) { float alpha = angle; //edit: negative angle +360 while (alpha < 0) alpha += 360; ...
12,024,406
I have animated gif and I'm using a class to parse the images(frames) from it. The class is: ``` using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using System.IO; public class AnimatedGif { private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>(); ...
2012/08/19
[ "https://Stackoverflow.com/questions/12024406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847881/" ]
Based on the previous answers I created this code that doesn't cut the image (the other examples were not working for me) ``` private Bitmap RotateImage(Bitmap bmp, float angle) { float height = bmp.Height; float width = bmp.Width; int hypotenuse = System.Convert.ToInt32(System.Math.Flo...
Depending on Timo's code, i made some improvements, with improvement, negative angles (up to -360) can be give as a parameter succesfully ``` private static Bitmap RotateImage(Bitmap bmp, float angle) { float alpha = angle; //edit: negative angle +360 while (alpha < 0) alpha += 360; ...
17,263
All those "systems": * 系统, * 体系 * 制度 * 体制 * 装置 How one should differentiate between them? I think that 1. 系统 has something to do with **unite, gather, tangle** flavor. So this word is a bit abstract. Should be used for "systems" which might NOT have a physical representation. 2. 体系 has somethign to do with **body +...
2016/02/20
[ "https://chinese.stackexchange.com/questions/17263", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/11754/" ]
装置 'device' doesn't really belong here. Here are some definitions from the [教育部國語辭典](http://dict.revised.moe.edu.tw/cbdic/): 系统: 同類事物,按一定秩序相連屬,而自成一整體 "objects/affairs belonging to the same category, joined together in a specific order to form a unity." The emphasis is on order, thus can be used to form adjecti...
You can speak this collocation like '改革教育体制', but if you speak '?改革教育体系', it sounds weird. If you speak 建立知识体系,it sounds natural. But if you speak ?建立知识体制, it is unacceptable. Based on these, I think, control as addressed above is the key factor for 体制, and 体系 seems to be a type of summary knowledge.
3,805,776
Suppose for nonnegative sequences $\{a\_k,b\_k,c\_k\}$, we have $$ 0 \leq \sum\_k a\_{k} (b\_k - c\_k) < C $$ for $C<\infty$. Let $\sum\_k a\_k =\infty$ hold and $b\_k \to 0$. Will this imply $c\_k \to 0?$
2020/08/28
[ "https://math.stackexchange.com/questions/3805776", "https://math.stackexchange.com", "https://math.stackexchange.com/users/143234/" ]
Let $a\_n= b\_n =\frac{1}{n}$ and define $$c\_n = \frac{1}{2} \quad\text{if} \quad \exists k, n=k^2 \quad \quad \quad \text{ and } \quad \quad c\_n = 0 \text{ otherwise}$$ Then $$\sum\_{k=1}^N a\_k(b\_k-c\_k) = \sum\_{k=1}^N a\_k b\_k-\sum\_{k=1}^N a\_kc\_k = \sum\_{k=1}^N \frac{1}{k^2}-\sum\_{k=1}^{\lfloor \sqrt{N} \...
Choose bk=0 for all k, ak=1 if k is even and 0 if k ist odd, ck=0 for even k and 1 for odd k. Then they're certainly all nonnegative and the sum in the question is bounded by C=1 since every term of it is 0 (either ak=0 or bk-ck=0). The sum over ak diverges and bk →0 but ck doesn't converge since it "jumps" between 0 a...
55,303,092
I have two dataframes: s-1 column, d-3 columns ``` s = {0: [0, 0.3, 0.5, -0.1, -0.2, 0.7, 0]} d = {0: [0.1, 0.2, -0.2, 0, 0, 0, 0], 1: [0.3, 0.4, -0.7, 0, 0.8, 0, 0.1], 2: [-0.5, 0.4, -0.1, 0.5, 0.5, 0, 0]} sd = pd.DataFrame(data=s) dd = pd.DataFrame(data=d) result = pd.DataFrame() ``` I want to get the result dataf...
2019/03/22
[ "https://Stackoverflow.com/questions/55303092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11243722/" ]
Using `np.where` twice ``` np.where(sd[0]==0,0,np.where(dd.eq(0).all(1),'OK',dd.mask(dd==0).mean(1))) Out[232]: array(['0', '0.3333333333333333', '-0.3333333333333333', '0.5', '0.65', 'OK', '0'], dtype='<U32') ```
thank you for your help. I managed to do it in a quite different way. I used: ``` res1 = pd.Series(np.where(sd[0]==0, 0, dd[dd != 0].mean(axis=1))).fillna('OK') ``` The difference is that it returns float values (for rows that are not 'OK'), not string. It also appears to be a little bit faster.
55,303,092
I have two dataframes: s-1 column, d-3 columns ``` s = {0: [0, 0.3, 0.5, -0.1, -0.2, 0.7, 0]} d = {0: [0.1, 0.2, -0.2, 0, 0, 0, 0], 1: [0.3, 0.4, -0.7, 0, 0.8, 0, 0.1], 2: [-0.5, 0.4, -0.1, 0.5, 0.5, 0, 0]} sd = pd.DataFrame(data=s) dd = pd.DataFrame(data=d) result = pd.DataFrame() ``` I want to get the result dataf...
2019/03/22
[ "https://Stackoverflow.com/questions/55303092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11243722/" ]
Using `numpy.select`: ``` c1 = sd[0].eq(0) c2 = dd.eq(0).all(1) res = np.select([c1, c2], [0, 'OK'], dd.where(dd.ne(0)).mean(1)) pd.Series(res) ``` ``` 0 0 1 0.3333333333333333 2 -0.3333333333333333 3 0.5 4 0.65 5 OK 6 ...
thank you for your help. I managed to do it in a quite different way. I used: ``` res1 = pd.Series(np.where(sd[0]==0, 0, dd[dd != 0].mean(axis=1))).fillna('OK') ``` The difference is that it returns float values (for rows that are not 'OK'), not string. It also appears to be a little bit faster.
13,011,939
I want to make a timer which will be shown on every activity of my application. I know how to make a timer on an activity below is my code ``` public class Timer extends Activity implements OnClickListener { public TextView mTextField; private Button btnstart; public String formatTime(long millis) { ...
2012/10/22
[ "https://Stackoverflow.com/questions/13011939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1722944/" ]
You can have a singleton class holding your `CountDownTimer` ``` // This is not a real singleton, Google to get a proper Java implementation public class TimerSingleton { // Should not be public, you should of course encapsulate access to that timer. // static keyword says that one timer object is shared by all ...
Create a Singleton! <http://en.wikipedia.org/wiki/Singleton_pattern> singleton guarantee that there will be only one object of some kind and makes it easy for any other object to access it.
13,011,939
I want to make a timer which will be shown on every activity of my application. I know how to make a timer on an activity below is my code ``` public class Timer extends Activity implements OnClickListener { public TextView mTextField; private Button btnstart; public String formatTime(long millis) { ...
2012/10/22
[ "https://Stackoverflow.com/questions/13011939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1722944/" ]
I have solved my problem by making a timer in one activity and calling its protected function in my other activity. This is the startTimer function to start the timer: ``` private void startTimer(){ if (mTimer == null) { mTimer = new Timer(); } if (mTimerTask == null) { mTimerTask = n...
Create a Singleton! <http://en.wikipedia.org/wiki/Singleton_pattern> singleton guarantee that there will be only one object of some kind and makes it easy for any other object to access it.
13,011,939
I want to make a timer which will be shown on every activity of my application. I know how to make a timer on an activity below is my code ``` public class Timer extends Activity implements OnClickListener { public TextView mTextField; private Button btnstart; public String formatTime(long millis) { ...
2012/10/22
[ "https://Stackoverflow.com/questions/13011939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1722944/" ]
You can have a singleton class holding your `CountDownTimer` ``` // This is not a real singleton, Google to get a proper Java implementation public class TimerSingleton { // Should not be public, you should of course encapsulate access to that timer. // static keyword says that one timer object is shared by all ...
If you want to show it one every activity of your application, then I suggest you to use [Fragments](http://developer.android.com/guide/components/fragments.html). All you need to do is to create a Fragment with your Timer class that will appear every time, another Fragment with other content you want to show, and mani...
13,011,939
I want to make a timer which will be shown on every activity of my application. I know how to make a timer on an activity below is my code ``` public class Timer extends Activity implements OnClickListener { public TextView mTextField; private Button btnstart; public String formatTime(long millis) { ...
2012/10/22
[ "https://Stackoverflow.com/questions/13011939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1722944/" ]
You can have a singleton class holding your `CountDownTimer` ``` // This is not a real singleton, Google to get a proper Java implementation public class TimerSingleton { // Should not be public, you should of course encapsulate access to that timer. // static keyword says that one timer object is shared by all ...
make a singleton class and register listener in your ui. ``` mTimerCustom = CountdownTimer.getInstance(); mTimerCustom.registerListener(this); mTimerCustom.start(); ``` in CountDownTimer class ``` public static CountdownTimer getInstance() { return INSTANCE; } public synchronized void start() ...
13,011,939
I want to make a timer which will be shown on every activity of my application. I know how to make a timer on an activity below is my code ``` public class Timer extends Activity implements OnClickListener { public TextView mTextField; private Button btnstart; public String formatTime(long millis) { ...
2012/10/22
[ "https://Stackoverflow.com/questions/13011939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1722944/" ]
I have solved my problem by making a timer in one activity and calling its protected function in my other activity. This is the startTimer function to start the timer: ``` private void startTimer(){ if (mTimer == null) { mTimer = new Timer(); } if (mTimerTask == null) { mTimerTask = n...
If you want to show it one every activity of your application, then I suggest you to use [Fragments](http://developer.android.com/guide/components/fragments.html). All you need to do is to create a Fragment with your Timer class that will appear every time, another Fragment with other content you want to show, and mani...
13,011,939
I want to make a timer which will be shown on every activity of my application. I know how to make a timer on an activity below is my code ``` public class Timer extends Activity implements OnClickListener { public TextView mTextField; private Button btnstart; public String formatTime(long millis) { ...
2012/10/22
[ "https://Stackoverflow.com/questions/13011939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1722944/" ]
I have solved my problem by making a timer in one activity and calling its protected function in my other activity. This is the startTimer function to start the timer: ``` private void startTimer(){ if (mTimer == null) { mTimer = new Timer(); } if (mTimerTask == null) { mTimerTask = n...
make a singleton class and register listener in your ui. ``` mTimerCustom = CountdownTimer.getInstance(); mTimerCustom.registerListener(this); mTimerCustom.start(); ``` in CountDownTimer class ``` public static CountdownTimer getInstance() { return INSTANCE; } public synchronized void start() ...
18,095,091
Can you please take a look at [JSfiddle](http://jsfiddle.net/Behseini/sBxP2/1/) and let me know how I can position the div with `.caption` at the bottom of the div with class `.wrapper`. I already tried to add `position:absolute; bottom:5px;` rules to `.caption` but it positioned the caption div out of the `.wrapper` ...
2013/08/07
[ "https://Stackoverflow.com/questions/18095091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2426488/" ]
The `position: absolute` should work but you'll need to set `.wrapper` as: ``` .wrapper { position: relative; } ``` Demo here: <http://jsfiddle.net/sBxP2/4/>
try this <http://jsfiddle.net/shall1987/MwJsG/> CSS ``` .wrapper{ height:300px; width:300px; background-color:yellow; position: relative; } .main{ height:100%; width:100%; } .caption{ height:10%; width:100%; background: rgb(0, 0, 0) ; opacity: 0.7;> margin-bottom:5px; colo...
18,095,091
Can you please take a look at [JSfiddle](http://jsfiddle.net/Behseini/sBxP2/1/) and let me know how I can position the div with `.caption` at the bottom of the div with class `.wrapper`. I already tried to add `position:absolute; bottom:5px;` rules to `.caption` but it positioned the caption div out of the `.wrapper` ...
2013/08/07
[ "https://Stackoverflow.com/questions/18095091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2426488/" ]
The `position: absolute` should work but you'll need to set `.wrapper` as: ``` .wrapper { position: relative; } ``` Demo here: <http://jsfiddle.net/sBxP2/4/>
you can update your css like this <http://jsfiddle.net/shall1987/MwJsG/> ``` .wrapper{ height:300px; width:300px; background-color:yellow; position:relative; } .main{ height:100%; width:100%; } .caption{ height:10%; width:100%; background: rgb(0, 0, 0) ; opacity: 0.7; margin-bot...
28,256,356
How to subtract the following format data in python ``` a =16:03:00.135 b =16:02:57:507 ``` Please provide some inputs on this ``` >>> float(16:03:00.135) - float(16:02:57.507) File "<stdin>", line 1 float(16:03:00.135) - float(16:02:57.507) ^ SyntaxError: invalid syntax ```
2015/01/31
[ "https://Stackoverflow.com/questions/28256356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3924760/" ]
The return type of `malloc` is `void *`, which, according to the standard, cannot be used for pointer arithmetic. There is a GNU extension, however, that treats `sizeof(void)` as `1` and that is why your first fragment compiles. Later on, `pointer - 1` subtracts `sizeof(int)` and not `1`, hence the pointer mismatch. ...
Pointer arithmetic can be done using either of `+` or `+=`. It has nothing to do with the error produced. `malloc` returns `void *` type. C standard says that: ### C11: 6.2.5 Types (p19): > > The `void` type comprises an empty set of values; it is an **incomplete type** that cannot be completed. > > > ### 6.5.6...
28,256,356
How to subtract the following format data in python ``` a =16:03:00.135 b =16:02:57:507 ``` Please provide some inputs on this ``` >>> float(16:03:00.135) - float(16:02:57.507) File "<stdin>", line 1 float(16:03:00.135) - float(16:02:57.507) ^ SyntaxError: invalid syntax ```
2015/01/31
[ "https://Stackoverflow.com/questions/28256356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3924760/" ]
The return type of `malloc` is `void *`, which, according to the standard, cannot be used for pointer arithmetic. There is a GNU extension, however, that treats `sizeof(void)` as `1` and that is why your first fragment compiles. Later on, `pointer - 1` subtracts `sizeof(int)` and not `1`, hence the pointer mismatch. ...
Saw the other answers, change your code into ``` int *pointer = (int *)malloc(sizeof(int)); ``` or ``` int * pointer = new int[1]; ``` will allow you to do what you wanted.
28,256,356
How to subtract the following format data in python ``` a =16:03:00.135 b =16:02:57:507 ``` Please provide some inputs on this ``` >>> float(16:03:00.135) - float(16:02:57.507) File "<stdin>", line 1 float(16:03:00.135) - float(16:02:57.507) ^ SyntaxError: invalid syntax ```
2015/01/31
[ "https://Stackoverflow.com/questions/28256356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3924760/" ]
Pointer arithmetic can be done using either of `+` or `+=`. It has nothing to do with the error produced. `malloc` returns `void *` type. C standard says that: ### C11: 6.2.5 Types (p19): > > The `void` type comprises an empty set of values; it is an **incomplete type** that cannot be completed. > > > ### 6.5.6...
Saw the other answers, change your code into ``` int *pointer = (int *)malloc(sizeof(int)); ``` or ``` int * pointer = new int[1]; ``` will allow you to do what you wanted.
70,176,163
How do I use the output of one function as the argument of another. There is an unknown (X) number of functions and each function is different. The argument to the first function is known (lets call it n). I have tried to create a list of the functions and use the results of one for another, I can't really get anywher...
2021/11/30
[ "https://Stackoverflow.com/questions/70176163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17551609/" ]
It's way easier than you made it: ``` funcs = [function1, function2, function3, function4, function5.....functionX] def nestedfunction(funcs, n): for f in funcs: n = f(n) return n ```
Iterate over the list and overwrite `n` with each iteration, then return it: ``` def nestedfunction(function_list, n): for function in function_list: n = function(n) return n ```
70,176,163
How do I use the output of one function as the argument of another. There is an unknown (X) number of functions and each function is different. The argument to the first function is known (lets call it n). I have tried to create a list of the functions and use the results of one for another, I can't really get anywher...
2021/11/30
[ "https://Stackoverflow.com/questions/70176163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17551609/" ]
It's way easier than you made it: ``` funcs = [function1, function2, function3, function4, function5.....functionX] def nestedfunction(funcs, n): for f in funcs: n = f(n) return n ```
The other answers are the Pythonic way of doing this. But I just wanted to point out that this is a common pattern, and in functional programming we would recognize this as a *reduction*. So this is how we would do this operation: ``` >>> import functools >>> funcs = [lambda x: x + 42, lambda x: x % 12, lambda x: x*2]...
19,997,199
I have more than 300 html pages, each page is named the same with 3 numbers at the end example first page is named gs001.html, second gs002.html, third gs003.html etc... till gs330.html I need code for previous and next buttons (preferably the code to be the same to paste on all pages) For example if I'm on page gs150...
2013/11/15
[ "https://Stackoverflow.com/questions/19997199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2995559/" ]
`ExecuteScalar` returns `null` when no records found. So when trying to cast `null -> int` you get a `NullReferenceException` Try this instead. ``` int count = Convert.ToInt32(cmd.ExecuteScalar()); ``` `Convert.ToInt32` will return `0` when parameter is `null`.
From [`SqlCommand.ExecuteScalar`](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar%28v=vs.110%29.aspx) > > Return Value > > > The first column of the first row in the result set, **or a null > reference if the result set is empty.** > > > That's why when there is no row as...
72,701,019
I'm unable to decode the utc8 characters from string. Below line getting from API ``` replace the cable if a fault is found â for example ``` actual string ``` replace the cable if a fault is found - for example ``` Can any one help me how to fix this ? Thanks!!!
2022/06/21
[ "https://Stackoverflow.com/questions/72701019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14240187/" ]
``` data.frame( people = people, Red = as.integer(colors=="Red"), Green = as.integer(colors=="Green"), Blue = as.integer(colors=="Blue") ) ```
Base R solution: ``` with( data.frame(df), cbind( people = people, setNames( data.frame(+outer(colors, unique(colors),`==`)), unique(colors) ) ) ) ```
26,871,653
I have created a class Hotel defined as follows: ``` import java.util.Random; public class Hotel { private Osoba[] tab = new Osoba[100]; public void zamelduj(Osoba os, int num) { if (tab[num - 1] == null) { System.out.println("Pokoj o numerze " + num + "jest zajety"); return; } tab[num -...
2014/11/11
[ "https://Stackoverflow.com/questions/26871653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4240739/" ]
Several solutions (the first and second one does not make use of databinding). ``` txtMyControl.text = "New value"; ``` If not on the main thread, you could use the dispatcher to update the value. ``` Application.Current.Dispatcher.BeginInvoke(() => txtMyControl.text == "New Value") ``` However, the most WPF fri...
The best approach to what you're trying to do would be to use Data Binding. You need to have a string object that will always hold the value of your textblock. Next you need to bind that object to your textblock and then use the event provided by the `INotifyPropertyChanged` interface and each time the value changes i...
26,871,653
I have created a class Hotel defined as follows: ``` import java.util.Random; public class Hotel { private Osoba[] tab = new Osoba[100]; public void zamelduj(Osoba os, int num) { if (tab[num - 1] == null) { System.out.println("Pokoj o numerze " + num + "jest zajety"); return; } tab[num -...
2014/11/11
[ "https://Stackoverflow.com/questions/26871653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4240739/" ]
Several solutions (the first and second one does not make use of databinding). ``` txtMyControl.text = "New value"; ``` If not on the main thread, you could use the dispatcher to update the value. ``` Application.Current.Dispatcher.BeginInvoke(() => txtMyControl.text == "New Value") ``` However, the most WPF fri...
If your event updates the textblock and the textblock you are using is bound to a string property and that property issues a NotifyPropertyChanged() in it's set method, that will cause the display to refresh as you desire. There are other ways, but this is the easiest given my understanding of your question. (this is...
9,235,376
As any Python developer I messed around with Python's Unicode issue for years now. But now I got a situation that drives me nuts and I'm not able to solve it by myself. It already took 1 day now, including recherches .. My setup is a little Django application that connects to a remote system via SOAP (using Suds), p...
2012/02/10
[ "https://Stackoverflow.com/questions/9235376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1203011/" ]
suds.sax.text.Text inherits from unicode ```python class Text(unicode): """ An XML text object used to represent text content. @ivar lang: The (optional) language flag. @type lang: bool @ivar escaped: The (optional) XML special character escaped flag. @type escaped: bool """ ``` You can ...
I spent over 2 hours trying to figure out what is going on and why I can not save Django objects after assigning values from Suds data structures to the fields of the objects. As @guillaumevincent mentioned Suds Text class is inherited from unicode and implementation is not 100% correct, so Django fails after trying t...
7,964
Time for a holiday-themed question. I lead a small online group in an MMORPG. For the holidays, we decided to exchange gifts ala Secret Santa. As leader, I took it upon myself to organize the whole thing. The mechanics for the gift exchange was that participants would sign up, and they would give a gift of an in-game...
2017/12/12
[ "https://interpersonal.stackexchange.com/questions/7964", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/6697/" ]
**Response to Edited Question.** When you say > > Compared to the other participants, the giver would have had to spend more, in terms of percentage, of in-game money he currently has. (think, beggar offering 5 coins vs rich man offering 5 coins kind of thing) For most of us who have been playing a while already,...
I agree with Dan Anderson's idea, don't say anything and just promise to rectify the situation next year. In terms of dealing with it next year, I've been running a Secret Santa event with my friends for what will be the 4th year running now. The way we deal with people not being happy with gifts is in advance, every...
7,964
Time for a holiday-themed question. I lead a small online group in an MMORPG. For the holidays, we decided to exchange gifts ala Secret Santa. As leader, I took it upon myself to organize the whole thing. The mechanics for the gift exchange was that participants would sign up, and they would give a gift of an in-game...
2017/12/12
[ "https://interpersonal.stackexchange.com/questions/7964", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/6697/" ]
> > We agreed on a budget, drew lots, setup a wish list so people can get the item they want, and exchanged gifts after a few days...I want to communicate to the gift-giver that they should at least give something near the budget, but I'm not sure how to: do I tell him that the recipient got upset? How do I tell him t...
I agree with Dan Anderson's idea, don't say anything and just promise to rectify the situation next year. In terms of dealing with it next year, I've been running a Secret Santa event with my friends for what will be the 4th year running now. The way we deal with people not being happy with gifts is in advance, every...
41,796,525
I'm creating a database for a browser game. So far I was doing quite well (I guess) until I decided to make items stackable. Therefore, I created "quantity\_table". This is my simplified database: [![enter image description here](https://i.stack.imgur.com/tulrx.png)](https://i.stack.imgur.com/tulrx.png) My goal is to...
2017/01/22
[ "https://Stackoverflow.com/questions/41796525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6361044/" ]
Databases don't have the concept of *lists* like most programming languages. Any time you need a *many* relationship, it has to be a table. Using that concept here, your equipment table should be like: Table Equipment --------------- * id\_acc: int(10) * id\_item: smallint(5) * qty: tinyint(3) To get all items for...
What about creating association table item\_quantity? ``` CREATE TABLE item_quantity( id_item INT NOT NULL, id_quant INT NOT NULL, CONSTRAINT id_item_quantity PRIMARY KEY (id_item,id_quant), CONSTRAINT fk_id_item FOREIGN KEY (id_item) REFERENCES items(id_item), CONSTRAINT fk_id_quant FOREIGN KEY (id_quant) REF...
18,615,213
My questions is what is default timeout for requests made with DefaultHttpClient if I didn't specify it. So if don't have code like this ``` HttpParams my_httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(my_httpParams, 3000); HttpConnectionParams.setSoTimeout(my_httpParams, 1); ``` but...
2013/09/04
[ "https://Stackoverflow.com/questions/18615213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1222067/" ]
As far as I know the connection timeout and socket timeout for the DefaultHttpClient are both null (or zero) by default, which means that the timeouts are not used and Android application will wait theoretically forever for both the connection and socket response to complete. Therefore, it is highly recommended that to...
I did some snooping around in the source and found these two methods. So it looks like they default to 0. ``` /** * Obtains value of the {@link CoreConnectionPNames#CONNECTION_TIMEOUT} * parameter. If not set, defaults to <code>0</code>. * * @param params HTTP parameters. * @return connect timeout. */ public sta...
217,867
In this [answered question](https://english.stackexchange.com/questions/91122/how-many-tenses-are-there-in-english?answertab=active#tab-top) An user said this **((5 moods × 2 tenses) + (1 defective mood)) × (4 aspects × 2 voices)** But what I don't understand is about the **moods** that he/she mentioned. Indicative, ...
2015/01/01
[ "https://english.stackexchange.com/questions/217867", "https://english.stackexchange.com", "https://english.stackexchange.com/users/101849/" ]
The user is using "mood" to refer to modal verbs indicating the speaker's attitude to the verb. They list them right in [the answer](https://english.stackexchange.com/a/91130). > > Really we have 4 modal verbs which occur in present/past tense pairs: *will/would, shall/should, can/could, may/might*, and then *must* w...
Oxford's answer in Grammar A-Z (I have changed the order): Mood 1 indicative mood, expressing facts 2 subjunctive mood, expressing wishes or possibility 3 conditional mood, expressing a condition 4 imperative mood, expressing a command 5 interrogative mood, expressing a question <http://www.oxforddictionaries.co...
4,561,726
``` from celery.task import Task class Decayer(Task): def calc_decay_value(self, x): y = (1.0/(2^x)) return y def calc_decay_time(self, x): y = 2^x return y def run(self, d, **kwargs): #do stuff. return 0 >>> decayer = tasks.Decayer(r) Traceback (most ...
2010/12/30
[ "https://Stackoverflow.com/questions/4561726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179736/" ]
Two errors 1) Your class doesn't have an `__init__` function. Either add one, or use this instead: ``` decayer = tasks.Decayer() ``` 2) You are trying to raise an integer to the power of a float, but `^` means xor and cannot be used on floats. Use `**` instead of `^`: ``` y = 2 ** x ```
The problem seems due to `decayer = tasks.Decayer(r)` call and tasks.Decayer is not designed to take a argument, because `Task` does not define a `__init__` method which can take one.
46,543,037
below is a program where I need to store String time and int datum as objects in an array and then print them out. This is what I am up to currently. I believe it is an issue with my recordEvent method. ``` class RecordEvents4 { public static void main(String[] args){ Recorder4 r1 = new Recorder4(100,100,"Wom...
2017/10/03
[ "https://Stackoverflow.com/questions/46543037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7779620/" ]
You are effectively asking Java to print out an element of your events array. In your declaration of this array, you gave elements inside it the `EventInformation` type. Java, by default, obviously doesn't know how to print this, since you defined it yourself! To fix this, change your print statement: ``` System.o...
Your `printEvents()` method should look like this: ``` void printEvents(){ System.out.println("Record of " + eventType + " events at [" + xPos + "," + yPos + "]"); for(int i = 0; i < xevent; i++){ System.out.println("Event number " + i + " was recorded at " + event[i].eventTime + " with d...
9,590,034
In a bash script, how do I use a variable to create a specifically named zipped file? For example, I would like to do something like: ``` VERSION_STRING='1.7.3' zip -r foo.$VERSION_STRING foo ``` Where I ideally end up with a file called `foo.1.7.3.zip` It seems like I'm having 2 problems: 1. the zip command is tr...
2012/03/06
[ "https://Stackoverflow.com/questions/9590034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208770/" ]
The following works fine here using bash 4.1.5: ``` #!/bin/bash VERSION_STRING='1.7.3' echo zip -r foo foo.$VERSION_STRING.zip ``` I've added the `echo` to see the actual command rather than run it. The script prints out ``` zip -r foo foo.1.7.3.zip ```
I think you have your zip inputs backwards. For me the following command: ``` zip -r foo.${VERSION_STRING}.zip foo ``` creates a valid zip file. Your command does not (at least with my version of zip).
9,590,034
In a bash script, how do I use a variable to create a specifically named zipped file? For example, I would like to do something like: ``` VERSION_STRING='1.7.3' zip -r foo.$VERSION_STRING foo ``` Where I ideally end up with a file called `foo.1.7.3.zip` It seems like I'm having 2 problems: 1. the zip command is tr...
2012/03/06
[ "https://Stackoverflow.com/questions/9590034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208770/" ]
you can use `${VERSION_STRING}` to clearly wrap your variable name
I think you have your zip inputs backwards. For me the following command: ``` zip -r foo.${VERSION_STRING}.zip foo ``` creates a valid zip file. Your command does not (at least with my version of zip).
37,903,525
Apologies if the answer to this is readily found elsewhere. My math and stats are weak and thus I don't even know the search terms for what I'm trying to do . . . I have *b* anonymous indistinguishable buckets into which I'm putting *i* identical items. I want to know all possible distributions and their probabilities...
2016/06/19
[ "https://Stackoverflow.com/questions/37903525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4063983/" ]
**Overview** When distributing e.g. 3 items over 4 buckets, you can put the first item into any of the 4 buckets, then for each of these 4 possibilities you can put the second item into any of the 4 buckets, and then for each of these 16 possibilities you can put the third item into any of the 4 buckets, to make a to...
Update ------ I just realized that you probably can't use my original recommendation for larger values of n and r. At least, not without some modification. For example, if you're putting 4 items into 5 buckets, you can have (among others): ``` {3,1,0,0,0} {2,2,0,0,0} ``` So the "n choose r" trick described below do...
57,226,469
I have a C# application that is adding row to a SQLite database table. The timestamp is a DateTime object with the milliseconds set to a value and the Kind is set to Utc. When I add many of these to the database, I'll have rows with the same time except the milliseconds are different. Some milliseconds have the trail...
2019/07/26
[ "https://Stackoverflow.com/questions/57226469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9516/" ]
Try to use `strftime` function. See [Date And Time Functions](https://www.sqlite.org/lang_datefunc.html). ``` select strftime('%Y-%m-%d %H:%M:%S.%f', '2019-07-26 20:02:38.41Z') select strftime('%Y-%m-%d %H:%M:%S.%f', '2019-07-26 20:02:38.4Z') ``` It returns ``` 2019-07-26 20:02:38.38.410 2019-07-26 20:02:38.38.400 ...
Like other persons already mentioned SQLLite doesn't have a real date type. You can test this thing to avoid that the 'Z' char appears in your ORDER BY statement if you remove it. ``` SELECT date FROM test ORDER BY REPLACE(date,'Z', ''); ```
57,226,469
I have a C# application that is adding row to a SQLite database table. The timestamp is a DateTime object with the milliseconds set to a value and the Kind is set to Utc. When I add many of these to the database, I'll have rows with the same time except the milliseconds are different. Some milliseconds have the trail...
2019/07/26
[ "https://Stackoverflow.com/questions/57226469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9516/" ]
Try to use `strftime` function. See [Date And Time Functions](https://www.sqlite.org/lang_datefunc.html). ``` select strftime('%Y-%m-%d %H:%M:%S.%f', '2019-07-26 20:02:38.41Z') select strftime('%Y-%m-%d %H:%M:%S.%f', '2019-07-26 20:02:38.4Z') ``` It returns ``` 2019-07-26 20:02:38.38.410 2019-07-26 20:02:38.38.400 ...
I would suggest storing the dates as ticks, instead of strings, as Magnetron suggested, but if you want to keep the string format, you could manually format your dates into string with something like this: ``` var date = DateTime.UtcNow; string dateString = date.ToString("yyyy-MM-dd hh:mm:ss.fffZ", CultureInfo.Invaria...
48,100,429
I've tried everything, yet strcmp (as well as strncmp) always give a value other than 0, both with and without using pointers, as well as inside and outside functions. What should I do? The point of the program is to create a student data system for signing up and in, as well as managing and sorting said data, the lat...
2018/01/04
[ "https://Stackoverflow.com/questions/48100429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5976239/" ]
First off, you're allocating a lot of arrays in local variables in `main()`. That could lead to a stack overflow. You should probably use `malloc()` to allocate them instead. Second, this line is an assignment, not a comparison, which is a bug: ``` if (succ = 0) ``` Change it to this, if you want it to be a compari...
There are a few issues with your code, as was pointed out, but the reason it doesn't work as you expect is the line: `if(succ = 0)` I changed it to: `if(succ==0)` And it worked as you described. Additionally this line here: `scanf("%s", &LU);` should be `scanf("%s", LU);` The compiler is probably generating a warnin...
9,258,751
I have a french website, the below is my header. ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> ``` I am trying to put...
2012/02/13
[ "https://Stackoverflow.com/questions/9258751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1166361/" ]
> > I am trying to put these charactors ù,é it turns in to � > > > That is a pretty certain indicator that the text you output is not UTF-8 encoded as you say in the header. My guess would be it's ISO-8859-1 encoded. This can be because * The HTML file you are editing isn't UTF-8 encoded. Save it as UTF-8 - the ...
You need to save the html file as UTF-8 format. Also you can add an attribute lang="fr" to your html tag. ``` <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> ```
9,258,751
I have a french website, the below is my header. ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> ``` I am trying to put...
2012/02/13
[ "https://Stackoverflow.com/questions/9258751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1166361/" ]
> > I am trying to put these charactors ù,é it turns in to � > > > That is a pretty certain indicator that the text you output is not UTF-8 encoded as you say in the header. My guess would be it's ISO-8859-1 encoded. This can be because * The HTML file you are editing isn't UTF-8 encoded. Save it as UTF-8 - the ...
You can use the following code in head section ``` <meta http-equiv="encoding" content="text/html" /> ``` I think it will works for you.
34,026,875
I am using vagrant with an ansible playbook to automatically install a bunch of programs on an ubuntu image. One program is failing to install on the vagrant VM. In the `Vagrant` file I have ``` config.vm.provision :ansible do |ansible| ansible.verbose = "vvv" ansible.playbook = "provisioning/playbook.yml" end ``...
2015/12/01
[ "https://Stackoverflow.com/questions/34026875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817379/" ]
You can register to a variable the output of the apt module execution and then print it. ```yaml - hosts: localhost sudo: true tasks: - name: get vi apt: state=latest name=vim register: aptout # show the content of aptout var - debug: var=aptout ```
In the version of ansible I'm using at the moment, `ansible-playbook -v` seems sufficient to get apt output. Admittedly I haven't tested failures. The output is in the form of JSON, which makes it a bit hard to read (as the other answer works around). The Ansible version I tested was 2.3.2.0.
34,026,875
I am using vagrant with an ansible playbook to automatically install a bunch of programs on an ubuntu image. One program is failing to install on the vagrant VM. In the `Vagrant` file I have ``` config.vm.provision :ansible do |ansible| ansible.verbose = "vvv" ansible.playbook = "provisioning/playbook.yml" end ``...
2015/12/01
[ "https://Stackoverflow.com/questions/34026875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817379/" ]
You can register to a variable the output of the apt module execution and then print it. ```yaml - hosts: localhost sudo: true tasks: - name: get vi apt: state=latest name=vim register: aptout # show the content of aptout var - debug: var=aptout ```
You can use directly `stdout_lines`, after registering the output as also shown above, but you must make sure that `apt` did output something, for example, it installed something, otherwise that element is not defined. Here's a possible example: ```yaml - name: Install Gnome Packages become: yes apt: update_ca...
34,026,875
I am using vagrant with an ansible playbook to automatically install a bunch of programs on an ubuntu image. One program is failing to install on the vagrant VM. In the `Vagrant` file I have ``` config.vm.provision :ansible do |ansible| ansible.verbose = "vvv" ansible.playbook = "provisioning/playbook.yml" end ``...
2015/12/01
[ "https://Stackoverflow.com/questions/34026875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817379/" ]
Reproducing the `stdout` of `apt` ================================= Here is how to reproduce the `stdout` of `apt`… ``` --- - name: 'apt: update & upgrade' apt: update_cache: yes cache_valid_time: 3600 upgrade: safe register: apt - debug: msg={{ apt.stdout.split('\n')[:-1] }} ``` …with nice line bre...
In the version of ansible I'm using at the moment, `ansible-playbook -v` seems sufficient to get apt output. Admittedly I haven't tested failures. The output is in the form of JSON, which makes it a bit hard to read (as the other answer works around). The Ansible version I tested was 2.3.2.0.
34,026,875
I am using vagrant with an ansible playbook to automatically install a bunch of programs on an ubuntu image. One program is failing to install on the vagrant VM. In the `Vagrant` file I have ``` config.vm.provision :ansible do |ansible| ansible.verbose = "vvv" ansible.playbook = "provisioning/playbook.yml" end ``...
2015/12/01
[ "https://Stackoverflow.com/questions/34026875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817379/" ]
Reproducing the `stdout` of `apt` ================================= Here is how to reproduce the `stdout` of `apt`… ``` --- - name: 'apt: update & upgrade' apt: update_cache: yes cache_valid_time: 3600 upgrade: safe register: apt - debug: msg={{ apt.stdout.split('\n')[:-1] }} ``` …with nice line bre...
You can use directly `stdout_lines`, after registering the output as also shown above, but you must make sure that `apt` did output something, for example, it installed something, otherwise that element is not defined. Here's a possible example: ```yaml - name: Install Gnome Packages become: yes apt: update_ca...
442,667
I read some very interesting discussions about decoupling microservices on this forum. One of the approaches is to ensure each service holds (parts of) the data of another context to allow it to operate without having a dependency on other services (e.g. REST call to other services). Where does one draw the line while...
2022/12/05
[ "https://softwareengineering.stackexchange.com/questions/442667", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/331862/" ]
When it comes to data warehousing, business analytics or in this case AI/ML analytics (which is a comparable case), the usual strategy is to build snapshots from the production data and store them in a dedicated database or storage system. These snapshots are often retrieved by some ETL process, they are aggregated and...
Here's an example of data you should copy: product prices, when creating an order. Simply put, if I sell thingamajigs for $100 today and you buy one, I would create an order and refer to the product you bought. But tomorrow, I might start selling the thingamajigs for $150. If your order only contained a reference t...
442,667
I read some very interesting discussions about decoupling microservices on this forum. One of the approaches is to ensure each service holds (parts of) the data of another context to allow it to operate without having a dependency on other services (e.g. REST call to other services). Where does one draw the line while...
2022/12/05
[ "https://softwareengineering.stackexchange.com/questions/442667", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/331862/" ]
When it comes to data warehousing, business analytics or in this case AI/ML analytics (which is a comparable case), the usual strategy is to build snapshots from the production data and store them in a dedicated database or storage system. These snapshots are often retrieved by some ETL process, they are aggregated and...
As you suspect, it is best to minimize duplication as much as possible to avoid wasting resources and keep the services decoupled. However, there may be cases where it is necessary to duplicate *some* data to allow a service to operate independently. In the situation you described, it may be necessary for the data pro...
4,114,728
If you use an odd number of terms, $$f\_{4n}(x) = 1 - \frac{x^2}{2!} + ... + \frac{x^{4n}}{(4n)!},$$ this Taylor polynomial $f\_{4n}(x) \geq \cos(x)$. With an even number of terms, $$f\_{4n-2}(x) = 1 - \frac{x^2}{2!} + ... - \frac{x^{4n-2}}{(4n-2)!}$$ the Taylor polynomial $f\_{4n-2}(x) \leq \cos(x).$ **How do we prove...
2021/04/24
[ "https://math.stackexchange.com/questions/4114728", "https://math.stackexchange.com", "https://math.stackexchange.com/users/799898/" ]
A function $f:X\rightarrow Y$ is said to be [surjective](https://en.wikipedia.org/wiki/Surjective_function) if: *For every $y\in Y$ there exists and $x\in X$ such that $f(x)=y$.* We need to show that for every $a+bx+cx^2 \in \mathbb{R}\_3[x]$ for arbitrary $a,b,c \in \mathbb{R}$ that there exists some symmetric matri...
We are to show that every element in $\Bbb R\_3[x]$ can be represented by $T(k)$ for some $k\in S\_2$. That is, for any $p,q,r\in\Bbb R$, there exists functions $f(p,q,r),g(p,q,r),h(p,q,r)$ such that \begin{align}p+qx+rx^2&=T\left(\begin{bmatrix}f&g\\g&h\end{bmatrix}\right)\\&=(f+g+h)+(-f+2h)x+(2f+3g+6h)x^2.\end{align}...
56,914,459
I am using asp.net core 2.2, I have a type which needs to be a singleton *for the intended use case*, however I require *multiple discrete singleton instances* of this same type such that they may be uniquely identifiable and injected where applicable. In other words, for use case *A*, one singleton must be used when ...
2019/07/06
[ "https://Stackoverflow.com/questions/56914459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3536370/" ]
> > What pattern exists that would allow me to perform the above without continuously refactoring the singleton to derive from new narrower interfaces > > > The Factory Pattern would. Instead of injecting your target service, inject a Factory that returns the one the instances of your service. EG ``` interface I...
This required creating a few extra classes and a unit test. The test resolves services from the container and confirms that they were resolved and injected according to the specifications in your question. If we can configure the container so that the test passes, we've succeeded. ``` public interface IServiceA { ...
16,539,158
I have added a custom column to my user profile table that is called CoID (int). When I want to create a new user I want to send the value 1 to CoID, but I am experiencing some trouble and cant get it to work properly. I am using the standard account tables from mvc4. Here are some of my code AccountModel.cs ``` pu...
2013/05/14
[ "https://Stackoverflow.com/questions/16539158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2380907/" ]
**example markup** ``` <select> <option value="http://www.facebook.com">Facebook</option> <option value="http://www.twitter.com">Twitter</option> </select> <input type="text" /> ``` **jquery** ``` $('select').change(function() { $('input[type="text"]').val(this.value); }); ``` ### [Here's a fiddle](h...
**HTML** ``` <select id="network"> <option value="http://www.facebook.com">Facebook</div> <option value="http://www.twitter.com">Twitter</div> </select> <input id="network-txt"/> ``` **Jquery** ``` $("#network").change(function(){ $("#network-txt").val($(this).val()); }); ``` **Working Example** <http...
13,587,646
I have the following table: ``` ---------------------------------------------- |ID|Vote_Item_ID|User_ID|Country_code| Vote| |01| 105102151|user1 | CA| like| |02| 105102151|user2 | CA|dislike| |03| 105102151|user3 | UK|dislike| |04| 105102151|user4 | UK| like| |05| ...
2012/11/27
[ "https://Stackoverflow.com/questions/13587646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1515926/" ]
``` SELECT Country_Code, SUM(CASE WHEN vote = 'like' THEN 1 ELSE 0 END) `like`, SUM(CASE WHEN vote = 'dislike' THEN 1 ELSE 0 END) dislike FROM tableName GROUP BY Country_Code ``` * [SQLFiddle Demo](http://sqlfiddle.com/#!2/d483bb/1) or if you want `PreparedStatement` (*both give the same results*) ...
If you had shown your expected output, that would have been great. Following sample is simple. So let us know what you really need beyond this. Would be happy to pitch in. :) REFERENCE : [SQLFIDDLE](http://sqlfiddle.com/#!2/03da7/8) CODE: ``` SELECT t.country_code, sum(CASE WHEN t.vote = 'like' ...
26,514,646
I tried it with `getElementById` and it worked. But now I want the same with multiple `div`'s so I have to use classes. So I changed the method to `getElementsByClassName` and now it says undefined. (The function is called when a option in a select changes. This works correctly) HTML: ``` <div class="item_content">...
2014/10/22
[ "https://Stackoverflow.com/questions/26514646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4171155/" ]
`getElementsByClassName` returns a collection, so loop that! ``` var titelfilms = document.getElementsByClassName("filmnaam"); for (var i = 0; i < titelfilms.length; i++) { var titels = titelfilms[i].innerHTML; console.log(titels); } ```
`titelfilms` is a node list, you can't get the `innerHTML` of a node list as a whole, it contains multiple references to elements which each have their own individual property. You could loop through and concatenate each `innerHTML` onto a variable, or you could [`map()`](https://developer.mozilla.org/en/docs/Web/Java...
57,427
I'm interested in buying an STM32F4 Discovery from ST Microelectronics. I'm using Mac OS X, 10.8 and would like to use a toolchain including * GCC * OpenOCD for debugging * Eclipse IDE / IntelliJ IDEA Ultimate and this must work on my Mac. Would this setup be possible at all?
2013/02/08
[ "https://electronics.stackexchange.com/questions/57427", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/15299/" ]
It's definitely possible. I haven't tried it yet but I did come across a post I found on hackaday that you might find useful. <http://spin.atomicobject.com/2013/01/18/stm32f4-discovery-toolchain-mac-os-x/> Good luck!
I wrote a tutorial for setting up the STM32F3DISCOVERY on Mac OS X (tested on 10.8 and 10.9) using the GNU ARM toolchain, Eclipse and OpenOCD: <http://www.davidrojas.co.uk/stm32f3discovery-on-mac-os-x-using-eclipse-gcc-arm-and-openocd/> It should work with the STM32F4DISCOVERY too (they are both Cortex-M4, and use the...
10,827,305
At the moment I am researching what the best configuration for Solr is to fit the scope of my application. It involves a lot of testing and I was wondering if I can display what Solr saves as index. I.e. I want to see the tokenized, stemmed, lower cased, etc. version of my documents. Is there any way Solr will provide ...
2012/05/31
[ "https://Stackoverflow.com/questions/10827305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427432/" ]
Have a look at Luke: <http://www.getopt.org/luke/> Solr also has a Luke handler built-in: <https://wiki.apache.org/solr/LukeRequestHandler>
You can use the Solr Analysis which is provided on Solr admin interface. <http://wiki.apache.org/solr/SolrAdminGUI> When on the analysis page, just putting the 'field type' or 'field name' you want the analysis on and put in any field value. Solr Analysis will show you what each Filter/Tokenizer is doing and how exact...
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
You can store the keys in one variable and values in the other, and then use something like ``` if set -l index (contains -i -- foo $keys) # `set` won't modify $status, so this succeeds if `contains` succeeds echo $values[$index] end ``` to retrieve the corresponding value. Other possibilities include alternati...
Here is how I implemented the alternative solution mentioned by @faho I'm using '\_\_' as seperator. ``` function set_field --argument-names dict key value set -g $dict'__'$key $value end function get_field --argument-names dict key eval echo \$$dict'__'$key end ```
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
You can store the keys in one variable and values in the other, and then use something like ``` if set -l index (contains -i -- foo $keys) # `set` won't modify $status, so this succeeds if `contains` succeeds echo $values[$index] end ``` to retrieve the corresponding value. Other possibilities include alternati...
If you wanted to use a single variable with paired key/values, it's possible but as @faho mentioned, it is more complicated. Here's how you could do it: ``` function dict_keys -d "Print keys from a key/value paired list" for idx in (seq 1 2 (count $argv)) echo $argv[$idx] end end function dict_values ...
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
You can store the keys in one variable and values in the other, and then use something like ``` if set -l index (contains -i -- foo $keys) # `set` won't modify $status, so this succeeds if `contains` succeeds echo $values[$index] end ``` to retrieve the corresponding value. Other possibilities include alternati...
I finally needed this for an application, and I'm not super comfortable with fish builtins, so here is an implementation in Lua: <https://gist.github.com/nrnrnr/b302db5c59c600dd75c38d460423cc3d>. This code uses the alternating key/value representation: ``` key1 value1 key2 value2 ... ```
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
You can store the keys in one variable and values in the other, and then use something like ``` if set -l index (contains -i -- foo $keys) # `set` won't modify $status, so this succeeds if `contains` succeeds echo $values[$index] end ``` to retrieve the corresponding value. Other possibilities include alternati...
@faho's answer got me thinking about this and there are a few this I wanted to add. At first I wrote a small set of fish functions (A sort of library, if you will) that dealt with serialization, you would call a `dict` function with a key name, an operation (`get`, `set`, `add` or `del`) and it would use global variab...
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
Here is how I implemented the alternative solution mentioned by @faho I'm using '\_\_' as seperator. ``` function set_field --argument-names dict key value set -g $dict'__'$key $value end function get_field --argument-names dict key eval echo \$$dict'__'$key end ```
If you wanted to use a single variable with paired key/values, it's possible but as @faho mentioned, it is more complicated. Here's how you could do it: ``` function dict_keys -d "Print keys from a key/value paired list" for idx in (seq 1 2 (count $argv)) echo $argv[$idx] end end function dict_values ...
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
Here is how I implemented the alternative solution mentioned by @faho I'm using '\_\_' as seperator. ``` function set_field --argument-names dict key value set -g $dict'__'$key $value end function get_field --argument-names dict key eval echo \$$dict'__'$key end ```
I finally needed this for an application, and I'm not super comfortable with fish builtins, so here is an implementation in Lua: <https://gist.github.com/nrnrnr/b302db5c59c600dd75c38d460423cc3d>. This code uses the alternating key/value representation: ``` key1 value1 key2 value2 ... ```
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
@faho's answer got me thinking about this and there are a few this I wanted to add. At first I wrote a small set of fish functions (A sort of library, if you will) that dealt with serialization, you would call a `dict` function with a key name, an operation (`get`, `set`, `add` or `del`) and it would use global variab...
If you wanted to use a single variable with paired key/values, it's possible but as @faho mentioned, it is more complicated. Here's how you could do it: ``` function dict_keys -d "Print keys from a key/value paired list" for idx in (seq 1 2 (count $argv)) echo $argv[$idx] end end function dict_values ...
40,009,261
I am trying to get the past images as background using ``` <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');"> ``` but it shows blank, i have tried with echo too ``` <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_im...
2016/10/12
[ "https://Stackoverflow.com/questions/40009261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5099094/" ]
@faho's answer got me thinking about this and there are a few this I wanted to add. At first I wrote a small set of fish functions (A sort of library, if you will) that dealt with serialization, you would call a `dict` function with a key name, an operation (`get`, `set`, `add` or `del`) and it would use global variab...
I finally needed this for an application, and I'm not super comfortable with fish builtins, so here is an implementation in Lua: <https://gist.github.com/nrnrnr/b302db5c59c600dd75c38d460423cc3d>. This code uses the alternating key/value representation: ``` key1 value1 key2 value2 ... ```
52,267,295
I am working on a new site, and I am spinning up a new server. I have ran into an issue I never have before. After installing LAMP on the server (Ubuntu 16.04), I am not receiving the default Apache Ubuntu page. I am getting this error: ``` 13.59.41.148 took too long to respond. ``` I have started many servers with ...
2018/09/11
[ "https://Stackoverflow.com/questions/52267295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6427750/" ]
Your instance has a public IP assigned already, the issue is the security groups. Check the default group, you will have ssh port (22) open to 0.0.0.0/0 which means to the entire world as I was able to hit your instance over IP/22. You can use nc utility to check connections[ IP port ] ``` nc -vz 13.59.41.148 22 ``...
Amazon's AWS Solution For those setting up on Amazon's AWS, ensure you are manually typing http:// instead of clicking the default link on their dashboard. I had a similar issue just after installing Apache on Ubuntu 20. I solved the issue by manually typing the address in my browser and ensuring the address had http...
68,432
Let $G=\{x \in \mathbb{R}\mid 0 \leq x < 1 \}$ and for $x,y \in G$ let $x\star y$ be the fractional part of $x+y$ (i.e $x\star y=x+y-\lfloor x+y \rfloor$ where $\lfloor a \rfloor $ is the greatest integer less than or equal to a). Then, how do I prove that $\star$ is a well defined binary operation on $G$ and that $G$ ...
2011/09/29
[ "https://math.stackexchange.com/questions/68432", "https://math.stackexchange.com", "https://math.stackexchange.com/users/13621/" ]
There is no issue of "well-definedness": the elements of $G$ are real numbers, and for every real number $r$, $r-\lfloor r\rfloor$ is a real number that lies in $[0,1)$; thus, $\star$ is a function from $\mathbb{R}\times\mathbb{R}$ to $[0,1)$, and hence by restriction $\star$ is a function from $G\times G$ to $[0,1)\su...
**Hint** $ $ The only difficult part is proving associativity. Denote the fractional part of a real by $\, f(r) = r - \lfloor r\rfloor = r\bmod 1.\,$ Note that $\,x\star y = f(x+y).\,$ CLAIM: $\ f(x+f(y)) = f(x+y)\,$ Proof: let $\,f(y) = r,\ y = r + n,\ n\in \mathbb Z.\,$ The claim is equivalent to $\,f(x+r) = f(x+r...
68,432
Let $G=\{x \in \mathbb{R}\mid 0 \leq x < 1 \}$ and for $x,y \in G$ let $x\star y$ be the fractional part of $x+y$ (i.e $x\star y=x+y-\lfloor x+y \rfloor$ where $\lfloor a \rfloor $ is the greatest integer less than or equal to a). Then, how do I prove that $\star$ is a well defined binary operation on $G$ and that $G$ ...
2011/09/29
[ "https://math.stackexchange.com/questions/68432", "https://math.stackexchange.com", "https://math.stackexchange.com/users/13621/" ]
There is no issue of "well-definedness": the elements of $G$ are real numbers, and for every real number $r$, $r-\lfloor r\rfloor$ is a real number that lies in $[0,1)$; thus, $\star$ is a function from $\mathbb{R}\times\mathbb{R}$ to $[0,1)$, and hence by restriction $\star$ is a function from $G\times G$ to $[0,1)\su...
If in doubt about what well defined means, read the last sentence of page 1 of the textbook. Proof: Let a,b,c∈G. When 0≤a+b<1, then ⌊a+b⌋=0 (see “Identity” section for proof that -0=0). When 1≤a+b<2, then ⌊a+b⌋=1. Thus G is closed under ⋆. The mapping a⋆b ∶ G×G → G is defined for all a,b∈G because G is closed under...
68,432
Let $G=\{x \in \mathbb{R}\mid 0 \leq x < 1 \}$ and for $x,y \in G$ let $x\star y$ be the fractional part of $x+y$ (i.e $x\star y=x+y-\lfloor x+y \rfloor$ where $\lfloor a \rfloor $ is the greatest integer less than or equal to a). Then, how do I prove that $\star$ is a well defined binary operation on $G$ and that $G$ ...
2011/09/29
[ "https://math.stackexchange.com/questions/68432", "https://math.stackexchange.com", "https://math.stackexchange.com/users/13621/" ]
I'm expanding Bill Dubuque's note: Forget about fractional parts for the moment. Call two real numbers $x$, $y$ equivalent if $y-x\in{\mathbb Z}$. Denote the equivalence class of $x\in{\mathbb R}$ by $[x]$ and the set of all equivalence classes by $F$. The definition $$[x]+[y]\ :=\ [x+y]$$ defines addition uniquely on...
**Hint** $ $ The only difficult part is proving associativity. Denote the fractional part of a real by $\, f(r) = r - \lfloor r\rfloor = r\bmod 1.\,$ Note that $\,x\star y = f(x+y).\,$ CLAIM: $\ f(x+f(y)) = f(x+y)\,$ Proof: let $\,f(y) = r,\ y = r + n,\ n\in \mathbb Z.\,$ The claim is equivalent to $\,f(x+r) = f(x+r...
68,432
Let $G=\{x \in \mathbb{R}\mid 0 \leq x < 1 \}$ and for $x,y \in G$ let $x\star y$ be the fractional part of $x+y$ (i.e $x\star y=x+y-\lfloor x+y \rfloor$ where $\lfloor a \rfloor $ is the greatest integer less than or equal to a). Then, how do I prove that $\star$ is a well defined binary operation on $G$ and that $G$ ...
2011/09/29
[ "https://math.stackexchange.com/questions/68432", "https://math.stackexchange.com", "https://math.stackexchange.com/users/13621/" ]
I'm expanding Bill Dubuque's note: Forget about fractional parts for the moment. Call two real numbers $x$, $y$ equivalent if $y-x\in{\mathbb Z}$. Denote the equivalence class of $x\in{\mathbb R}$ by $[x]$ and the set of all equivalence classes by $F$. The definition $$[x]+[y]\ :=\ [x+y]$$ defines addition uniquely on...
If in doubt about what well defined means, read the last sentence of page 1 of the textbook. Proof: Let a,b,c∈G. When 0≤a+b<1, then ⌊a+b⌋=0 (see “Identity” section for proof that -0=0). When 1≤a+b<2, then ⌊a+b⌋=1. Thus G is closed under ⋆. The mapping a⋆b ∶ G×G → G is defined for all a,b∈G because G is closed under...
261,169
For example, there's someone at work that I really don't like, and she's good at her job. She makes me want to work harder and outdo her. Can I say, "She really motivates me"? To me, it sounds a little like she motivates me in a good way when it isn't. Is there another word that I can use? Or can "motivate" be used her...
2020/09/26
[ "https://ell.stackexchange.com/questions/261169", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/109742/" ]
I'm not sure if there's a word that combines annoyance with motivation, although I'm sure someone will post it if there is! But you could just say that *wanting to beat her* motivates you, or something along those lines - it's the competition that inspires you, or the outcome you're looking for. There are words for th...
I feel that having "She" as the subject of the sentence isn't going to work. "She" isn't doing anything, except being there and doing her job. Instead it is "I" who is finding motivation in this situation. It sound like you are competing with her. You want to beat her, you could also use "better" as a verb. > > I'm ...
126,721
When EM radiation with fixed intensity and frequency strikes the metal plate, are the outgoing electrons at higher energy if the plate were charged to some potential than if the plate were simply neutral?
2014/07/16
[ "https://physics.stackexchange.com/questions/126721", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/41250/" ]
If the plate has negative charge, then yes. Freed electrons will be accelerated away from the plate by the electric field, gaining energy above what they acquired from absorbing a photon. If the plate is positively charged, then the opposite occurs- moving against an attractive electric field robs the emitted electro...
No, the electric field applied to the metal plate will only take effect once the electron is ejected from the surface (once it has gotten over the work function of the surface) once it is a free electron and assuming it is in a vacuum only then will the electron be accelerated. In fact this is the principal by which a ...
64,075,733
here is the code: ``` type TypeKey = 'A' | 'B' | 'C' type Types = { [key in TypeKey] : string} let myTypes : Types = { A : 'Apple', B : 'Banna' } ``` this will have an error: ``` error: TS2741 [ERROR]: Property 'C' is missing in type '{ A: string; B: string; }' but required in type 'Types'. ``` How to ma...
2020/09/26
[ "https://Stackoverflow.com/questions/64075733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12972505/" ]
This probably is the variant you are looking for. Both rules capture the actual argument embedded in the requested URL to re-use it in the internally rewritten request. ``` RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [END] RewriteRule ^dl/([^/]+)/?$ dl.p...
In the end, this worked. ``` RewriteEngine On RewriteRule ^dl/(.*) dl.php/$1 [L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule . index.php [L] ``` Now I am able to call the pages like this: /proposal/123abc/ /proposal/dl/...
736,999
I want to copy all the files that **begin with two digits followed by an underscore**. My code below did not copy any files to the `KIRC` folder. ``` cp -R ~/KIRP/[0-9][0-9]_* ~/KIRC/ ``` Example contents of the `KIRP` folder: ``` 11_abc.py 9_efg.R hij_12.csv ``` Expected output: 11\_abc.py 9\_efg.R
2023/02/26
[ "https://unix.stackexchange.com/questions/736999", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/562286/" ]
`9_efg.R` doesn't match that pattern as there's only one digit before the `_`. `11_abc.py` does though. Maybe you tried that from the `fish` shell that doesn't support the `[...]` glob operator. If you want to copy files whose name starts with a number between 0 and 99 followed by `_` regardless of how many digits are...
With `bash`, you can type `cp -R ~/KIRP/[0-9]?([0-9])_* ~/KIRC/`. The extblob option should be set (see `echo $BASHOPTS`). But this would copy files and directories.
736,999
I want to copy all the files that **begin with two digits followed by an underscore**. My code below did not copy any files to the `KIRC` folder. ``` cp -R ~/KIRP/[0-9][0-9]_* ~/KIRC/ ``` Example contents of the `KIRP` folder: ``` 11_abc.py 9_efg.R hij_12.csv ``` Expected output: 11\_abc.py 9\_efg.R
2023/02/26
[ "https://unix.stackexchange.com/questions/736999", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/562286/" ]
`9_efg.R` doesn't match that pattern as there's only one digit before the `_`. `11_abc.py` does though. Maybe you tried that from the `fish` shell that doesn't support the `[...]` glob operator. If you want to copy files whose name starts with a number between 0 and 99 followed by `_` regardless of how many digits are...
If I understand you correctly, you want to copy "files only" from a directory and its (nested) subdirectories into a "flat" directory. That is a job for `find`: ```bash marco@minestrone ~/temp [0] $ ls -lhvF KIRP insgesamt 0 -rw-r----- 1 marco marco 0 Feb 26 18:54 9_efg.R -rw-r----- 1 marco marco 0 Feb 26 18:54 11_ab...
14,885,535
I need to run a sed command like this as part of a shell script ``` sed 's/brad/pitt/g' ``` I am supposed to provide brad as a command line argument and run a command like this ``` sed s/$1/pitt/g ``` While this command is working, what I would like to know is how can I do this command without removing the quote...
2013/02/14
[ "https://Stackoverflow.com/questions/14885535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1529267/" ]
You can `sed "s/$1/pitt/g"` or `sed 's/'$1'/pitt/g'` or, if the command line argument is not a simple word, `sed 's/'"$1"'/pitt/g'`.
There are two ways you can do it: 1) use double quotes ``` sed "s/$1/pitt/g" ``` 2) construct the command as a string and run it with eval ``` SEDCMD="s/$1/pitt/g" eval sed $SEDCMD ``` The eval method works and is very flexible, but is considered dangerous, because it is vulnerable to code injection. If you don...
32,708,869
I have this angular code whereby I have a form and i want upon enter being clicked, it simulates a tab keypress and focuses on the next input. When it gets to the last input, it looks for the button element and then it triggers the ng-submit for the form But for some reasons, angularjs doesnt catch my trigger click fun...
2015/09/22
[ "https://Stackoverflow.com/questions/32708869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809686/" ]
I think this is the correct code. To redirect to same page, ``` header( "Refresh:0"); ``` To redirect to another page, ``` header("Refresh:0; url=yourPage.php"); ```
If you want to redirect user to same page you could simply use ``` header("Location: yourfile.php"); ```
32,708,869
I have this angular code whereby I have a form and i want upon enter being clicked, it simulates a tab keypress and focuses on the next input. When it gets to the last input, it looks for the button element and then it triggers the ng-submit for the form But for some reasons, angularjs doesnt catch my trigger click fun...
2015/09/22
[ "https://Stackoverflow.com/questions/32708869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2809686/" ]
I think this is the correct code. To redirect to same page, ``` header( "Refresh:0"); ``` To redirect to another page, ``` header("Refresh:0; url=yourPage.php"); ```
I've found 2 Ways to refresh a PHP content : **1.Using HTML META :** ``` echo("<meta http-equiv='refresh' content='1'>"); //Refresh by HTTP META ``` **2.Using PHP REFRESH RATE :** ``` //Where 0 is an example of time Delay you can use 5 for 5 seconds for example ! $delay=0; header("Refresh: $delay; url=yourURL.php...
33,535,146
I'm trying to write two separate tokenizes functions in python the first one basically takes in a string and returns a list of tokens such that 1) all tokens are lowercase, (2) all punctuation is kept as separate tokens. The second one does the same thing as the one mentioned above, with the following difference: whe...
2015/11/05
[ "https://Stackoverflow.com/questions/33535146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4468587/" ]
Try: ``` import re def token(text): x=re.findall(r"[\w]+|['(&#@$*.,/)!?;^]", text.lower()) return x def tokenize_with_not(text): result = [] c=0 for t in token(text): if t == 'not': c=2 result.append(t) else: if c>0: result.appen...
You can try this: ``` def token_with(text, t): ret = token(text) for i in range(len(ret)): if ret[i] == t: try: ret[i+1] = '{}_{}'.format(t, ret[i+1]) ret[i+2] = '{}_{}'.format(t, ret[i+2]) except IndexError: pass return ret ...