qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
62,748,320
I'm trying to make a layout that looks like this in java swing: [![enter image description here](https://i.stack.imgur.com/QzfHH.png)](https://i.stack.imgur.com/QzfHH.png) but none of the layout managers provided by swing fit this use case. In android I can simply use a linear layout and set the height of child eleme...
2020/07/06
[ "https://Stackoverflow.com/questions/62748320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12760739/" ]
Here is one way to approach it. [![enter image description here](https://i.stack.imgur.com/UgZXz.png)](https://i.stack.imgur.com/UgZXz.png)
You can use 3rd party library * Swan Layout <https://github.com/idayrus/swan-layout> If you use gradle, add this to build.gradle ``` implementation 'com.github.idayrus:swan-layout:1.01.000' ``` for other build tools, see <https://jitpack.io/#idayrus/swan-layout/1.01.000> Example in Kotlin: ```kotlin val lc = Lin...
19,276
I am using DrawIndexedPrimitives() for drawing a loaded 3D model by drawing each [mesh part](http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.modelmeshpart.aspx), but this process makes my application very slow. This is perhaps because of a very large number of vertex/index buffer data created i...
2011/11/01
[ "https://gamedev.stackexchange.com/questions/19276", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/10885/" ]
Make a single texture atlas by combining all your mesh's textures into one, in any image editing program. Then you'll have to go into your 3D modeling program to set the texture atlas to all the parts of your model, and UV re-map. The re-mapping is not as daunting as you might expect- it'll usually just be a matter of ...
If the entire model uses only one texture, theoretically you can set that texture and draw the model's vertex buffer and index buffer in one call, since the entire model is stored in a single vertex and index buffer. Except, when you load the model the indexes for various mesh parts will not be relative the vertex buf...
166,546
I'm trying to change the font inside of my pstricks code, but I can't change to the font I want to use. I'd rather use another code instead `\usefont`. This is my code: ``` \thispagestyle{empty} \newgeometry{left=0cm,right=0cm,top=0cm,bottom=0cm} \begin{pspicture}(0cm,29.7cm) \newsavebox\IBox \sbox\IBox{\includegraphi...
2014/03/19
[ "https://tex.stackexchange.com/questions/166546", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/48279/" ]
Since I'm not sure what the question is (see queries in comments to original question), I'm obviously not sure if this answers it. However, I hope that it will at least be helpful and perhaps help sharpen the question if nothing else. This example shows how to use two fonts within the picture. The first, Zapf Chancery...
`phv` is the fontname for Helvetica ``` \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{pstricks} \usepackage{helvet} \usepackage{graphicx} \usepackage{geometry} \begin{document} \newgeometry{left=0cm,right=0cm,top=0cm,bottom=0cm} \begin{pspicture}(0cm,29.7cm) \newsavebox\IBox \sbox\IBox{\inc...
14,595,570
Beginner question: I'm working on web application which I will releasing to the world soon. Right now, I'm using AWS free tier to test my application written in Asp.Net Mvc 4. I follow HN and Reddit. I have seen many sites crash or become unresponsive when the submission gets on front page of this site and can't hand...
2013/01/30
[ "https://Stackoverflow.com/questions/14595570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1057297/" ]
You may want to look at some of the options [RightScale](http://rightscale.com) has to offer. They are one of the bigger providers and have a very robust suite of functionality. If you want to roll up the sleeves and get a little more involved, this isn't hard to do directly via the AWS console using [auto scaling gro...
I'm rather new to scaling on EC2s as well (most experience was with dedicated servers) it really depends on your app and how it's built. For one of my projects the app is relatively simple enough that I've created an image of the server and app, and then spin up new servers as needed. All data is stored in rds with rep...
32,683,846
`Date.new` results in `# -4712-01-01`. Just as per the title, what logic am i missing, why start from -4712?
2015/09/20
[ "https://Stackoverflow.com/questions/32683846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3346954/" ]
<https://en.wikipedia.org/wiki/Julian_day> *The Julian Period is a chronological interval of 7980 years beginning 4713 BC. It has been used by historians since its introduction in 1583 to convert between different calendars. 2015 is year 6728 of the current Julian Period. The next Julian Period begins in the year 3268...
The internal representation of a Date or DateTime object is an astronomical Julian date: a fractional number of days since a "time zero" in 4712 BCE. More information are also available in the [Ruby documentation for Date](http://ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#class-Date-label-julian+day+number)....
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
I'm not sure what the minimum required version of Visual Studio is, but in VS2015 you can use ``` Public ReadOnly Property Name As String ``` It is read-only for public access but can be privately modified using `_Name`
If you are using VS2010 or later it is even easier than that ``` Public Property Name as String ``` You get the private properties and Get/Set completely for free! see this blog post: [Scott Gu's Blog](http://weblogs.asp.net/scottgu/automatic-properties-collection-initializers-and-implicit-line-continuation-support...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
I find marking the `property` as `readonly` cleaner than the above answers. I believe vb14 is required. ``` Private _Name As String Public ReadOnly Property Name() As String Get Return _Name End Get End Property ``` This can be condensed to ``` Public ReadOnly Property Name As String ``` <https:/...
If you are using VS2010 or later it is even easier than that ``` Public Property Name as String ``` You get the private properties and Get/Set completely for free! see this blog post: [Scott Gu's Blog](http://weblogs.asp.net/scottgu/automatic-properties-collection-initializers-and-implicit-line-continuation-support...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
Yes, quite straight forward: ``` Private _name As String Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
One additional tweak worth mentioning: I'm not sure if this is a .NET 4.0 or Visual Studio 2010 feature, but if you're using both you don't need to declare the **value** parameter for the setter/mutator block of code: ``` Private _name As String Public Property Name() As String Get Return _name End Ge...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
I'm not sure what the minimum required version of Visual Studio is, but in VS2015 you can use ``` Public ReadOnly Property Name As String ``` It is read-only for public access but can be privately modified using `_Name`
I find marking the `property` as `readonly` cleaner than the above answers. I believe vb14 is required. ``` Private _Name As String Public ReadOnly Property Name() As String Get Return _Name End Get End Property ``` This can be condensed to ``` Public ReadOnly Property Name As String ``` <https:/...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
Yes, quite straight forward: ``` Private _name As String Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
``` Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
Yes, quite straight forward: ``` Private _name As String Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
I'm not sure what the minimum required version of Visual Studio is, but in VS2015 you can use ``` Public ReadOnly Property Name As String ``` It is read-only for public access but can be privately modified using `_Name`
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
``` Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
If you are using VS2010 or later it is even easier than that ``` Public Property Name as String ``` You get the private properties and Get/Set completely for free! see this blog post: [Scott Gu's Blog](http://weblogs.asp.net/scottgu/automatic-properties-collection-initializers-and-implicit-line-continuation-support...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
Yes, quite straight forward: ``` Private _name As String Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
I find marking the `property` as `readonly` cleaner than the above answers. I believe vb14 is required. ``` Private _Name As String Public ReadOnly Property Name() As String Get Return _Name End Get End Property ``` This can be condensed to ``` Public ReadOnly Property Name As String ``` <https:/...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
Yes, quite straight forward: ``` Private _name As String Public Property Name() As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property ```
If you are using VS2010 or later it is even easier than that ``` Public Property Name as String ``` You get the private properties and Get/Set completely for free! see this blog post: [Scott Gu's Blog](http://weblogs.asp.net/scottgu/automatic-properties-collection-initializers-and-implicit-line-continuation-support...
1,462,673
I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private? Otherwise I am thinking I need two properties or a property and a method, just figured this would be cleaner.
2009/09/22
[ "https://Stackoverflow.com/questions/1462673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/151316/" ]
One additional tweak worth mentioning: I'm not sure if this is a .NET 4.0 or Visual Studio 2010 feature, but if you're using both you don't need to declare the **value** parameter for the setter/mutator block of code: ``` Private _name As String Public Property Name() As String Get Return _name End Ge...
If you are using VS2010 or later it is even easier than that ``` Public Property Name as String ``` You get the private properties and Get/Set completely for free! see this blog post: [Scott Gu's Blog](http://weblogs.asp.net/scottgu/automatic-properties-collection-initializers-and-implicit-line-continuation-support...
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
try <http://qt.nokia.com/products/developer-tools> It was written for Qt but it can also be used for plain C++. Furthermore it has great support for CMake (if you are like me and do not like qmake).
I'm very partial to CodeLite. You can use it on Windows and Linux. It has support for Subversion, Qt, and wxWidgets. <http://www.codelite.org/Main/ReadMore>
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
You can use Eclipse IDE for C/C++ Developers. With the subclipse plugin you have accesses to `svn` as well Link: <http://eclipse.org/downloads/moreinfo/c.php>
I use Eclipse with CDT, and SVN integration is very good.
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
I'm all for Eclipse CDT, it rocks. However, you did mention you wanted something more lightweight. A popular Windows and Linux alternative is Code::Blocks (http://www.codeblocks.org/). Its a great open source C/C++ IDE and even comes bundled with MinGW. EDIT: Also has SVN support, according to <http://www.codeblock...
I'm very partial to CodeLite. You can use it on Windows and Linux. It has support for Subversion, Qt, and wxWidgets. <http://www.codelite.org/Main/ReadMore>
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
I use Eclipse with CDT, and SVN integration is very good.
I'm all for Eclipse CDT, it rocks. However, you did mention you wanted something more lightweight. A popular Windows and Linux alternative is Code::Blocks (http://www.codeblocks.org/). Its a great open source C/C++ IDE and even comes bundled with MinGW. EDIT: Also has SVN support, according to <http://www.codeblock...
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
You can use Eclipse IDE for C/C++ Developers. With the subclipse plugin you have accesses to `svn` as well Link: <http://eclipse.org/downloads/moreinfo/c.php>
I'm very partial to CodeLite. You can use it on Windows and Linux. It has support for Subversion, Qt, and wxWidgets. <http://www.codelite.org/Main/ReadMore>
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
You can use Eclipse IDE for C/C++ Developers. With the subclipse plugin you have accesses to `svn` as well Link: <http://eclipse.org/downloads/moreinfo/c.php>
try <http://qt.nokia.com/products/developer-tools> It was written for Qt but it can also be used for plain C++. Furthermore it has great support for CMake (if you are like me and do not like qmake).
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
I use Eclipse with CDT, and SVN integration is very good.
I use Eclipse CDT at our school, the University of Advancing Technology in Tempe AZ. One of our students put together a package that's an all-in-one version of Eclipse CDT (Helios at the moment. Indigo real soon now.) + Subclipse + Boost + cppunit. It is targeted at Windows 7 only. If you wish, you can download this se...
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
You can also try netbeans, most people in my company use it now and they say it's faster than eclipse. I still use eclipse, but since you don't want it you may want to try netbeans with svn plugin.
I use Eclipse CDT at our school, the University of Advancing Technology in Tempe AZ. One of our students put together a package that's an all-in-one version of Eclipse CDT (Helios at the moment. Indigo real soon now.) + Subclipse + Boost + cppunit. It is targeted at Windows 7 only. If you wish, you can download this se...
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
You can use Eclipse IDE for C/C++ Developers. With the subclipse plugin you have accesses to `svn` as well Link: <http://eclipse.org/downloads/moreinfo/c.php>
I use Eclipse CDT at our school, the University of Advancing Technology in Tempe AZ. One of our students put together a package that's an all-in-one version of Eclipse CDT (Helios at the moment. Indigo real soon now.) + Subclipse + Boost + cppunit. It is targeted at Windows 7 only. If you wish, you can download this se...
6,703,840
I would like to compile with `MinGW` on Windows. I am seeking for IDE (Visual Studio 2010 is out, because as far as I know it cannot use `MinGW`) with integrated SVN support like AnkhSVN plugin for Visual Studio 2010. One candidate is `CodeBlocks`. Does it have some SVN plugin? Or would you recommend another IDE? Thank...
2011/07/15
[ "https://Stackoverflow.com/questions/6703840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
I'm all for Eclipse CDT, it rocks. However, you did mention you wanted something more lightweight. A popular Windows and Linux alternative is Code::Blocks (http://www.codeblocks.org/). Its a great open source C/C++ IDE and even comes bundled with MinGW. EDIT: Also has SVN support, according to <http://www.codeblock...
I use Eclipse CDT at our school, the University of Advancing Technology in Tempe AZ. One of our students put together a package that's an all-in-one version of Eclipse CDT (Helios at the moment. Indigo real soon now.) + Subclipse + Boost + cppunit. It is targeted at Windows 7 only. If you wish, you can download this se...
26,179,403
I have some form data and after submitting, a PDF is generated. The problem is size of tables in PDF. If some string in my form is too long the PDF is generated wrongly. It's because the tables. They have static size so if string is too long the table did not accommodate it. I use mPDF library. How can I make this ta...
2014/10/03
[ "https://Stackoverflow.com/questions/26179403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498366/" ]
Here: ``` <tr> <td width="5%">A</td> <td width="95%"><b>'.$a.'</b><br /><br /> '.$_POST['title'].'</td> </tr> ``` Try using a fixed value for table width instead of a percent. something like: ``` <table class="items" width="950" style="font-size: 9pt; border-collapse: collapse;" cellpadding="8"> ``` And see what ...
It is really hard to find the problem, but the answer is simple. table with style="overflow:wrap" after reading the source code: ``` elseif ($table['overflow']=='wrap') ```
26,179,403
I have some form data and after submitting, a PDF is generated. The problem is size of tables in PDF. If some string in my form is too long the PDF is generated wrongly. It's because the tables. They have static size so if string is too long the table did not accommodate it. I use mPDF library. How can I make this ta...
2014/10/03
[ "https://Stackoverflow.com/questions/26179403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498366/" ]
Here: ``` <tr> <td width="5%">A</td> <td width="95%"><b>'.$a.'</b><br /><br /> '.$_POST['title'].'</td> </tr> ``` Try using a fixed value for table width instead of a percent. something like: ``` <table class="items" width="950" style="font-size: 9pt; border-collapse: collapse;" cellpadding="8"> ``` And see what ...
``` <style> table { overflow: wrap; } </style> ```
26,179,403
I have some form data and after submitting, a PDF is generated. The problem is size of tables in PDF. If some string in my form is too long the PDF is generated wrongly. It's because the tables. They have static size so if string is too long the table did not accommodate it. I use mPDF library. How can I make this ta...
2014/10/03
[ "https://Stackoverflow.com/questions/26179403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498366/" ]
It's a late answer but it's worth of answering now. I too faced same problem when a table tr have very big content. I tried the below solution but no luck. > > $mpdf->shrink\_tables\_to\_fit=0; > > > Then I have changed my html structure from table into div, boom it's worked. So now it's working perfectly and the...
It is really hard to find the problem, but the answer is simple. table with style="overflow:wrap" after reading the source code: ``` elseif ($table['overflow']=='wrap') ```
26,179,403
I have some form data and after submitting, a PDF is generated. The problem is size of tables in PDF. If some string in my form is too long the PDF is generated wrongly. It's because the tables. They have static size so if string is too long the table did not accommodate it. I use mPDF library. How can I make this ta...
2014/10/03
[ "https://Stackoverflow.com/questions/26179403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498366/" ]
It's a late answer but it's worth of answering now. I too faced same problem when a table tr have very big content. I tried the below solution but no luck. > > $mpdf->shrink\_tables\_to\_fit=0; > > > Then I have changed my html structure from table into div, boom it's worked. So now it's working perfectly and the...
``` <style> table { overflow: wrap; } </style> ```
48,056,742
I have a script in Laravel platform which process thousands of records , and **it's timing out issue**. I want to avoid update settings on server like php.ini file. Is there any way to chunk all records in small pieces and use them in further processing until all records will be used. I have thousands of records whic...
2018/01/02
[ "https://Stackoverflow.com/questions/48056742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7620562/" ]
i suppose this is the implementation u are looking for ``` b=[0] a=[2,5,7,8,3,5,9] for i in range (len(a)-1): if i-1>=0: u=b[i-1] else: u=0 b_temp=u+a[i] b.append(b_temp) print (b) ``` **Output** ``` [0, 2, 7, 14, 22, 25, 30] ``` The problem with your code was that it if u initial...
Because you set `b=0`, `b` is not a list or dataframe, it's an int. As such, it's not subscriptable. Maybe you want `b=[0]`? (Besides that point, since `i` is 0 for your first iteration, you'll be looking for `b[-1]`, which will in fact work, but probably not for the reason you intend it to).
48,056,742
I have a script in Laravel platform which process thousands of records , and **it's timing out issue**. I want to avoid update settings on server like php.ini file. Is there any way to chunk all records in small pieces and use them in further processing until all records will be used. I have thousands of records whic...
2018/01/02
[ "https://Stackoverflow.com/questions/48056742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7620562/" ]
The error means The object is like lists or dictionaries and not the integer variable Hence it is not subscriptable. So you need to define a list such as b = [ ] And create a variable to store the sum of the variables which you can later append to the list object. for code reference, you can refer this link <https...
Because you set `b=0`, `b` is not a list or dataframe, it's an int. As such, it's not subscriptable. Maybe you want `b=[0]`? (Besides that point, since `i` is 0 for your first iteration, you'll be looking for `b[-1]`, which will in fact work, but probably not for the reason you intend it to).
48,056,742
I have a script in Laravel platform which process thousands of records , and **it's timing out issue**. I want to avoid update settings on server like php.ini file. Is there any way to chunk all records in small pieces and use them in further processing until all records will be used. I have thousands of records whic...
2018/01/02
[ "https://Stackoverflow.com/questions/48056742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7620562/" ]
i suppose this is the implementation u are looking for ``` b=[0] a=[2,5,7,8,3,5,9] for i in range (len(a)-1): if i-1>=0: u=b[i-1] else: u=0 b_temp=u+a[i] b.append(b_temp) print (b) ``` **Output** ``` [0, 2, 7, 14, 22, 25, 30] ``` The problem with your code was that it if u initial...
The error means The object is like lists or dictionaries and not the integer variable Hence it is not subscriptable. So you need to define a list such as b = [ ] And create a variable to store the sum of the variables which you can later append to the list object. for code reference, you can refer this link <https...
125,145
I have a simple setup. An active cube and a passive plane with rigid body physics activated. An empty with wind physics activated and the strengh set to 1000. When I play the animation, nothing happen except for the cube falling on the plane... Did I miss something ? [![](https://blend-exchange.giantcowfilms.com/e...
2018/12/14
[ "https://blender.stackexchange.com/questions/125145", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/53465/" ]
First of all you need to select the inner ring that you created with `I`. You can use `Alt` for it. Then deselect everything that is fine with the circle selection tool (`C`). Then press `X` and select Edge Collapse. Your problems should now be fixed. For that selection part I made a little picture here: [![enter image...
You need to merge the faces at this point in your model. Select two faces and them press Alt-M. Select "To Center". As answered before in the link below. [Getting rid of theses overlapping edges to form a solid shape?](https://blender.stackexchange.com/questions/141305/getting-rid-of-theses-overlapping-edges-to-for...
54,012,918
I do not have much experience with JSP/Servlets and I have searched for an answer regarding my problem but have not found an answer to my question. Lets say I have a file on the back-end, called test.txt, and i want my servlet to stream the file contents to a jsp page dynamically. By dynamically i mean that if the fil...
2019/01/02
[ "https://Stackoverflow.com/questions/54012918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3470766/" ]
Adding in `align-items:center` on the parent container will achieve what you are looking for. The reason why it isn't set by default is to give the user control of its placement. [CSS-Tricks](https://css-tricks.com/snippets/css/complete-guide-grid/) has a really in-depth breakdown of the different ways you can align it...
add `align-items:center;` ```css .dpNav{ width:50%; display:grid; grid-template-columns: repeat(5, 1fr); text-align:center; background:gold; align-items:center; } ``` ```html <div class='dpNav' id='dpNav'> <div class='yearTitle' id='yearTitle'>2019</div> <div class='btnYear' id='btnYear'>&#x267B;</div> <div...
54,012,918
I do not have much experience with JSP/Servlets and I have searched for an answer regarding my problem but have not found an answer to my question. Lets say I have a file on the back-end, called test.txt, and i want my servlet to stream the file contents to a jsp page dynamically. By dynamically i mean that if the fil...
2019/01/02
[ "https://Stackoverflow.com/questions/54012918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3470766/" ]
Adding in `align-items:center` on the parent container will achieve what you are looking for. The reason why it isn't set by default is to give the user control of its placement. [CSS-Tricks](https://css-tricks.com/snippets/css/complete-guide-grid/) has a really in-depth breakdown of the different ways you can align it...
```css .dpNav{ width:50%; display:grid; grid-template-columns: repeat(5, 1fr); text-align:center; vertical-align: middle; background:gold; padding-bottom: 2px } .text { padding-top: 3px; } ``` ```html <div class='dpNav' id='dpNav'> <div class='yearTitle text' id='yearTitle'>2019</div> <div class='btnYe...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could use `SpinWait.SpinUntil` See <https://msdn.microsoft.com/en-us/library/dd449238(v=vs.110).aspx> ``` bool spinUntil = System.Threading.SpinWait.SpinUntil(() => job.IsDisposed, TimeSpan.FromSeconds(5)); ```
You need to use [Thread.Join](http://msdn.microsoft.com/en-us/library/95hbf2ta.aspx). From MSDN, > > Blocks the calling thread until a > thread terminates, while continuing to > perform standard COM and SendMessage > pumping. > > > If you want to wait until a specified time elapses, then use the [Thread.Join (...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You really should not have to use `Sleep()` to wait for tasks to complete. You waste an average of 500ms after the task has completed by doing this. You ought to be able to do this deterministically using Task Parallel Library, see [here](http://msdn.microsoft.com/en-us/library/dd537610.aspx) for example. > > This e...
I prefer the async-Task-approach. Many things copied, but my tested version: ``` async Task<bool> DelayTillCondition(Func<bool> exitCondition, int delayInMs, int timeoutInSec) { bool success = false; int elapsed = 0; while ((!success) && (elapsed < timeoutInSec * 1000)) { await Task.Delay(delay...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could wrap your algorithm in a method: ``` public bool RetryUntilSuccessOrTimeout(Func<bool> task, TimeSpan timeSpan) { bool success = false; int elapsed = 0; while ((!success) && (elapsed < timeSpan.TotalMilliseconds)) { Thread.Sleep(1000); elapsed += 1000; success = task()...
Others have mentioned thread synchronization techniques, which would allow you to wait until some task is finished. However, if you want to continue polling every second like you are doing, you can wrap that method like this: ``` void Main() { Timeout(() => {return false;}); } public void Timeout(Func<bool> actio...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could use `SpinWait.SpinUntil` See <https://msdn.microsoft.com/en-us/library/dd449238(v=vs.110).aspx> ``` bool spinUntil = System.Threading.SpinWait.SpinUntil(() => job.IsDisposed, TimeSpan.FromSeconds(5)); ```
I prefer the async-Task-approach. Many things copied, but my tested version: ``` async Task<bool> DelayTillCondition(Func<bool> exitCondition, int delayInMs, int timeoutInSec) { bool success = false; int elapsed = 0; while ((!success) && (elapsed < timeoutInSec * 1000)) { await Task.Delay(delay...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could use `SpinWait.SpinUntil` See <https://msdn.microsoft.com/en-us/library/dd449238(v=vs.110).aspx> ``` bool spinUntil = System.Threading.SpinWait.SpinUntil(() => job.IsDisposed, TimeSpan.FromSeconds(5)); ```
I don't know that there's any existing thing, but I would think you could create a method to that would accept the timeout and the success-determination function. Something like this: ``` public static bool KeepTrying(int timeout, Func<bool> operation) { bool success = false; int elapsed = 0; while ((!succ...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
The first solution is to use SpinWait ``` SpinWait.SpinUntil(() => LoopProcedure(), 1000); ``` The other solution is to use Task.Wait() ``` var task = Task.Run(() => LoopProcedure()); task.Wait(1000); ``` Wrap your loop into a procedure that return bool value ``` private bool LoopProcedure() { bool success =...
You need to use [Thread.Join](http://msdn.microsoft.com/en-us/library/95hbf2ta.aspx). From MSDN, > > Blocks the calling thread until a > thread terminates, while continuing to > perform standard COM and SendMessage > pumping. > > > If you want to wait until a specified time elapses, then use the [Thread.Join (...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could use `SpinWait.SpinUntil` See <https://msdn.microsoft.com/en-us/library/dd449238(v=vs.110).aspx> ``` bool spinUntil = System.Threading.SpinWait.SpinUntil(() => job.IsDisposed, TimeSpan.FromSeconds(5)); ```
You really should not have to use `Sleep()` to wait for tasks to complete. You waste an average of 500ms after the task has completed by doing this. You ought to be able to do this deterministically using Task Parallel Library, see [here](http://msdn.microsoft.com/en-us/library/dd537610.aspx) for example. > > This e...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could wrap your algorithm in a method: ``` public bool RetryUntilSuccessOrTimeout(Func<bool> task, TimeSpan timeSpan) { bool success = false; int elapsed = 0; while ((!success) && (elapsed < timeSpan.TotalMilliseconds)) { Thread.Sleep(1000); elapsed += 1000; success = task()...
I prefer the async-Task-approach. Many things copied, but my tested version: ``` async Task<bool> DelayTillCondition(Func<bool> exitCondition, int delayInMs, int timeoutInSec) { bool success = false; int elapsed = 0; while ((!success) && (elapsed < timeoutInSec * 1000)) { await Task.Delay(delay...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You could wrap your algorithm in a method: ``` public bool RetryUntilSuccessOrTimeout(Func<bool> task, TimeSpan timeSpan) { bool success = false; int elapsed = 0; while ((!success) && (elapsed < timeSpan.TotalMilliseconds)) { Thread.Sleep(1000); elapsed += 1000; success = task()...
The first solution is to use SpinWait ``` SpinWait.SpinUntil(() => LoopProcedure(), 1000); ``` The other solution is to use Task.Wait() ``` var task = Task.Run(() => LoopProcedure()); task.Wait(1000); ``` Wrap your loop into a procedure that return bool value ``` private bool LoopProcedure() { bool success =...
6,629,219
I commonly employ a while loop that continues to try some operation until either the operation succeeds or a timeout has elapsed: ``` bool success = false int elapsed = 0 while( ( !success ) && ( elapsed < 10000 ) ) { Thread.sleep( 1000 ); elapsed += 1000; success = ... some operation ... } ``` I...
2011/07/08
[ "https://Stackoverflow.com/questions/6629219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356790/" ]
You really should not have to use `Sleep()` to wait for tasks to complete. You waste an average of 500ms after the task has completed by doing this. You ought to be able to do this deterministically using Task Parallel Library, see [here](http://msdn.microsoft.com/en-us/library/dd537610.aspx) for example. > > This e...
I don't know that there's any existing thing, but I would think you could create a method to that would accept the timeout and the success-determination function. Something like this: ``` public static bool KeepTrying(int timeout, Func<bool> operation) { bool success = false; int elapsed = 0; while ((!succ...
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > Or would such an approach be > antithetical to unit testing's > underlying philosophy? > > > Yep...if it is a unit test, it should be able to run on its own. Anytime I have found someone wanting to create dependencies on tests was due to the code being structured in a poor manner. I am not saying this is the...
It looks like what you need is not to prevent the execution of your dependent tests but to report the results of your unit test in a more structured way that allows you to identify when an error in a test cascades onto other failed tests.
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > Or would such an approach be > antithetical to unit testing's > underlying philosophy? > > > Yep...if it is a unit test, it should be able to run on its own. Anytime I have found someone wanting to create dependencies on tests was due to the code being structured in a poor manner. I am not saying this is the...
This seems to be a recurring question - e.g. #3396055 It most probably isn't a unit-test, because they should be fast (and independent). So running them all isn't a big drag. I can see where this might help in short-circuiting integration/regression runs to save time. If this is a major need for you, I'd tag the setup...
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > Or would such an approach be > antithetical to unit testing's > underlying philosophy? > > > Yep...if it is a unit test, it should be able to run on its own. Anytime I have found someone wanting to create dependencies on tests was due to the code being structured in a poor manner. I am not saying this is the...
The test runners py.test, Nosetests and unit2/unittest2 all support the notion of "exiting after the first failure". py.test more generally allows to specify "--maxfail=NUM" to stop running and reporting after NUM failures. This may already help your case especially since maintaining and updating dependencies for tests...
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > Or would such an approach be > antithetical to unit testing's > underlying philosophy? > > > Yep...if it is a unit test, it should be able to run on its own. Anytime I have found someone wanting to create dependencies on tests was due to the code being structured in a poor manner. I am not saying this is the...
> > [Proboscis](https://pythonhosted.org/proboscis/#how-it-works) is a Python test framework that extends Python’s built-in unittest module and Nose with features from TestNG. > > > Sounds like what you're looking for. Note that it works a bit differently to unittest and Nose, but that page explains how it works p...
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
This seems to be a recurring question - e.g. #3396055 It most probably isn't a unit-test, because they should be fast (and independent). So running them all isn't a big drag. I can see where this might help in short-circuiting integration/regression runs to save time. If this is a major need for you, I'd tag the setup...
It looks like what you need is not to prevent the execution of your dependent tests but to report the results of your unit test in a more structured way that allows you to identify when an error in a test cascades onto other failed tests.
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > [Proboscis](https://pythonhosted.org/proboscis/#how-it-works) is a Python test framework that extends Python’s built-in unittest module and Nose with features from TestNG. > > > Sounds like what you're looking for. Note that it works a bit differently to unittest and Nose, but that page explains how it works p...
It looks like what you need is not to prevent the execution of your dependent tests but to report the results of your unit test in a more structured way that allows you to identify when an error in a test cascades onto other failed tests.
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
This seems to be a recurring question - e.g. #3396055 It most probably isn't a unit-test, because they should be fast (and independent). So running them all isn't a big drag. I can see where this might help in short-circuiting integration/regression runs to save time. If this is a major need for you, I'd tag the setup...
The test runners py.test, Nosetests and unit2/unittest2 all support the notion of "exiting after the first failure". py.test more generally allows to specify "--maxfail=NUM" to stop running and reporting after NUM failures. This may already help your case especially since maintaining and updating dependencies for tests...
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > [Proboscis](https://pythonhosted.org/proboscis/#how-it-works) is a Python test framework that extends Python’s built-in unittest module and Nose with features from TestNG. > > > Sounds like what you're looking for. Note that it works a bit differently to unittest and Nose, but that page explains how it works p...
This seems to be a recurring question - e.g. #3396055 It most probably isn't a unit-test, because they should be fast (and independent). So running them all isn't a big drag. I can see where this might help in short-circuiting integration/regression runs to save time. If this is a major need for you, I'd tag the setup...
3,885,489
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
2010/10/07
[ "https://Stackoverflow.com/questions/3885489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192812/" ]
> > [Proboscis](https://pythonhosted.org/proboscis/#how-it-works) is a Python test framework that extends Python’s built-in unittest module and Nose with features from TestNG. > > > Sounds like what you're looking for. Note that it works a bit differently to unittest and Nose, but that page explains how it works p...
The test runners py.test, Nosetests and unit2/unittest2 all support the notion of "exiting after the first failure". py.test more generally allows to specify "--maxfail=NUM" to stop running and reporting after NUM failures. This may already help your case especially since maintaining and updating dependencies for tests...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Pyth, 10 bytes ============== ``` jb_.T.T_.z ``` Try it online in the [Pyth Compiler/Executor](https://pyth.herokuapp.com/?code=jb_.T.T_.z&input=Programming%0APuzzles%0A%26%0ACode%0AGolf&debug=0). ### Idea We can achieve the desired output by applying four simple transformations: 1. Reverse the order of the lines...
J, 17 bytes =========== ``` -.&' '"1&.(|:@|.) ``` Quite pleasant solution. Explanation: ``` -.&' '"1&.(|:@|.) input: list of strings y |. reverse lines |:@ then transpose -.&' '"1 remove blanks from columns &. and undo the inside |:@|. (that is...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Matlab / Octave, 99 bytes ------------------------- ``` function f(s) c=char(strsplit(s,[10 '']));[~,i]=sort(c>32);[m,n]=size(c);c(i+repmat((0:n-1)*m,m,1)) ``` **Example**: Define an input string in a variable, say `s`. `10` is the line feed character: ``` >> s = ['Programming' 10 'Puzzles' 10 '&' 10 'Code' 10 'Go...
[pb](https://esolangs.org/wiki/Pb) - 310 bytes ============================================== ``` ^w[B!0]{w[B=32]{vb[1]^b[0]}>}b[1]vb[1]>b[2]<[X]w[B!2]{t[T+B]b[0]>}b[0]v[T]w[X!-1]{b[1]<}b[1]vb[1]w[B!0]{w[B!0]{^w[B!0]{>}<<<<^[Y+1]w[B!0]{<}>t[B]b[0]w[B!1]{v}v<[X]w[B!0]{>}b[T]}b[0]vb[1]^w[X!0]{<vb[1]^t[B]b[0]^w[B!0]{^}b[...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
SmileBASIC, 90 bytes ==================== ``` X=RND(50)Y=RND(20)G=CHKCHR(X,Y+1)<33LOCATE X,Y+G?CHR$(CHKCHR(X,Y)); LOCATE X,Y?" "*G EXEC. ``` Applies gravity to all text in the console. I'm not sure if this is valid, or if I have to use a string array.
[Julia 0.6](http://julialang.org/), 141 bytes ============================================= ```julia l=length g(z,i)=(n=z[i];m=z[i+1];(N,M)=l.([n,m]);z[i:i+1]=[n[1:min(N,M)],m*n[M+1:N]]) f(s,w=split(s),d=1:l(w)-1)=(g.([w],[d d]);join(w,"\n")) ``` [Try it online!](https://tio.run/##HY0/C8IwEMX3@xSSQe40ClkcWjI5OCnuMYP...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Pyth, 10 bytes ============== ``` jb_.T.T_.z ``` Try it online in the [Pyth Compiler/Executor](https://pyth.herokuapp.com/?code=jb_.T.T_.z&input=Programming%0APuzzles%0A%26%0ACode%0AGolf&debug=0). ### Idea We can achieve the desired output by applying four simple transformations: 1. Reverse the order of the lines...
R, 171 bytes ============ ``` S=scan(,"");while(any((D<-diff(N<-sapply(S,nchar)))<0)){n=max(which(D<0));S[n+1]=paste0(S[n+1],substr(S[n],N[n]+D[n]+1,N[n]));S[n]=substr(S[n],1,N[n]+D[n])};cat(S,sep="\n") ``` With newlines and indentation: ```r S=scan(,"") #Takes input from stdin while(any((D<-diff(N<-sapply(S,nchar)...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
[Jelly](https://github.com/DennisMitchell/jelly), 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) (non-competing) =================================================================================================================================== ``` ỴṚZZṚY ``` [Try it online!](http://jelly.tryitonl...
[pb](https://esolangs.org/wiki/Pb) - 310 bytes ============================================== ``` ^w[B!0]{w[B=32]{vb[1]^b[0]}>}b[1]vb[1]>b[2]<[X]w[B!2]{t[T+B]b[0]>}b[0]v[T]w[X!-1]{b[1]<}b[1]vb[1]w[B!0]{w[B!0]{^w[B!0]{>}<<<<^[Y+1]w[B!0]{<}>t[B]b[0]w[B!1]{v}v<[X]w[B!0]{>}b[T]}b[0]vb[1]^w[X!0]{<vb[1]^t[B]b[0]^w[B!0]{^}b[...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Matlab / Octave, 99 bytes ------------------------- ``` function f(s) c=char(strsplit(s,[10 '']));[~,i]=sort(c>32);[m,n]=size(c);c(i+repmat((0:n-1)*m,m,1)) ``` **Example**: Define an input string in a variable, say `s`. `10` is the line feed character: ``` >> s = ['Programming' 10 'Puzzles' 10 '&' 10 'Code' 10 'Go...
[APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), ~~13~~ 11 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set") ===================================...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Haskell, 62 bytes ================= ``` import Data.List p=reverse;o=transpose f=unlines.p.o.o.p.lines ``` I'm very mature.
[Turtlèd](https://github.com/Destructible-Watermelon/turtl-d/), 72 bytes, noncompeting ====================================================================================== Fairly sure I could change approach to save bytes, but later. :p Non-golf esolang beats regular langs :p The odd thing about Turtlèd is it was ...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
CJam, 11 bytes ============== ``` qN/W%zzW%N* ``` Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=qN%2FW%25zzW%25N*&input=Programming%0APuzzles%0A%26%0ACode%0AGolf). ### How it works The idea in the same as in my [Pyth answer](https://codegolf.stackexchange.com/a/55229). ``` q e# Re...
Perl, 133 bytes --------------- This was one of those challenges that changed in my head from being too hard, to being easy, to being a lot more code than I'd anticipated... I'm not particularly happy with the approach, I'm sure there's a much better way to reduce the `print pop@F...` bit perhaps using `-n` or just pu...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Haskell, 62 bytes ================= ``` import Data.List p=reverse;o=transpose f=unlines.p.o.o.p.lines ``` I'm very mature.
STATA, 323 bytes ---------------- Takes input in a file called a.b Only works for up to 24 characters now. Will update later to make it work with more. Also, doesn't work in the online compiler. Requires the non-free compiler. ``` gl l=24/ forv x=1/$l{ gl a="$a str a`x' `x'" } infix $a using a.b gl b=_N forv k=1/$l{ ...
55,227
Say I have text like this (each word on one line, with no spaces) ``` Programming Puzzles & Code Golf ``` That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: ``` P Prog &uzz Coderam Golflesming ``` So that there is no em...
2015/08/24
[ "https://codegolf.stackexchange.com/questions/55227", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/33183/" ]
Python 2, 104 bytes ------------------- ```python l=[] for x in input().split('\n'):n=len(x);l=[a[:n]+b[n:]for a,b in zip(l+[x],['']+l)] print'\n'.join(l) ``` An iterative one-pass algorithm. We go through each line in order, updating the list `l` of lines to output. The new word effectively pushes from the bottom, ...
JavaScript (ES6), 146 ===================== (The 2 newlines inside template strings are significant and counted) The idea of @Dennis implemented in JavaScript. The lengthy S function do the transposition line by line and char by char, leaving the result in the `t` array. ``` a=>(S=z=>{for(t=[];z.join``;t.push(w))for...
4,430,356
**EDIT TWO** To prevent snarky comments and one-line answers missing the point: *IFF* it is as simple as calling *setDoubleBuffered(true)*, then how do I get access to the current offline buffer so that I can start messing with the BufferedImage's underlying pixel databuffer? I took the time to write a running piece ...
2010/12/13
[ "https://Stackoverflow.com/questions/4430356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/257356/" ]
---- Edited to address per pixel setting ---- The item blow addresses double buffering, but there's also an issue on how to get pixels into a `BufferedImage`. If you call ``` WriteableRaster raster = bi.getRaster() ``` on the `BufferedImage` it will return a `WriteableRaster`. From there you can use ``` int[] pix...
Generally we use Canvas class which is suitable for animation in Java. Anyhoo, following is how you achieve double buffering: ``` class CustomCanvas extends Canvas { private Image dbImage; private Graphics dbg; int x_pos, y_pos; public CustomCanvas () { } public void update (Graphics g) { // initia...
4,430,356
**EDIT TWO** To prevent snarky comments and one-line answers missing the point: *IFF* it is as simple as calling *setDoubleBuffered(true)*, then how do I get access to the current offline buffer so that I can start messing with the BufferedImage's underlying pixel databuffer? I took the time to write a running piece ...
2010/12/13
[ "https://Stackoverflow.com/questions/4430356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/257356/" ]
---- Edited to address per pixel setting ---- The item blow addresses double buffering, but there's also an issue on how to get pixels into a `BufferedImage`. If you call ``` WriteableRaster raster = bi.getRaster() ``` on the `BufferedImage` it will return a `WriteableRaster`. From there you can use ``` int[] pix...
Here's a variation in which all drawing takes place on the [event dispatch thread](http://download.oracle.com/javase/tutorial/uiswing/concurrency/initial.html). Addendum: > > Basically, I need to constantly modify a lot pixels in a `BufferedImage`… > > > This [kinetic model](http://sites.google.com/site/drjohnbm...
4,430,356
**EDIT TWO** To prevent snarky comments and one-line answers missing the point: *IFF* it is as simple as calling *setDoubleBuffered(true)*, then how do I get access to the current offline buffer so that I can start messing with the BufferedImage's underlying pixel databuffer? I took the time to write a running piece ...
2010/12/13
[ "https://Stackoverflow.com/questions/4430356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/257356/" ]
---- Edited to address per pixel setting ---- The item blow addresses double buffering, but there's also an issue on how to get pixels into a `BufferedImage`. If you call ``` WriteableRaster raster = bi.getRaster() ``` on the `BufferedImage` it will return a `WriteableRaster`. From there you can use ``` int[] pix...
What you want is basically impossible in windowed mode with Swing. There is no support for raster synchronization for window repaints, this is only available in fullscreen mode (and even then may not be supported by all platforms). Swing components are double-buffered by default, that is they will do all the rendering...
358,093
Let $f \in C^2\_C(\mathbb{R})$ and $$X\_t = X\_0 + \int\_0^t \sigma(s) \, dB\_s + \int\_0^t b(s) \, ds$$ be an (one-dimensional) Itô process where $\sigma,b: [0,\infty) \times \Omega \to \mathbb{R}$ progressively measurable and pathwise bounded. Let $(\tau\_n)\_n$ be a common localization sequence of $b$, $\sigma$. The...
2013/04/11
[ "https://math.stackexchange.com/questions/358093", "https://math.stackexchange.com", "https://math.stackexchange.com/users/36150/" ]
Actually, the proof is indeed similar to the proof of $(1)$. It's based on the fact that convergence in probability implies almost sure convergence of a subsequence. Set $$\tau\_n := \inf\left\{t \geq 0; \int\_0^t |\sigma(s)|^2 \, ds + \int\_0^t |b(s)|^2 \, ds \geq n \right\}.\tag{4}$$ By Doob's inequality, Itô's is...
So here we assume that $f$ is compactly supported and of $C^2$. I will prove $$P(\sup\_{0\le t \le T} | \int\_0^t f''(X\_s^\Pi) \sigma\_\Pi^2(s)ds - \int\_0^t f''(X\_s)\sigma^2(s)ds|>\epsilon) \to 0.$$ The initial step is identical as in the first case by decomposing into sets of $\tau\_n>T$ and $\tau\_n\le T$. So co...
193,952
I have a SQL Server Database filled with Reports all having the same schema. What I've done is created a .NET application to automate the process of adding all reports to a new table. How can the code be modified to increase performance? Is there a better approach then using: `conn.Close(); dr.Close(); conn.Open();` ...
2018/05/08
[ "https://codereview.stackexchange.com/questions/193952", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/169225/" ]
### `arr.forEach` I would consider using a simple `for` loop to iterate over the `elArr` (perhaps consider a bit better name, like `elementsArray` or just `elements`). [This StackOverflow post](https://stackoverflow.com/a/43032526/3626537) goes over some of the benefits of doing this. You can also use the `disabled` ...
That's not a toggle =================== * Toggle has a very specific meaning and comes with the benefit of not having to supply the new state when called. Your function is not a toggle and should be called something along the lines of `setFormDisableState(formElements, disable = true)` or `setFormState(formElements, d...
32,639,628
How do I store the `window.innerWidth` value and calculate the difference with the new value on resize? ``` var w; function example { var onResize = function () { w = {width: window.innerWidth || document.body.clientWidth }; if (difference of old width and this (new) width is 100) { // then do some stuff } wi...
2015/09/17
[ "https://Stackoverflow.com/questions/32639628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5208406/" ]
Just start out by using some better names and an extra variable as a placeholder. Also, I am adding a scope to your shown code so that `w` or `width` does not get used outside of this snippet. ``` (function(){ //create a closed scope to prevent naming collision //store the previous value for the width...
Store the current width as `oldWidth`. In `resize` listener check if current width differs form `oldWidth` by 100px (or more). If it does, then do some stuff and update the `oldWidth` with current value. ``` var oldWidth = window.innerWidth; var onResize = function () { var w = window.innerWidth; if ( Math.abs( w...
32,639,628
How do I store the `window.innerWidth` value and calculate the difference with the new value on resize? ``` var w; function example { var onResize = function () { w = {width: window.innerWidth || document.body.clientWidth }; if (difference of old width and this (new) width is 100) { // then do some stuff } wi...
2015/09/17
[ "https://Stackoverflow.com/questions/32639628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5208406/" ]
Store the current width as `oldWidth`. In `resize` listener check if current width differs form `oldWidth` by 100px (or more). If it does, then do some stuff and update the `oldWidth` with current value. ``` var oldWidth = window.innerWidth; var onResize = function () { var w = window.innerWidth; if ( Math.abs( w...
Try the following. But be aware - "resize" events are sent periodically as the user resizes the window. This code will have the effect of detecting resizes that occur instantaneously (minimize, maximize) or very quickly - faster than 100px per render tick. If you want the *eventual* size of the final resize, once the u...
32,639,628
How do I store the `window.innerWidth` value and calculate the difference with the new value on resize? ``` var w; function example { var onResize = function () { w = {width: window.innerWidth || document.body.clientWidth }; if (difference of old width and this (new) width is 100) { // then do some stuff } wi...
2015/09/17
[ "https://Stackoverflow.com/questions/32639628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5208406/" ]
Just start out by using some better names and an extra variable as a placeholder. Also, I am adding a scope to your shown code so that `w` or `width` does not get used outside of this snippet. ``` (function(){ //create a closed scope to prevent naming collision //store the previous value for the width...
Try the following. But be aware - "resize" events are sent periodically as the user resizes the window. This code will have the effect of detecting resizes that occur instantaneously (minimize, maximize) or very quickly - faster than 100px per render tick. If you want the *eventual* size of the final resize, once the u...
42,314
Is there a PNG viewer that can display text chunk metadata? Ideally, I'd like a way to view arbitrary chunks.
2012/07/04
[ "https://unix.stackexchange.com/questions/42314", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/20553/" ]
Found a partial solution, the [pngcheck](http://www.libpng.org/pub/png/apps/pngcheck.html) tool can print text chunks although it wont display the image. ``` pngcheck -c -v -t foobar.png ``` These are the relevant options for showing PNG chunks: ``` -7 print contents of tEXt chunks, escape chars >=128 (for 7-bit t...
The ImageMagick "display" program will do it. Display the image with **display *filename*.png**, hold the right button to bring up the menu, select **Image info**, and scroll down.
25,791,606
I have a type that can be define as a vector of vector of vector ... of vector of an integral type. Example: ``` std::vector<std::vector<std::vector<std::vector< std::vector<signed char> > > > > _data; ``` I'm searching for an elegant way to determine the number of non-empty vector at the deeper level. I could do th...
2014/09/11
[ "https://Stackoverflow.com/questions/25791606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2509081/" ]
Maybe Something like that ? (it uses `std::enable_if` so it's a C++11 answer, but maybe you can use the boost one instead). ``` template <typename T, typename U> typename std::enable_if<std::is_same<typename U::value_type,T>::value,std::size_t>::type non_empties(const U& r) { return !r.empty(); } template <typena...
You can do pattern matching to count depthness ``` template <typename Base> struct NestedVectors //non vector match { static const size_t depth=0; static size_t count_empty(const Base& b) { throw std::string("cant be here"); } }; template <class Rv> struct NestedVectors<std::vector<Rv> > { stat...
25,791,606
I have a type that can be define as a vector of vector of vector ... of vector of an integral type. Example: ``` std::vector<std::vector<std::vector<std::vector< std::vector<signed char> > > > > _data; ``` I'm searching for an elegant way to determine the number of non-empty vector at the deeper level. I could do th...
2014/09/11
[ "https://Stackoverflow.com/questions/25791606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2509081/" ]
Here's a C++98 solution using nothing more than basic template specialization: ``` template<typename T> struct VectorCounter { /* no count method: this is an error */ }; template<typename U> struct VectorCounter<vector<U> > { static int count(const vector<U> &v) { return (int)v.empty(); } }; temp...
Maybe Something like that ? (it uses `std::enable_if` so it's a C++11 answer, but maybe you can use the boost one instead). ``` template <typename T, typename U> typename std::enable_if<std::is_same<typename U::value_type,T>::value,std::size_t>::type non_empties(const U& r) { return !r.empty(); } template <typena...
25,791,606
I have a type that can be define as a vector of vector of vector ... of vector of an integral type. Example: ``` std::vector<std::vector<std::vector<std::vector< std::vector<signed char> > > > > _data; ``` I'm searching for an elegant way to determine the number of non-empty vector at the deeper level. I could do th...
2014/09/11
[ "https://Stackoverflow.com/questions/25791606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2509081/" ]
Here's a C++98 solution using nothing more than basic template specialization: ``` template<typename T> struct VectorCounter { /* no count method: this is an error */ }; template<typename U> struct VectorCounter<vector<U> > { static int count(const vector<U> &v) { return (int)v.empty(); } }; temp...
You can do pattern matching to count depthness ``` template <typename Base> struct NestedVectors //non vector match { static const size_t depth=0; static size_t count_empty(const Base& b) { throw std::string("cant be here"); } }; template <class Rv> struct NestedVectors<std::vector<Rv> > { stat...
66,987,801
I have a record in my table: [![enter image description here](https://i.stack.imgur.com/3U3TU.png)](https://i.stack.imgur.com/3U3TU.png) What I need is to create a column with order state: '1' if order was created, '0' if order was cancelled. So for this example, when there was both creation and cancellation I need ...
2021/04/07
[ "https://Stackoverflow.com/questions/66987801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11324687/" ]
I think you can simply do a UNION like this: ``` select OrderCreateDate, OrderCancelDate, ReportDate, 1 as OrderState from your_table where orderCreateDate is not null union all select OrderCreateDate, OrderCancelDate, ReportDate, 0 as OrderState from your_table where orderCancelDate is not null ```
One way to do this is to join your table multiple times with a constraint on the join to limit your result set; this is an easy way to pivot your data, but it can affect performance. ``` DECLARE @a TABLE (id INT, createdate date,canceldate date,reportdate DATE) INSERT INTO @a (id, createdate, canceldate, reportdate) ...
66,987,801
I have a record in my table: [![enter image description here](https://i.stack.imgur.com/3U3TU.png)](https://i.stack.imgur.com/3U3TU.png) What I need is to create a column with order state: '1' if order was created, '0' if order was cancelled. So for this example, when there was both creation and cancellation I need ...
2021/04/07
[ "https://Stackoverflow.com/questions/66987801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11324687/" ]
One way to do this is to join your table multiple times with a constraint on the join to limit your result set; this is an easy way to pivot your data, but it can affect performance. ``` DECLARE @a TABLE (id INT, createdate date,canceldate date,reportdate DATE) INSERT INTO @a (id, createdate, canceldate, reportdate) ...
Join to the table a query that returns the values `1` and `0`: ``` SELECT t.*, s.OrderState FROM tablename AS t INNER JOIN (SELECT 1 AS OrderState UNION ALL SELECT 0) AS s ON (s.OrderState = 1 AND t.OrderCreateDate IS NOT NULL) OR (s.OrderState = 0 AND t.OrderCancelDate IS NOT NULL) ```
66,987,801
I have a record in my table: [![enter image description here](https://i.stack.imgur.com/3U3TU.png)](https://i.stack.imgur.com/3U3TU.png) What I need is to create a column with order state: '1' if order was created, '0' if order was cancelled. So for this example, when there was both creation and cancellation I need ...
2021/04/07
[ "https://Stackoverflow.com/questions/66987801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11324687/" ]
I think you can simply do a UNION like this: ``` select OrderCreateDate, OrderCancelDate, ReportDate, 1 as OrderState from your_table where orderCreateDate is not null union all select OrderCreateDate, OrderCancelDate, ReportDate, 0 as OrderState from your_table where orderCancelDate is not null ```
Join to the table a query that returns the values `1` and `0`: ``` SELECT t.*, s.OrderState FROM tablename AS t INNER JOIN (SELECT 1 AS OrderState UNION ALL SELECT 0) AS s ON (s.OrderState = 1 AND t.OrderCreateDate IS NOT NULL) OR (s.OrderState = 0 AND t.OrderCancelDate IS NOT NULL) ```
58,823
I have to figure out how the CMIS support in SP2013 foundation does work out. And everything I find says that it is natively supported. But the site feature 'Content Management Interoperability Services (CMIS) Producer' does not exist. So I downloaded and installed the trial version of SP2013 Standard Edition and there...
2013/02/05
[ "https://sharepoint.stackexchange.com/questions/58823", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/14657/" ]
Called Microsoft support and there is definitely no CMIS producer in SP2013 Foundation (but in Server Standard / Enterprise). The agent also clarified that there is no difference in editon features between SP2010 and SP2013 (no CMIS Producer in SP2010 Foundation = no CMIS Producer in SP2013 Foundation). Thanks Arsalan...
Swarley, The article you have given on the top-right corner says: > > Applies to: > > SharePoint Foundation 2013, > SharePoint Server 2013 Enterprise, > SharePoint Server 2013 Standard > > > So the feature list is for all.. and AFAIK, till now there isn't any list that gives the feature difference betw...
10,431,473
Some of my company consultants created multiple jasper reports (using iReports) which will be filled up programmatically using a Custom JRDataSource. The problem is that I need to know which Elements are present in the report so that I can invoke the corresponding WebServices, so my question is: *How can I programmati...
2012/05/03
[ "https://Stackoverflow.com/questions/10431473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902782/" ]
First think of the purpose of the screenshot. You might be able to log the order of objects inside the folder before and after sorting them. Then you can use your logdata to produce an textual or graphical output showing a folder like image with the contents in presorted order. If you take a screenshot how do you hand...
You can't take a snapshot of something that isn't drawn on the screen. You need to open the folder, take the snapshot and close the folder.
10,431,473
Some of my company consultants created multiple jasper reports (using iReports) which will be filled up programmatically using a Custom JRDataSource. The problem is that I need to know which Elements are present in the report so that I can invoke the corresponding WebServices, so my question is: *How can I programmati...
2012/05/03
[ "https://Stackoverflow.com/questions/10431473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902782/" ]
Depends on what you actually want to do, if your intent is to check the contents of the "folder" and "subfolders" before and after the sort operation, I will suggest you use the command prompt to generate the list of contents in a text file. you can use the dir command for this like so: ``` DIR /S /B "Path\To\Folder" ...
You can't take a snapshot of something that isn't drawn on the screen. You need to open the folder, take the snapshot and close the folder.
10,431,473
Some of my company consultants created multiple jasper reports (using iReports) which will be filled up programmatically using a Custom JRDataSource. The problem is that I need to know which Elements are present in the report so that I can invoke the corresponding WebServices, so my question is: *How can I programmati...
2012/05/03
[ "https://Stackoverflow.com/questions/10431473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902782/" ]
First think of the purpose of the screenshot. You might be able to log the order of objects inside the folder before and after sorting them. Then you can use your logdata to produce an textual or graphical output showing a folder like image with the contents in presorted order. If you take a screenshot how do you hand...
You could position the folder window outside of the bounds of his/her screen. Then take a screenshot of that window region. You can determine the screen width and height and position (if you position a second screen to the left of your primary screen you start position of your screen is negative) using the following c...
10,431,473
Some of my company consultants created multiple jasper reports (using iReports) which will be filled up programmatically using a Custom JRDataSource. The problem is that I need to know which Elements are present in the report so that I can invoke the corresponding WebServices, so my question is: *How can I programmati...
2012/05/03
[ "https://Stackoverflow.com/questions/10431473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902782/" ]
Depends on what you actually want to do, if your intent is to check the contents of the "folder" and "subfolders" before and after the sort operation, I will suggest you use the command prompt to generate the list of contents in a text file. you can use the dir command for this like so: ``` DIR /S /B "Path\To\Folder" ...
You could position the folder window outside of the bounds of his/her screen. Then take a screenshot of that window region. You can determine the screen width and height and position (if you position a second screen to the left of your primary screen you start position of your screen is negative) using the following c...
6,456,716
I am 100% new to python, I know I need to read more but I need to do this task right now that's why I am using python for it. Here is my code: ``` outputList = [] for line in open('cron.log', 'r'): m = line[45:47] outputList.append(m) ``` So I opened the file, read through lines, and append the 2 chars I need...
2011/06/23
[ "https://Stackoverflow.com/questions/6456716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/801807/" ]
``` #This is from the beginning for i in range(1, len(outputList)): # == could be what ever comparison you want. Any one in particular? if outputList[i] == outputList[i-1]: #do whatever you need to do ```
Also you can use something like this: ``` a = [1, 2, 3, 4, 5, 6, 7, 8] # proceed backward for x,y in ((a[i],a[i-1]) for i in xrange(len(a)-1,0,-1)): if x!= y: # do something ```
6,456,716
I am 100% new to python, I know I need to read more but I need to do this task right now that's why I am using python for it. Here is my code: ``` outputList = [] for line in open('cron.log', 'r'): m = line[45:47] outputList.append(m) ``` So I opened the file, read through lines, and append the 2 chars I need...
2011/06/23
[ "https://Stackoverflow.com/questions/6456716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/801807/" ]
``` #This is from the beginning for i in range(1, len(outputList)): # == could be what ever comparison you want. Any one in particular? if outputList[i] == outputList[i-1]: #do whatever you need to do ```
``` outputList = [line[45:47] for line in open('cron.log', 'r')] for idx, item in enumerate(outputList[:-1]): if item == outputList[idx+1]: # do something ```
4,282,720
I tried searching but couldn't find a function which can create a shape by calculating difference of two NSBezier Paths or two CGPaths. Is there a function that can establish this in cocoa ? Thanks.
2010/11/26
[ "https://Stackoverflow.com/questions/4282720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125571/" ]
See "[Winding Rules](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaDrawingGuide/Paths/Paths.html)" with NSBezierPath. You'll make a compound path by appending your two source paths to it. The resulting shape will depend upon the winding rule you set.
Finally did it by creating a bigger tracking area to enclose the whole shape and then tracking mouse moved events inside this tracking area.
139,042
is there a command line utility for changing the color label of files in macosx?
2010/05/08
[ "https://superuser.com/questions/139042", "https://superuser.com", "https://superuser.com/users/-1/" ]
You can write it yourself. Open `/Applications/Utilities/AppleScript Editor.app` and enter the following: ``` on run argv tell application "Finder" set theFile to POSIX file (item 1 of argv) as alias set labelIdx to (item 2 of argv as number) set label index of theFile to labelIdx end t...
This article, [View and set Labels from the command line](http://www.macosxhints.com/article.php?story=20031030221241557), describes a command line utility to do it. Caveat: it's an old article, describing a utility for OS 10.3, and I haven't tried it myself.
139,042
is there a command line utility for changing the color label of files in macosx?
2010/05/08
[ "https://superuser.com/questions/139042", "https://superuser.com", "https://superuser.com/users/-1/" ]
You can write it yourself. Open `/Applications/Utilities/AppleScript Editor.app` and enter the following: ``` on run argv tell application "Finder" set theFile to POSIX file (item 1 of argv) as alias set labelIdx to (item 2 of argv as number) set label index of theFile to labelIdx end t...
Based on the responses here and in referenced posts, I made the following function and added it to my ~/.bash\_profile file: ``` # Set Finder label color label(){ if [ $# -lt 2 ]; then echo "USAGE: label [0-7] file1 [file2] ..." echo "Sets the Finder label (color) for files" echo "Default colors:" ec...
14,018
I am building a medium-sized printer which needs to produce super-precise parts at a moderately fast print time. I frankly don't want to deal with belts or their tension issues but on the other hand, having ball screws on each axis will increase inertia...right?. I'm using Rexroth rails and will use (depending on what ...
2020/07/05
[ "https://3dprinting.stackexchange.com/questions/14018", "https://3dprinting.stackexchange.com", "https://3dprinting.stackexchange.com/users/21785/" ]
The size of the nozzle usually isn't the main factor for how close you can put nozzles together. To keep the filament drive gear system from being the limiting factor, you would need Bowden extruders. "Then, the heat sinks and fans would be your limiting factor. Have you considered a single nozzle with three extruders?...
One of the thinnest hotends I've seen are those from a Chinese factory Mellow Store, the heatsink is smaller than the top flange to mount the hotend. I don't know the quality of these hotends, the image below shows the basic layouts of available options: [![Mellow Store custom hotend](https://i.stack.imgur.com/MsvUL.j...
648,710
Every one know solutions of the Diophatine equation $x^2+y^2=z^2$ which are given by formula $x=t(a^2-b^2)$, $y=t(2ab)$ and $z=t(a^2+b^2)$. In this exemple one proove that all the solutions are in this form. My question is (Question 0): does all the solvable Diophantine equations have a unique complete description? I...
2014/01/23
[ "https://math.stackexchange.com/questions/648710", "https://math.stackexchange.com", "https://math.stackexchange.com/users/51400/" ]
Even an equation as simple as, $$x^2+dy^2 = z^n\tag{1}$$ already becomes tricky once we go $n>2$. We can solve (1) for any positive integer $n$ as, $$(x+y\sqrt{-d})\,(x-y\sqrt{-d})=(p+q\sqrt{-d})^n\,(p-q\sqrt{-d})^n$$ equating factors, and solving for $x,y$. This method (after scaling) gives the complete solution f...
It is even worse than that. [Matiyasevitch's solution](http://en.wikipedia.org/wiki/Yuri_Matiyasevich) to [Hilbert's tenth problem](http://en.wikipedia.org/wiki/Hilbert%27s_tenth_problem) showed there are Diophantine equations which we can't decide whether they have solutions or not.
55,784,275
I can't seem to get media queries to work - at least for the one relevant style which needs to work - `padding` for the `table-wrapper` class. The padding set inline always wins. 1. I believe I need to have `!important` set for the media query so I do have that. 2. Media queries are at the top of the html 3. This is a...
2019/04/21
[ "https://Stackoverflow.com/questions/55784275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5453649/" ]
Your code is at the class level, but it needs to be inside a method. At the class level you are defining what the object *is*, but in the methods you define what it *does*. The logical operations it performs, etc. Simply put your code inside a method: ``` public partial class Form1 : Form { public Form1() { ...
So continuing with what David commented on, you could just add a Button to your form and Double Click it to create the stub handler. From there you could display the return value in a Label, for instance: ``` public partial class Form1 : Form { public Form1() { InitializeComponent(); } Pet ca...
15,203,131
I am trying to pass the value stored in the function argument to the PHP page using data, however Ajax always executes the error section generating the popup - alert. The code is attached below. Any suggestions. thanks in advance ``` function clickonaccept(contentid) { $.ajax ({ type: 'POST', ...
2013/03/04
[ "https://Stackoverflow.com/questions/15203131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2131970/" ]
This is a bit of a hacky answer, but it works: ``` ##Define breaks co2$brks<- cut(co2$rank, c(seq(0, 100, 5), max(co2$rank))) #Create a plot object: g = ggplot(data=co2, aes(x = tons, fill=brks)) + geom_dotplot(stackgroups = TRUE, binwidth = 0.05, method = "histodot") ``` Now we manually specify the colours to us...
I just needed to add ``` + scale_fill_brewer(palette="RdYlBu") ``` See below: ``` library(reshape2) library(ggplot2) co2 <- read.table( header=TRUE, text=' rank tons 1 2 1.00 2 4 1.00 3 7 0.00 4 44 0.00 5 104 0.00 6 48 0.05 7 32 0.50 8 5 0.00 9 78 1.00 10 12 0.00 11 15 0.00 12 ...
60,713,550
Hi i am new to javascript and having some trouble. I need my function to take the user input "recserv" and multiply it by the value of the selected radio button, as well as update if the value is changed or the radio button is changed. Changing the radio buttons seems to work, but I get an error when the "recserv" v...
2020/03/16
[ "https://Stackoverflow.com/questions/60713550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13072950/" ]
simply this... ```js document.getElementById('my-form').addEventListener('input', function () { this.result.textContent = parseFloat(this.recserv.value) * parseInt(this.service.value) }) ``` ```html <form id="my-form" onsubmit="return false"> <p>Select the frequency</p> <input type="radio" name="service" va...
yeartot method has a parameter and when you use yeartot() in onchange property of input cause undefined value in service parameter.undefined value is not a number and take error.
60,713,550
Hi i am new to javascript and having some trouble. I need my function to take the user input "recserv" and multiply it by the value of the selected radio button, as well as update if the value is changed or the radio button is changed. Changing the radio buttons seems to work, but I get an error when the "recserv" v...
2020/03/16
[ "https://Stackoverflow.com/questions/60713550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13072950/" ]
The reason why you are getting `NaN` is because in your `#recserv` element's inline JS, you are not passing any value into the function when calling it. Therefore, you are multiplying with `undefined` which gives you a `NaN` value. A quick fix to your issue will simply be letting the method itself retrieve the checked...
yeartot method has a parameter and when you use yeartot() in onchange property of input cause undefined value in service parameter.undefined value is not a number and take error.
60,713,550
Hi i am new to javascript and having some trouble. I need my function to take the user input "recserv" and multiply it by the value of the selected radio button, as well as update if the value is changed or the radio button is changed. Changing the radio buttons seems to work, but I get an error when the "recserv" v...
2020/03/16
[ "https://Stackoverflow.com/questions/60713550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13072950/" ]
```js const setup = () => { const serviceInputs = document.querySelectorAll('input[name="service"]'); serviceInputs.forEach(e => e.addEventListener('click', yeartot)); const recserv = document.querySelector('#recserv'); recserv.addEventListener('change', yeartot); } const yeartot = (service) => { con...
yeartot method has a parameter and when you use yeartot() in onchange property of input cause undefined value in service parameter.undefined value is not a number and take error.
60,713,550
Hi i am new to javascript and having some trouble. I need my function to take the user input "recserv" and multiply it by the value of the selected radio button, as well as update if the value is changed or the radio button is changed. Changing the radio buttons seems to work, but I get an error when the "recserv" v...
2020/03/16
[ "https://Stackoverflow.com/questions/60713550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13072950/" ]
simply this... ```js document.getElementById('my-form').addEventListener('input', function () { this.result.textContent = parseFloat(this.recserv.value) * parseInt(this.service.value) }) ``` ```html <form id="my-form" onsubmit="return false"> <p>Select the frequency</p> <input type="radio" name="service" va...
> > Change your script into this > > > ``` <script> const input = document.getElementById("recserv"); const result = document.getElementById("result"); function yeartot(service) { const checkedService = document.querySelector(":checked"); var recserv = Number(document.getElementBy...
60,713,550
Hi i am new to javascript and having some trouble. I need my function to take the user input "recserv" and multiply it by the value of the selected radio button, as well as update if the value is changed or the radio button is changed. Changing the radio buttons seems to work, but I get an error when the "recserv" v...
2020/03/16
[ "https://Stackoverflow.com/questions/60713550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13072950/" ]
The reason why you are getting `NaN` is because in your `#recserv` element's inline JS, you are not passing any value into the function when calling it. Therefore, you are multiplying with `undefined` which gives you a `NaN` value. A quick fix to your issue will simply be letting the method itself retrieve the checked...
> > Change your script into this > > > ``` <script> const input = document.getElementById("recserv"); const result = document.getElementById("result"); function yeartot(service) { const checkedService = document.querySelector(":checked"); var recserv = Number(document.getElementBy...
60,713,550
Hi i am new to javascript and having some trouble. I need my function to take the user input "recserv" and multiply it by the value of the selected radio button, as well as update if the value is changed or the radio button is changed. Changing the radio buttons seems to work, but I get an error when the "recserv" v...
2020/03/16
[ "https://Stackoverflow.com/questions/60713550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13072950/" ]
```js const setup = () => { const serviceInputs = document.querySelectorAll('input[name="service"]'); serviceInputs.forEach(e => e.addEventListener('click', yeartot)); const recserv = document.querySelector('#recserv'); recserv.addEventListener('change', yeartot); } const yeartot = (service) => { con...
> > Change your script into this > > > ``` <script> const input = document.getElementById("recserv"); const result = document.getElementById("result"); function yeartot(service) { const checkedService = document.querySelector(":checked"); var recserv = Number(document.getElementBy...
8,793,020
``` #include <iostream> #include <getopt.h> #define no_argument 0 #define required_argument 1 #define optional_argument 2 int main(int argc, char * argv[]) { std::cout << "Hello" << std::endl; const struct option longopts[] = { {"version", no_argument, 0, 'v'}, {"help", no_argument, ...
2012/01/09
[ "https://Stackoverflow.com/questions/8793020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745835/" ]
Your getopt\_long call specifies "svh" for the short options when it should say "s:vh". The colon tells getopt to require an argument for "s".
I'm pretty sure you need to replace "svh" with "s:vh". Per the Linux man page for getopt\_long "optstring is a string containing the legitimate option characters. If such a character is followed by a colon, the option requires an argument,".