Search is not available for this dataset
qid
int64
1
74.7M
question
stringlengths
1
70k
date
stringlengths
10
10
metadata
sequencelengths
3
3
response_j
stringlengths
0
115k
response_k
stringlengths
0
60.5k
score_j
int64
0
14
score_k
int64
-1
10
269,810
I like to have the first row in table make with `tcolorbox` with `tabularx` option with different color as it is in the other rows. I try to use `\rowcolor{<color>}`, but i received error: Misplaced \noalign. If I add `\\` before `\rowcolor{...}`, error disappear, however as expected, new empty row is introduced... Is this a bug or do I miss something ? MwE, which show the problem is bellow. ``` \documentclass[border=5mm, preview]{standalone} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[dvipsnames,svgnames,table]{xcolor} \usepackage{makecell,tabularx} \newcolumntype{L}{>{\raggedright\arraybackslash}X} \usepackage[many]{tcolorbox} \newtcolorbox{tctabularx}[1]{% enhanced, fonttitle=\sffamily\bfseries, fontupper=\small\sffamily, arc=0mm, colback=yellow!10!white, colframe=red!50!black, #1 }% end tctabularx \begin{document} \begin{tctabularx}{tabularx={L|L}} \rowcolor{yellow!30!white} \thead{FIR} & \thead{IIR} \\ \hline končni impulzni odziv $h[n]$ & neskončni impulzni odziv $h[n]$ \\ \hline sistemska funkcija je polinom & sistemska funkcija je racionalna\newline (ulomek dveh polinomov) \\ \hline zahtevnejša izvedba & manj zahtevna izvedba \\ \end{tctabularx} \end{document} ```
2015/09/27
[ "https://tex.stackexchange.com/questions/269810", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/18189/" ]
Try the `before upper app={\rowcolor{yellow!30!white}` key -- code which is introduced before the first line of `tabularx` is shipped out. (See section 18.1 'hooks' of the current (3.72) manual of `tcolorbox`) ``` \documentclass[border=5mm, preview]{standalone} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[dvipsnames,svgnames,table]{xcolor} \usepackage{makecell,tabularx} \newcolumntype{L}{>{\raggedright\arraybackslash}X} \usepackage[many]{tcolorbox} \newtcolorbox{tctabularx}[1]{% enhanced, fonttitle=\sffamily\bfseries, fontupper=\small\sffamily, arc=0mm, colback=yellow!10!white, colframe=red!50!black, #1,before upper app={\rowcolor{yellow!30!white}} }% end tctabularx \begin{document} \begin{tctabularx}{tabularx={L|L}} \thead{FIR} & \thead{IIR} \\ \hline končni impulzni odziv $h[n]$ & neskončni impulzni odziv $h[n]$ \\ \hline sistemska funkcija je polinom & sistemska funkcija je racionalna\newline (ulomek dveh polinomov) \\ \hline zahtevnejša izvedba & manj zahtevna izvedba \\ \end{tctabularx} \end{document} ``` [![enter image description here](https://i.stack.imgur.com/yALRQ.jpg)](https://i.stack.imgur.com/yALRQ.jpg)
[![enter image description here](https://i.stack.imgur.com/YFCdm.jpg)](https://i.stack.imgur.com/YFCdm.jpg) ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage[dvipsnames,svgnames,table]{xcolor} \usepackage{makecell,tabularx} \newcolumntype{L}{>{\raggedright\arraybackslash}X} \usepackage[many]{tcolorbox} \newtcolorbox{tctabularx}[1]{% enhanced, fonttitle=\sffamily\bfseries, fontupper=\small\sffamily, arc=0mm, colback=yellow!10!white, colframe=red!50!black, #1 }% end tctabularx \begin{document} \begin{tctabularx}{tabularx={L|L}} \cellcolor{yellow!30!white} \thead{FIR} & \cellcolor{yellow!30!white} \thead{IIR} \\ \hline končni impulzni odziv $h[n]$ & neskončni impulzni odziv $h[n]$ \\ \hline sistemska funkcija je polinom & sistemska funkcija je racionalna\newline (ulomek dveh polinomov) \\ \hline zahtevnejša izvedba & manj zahtevna izvedba \\ \end{tctabularx} \end{document} ``` You would use `\cellcolor` instead in this case. This is because `tcolorbox`es are considered to be more like cells rather than multi-cells (row).
4
3
1,942,360
hello everyone it is me again! i've got few problems too. i am deveoping an training software that's why i am asking lots of questions.i hope you help me. thanks in advance. my problems are as follows: **First of all:** i have a register window that has a combobox. i have binded it an access datasource. the problem is when i select an item, it doesnt select. it writes System.data.Datarow.(i want it list names like mike,susan ect.) **how can i fix it?** where is the problem? ``` public Register() { this.InitializeComponent(); Select(); } public void Select() { DataView view; OleDbConnection con = new OleDbConnection(connectionstring); con.Open(); string sql = "Select * from UserInformation"; OleDbCommand cmd = new OleDbCommand(sql, con); OleDbDataAdapter da = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "UserInformation"); view = ds.Tables[0].DefaultView; RegCombo.ItemsSource = view; con.Close(); } ``` XAML Code: ``` <ComboBox IsSynchronizedWithCurrentItem="True" Margin="0,22.447,46.92,0" SelectedItem="{Binding Path=UserName}" VerticalAlignment="Top" Height="29" Grid.Column="3" Grid.Row="1" IsEditable="True" IsDropDownOpen="False" MaxDropDownHeight="266.666666666667" FontSize="16" x:Name="RegCombo" FontWeight="Normal" > <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=UserName}"></TextBlock> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> ```
2009/12/21
[ "https://Stackoverflow.com/questions/1942360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/232103/" ]
You'll need to set the [DisplayMemberPath](http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.displaymemberpath.aspx) on your ComboBox to be the property on the underlying object you want to see in the `ItemsControl` If this is not specified, and you have not overridden the `ToString()` method on that object, you will just see (what you are now seeing) - the qualified name of the object.
Try this Binding="{Binding RelativeSource={RelativeSource Self}, Path=UserName}"
2
0
31,091,744
``` regex= '<th scope="row" width="48%">52wk Range:</th><td class="yfnc_tabledata1"><span>(.+?)</span> - <span>(.+?)</span></td>' pattern = re.compile(regex) LBUB = re.findall(pattern,htmltext) ``` I am trying to do basic data scraping in Python and perform some calculations on the returned real numbers. I have shown a small extract from the program so you can get the basic idea. I want it to read a html file and return certain numbers. The issue is that the real numbers are returned within a string variable like this... ``` [('90.77', '134.54')] ``` I want to extract the numbers from the variable so that they can be used as separate float variable. Does anybody know how to extract the two real numbers from within the string variable, basically getting rid of the ')], This is in Python 2.7.10
2015/06/27
[ "https://Stackoverflow.com/questions/31091744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056562/" ]
if you are getting the array then you could just use the Float() function and put the array index in. for example: ``` StrFloats = [("90.77","134.54")] FltNewNums = {} IntInd = 0 for IntX in range(0,len(StrFloats)): for IntY in range(0,len(StrFloats[IntX])): FltNewNums[IntInd] = float(StrFloats[IntX][IntY]) IntInd += 1 ``` then you have the float variable in an array i had to make a few changes. forgot about the tuple :/ this should work :)
This looks like the job for [map](https://docs.python.org/2/library/functions.html#map) ``` list(map(lambda t: (float(t[0]), float(t[1])), LBUB)) ``` To avoid TypeError while casting to float you can use narrower capturing groups. Something like: ``` (\d+\.\d+) ``` **Anyway**, parsing HTML with regular expressions is generally [not a good idea](http://blog.codinghorror.com/parsing-html-the-cthulhu-way/).
2
0
9,349,067
This is a simple listener: ``` $("#target").keypress(function(event) { alert("test"); }); ``` I want to take separate function out but it won't work: ``` $("#target").keypress(doAlert(event)); function doAlert(event) { alert("test"); } ``` What am I missing?
2012/02/19
[ "https://Stackoverflow.com/questions/9349067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/720943/" ]
You want: ``` $("#target").keypress(doAlert); ``` Your original: ``` $("#target").keypress(doAlert(event)); ``` ...***calls*** the `doAlert` function and passes its return value into `keypress`, just like any other function call. You want to give `keypress` a *reference* to the `doAlert` function, you don't want to give it `doAlert`'s return value. (If `doAlert` created and returned an event handler function you might do that, but that's not what you've written.)
It won't work because with `doAlert(event)` you are **calling** *the function right away*. Remember in JS, you *call* functions by putting `()` after there names, that's what you are doing there which won't work because `keypress` needs **callback**, which runs after `keypress` handler is finished. So, you should have: ``` $("#target").keypress(doAlert); ```
3
0
38,478,319
I have data grid with some text columns and default value of all text column is 1. Also, i am using a button named 'save' which saves the values of text columns of data grid. My requirement is 'Save' button should only be enabled when value of text columns of data grid changes.Please help me. Below is my code:- ``` View:- x:Name="datagrid_range_targets" local:SetMinWidthToAutoAttachedBehaviour.SetMinWidthToAuto="true" ItemsSource="{Binding RangeData, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" Margin="0,5,5,0" Loaded="OnUserControlLoaded" Unloaded="OnUserControlUnloaded" Style="{StaticResource style_data_grid}"> <DataGrid.Resources> <Style x:Key="errorStyle" TargetType="{x:Type TextBox}"> <Setter Property="Padding" Value="-2"/> <Style.Triggers> <Trigger Property="Validation.HasError" Value="True"> <Setter Property="Background" Value="Red"/> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> </Style> </DataGrid.Resources> <DataGrid.Columns> <DataGridTextColumn x:Name="col_range_targets_range" Width="Auto" Binding="{Binding Name}" Header="Range" IsReadOnly="True" /> <DataGridTextColumn x:Name="col_budget_report_year1" Width="Auto" Header="Year 01" EditingElementStyle="{StaticResource errorStyle}"> <DataGridTextColumn.Binding> <Binding Path="budgetReportYear1" Mode="TwoWay" > <Binding.ValidationRules> <local:GreaterThanOrEqualLessThanOrEqual Max="99" Min=".0000001" /> </Binding.ValidationRules> </Binding> </DataGridTextColumn.Binding> </DataGridTextColumn> <DataGridTextColumn x:Name="col_budget_report_year2" Width="Auto" Header="Year 02" EditingElementStyle="{StaticResource errorStyle}"> <DataGridTextColumn.Binding> <Binding Path="budgetReportYear2" Mode="TwoWay" UpdateSourceTrigger="Default"> <Binding.ValidationRules> <local:GreaterThanOrEqualLessThanOrEqual Max="99" Min="0.0000001" /> </Binding.ValidationRules> </Binding> </DataGridTextColumn.Binding> </DataGridTextColumn> <Button x:Name="Save" Click="btn_Set_mulutiplier_Click" Content="Set multiplier" Style="{StaticResource button_SetMultiplier}" /> View Model- private double _budgetReportYear1 = 1; private double _budgetReportYear2 = 1; public double budgetReportYear1 { get { return _budgetReportYear1; } set { _budgetReportYear1 = value; Onchanged("budgetReportYear1"); } } public double budgetReportYear2 { get { return _budgetReportYear2; } set { _budgetReportYear2 = value; Onchanged("budgetReportYear2"); } } ```
2016/07/20
[ "https://Stackoverflow.com/questions/38478319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6613053/" ]
I found the passage you're talking about: > 4.5.1 JMP Instruction > > > The JMP instruction causes an unconditional transfer to a destination, identified by a code label that is translated by the assembler into an offset. The syntax is > > > JMP destination > > > When the CPU executes an unconditional transfer, **the offset of destination is moved into the instruction pointer**, causing execution to continue at the new location. Your confusion is understandable; this is poorly explained. --- First of all, if an instruction says `jmp destination`, then it will set the instruction pointer equal to `destination`. You're right about that. But the instruction behavior is being confused with the instruction *encoding*. --- Instructions of the form `jmp address` are encoded using **relative offsets** in x86. The offsets are relative to the address *immediately following* the `jmp` instruction. This can be encoded either as an `EB` followed by a signed byte offset or an `E9` followed by a signed dword offset. (Integers are [little endian](https://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Data/endian.html) in x86) For example, ``` 00010000: EB 01 CC 90 ``` Disassembles to ``` loc_10000: jmp loc_10003 ; EB 01 int3 ; CC loc_10003: nop ; 90 ``` And ``` 00010000: E9 01 00 00 00 CC 90 ``` Disassembles to ``` loc_10000: jmp loc_10006 ; E9 01 00 00 00 int3 ; CC loc_10006: nop ; 90 ``` Note that this means instructions written the same way may have different encodings when located at different addresses. For example, ``` 00010000: EB 02 EB 00 CC EB FD EB FB ``` Disassembles to ``` loc_10000: jmp loc_10004 ; EB 02 jmp loc_10004 ; EB 00 loc_10004: int3 ; CC jmp loc_10004 ; EB FD (FD == -3) jmp loc_10004 ; EB FB (FB == -5) ``` Side note: There are several different forms of the `jmp` instruction, but the type you are speaking of can only be encoded with a relative offset. --- Anyway, what the author is saying is that, for an assembler to generate machine code for an instruction like `jmp destination`, it must convert `destination` to a byte offset relative to the end of the `jmp` instruction. Most of the time, you don't need to worry about this process, however. You can just define a label in your assembly and write `jmp my_label`, and the assembler will take care of everything for you.
consider this fake machine ``` address: bytes: comment: 0x0004 01 20 00 ; jmp destination ; here ip = 0x0004 0x0007 ?? repeated 0x19 times destination: 0x0020 02 ; hlt ; here ip = 0x0020 ``` compiled from this source: ``` .code org 0x0004 jmp destination org 0x0020 destination: hlt ``` So the symbol `destination` here means absolute address `0x0020` in section `.code` (which I won't give any special meaning, but you can imagine whatever complex construction as you wish, for example see segment registers in 16b mode of x86). Then if the instruction with code 0x01 `jmp` is "near", only offset of that absolute address is used, which is 0x0020 in this simple fake example. You can still have other variants of `jmp` on your CPU, like "relative" 0x03 `jmp rel8` capable to jump -128..+127 bytes from current `ip`, or "far" 0x04 `jmp bank/segment:offset`, which would set not only `ip`, but also some banking/segment mechanism. So that word "offset" points to an era of `segment:offset` addressing, where full instruction pointer on x86 is `cs:ip`, not just `ip`. (cs = code segment) In modern 32/64b x86 OS you usually don't have to touch `cs`, and work only with offsets inside 32/64b flat virtual memory mapping, then "address" has the same meaning as "offset of address".
3
1
53,775,000
From 2018-12-14 to 2018/12/14??? I usually miss one day when i send date(datepicker(momentjs)) ``` startDate: moment().toDate(), // how to format('YYYY/MM/DD')??? ```
2018/12/14
[ "https://Stackoverflow.com/questions/53775000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10789553/" ]
startDate = "2018-12-14"; momentDate = moment(startDate ,'YYYY/MM/DD') If you know the exact format you can put it here .
``` Import moment from 'moment'; let date = 2018-12-14; let resultDate=moment(date).format('YYYY/MM/DD'); ``` Result: resultDate: 2018/12/14
1
0
53,775,000
From 2018-12-14 to 2018/12/14??? I usually miss one day when i send date(datepicker(momentjs)) ``` startDate: moment().toDate(), // how to format('YYYY/MM/DD')??? ```
2018/12/14
[ "https://Stackoverflow.com/questions/53775000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10789553/" ]
``` moment().format("YYYY/MM/DD"); // if you want to convert current date moment(startDate).format("YYYY/MM/DD"); // if you want to convert given date ```
startDate = "2018-12-14"; momentDate = moment(startDate ,'YYYY/MM/DD') If you know the exact format you can put it here .
2
1
53,775,000
From 2018-12-14 to 2018/12/14??? I usually miss one day when i send date(datepicker(momentjs)) ``` startDate: moment().toDate(), // how to format('YYYY/MM/DD')??? ```
2018/12/14
[ "https://Stackoverflow.com/questions/53775000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10789553/" ]
``` moment().format("YYYY/MM/DD"); // if you want to convert current date moment(startDate).format("YYYY/MM/DD"); // if you want to convert given date ```
You can just replace `-` to `/` if you have it already formatted but from the example, you gave us it appears that you don't know how to format date at all. So if you really want to do it with `moment` you've got 2 approaches. 1. If you already have formatted startDate and want to reformat it ```js const reformattedStartDate = moment(startDate).format('YYYY/MM/DD'); ``` 2. If you are creating new startDate with proper format ```js const startDate = moment().format('YYYY/MM/DD'); ```
2
0
53,775,000
From 2018-12-14 to 2018/12/14??? I usually miss one day when i send date(datepicker(momentjs)) ``` startDate: moment().toDate(), // how to format('YYYY/MM/DD')??? ```
2018/12/14
[ "https://Stackoverflow.com/questions/53775000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10789553/" ]
startDate = "2018-12-14"; momentDate = moment(startDate ,'YYYY/MM/DD') If you know the exact format you can put it here .
Use format: Data: "createdAt": "2022-04-04T18:56:36Z", ``` import { format } from "date-fns"; {format(new Date(reserve.createdAt), "dd/MM/yyyy HH:mm:ss")} ``` Result: 04/04/2022 18:56:36 Just be careful with MM and mm, MM is for month and mm is for minute
1
0
53,775,000
From 2018-12-14 to 2018/12/14??? I usually miss one day when i send date(datepicker(momentjs)) ``` startDate: moment().toDate(), // how to format('YYYY/MM/DD')??? ```
2018/12/14
[ "https://Stackoverflow.com/questions/53775000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10789553/" ]
``` moment().format("YYYY/MM/DD"); // if you want to convert current date moment(startDate).format("YYYY/MM/DD"); // if you want to convert given date ```
Use format: Data: "createdAt": "2022-04-04T18:56:36Z", ``` import { format } from "date-fns"; {format(new Date(reserve.createdAt), "dd/MM/yyyy HH:mm:ss")} ``` Result: 04/04/2022 18:56:36 Just be careful with MM and mm, MM is for month and mm is for minute
2
0
28,148,096
Here is some code that calls static method A.f() on class that is not initialized yet. Can someone explain behavior of this code in terms of JLS? ``` class A { final static Object b = new B(); final static int S1 = 1; final static Integer S2 = 2; static void f() { System.out.println(S1); System.out.println(S2); } } class B { static { A.f(); } } public class App { public static void main( String[] args ) { A.f(); } } ``` Output: ``` 1 null 1 2 ```
2015/01/26
[ "https://Stackoverflow.com/questions/28148096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1445898/" ]
`A.f()` in `App.main()` triggers initialization of class `A`. All constant variables are initialized. The only constant variable is `S1`, which now is `1`. Then, the other static fields are initialized in textual order. `b` is the first field, which triggers initialization of class `B`, which in turn calls `A.f()`. `S2` is simply `null` because it is not initialized yet. Initialization of `b` is now complete. Last but not least, `S2` is initialized to the `Integer` object `2`. `S2` is not a constant variable because it is not of the primitive type `int` but of the reference type `Integer`. `S2 = 2;` is an auto-boxing shorthand for `S2 = Integer.valueOf(2);`. > If a declarator in a field declaration has a variable initializer, then the declarator has the semantics of an assignment (§15.26) to the declared variable. > > > […] > > > Note that `static` fields that are constant variables (§4.12.4) are initialized before other `static` fields (§12.4.2). This also applies in interfaces (§9.3.1). Such fields will never be observed to have their default initial values (§4.12.5), even by devious programs. [8.3.2. Field Initialization](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.3.2) > A *constant variable* is a `final` variable of primitive type or type `String` that is initialized with a constant expression (§15.28). Whether a variable is a constant variable or not may have implications with respect to class initialization (§12.4.1), binary compatibility (§13.1, §13.4.9), and definite assignment (§16 (Definite Assignment)). [4.12.4. `final` Variables](http://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.12.4) > A *constant expression* is an expression denoting a value of primitive type or a `String` that does not complete abruptly and is composed using only the following: > > > * Literals of primitive type and literals of type `String` > > > […] [15.28. Constant Expressions](http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.28) > For each class or interface C, there is a unique initialization lock `LC`. The mapping from C to `LC` is left to the discretion of the Java Virtual Machine implementation. The procedure for initializing C is then as follows: > > > […] > > > 6. Otherwise, record the fact that initialization of the `Class` object for C is in progress by the current thread, and release `LC`. > > > Then, initialize the `static` fields of C which are constant variables (§4.12.4, §8.3.2, §9.3.1). > > > […] > > > 9. Next, execute either the class variable initializers and static initializers of the class, or the field initializers of the interface, in textual order, as though they were a single block. [12.4.2. Detailed Initialization Procedure](http://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.4.2) > Every variable in a program must have a value before its value is used: > > > * Each class variable, instance variable, or array component is initialized with a default value when it is created (§15.9, §15.10.2): > > > […] > > > + For all reference types (§4.3), the default value is `null`. [4.12.5. Initial Values of Variables](http://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.12.5)
It seems that this issue doesn't belong to `JLS`, but we have deal with `JVMS`. On `Linking` stage before `resolution` process there is [Preparation](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.4.2) substage, which involves: > creating the static fields for a class or interface and initializing > such fields to their default values and more: > explicit initializers for static fields are executed as part of > initialization (§5.5), not preparation while [initialization](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.5) includes: > The execution of any one of the Java Virtual Machine instructions new Initializing of primitive types includes writing their initial value. For reference type fields their default value is `null` because before [Resolution](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.4.3) substage jvm doesn't "know" which class is associated to apropriate symbolic reference name of a class.
6
2
47,663,204
This is a piece of code from which I am trying to obtain data. ``` <p>ul. Niecała 10</p> <p>05-800 Pruszków</p> </div> ``` I did it this way: ``` address = result.find('div', attrs={'class': 'section address'}).get_text() ``` Unfortunately, the result does not satisfy me. The texts from the paragraphs are stuck together. I would like these paragraphs to be separated by a comma. Now: ``` ul. Niecała 1005-800 Pruszków ``` I would like it to be: ``` ul. Niecała 10, 05-800 Pruszków ``` How do I do that? Do you have any suggestions?
2017/12/05
[ "https://Stackoverflow.com/questions/47663204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8867842/" ]
@a\_horse\_with\_no\_name is correct, you can try the below code to find empty rows in columns of a particular table. ``` SET SERVEROUTPUT ON DECLARE l_sql VARCHAR2(4000); n_nulls NUMBER; BEGIN FOR i IN ( SELECT column_name FROM all_tab_columns WHERE table_name = 'my_table' ) LOOP l_sql := ' SELECT SUM (CASE WHEN ' || i.column_name || ' IS NULL THEN 1 ELSE 0 END) FROM my_table WHERE ' || i.column_name || ' IS NULL'; EXECUTE IMMEDIATE l_sql INTO n_nulls; dbms_output.put_line('NUMBER OF NULLS IN' || i.column_name || ' IS ' || n_nulls); END LOOP; END; / ```
``` (CASE WHEN I IS NULL THEN 1 ELSE 0 END) ``` should be ``` (CASE WHEN I.COLUMN_NAME IS NULL THEN 1 ELSE 0 END) ``` Same issue here: ``` DBMS_OUTPUT.PUT_LINE ('NUMBER OF NULLS IN'|| I ||' IS ' || N_NULLS); ```
3
0
11,525,186
I'm developing an Android 2.3.3 application with Java. This app is an iOS code with unsigned data types port to Java. On iOS it works with `UInt16` and `UInt8`. In one case instead using `byte[]` I'm using `char[]`. But know I have to send that `char[]` as a `byte[]` using a [DatagramPacket](http://developer.android.com/reference/java/net/DatagramPacket.html). If one element of char[] is 128, how can I do to insert into byte[] and the receiver gets 128. I don't know what happens if I do this: ``` char c = (char)128; byte b = (byte)c; ``` Which will be `b` value? 128 = 10000000. b = -1 or b = 127? How can I convert `char[]` to `byte[]` without losing any **bits**?
2012/07/17
[ "https://Stackoverflow.com/questions/11525186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68571/" ]
In Java `char` is an unsigned 16-bit quantity. So you can directly convert your `uint16` to `char` without doing anything else. For unsigned 8-bit quantity you have 2 options: 1. Use `byte`. It also holds 8 bits. You don't lose any bits just because it is signed. However, if you do arithmetic with it you need to remember that Java will scale `byte` up automatically to an `int` and sign-extend it. To prevent this just always mask it like this: byte b; int foo = 5 \* (b & 0xFF); 2. Use `char`. It is unsigned and can hold 16 bits so the 8 bits will fit in there quite nicely. To put a `byte` into a `char` just do this: byte b; char c = (char)(b & 0xFF); // Mask off the low-order 8 bits To put a `char` into a `byte` just do: ``` char c; byte b = (byte)c; // Truncates to 8 bits ``` Be aware that `byte` in Java is signed, so that whenever you do arithmetic with it you need to mask the low-order 8 bits only (to prevent sign-extension). Like this: ``` byte b; int foo = (b & 0xFF); ``` You can do all the normal bitwise operations you want with a byte without having to mask: ``` byte b; if (b & 0x80) ... // Test a flag b |= 0x40; // Set a flag b ^= 0x20; // Flip a flag from 0 to 1 or 1 to 0 b ^= ~0x10; // Clear a flag byte x = b << 3; // Shift left 3 bits and assign byte x = b >>> 4; // Shift right 4 bits and assign (WITHOUT sign extension) ```
I think you need to rethink your approach so you don't end up needing to convert `char[]` to `byte[]`. If your data really is characters, then you want to look at various serialization techniques, such as using [`new String(char[])`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#String%28char%5B%5D%29) to create a string and then using [`getBytes(Charset)`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#getBytes%28java.nio.charset.Charset%29) to get the bytes as encoded by a given [`Charset`](http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html) (because, of course, the same characters result in different bytes when encoded in ASCII or UTF-8 or UTF-16, etc.). But from your question, it sounds like you're not really using characters, you're just using `char` as a 16-bit type. If so, doing the conversion isn't difficult, something along these lines: ``` byte[] toBytes(char[] chars) { byte[] bytes = new byte[chars.length * 2]; int ci, bi; char ch; bi = 0; for (ci = 0; ci < chars.length; ++ci) { ch = chars[ci]; bytes[bi++] = (byte)((ch & 0xFF00) >> 8); bytes[bi++] = (byte)(ch & 0x00FF); } return bytes; } ``` Reverse the masks if you want the result to be small-endian instead. But again, I would look at your overall approach and try to avoid this.
4
2
268,337
I tend to answer questions related to specific plugins (see questions related to [`parsley.js`](https://stackoverflow.com/questions/tagged/parsley.js), which is a jQuery plugin). More often than not, the OP simply adds the tag of the plugin. However, if she/he adds code to the question, or if I add code to my answer, there will be no syntax highlighting. It pains me to read code without syntax highlighting and sometimes you can spot the mistake simply by reading code. Most times I edit the question and add the `[javascript]` tag, but I have seen some users reject my edit with the message: > This edit is too minor; suggested edits should be substantive improvements addressing multiple issues in the post. I understand that simply editing the tags is an easy way to gain those extra two reputation points, but it really helps anyone who visits the site. What is your opinion on this?
2014/08/11
[ "https://meta.stackoverflow.com/questions/268337", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/908174/" ]
I would approve any correct edit that added a language-related tag, such as `[javascript]`. Simply by adding that tag, you ensure the question is seen by those people who can answer it. I would encourage you to make your edits more substantive than that if possible, but I wouldn't reject it if you didn't. If you simply added syntax highlighting with a markdown hint: ``` <!-- language: javascript --> ``` I may well reject that as too minor if it were your only change. Prettifying code is not really a good enough reason to bring three edit reviewers into the debate.
"Too Minor" is there largely because you're spending someone's time (3 or more someones) to verify your edit when you're a low-rep user. If you're just adding syntax highlighting, I'd say that is indeed too minor; it does add to the post, and when you hit 2k+ it's much appreciated, but it doesn't sufficiently take away from the reading of the post that it's worth taking so many peoples' time to do. If the post has other issues, fix them as well; if it's a great question and just forgot syntax highlighting, add a comment. Most questions without syntax highlighting need more work than just a tag, to be honest, so I suspect some/many of these rejections are because of that.
2
-1
268,337
I tend to answer questions related to specific plugins (see questions related to [`parsley.js`](https://stackoverflow.com/questions/tagged/parsley.js), which is a jQuery plugin). More often than not, the OP simply adds the tag of the plugin. However, if she/he adds code to the question, or if I add code to my answer, there will be no syntax highlighting. It pains me to read code without syntax highlighting and sometimes you can spot the mistake simply by reading code. Most times I edit the question and add the `[javascript]` tag, but I have seen some users reject my edit with the message: > This edit is too minor; suggested edits should be substantive improvements addressing multiple issues in the post. I understand that simply editing the tags is an easy way to gain those extra two reputation points, but it really helps anyone who visits the site. What is your opinion on this?
2014/08/11
[ "https://meta.stackoverflow.com/questions/268337", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/908174/" ]
As a high-rep user, I will either edit tags to add a missing relevant tag, such as the JavaScript tag, or I will add [syntax-highlighting hints](https://meta.stackexchange.com/questions/184108/what-is-syntax-highlighting-and-how-does-it-work) to the Stack Exchange's Markdown parser: ``` <!-- language: lang-js --> if (foo) { alert("Shazbot!"); } ``` However, as a low-rep user like yourself, without full-editing privileges, I would try to improve the post as much as possible, if there are any other things that can be improved as well (grammar, spelling, missing punctuation, etc.). If adding a missing relevant tag or adding syntax highlighting is the only thing to improve in a post, personally, I would approve such an edit, but I can see how a lot of other users would reject such edits as seemingly too minor. If there's nothing else to improve in the post and your edit is still rejected, I would just move on and find another post to edit instead.
Yes, this is fine. The "too minor" edit reject phenomenon is a disease to be wiped out. The Stack Exchange servers can handle multiple incremental edits being made rather than one big one, so rejecting a small improvement on the basis that "other improvements could also have been made" is entirely ridiculous.
7
5
268,337
I tend to answer questions related to specific plugins (see questions related to [`parsley.js`](https://stackoverflow.com/questions/tagged/parsley.js), which is a jQuery plugin). More often than not, the OP simply adds the tag of the plugin. However, if she/he adds code to the question, or if I add code to my answer, there will be no syntax highlighting. It pains me to read code without syntax highlighting and sometimes you can spot the mistake simply by reading code. Most times I edit the question and add the `[javascript]` tag, but I have seen some users reject my edit with the message: > This edit is too minor; suggested edits should be substantive improvements addressing multiple issues in the post. I understand that simply editing the tags is an easy way to gain those extra two reputation points, but it really helps anyone who visits the site. What is your opinion on this?
2014/08/11
[ "https://meta.stackoverflow.com/questions/268337", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/908174/" ]
I would approve any correct edit that added a language-related tag, such as `[javascript]`. Simply by adding that tag, you ensure the question is seen by those people who can answer it. I would encourage you to make your edits more substantive than that if possible, but I wouldn't reject it if you didn't. If you simply added syntax highlighting with a markdown hint: ``` <!-- language: javascript --> ``` I may well reject that as too minor if it were your only change. Prettifying code is not really a good enough reason to bring three edit reviewers into the debate.
No. I don't do it because I don't think it's worth doing. I would rather spend time and effort asking, reading or answering an interesting question. I don't have a problem with it, though -- it's okay if we disagree -- but I won't willingly spend my time on it. My opinion on some of your points: > It pains me to read code without syntax highlighting It doesn't bother me. As long as it's in a Markdown code block, I'm fine with it. > sometimes you can spot the mistake simply by reading code. Sounds like a junk question. If the question is that easily answered, there's a good chance I won't be interested in reading it, regardless of syntax highlighting. > it really helps anyone who visits the site. I disagree. *(EDIT: if you think that I'm categorically saying that syntax highlighting doesn't help anyone, then you're WRONG! See the comments below for more explanation.)*
2
-1
268,337
I tend to answer questions related to specific plugins (see questions related to [`parsley.js`](https://stackoverflow.com/questions/tagged/parsley.js), which is a jQuery plugin). More often than not, the OP simply adds the tag of the plugin. However, if she/he adds code to the question, or if I add code to my answer, there will be no syntax highlighting. It pains me to read code without syntax highlighting and sometimes you can spot the mistake simply by reading code. Most times I edit the question and add the `[javascript]` tag, but I have seen some users reject my edit with the message: > This edit is too minor; suggested edits should be substantive improvements addressing multiple issues in the post. I understand that simply editing the tags is an easy way to gain those extra two reputation points, but it really helps anyone who visits the site. What is your opinion on this?
2014/08/11
[ "https://meta.stackoverflow.com/questions/268337", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/908174/" ]
As a high-rep user, I will either edit tags to add a missing relevant tag, such as the JavaScript tag, or I will add [syntax-highlighting hints](https://meta.stackexchange.com/questions/184108/what-is-syntax-highlighting-and-how-does-it-work) to the Stack Exchange's Markdown parser: ``` <!-- language: lang-js --> if (foo) { alert("Shazbot!"); } ``` However, as a low-rep user like yourself, without full-editing privileges, I would try to improve the post as much as possible, if there are any other things that can be improved as well (grammar, spelling, missing punctuation, etc.). If adding a missing relevant tag or adding syntax highlighting is the only thing to improve in a post, personally, I would approve such an edit, but I can see how a lot of other users would reject such edits as seemingly too minor. If there's nothing else to improve in the post and your edit is still rejected, I would just move on and find another post to edit instead.
No. I don't do it because I don't think it's worth doing. I would rather spend time and effort asking, reading or answering an interesting question. I don't have a problem with it, though -- it's okay if we disagree -- but I won't willingly spend my time on it. My opinion on some of your points: > It pains me to read code without syntax highlighting It doesn't bother me. As long as it's in a Markdown code block, I'm fine with it. > sometimes you can spot the mistake simply by reading code. Sounds like a junk question. If the question is that easily answered, there's a good chance I won't be interested in reading it, regardless of syntax highlighting. > it really helps anyone who visits the site. I disagree. *(EDIT: if you think that I'm categorically saying that syntax highlighting doesn't help anyone, then you're WRONG! See the comments below for more explanation.)*
7
-1
268,337
I tend to answer questions related to specific plugins (see questions related to [`parsley.js`](https://stackoverflow.com/questions/tagged/parsley.js), which is a jQuery plugin). More often than not, the OP simply adds the tag of the plugin. However, if she/he adds code to the question, or if I add code to my answer, there will be no syntax highlighting. It pains me to read code without syntax highlighting and sometimes you can spot the mistake simply by reading code. Most times I edit the question and add the `[javascript]` tag, but I have seen some users reject my edit with the message: > This edit is too minor; suggested edits should be substantive improvements addressing multiple issues in the post. I understand that simply editing the tags is an easy way to gain those extra two reputation points, but it really helps anyone who visits the site. What is your opinion on this?
2014/08/11
[ "https://meta.stackoverflow.com/questions/268337", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/908174/" ]
Yes, this is fine. The "too minor" edit reject phenomenon is a disease to be wiped out. The Stack Exchange servers can handle multiple incremental edits being made rather than one big one, so rejecting a small improvement on the basis that "other improvements could also have been made" is entirely ridiculous.
No. I don't do it because I don't think it's worth doing. I would rather spend time and effort asking, reading or answering an interesting question. I don't have a problem with it, though -- it's okay if we disagree -- but I won't willingly spend my time on it. My opinion on some of your points: > It pains me to read code without syntax highlighting It doesn't bother me. As long as it's in a Markdown code block, I'm fine with it. > sometimes you can spot the mistake simply by reading code. Sounds like a junk question. If the question is that easily answered, there's a good chance I won't be interested in reading it, regardless of syntax highlighting. > it really helps anyone who visits the site. I disagree. *(EDIT: if you think that I'm categorically saying that syntax highlighting doesn't help anyone, then you're WRONG! See the comments below for more explanation.)*
5
-1
34,869
When leveling up in Skyrim you have to choose between increasing your Magicka, Health or Stamina in addition to gaining a perk point. What effects does your choice have? Are there any effects apart from simply having more Magicka, Health or Stamina available?
2011/11/10
[ "https://gaming.stackexchange.com/questions/34869", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/615/" ]
Almost nothing. That choice basically is the new replacement for the old attributes in the previous games. The developers said that the old attributes were basically just a fancy way to raise or lower Health, Magicka or Stamina (besides also influencing skills, obviously), so they went for this "choose between the three" plus "perks" system. The only thing that changes is the amount you can carry. As Arkvive pointed out, choosing stamina will increase your maximum carry capacity by 5.
Choosing Stamina increases not only your availiable Stamina pool, but also your carrying capacity. Additionally, whichever attribute you choose will be refilled to full. This means that you can 'save' a level up and apply the points in combat as a sort of poor mans potion.
5
3
277,073
In the library, right-click on a movieclip that you have written an ActionScript class for and select "Linkage...". Notice that the "Base class" field is not empty (it can't be). It's likely to be `flash.display.MovieClip`, but it could be something else, depending on what your class inherits from. This base class field is only required when publishing for ActionScript 3. So can anyone tell me why Flash CS3 insists on me providing the base class in both the ActionScript file *and* the Linkage dialog? If the base class differs between the two locations, it can still be published without errors, and the Linkage dialog just seems to be ignored (as long as it's valid). What is the point of the Base class field!?
2008/11/10
[ "https://Stackoverflow.com/questions/277073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26331/" ]
I often use it so set the same base class for multiple objects without creating separate class .as files for them. It's useful when you're doing more graphical type stuff and don't really need separate classes, but do need to create them programatically. I don't know why it allows you to set incorrect parameters here, I suspect it's an heritage from the very "relaxed view" on typing the Flash IDE always had.
From: <http://www.adobe.com/devnet/flash/quickstart/external_files_as3/> > The value of the Base Class defaults to flash.display.MovieClip. Use this default unless you are using an automatically generated class that uses the functionality of an external class. Base Class is not synonomous with extension; **if you are specifying a custom class that itself extends another class, it is not necessary to specify this superclass as the Base Class**. In this situation, the default of flash.display.MovieClip is sufficient. If, however, you wanted two symbols, RedFish and BlueFish, to function identically but have different skins, you could use the authoring tool to create different appearances, then set their Base Class to Fish and use a Fish class in an external Fish.as file to provide the functionality for both fish.
3
1
277,073
In the library, right-click on a movieclip that you have written an ActionScript class for and select "Linkage...". Notice that the "Base class" field is not empty (it can't be). It's likely to be `flash.display.MovieClip`, but it could be something else, depending on what your class inherits from. This base class field is only required when publishing for ActionScript 3. So can anyone tell me why Flash CS3 insists on me providing the base class in both the ActionScript file *and* the Linkage dialog? If the base class differs between the two locations, it can still be published without errors, and the Linkage dialog just seems to be ignored (as long as it's valid). What is the point of the Base class field!?
2008/11/10
[ "https://Stackoverflow.com/questions/277073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26331/" ]
I often use it so set the same base class for multiple objects without creating separate class .as files for them. It's useful when you're doing more graphical type stuff and don't really need separate classes, but do need to create them programatically. I don't know why it allows you to set incorrect parameters here, I suspect it's an heritage from the very "relaxed view" on typing the Flash IDE always had.
Well, it can be a Button, a Sprite, MovieClip, or any other display object. You are simply creating a special version of one of these. You need to provide Flash with the type you are creating.
3
0
277,073
In the library, right-click on a movieclip that you have written an ActionScript class for and select "Linkage...". Notice that the "Base class" field is not empty (it can't be). It's likely to be `flash.display.MovieClip`, but it could be something else, depending on what your class inherits from. This base class field is only required when publishing for ActionScript 3. So can anyone tell me why Flash CS3 insists on me providing the base class in both the ActionScript file *and* the Linkage dialog? If the base class differs between the two locations, it can still be published without errors, and the Linkage dialog just seems to be ignored (as long as it's valid). What is the point of the Base class field!?
2008/11/10
[ "https://Stackoverflow.com/questions/277073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26331/" ]
From: <http://www.adobe.com/devnet/flash/quickstart/external_files_as3/> > The value of the Base Class defaults to flash.display.MovieClip. Use this default unless you are using an automatically generated class that uses the functionality of an external class. Base Class is not synonomous with extension; **if you are specifying a custom class that itself extends another class, it is not necessary to specify this superclass as the Base Class**. In this situation, the default of flash.display.MovieClip is sufficient. If, however, you wanted two symbols, RedFish and BlueFish, to function identically but have different skins, you could use the authoring tool to create different appearances, then set their Base Class to Fish and use a Fish class in an external Fish.as file to provide the functionality for both fish.
Well, it can be a Button, a Sprite, MovieClip, or any other display object. You are simply creating a special version of one of these. You need to provide Flash with the type you are creating.
1
0
47,713,857
I have got a express server, which creates a pdf file. I am trying to send this file to the client: ```js const fs = require('fs'); function download(req, res) { var filePath = '/../../myPdf.pdf'; fs.readFile(__dirname + filePath, function(err, data) { if (err) throw new Error(err); console.log('yeyy, no errors :)'); if (!data) throw new Error('Expected data, but got', data); console.log('got data', data); res.contentType('application/pdf'); res.send(data); }); } ``` On the client I want to download it: ```js _handleDownloadAll = async () => { console.log('handle download all'); const response = await request.get( `http://localhost:3000/download?accessToken=${localStorage.getItem( 'accessToken' )}` ); console.log(response); }; ``` I recieve an body.text like ```js %PDF-1.4↵1 0 obj↵<<↵/Title (��)↵/Creator (��)↵/Producer (��Qt 5.5.1)↵ ``` but I can't achieve a download. How can I create a PDF from the data OR directly download it from the server? **I've got it working:** The answer was pretty simple. I just let the browser handle the download with an html anchor tag: server: ```js function download(req, res) { const { creditor } = req.query; const filePath = `/../../${creditor}.pdf`; res.download(__dirname + filePath); } ``` client: ```js <a href{`${BASE_URL}?accessToken=${accessToken}&creditor=${creditorId}`} download>Download</a> ```
2017/12/08
[ "https://Stackoverflow.com/questions/47713857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7990485/" ]
The result is the string of the binary. We use base 64 to convert from binary to pdf > `var buffer = Buffer.from(result['textBinary'], 'base64')` > `fs.writeFileSync('/path/to/my/file.pdf', buffer)`
You can prompt the browser to download the file by setting the correct content-disposition header: ``` res.setHeader('Content-disposition', 'attachment; filename=myfile.pdf'); ```
1
0
47,713,857
I have got a express server, which creates a pdf file. I am trying to send this file to the client: ```js const fs = require('fs'); function download(req, res) { var filePath = '/../../myPdf.pdf'; fs.readFile(__dirname + filePath, function(err, data) { if (err) throw new Error(err); console.log('yeyy, no errors :)'); if (!data) throw new Error('Expected data, but got', data); console.log('got data', data); res.contentType('application/pdf'); res.send(data); }); } ``` On the client I want to download it: ```js _handleDownloadAll = async () => { console.log('handle download all'); const response = await request.get( `http://localhost:3000/download?accessToken=${localStorage.getItem( 'accessToken' )}` ); console.log(response); }; ``` I recieve an body.text like ```js %PDF-1.4↵1 0 obj↵<<↵/Title (��)↵/Creator (��)↵/Producer (��Qt 5.5.1)↵ ``` but I can't achieve a download. How can I create a PDF from the data OR directly download it from the server? **I've got it working:** The answer was pretty simple. I just let the browser handle the download with an html anchor tag: server: ```js function download(req, res) { const { creditor } = req.query; const filePath = `/../../${creditor}.pdf`; res.download(__dirname + filePath); } ``` client: ```js <a href{`${BASE_URL}?accessToken=${accessToken}&creditor=${creditorId}`} download>Download</a> ```
2017/12/08
[ "https://Stackoverflow.com/questions/47713857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7990485/" ]
The result is the string of the binary. We use base 64 to convert from binary to pdf > `var buffer = Buffer.from(result['textBinary'], 'base64')` > `fs.writeFileSync('/path/to/my/file.pdf', buffer)`
`readFile` returns a [Buffer](https://nodejs.org/api/buffer.html#buffer_class_buffer) which is a wrapper around bytes. You're sending `Buffer` back to the client which is logging them to the console. The body.text you see is to be expected. You will need to write these bytes to a file using `fs.writeFile` or similar. Here's an example: ``` _handleDownloadAll = async () => { console.log('handle download all'); const response = await request.get( `http://localhost:3000/download?accessToken=${localStorage.getItem( 'accessToken' )}` ); // load your response data into a Buffer let buffer = Buffer.from(response.body.text) // open the file in writing mode fs.open('/path/to/my/file.pdf', 'w', function(err, fd) { if (err) { throw 'could not open file: ' + err; } // write the contents of the buffer fs.write(fd, buffer, 0, buffer.length, null, function(err) { if (err) { throw 'error writing file: ' + err; } fs.close(fd, function() { console.log('file written successfully'); }); }); }); }; ``` You may need to experiment with the buffer encoding, it defaults to `utf8`. **Read this!** The other option you may want to consider is generating the PDF on the server and simply sending the client a link to where it can download this.
1
0
109,357
I have the following points: ``` aa={{238.5, 394.5}, {195.5, 441.5}, {219.5, 397.5}, {216.5, 398.5}, {246.5, 397.5}, {265.5, 476.5}, {275.5, 450.5}, {273.5, 435.5}, {274.5, 461.5}, {212.5, 447.5}, {221.5, 457.5}} ``` Now, I want to draw a closed curve from those line. So I used the following code: ``` Graphics[{{Blue, Point[aa]}, JoinedCurve[Line[aa], CurveClosed -> True]}] ``` But, it gives me curve like this: [![enter image description here](https://i.stack.imgur.com/voq3z.jpg)](https://i.stack.imgur.com/voq3z.jpg) I want the curve like this way: [![enter image description here](https://i.stack.imgur.com/ZGmkp.jpg)](https://i.stack.imgur.com/ZGmkp.jpg) Please let me know, how to do it. And, I want it to do automatically, not point by point. Please let me know. Thanks.
2016/03/07
[ "https://mathematica.stackexchange.com/questions/109357", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/37314/" ]
Note that the above method doesn't always work. Here is an alternative: ``` aa = RandomReal[{-1, 1}, {20, 2}]; Graphics[Line[aa[[Last[FindShortestTour[aa]]]]]] ``` [![enter image description here](https://i.stack.imgur.com/KuZML.png)](https://i.stack.imgur.com/KuZML.png)
``` curve = FindCurvePath[aa] ListLinePlot[aa[[curve[[1]]]], AspectRatio -> Automatic] ``` ![Mathematica graphics](https://i.stack.imgur.com/XkN1H.png)
4
3
109,357
I have the following points: ``` aa={{238.5, 394.5}, {195.5, 441.5}, {219.5, 397.5}, {216.5, 398.5}, {246.5, 397.5}, {265.5, 476.5}, {275.5, 450.5}, {273.5, 435.5}, {274.5, 461.5}, {212.5, 447.5}, {221.5, 457.5}} ``` Now, I want to draw a closed curve from those line. So I used the following code: ``` Graphics[{{Blue, Point[aa]}, JoinedCurve[Line[aa], CurveClosed -> True]}] ``` But, it gives me curve like this: [![enter image description here](https://i.stack.imgur.com/voq3z.jpg)](https://i.stack.imgur.com/voq3z.jpg) I want the curve like this way: [![enter image description here](https://i.stack.imgur.com/ZGmkp.jpg)](https://i.stack.imgur.com/ZGmkp.jpg) Please let me know, how to do it. And, I want it to do automatically, not point by point. Please let me know. Thanks.
2016/03/07
[ "https://mathematica.stackexchange.com/questions/109357", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/37314/" ]
``` curve = FindCurvePath[aa] ListLinePlot[aa[[curve[[1]]]], AspectRatio -> Automatic] ``` ![Mathematica graphics](https://i.stack.imgur.com/XkN1H.png)
Why not directly use `ListCurvePathPlot`? ``` ListCurvePathPlot@aa ``` [![enter image description here](https://i.stack.imgur.com/K3wjw.png)](https://i.stack.imgur.com/K3wjw.png)
3
2
109,357
I have the following points: ``` aa={{238.5, 394.5}, {195.5, 441.5}, {219.5, 397.5}, {216.5, 398.5}, {246.5, 397.5}, {265.5, 476.5}, {275.5, 450.5}, {273.5, 435.5}, {274.5, 461.5}, {212.5, 447.5}, {221.5, 457.5}} ``` Now, I want to draw a closed curve from those line. So I used the following code: ``` Graphics[{{Blue, Point[aa]}, JoinedCurve[Line[aa], CurveClosed -> True]}] ``` But, it gives me curve like this: [![enter image description here](https://i.stack.imgur.com/voq3z.jpg)](https://i.stack.imgur.com/voq3z.jpg) I want the curve like this way: [![enter image description here](https://i.stack.imgur.com/ZGmkp.jpg)](https://i.stack.imgur.com/ZGmkp.jpg) Please let me know, how to do it. And, I want it to do automatically, not point by point. Please let me know. Thanks.
2016/03/07
[ "https://mathematica.stackexchange.com/questions/109357", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/37314/" ]
Note that the above method doesn't always work. Here is an alternative: ``` aa = RandomReal[{-1, 1}, {20, 2}]; Graphics[Line[aa[[Last[FindShortestTour[aa]]]]]] ``` [![enter image description here](https://i.stack.imgur.com/KuZML.png)](https://i.stack.imgur.com/KuZML.png)
Why not directly use `ListCurvePathPlot`? ``` ListCurvePathPlot@aa ``` [![enter image description here](https://i.stack.imgur.com/K3wjw.png)](https://i.stack.imgur.com/K3wjw.png)
4
2
14,327,699
I have two heroku apps, staging and production. I am able to push my latest code up to the staging server without issue, however when I try to push my latest code up to production I get a timeout error. Looking at similar bugs that people have had it sounds like it could be an issue with the requirements doc or one of the packages. But I'm not sure how to even start debugging that. We're using a lot of external packages. And the fact that it works on one heroku app but not another makes me wonder how much it really is a previous app. It appears to timeout at different times during the process without any other errors from what I can tell. The first time it timed out after starting the install of psycopg2, however the last time it made it past psycopg2 and then timed out on the gevent install. I'm at a loss and this is the first time I've ever encountered this problem and this build needs to go out asap. Does anyone have any ideas? Here is as much of the log as stackoverflow will allow me to post: ``` Running setup.py install for django-extensions Running setup.py install for dj-database-url Running setup.py install for django-grappelli Running setup.py develop for ckeditor Creating /app/.heroku/python/lib/python2.7/site-packages/django-ckeditor.egg-link (link to .) Adding django-ckeditor 3.6.2 to easy-install.pth file Installed /app/.heroku/src/ckeditor Running setup.py install for django-heroku-memcacheify Running setup.py install for django-tastypie Running setup.py install for boto package init file 'tests/db/__init__.py' not found (or not a regular file) package init file 'tests/ec2/elb/__init__.py' not found (or not a regular file) package init file 'tests/utils/__init__.py' not found (or not a regular file) package init file 'boto/emr/tests/__init__.py' not found (or not a regular file) changing mode of build/scripts-2.7/sdbadmin from 600 to 755 changing mode of build/scripts-2.7/elbadmin from 600 to 755 changing mode of build/scripts-2.7/cfadmin from 600 to 755 changing mode of build/scripts-2.7/s3put from 600 to 755 changing mode of build/scripts-2.7/fetch_file from 600 to 755 changing mode of build/scripts-2.7/launch_instance from 600 to 755 changing mode of build/scripts-2.7/list_instances from 600 to 755 changing mode of build/scripts-2.7/taskadmin from 600 to 755 changing mode of build/scripts-2.7/kill_instance from 600 to 755 changing mode of build/scripts-2.7/bundle_image from 600 to 755 changing mode of build/scripts-2.7/pyami_sendmail from 600 to 755 changing mode of build/scripts-2.7/lss3 from 600 to 755 changing mode of build/scripts-2.7/cq from 600 to 755 changing mode of build/scripts-2.7/route53 from 600 to 755 changing mode of build/scripts-2.7/s3multiput from 600 to 755 changing mode of build/scripts-2.7/cwutil from 600 to 755 changing mode of build/scripts-2.7/instance_events from 600 to 755 changing mode of build/scripts-2.7/asadmin from 600 to 755 changing mode of /app/.heroku/python/bin/sdbadmin to 755 changing mode of /app/.heroku/python/bin/taskadmin to 755 changing mode of /app/.heroku/python/bin/lss3 to 755 changing mode of /app/.heroku/python/bin/cq to 755 changing mode of /app/.heroku/python/bin/route53 to 755 changing mode of /app/.heroku/python/bin/cwutil to 755 changing mode of /app/.heroku/python/bin/pyami_sendmail to 755 changing mode of /app/.heroku/python/bin/instance_events to 755 changing mode of /app/.heroku/python/bin/s3multiput to 755 changing mode of /app/.heroku/python/bin/launch_instance to 755 changing mode of /app/.heroku/python/bin/s3put to 755 changing mode of /app/.heroku/python/bin/list_instances to 755 changing mode of /app/.heroku/python/bin/bundle_image to 755 changing mode of /app/.heroku/python/bin/kill_instance to 755 changing mode of /app/.heroku/python/bin/elbadmin to 755 changing mode of /app/.heroku/python/bin/fetch_file to 755 changing mode of /app/.heroku/python/bin/cfadmin to 755 changing mode of /app/.heroku/python/bin/asadmin to 755 Running setup.py install for django-storages Running setup.py install for psycopg2 building 'psycopg2._psycopg' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/green.c -o build/temp.linux-x86_64-2.7/psycopg/green.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/pqpath.c -o build/temp.linux-x86_64-2.7/psycopg/pqpath.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/utils.c -o build/temp.linux-x86_64-2.7/psycopg/utils.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/bytes_format.c -o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/connection_int.c -o build/temp.linux-x86_64-2.7/psycopg/connection_int.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/connection_type.c -o build/temp.linux-x86_64-2.7/psycopg/connection_type.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/cursor_int.c -o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/cursor_type.c -o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/lobject_int.c -o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/lobject_type.c -o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/notify_type.c -o build/temp.linux-x86_64-2.7/psycopg/notify_type.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/xid_type.c -o build/temp.linux-x86_64-2.7/psycopg/xid_type.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_binary.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_datetime.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_list.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pboolean.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pdecimal.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pint.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pint.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pfloat.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_qstring.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/microprotocols.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/microprotocols_proto.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o -Wdeclaration-after-statement gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.6 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080409 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/app/.heroku/python/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/typecast.c -o build/temp.linux-x86_64-2.7/psycopg/typecast.o -Wdeclaration-after-statement gcc -pthread -shared build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o build/temp.linux-x86_64-2.7/psycopg/green.o build/temp.linux-x86_64-2.7/psycopg/pqpath.o build/temp.linux-x86_64-2.7/psycopg/utils.o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o build/temp.linux-x86_64-2.7/psycopg/connection_int.o build/temp.linux-x86_64-2.7/psycopg/connection_type.o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o build/temp.linux-x86_64-2.7/psycopg/notify_type.o build/temp.linux-x86_64-2.7/psycopg/xid_type.o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o build/temp.linux-x86_64-2.7/psycopg/adapter_pint.o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o build/temp.linux-x86_64-2.7/psycopg/typecast.o -L/usr/lib -lpq -o build/lib.linux-x86_64-2.7/psycopg2/_psycopg.so /app/slug-compiler/lib/utils.rb:66:in `block (2 levels) in spawn': command='/app/slug-compiler/lib/../../tmp/buildpacks/python/bin/compile /tmp/build_2ptirkdt1juhy /app/tmp/repo.git/.cache' exit_status=0 out='' at=timeout elapsed=900.018394947052 (Utils::TimeoutError) from /app/slug-compiler/lib/utils.rb:52:in `loop' from /app/slug-compiler/lib/utils.rb:52:in `block in spawn' from /app/slug-compiler/lib/utils.rb:47:in `popen' from /app/slug-compiler/lib/utils.rb:47:in `spawn' from /app/slug-compiler/lib/buildpack.rb:37:in `block in compile' from /app/slug-compiler/lib/buildpack.rb:35:in `fork' from /app/slug-compiler/lib/buildpack.rb:35:in `compile' from /app/slug-compiler/lib/slug.rb:497:in `block in run_buildpack' from /app/slug-compiler/lib/utils.rb:121:in `log' from /app/slug-compiler/lib/slug.rb:748:in `log' from /app/slug-compiler/lib/slug.rb:496:in `run_buildpack' from /app/slug-compiler/lib/slug.rb:125:in `block (2 levels) in compile' from /app/slug-compiler/lib/utils.rb:102:in `block in timeout' from /usr/local/lib/ruby/1.9.1/timeout.rb:58:in `timeout' from /app/slug-compiler/lib/utils.rb:102:in `rescue in timeout' from /app/slug-compiler/lib/utils.rb:97:in `timeout' from /app/slug-compiler/lib/slug.rb:114:in `block in compile' from /app/slug-compiler/lib/utils.rb:121:in `log' from /app/slug-compiler/lib/slug.rb:748:in `log' from /app/slug-compiler/lib/slug.rb:113:in `compile' from /app/slug-compiler/bin/slugc:85:in `block in <main>' from /app/slug-compiler/lib/slug.rb:505:in `block in lock' from /app/slug-compiler/lib/repo_lock.rb:44:in `call' from /app/slug-compiler/lib/repo_lock.rb:44:in `run' from /app/slug-compiler/lib/slug.rb:505:in `lock' from /app/slug-compiler/bin/slugc:66:in `<main>' ! Heroku push rejected, failed to compile Python app Auto packing the repository for optimum performance. Connection to 10.217.65.204 closed by remote host. To [email protected]:belo.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to '[email protected]:belo.git' Completed with errors, see above ```
2013/01/14
[ "https://Stackoverflow.com/questions/14327699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1375909/" ]
There's now a proper but undocumented solution to this problem (github history shows it was implemented in Feb. 2013): the `COMPILE_TIMEOUT` environment variable. Set it like so for a 50 minute timeout (the default is '900', or 15 minutes): ``` $ heroku config:set COMPILE_TIMEOUT=3000 ``` (note: you need [user-env-compile](https://devcenter.heroku.com/articles/labs-user-env-compile) enabled to use this feature) **Update:** Please read the comments on [this answer](https://stackoverflow.com/a/16283513/471671) for an important update -- long story short, Heroku recommends contacting support directly in these cases, and COMPILE\_TIMEOUT either no longer works or never worked as a solution to this particular problem.
I heard back from Heroku support. In my particular circumstance, the issue was that we simply have too many dependencies in requirements. It is a very large scale project and we utilize many third party modules and it simply was taking too long to install and create the slug. The solution was to comment out half of our requirements and push, then undo the comments and push again. Here is the response from Heroku: > That's a lot of dependencies! > > > I'd recommend pushing once with only half of your dependencies, then once again with all of them. Then you won't hit the timeout. > > > Once they are installed, they are cached, so you shouldn't run into this again.
4
1