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
|
---|---|---|---|---|---|
12,688 |
I have a cluster of Apache httpd servers. It's a load balanced cluster where all nodes serve the same, shared, content. The content itself is located on a shared storage.
I would like to setup all nodes to log (server access logs) to the same log file (again on the same shared storage), but I am concerned that this would create concurrency problems in a production environment.
Anyone knows a good guide or recommendation for setting up a logging for httpd clusters?
|
2009/05/27
|
[
"https://serverfault.com/questions/12688",
"https://serverfault.com",
"https://serverfault.com/users/3915/"
] |
I would say your concerns are correct. You already have a bottleneck with the apache children logging to the same file (or the same pipe if you use `cronolog`).
My suggestion would be to either log to different files (say appending the hostname to the end of the file) then summarise those files later. Alternatively if you are concerned about the overhead of logging to a network storage device, log locally, again with a unique extension then rsync the files to a central location after rolling them, and summarise.
|
Use logresolvemerge.pl, part of AWstats (or hack your own).
Personally, I'd log to a ramdisk on each server and merge to file every hour or so.
|
20,179,727 |
I have a set of images in a folder, where each image either has a square shape or a triangle shape on a white background (like [this](http://www.math-salamanders.com/image-files/equilateral-triangle-no-bg.png) and [this](http://www.math-salamanders.com/image-files/lgs-square-no-bg.png)). I would like to separate those images into different folders (note that I don't care about detecting whether image is a square/triangle etc. I just want to separate those two).
I am planning to use more complex shapes in the future (e.g. pentagons, or other non-geometric shapes) so I am looking for an unsupervised approach. But the main task will always be clustering a set of images into different folders.
What is the easiest/best way to do it? I looked at image clustering algorithms, but they do clustering of colors/shapes *inside* the image. In my case I simply want to separate those image files based on the shapes that have.
Any pointers/help is appreciated.
|
2013/11/24
|
[
"https://Stackoverflow.com/questions/20179727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048858/"
] |
You can follow this method:
```
1. Create a look-up tables with shape you are using in the images
2. Do template matching on the images stored in a single folder
3. According to the result of template matching just store them in different folders
4. You can create folders beforehand and just replace the strings in program according to the usage.
```
I hope this helps
|
It's really going to depend on what your data set looks like (e.g., what your shape images look like), and how robust you want your solution to be. The tricky part is going to be extracting features from each shape image the produce a clustering result that you're satisfied with. A few ideas:
You could compute **SIFT features** for each images and then cluster the images based on those features: <http://en.wikipedia.org/wiki/Scale-invariant_feature_transform>
If you don't want to go the SIFT route, you could try something like **HOG**: <http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients>
A somewhat more naive approach - If the shapes are always the same scale, and the background color is fixed you could get rid of the background cluster the images based on **shape area** (e.g., number of pixels taken up by the shape).
|
6,862,249 |
With the `<g:select>` tag... sometimes it displays normally like a selection drop down box, while sometimes it displays with multiple rows, this is very annoying.... Even I put the size="1" into the `<g:select>`, it still displays multiple rows... is there anyone knows how to make `<g:select>` display correctly? with only one item visible, like a dropdown box. Thanks!!
```
<g:select size="1" id="s_caseID" name="s_caseID" value="${t1T2InstanceListTotal?.Accession_No}"
noSelection="${['null':'Select One...']}"
from='${t1T2InstanceListTotal}'
optionKey="Accession_No" optionValue="Accession_No" onclick="this.form.submit();" >
</g:select>
```
|
2011/07/28
|
[
"https://Stackoverflow.com/questions/6862249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817688/"
] |
Here's the [taglib code](http://svn.codehaus.org/grails/trunk/grails/src/groovy/org/codehaus/groovy/grails/plugins/web/taglib/FormTagLib.groovy) that cause the `multiple="multiple"` attribute to be rendered (if not explicitly declared on the tag):
```
def value = attrs.remove('value')
if (value instanceof Collection && attrs.multiple == null) {
attrs.multiple = 'multiple'
}
```
Therefore, it looks like you're passing a `Collection` as the `<g:select>`'s `value` attribute instead of a single value. Is that what you're intending to do?
|
If the "value" is a list, **g:select** always considers it as a multiple select. To avoid this and have a single select drop-down just ignore the **value** attribute and use **keys** option instead!
This works fine for me!
```
`<g:select id="s_caseID" name="s_caseID" from='${t1T2InstanceListTotal}'
noSelection="${['null':'Select One...']}"
keys="${t1T2InstanceListTotal?.Accession_No}" onclick="this.form.submit();">
</g:select>`
```
|
6,862,249 |
With the `<g:select>` tag... sometimes it displays normally like a selection drop down box, while sometimes it displays with multiple rows, this is very annoying.... Even I put the size="1" into the `<g:select>`, it still displays multiple rows... is there anyone knows how to make `<g:select>` display correctly? with only one item visible, like a dropdown box. Thanks!!
```
<g:select size="1" id="s_caseID" name="s_caseID" value="${t1T2InstanceListTotal?.Accession_No}"
noSelection="${['null':'Select One...']}"
from='${t1T2InstanceListTotal}'
optionKey="Accession_No" optionValue="Accession_No" onclick="this.form.submit();" >
</g:select>
```
|
2011/07/28
|
[
"https://Stackoverflow.com/questions/6862249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817688/"
] |
Set the `multiple` attribute to `false`
```
<g:select name="cars"
from="${Car.list()}"
value="${person?.cars*.id}"
optionKey="id"
multiple="false" />
```
|
If the "value" is a list, **g:select** always considers it as a multiple select. To avoid this and have a single select drop-down just ignore the **value** attribute and use **keys** option instead!
This works fine for me!
```
`<g:select id="s_caseID" name="s_caseID" from='${t1T2InstanceListTotal}'
noSelection="${['null':'Select One...']}"
keys="${t1T2InstanceListTotal?.Accession_No}" onclick="this.form.submit();">
</g:select>`
```
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
You can use the SchemaExport class in NHibernate to do this in code:
```
var schema = new SchemaExport(config);
schema.Drop(true, true);
schema.Execute(true, true, false);
```
|
drop the entire database - don't drop table by table - that adds too much maintenance overhead
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
drop the entire database - don't drop table by table - that adds too much maintenance overhead
|
Have a look at these posts.
>
> Ayende Rahien - [nhibernate-unit-testing](http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx)
>
> Scott Muc - [unit-testing-domain-persistence-with-ndbunit-nhibernate-and-sqlite](http://scottmuc.com/blog/development/unit-testing-domain-persistence-with-ndbunit-nhibernate-and-sqlite/)
>
>
>
I have found them to be very usefull and basically they are extending the example by Mike Glenn
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
drop the entire database - don't drop table by table - that adds too much maintenance overhead
|
I use Proteus (Unit Test Utility), available on Google code here :
<http://code.google.com/p/proteusproject/>
You create a set of data. Each time, you run a unit test, the current data are saved, the set of data is loaded, then you use all the time the same set of data to make your tests. At the end the original data are restored.
Very powerfull
HTH
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
You can use the SchemaExport class in NHibernate to do this in code:
```
var schema = new SchemaExport(config);
schema.Drop(true, true);
schema.Execute(true, true, false);
```
|
I have used the following utility methods for running SQL scripts for setting up databases and test data in a project that I am working with every now and then. It has worked rather well:
```
internal static void RunScriptFile(SqlConnection conn, string fileName)
{
long fileSize = 0;
using (FileStream stream = File.OpenRead(fileName))
{
fileSize = stream.Length;
using (StreamReader reader = new StreamReader(stream))
{
StringBuilder sb = new StringBuilder();
string line = string.Empty;
while (!reader.EndOfStream)
{
line = reader.ReadLine();
if (string.Compare(line.Trim(), "GO", StringComparison.InvariantCultureIgnoreCase) == 0)
{
RunCommand(conn, sb.ToString());
sb.Length = 0;
}
else
{
sb.AppendLine(line);
}
}
}
}
}
private static void RunCommand(SqlConnection connection, string commandString)
{
using (SqlCommand command = new SqlCommand(commandString, connection))
{
try
{
command.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Exception while executing statement: {0}", commandString));
Console.WriteLine(ex.ToString());
}
}
}
```
I have used the [Database Publishing Wizard](http://www.microsoft.com/downloads/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en) to generate SQL scripts (and in some cases edited them to include only the data I want to use in the test), and just pass the script file paths into the `RunScriptFile` method before the tests. The method parses the script file and executes each part that is separated by a `GO` line separately (I found that this greatly helped in troubleshooting errors that happened while running the SQL scripts).
I has been a while since I wrote the code, but I think it requires the the script file ends with a `GO` line in order for the last part of it to be executed.
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
I have used the following utility methods for running SQL scripts for setting up databases and test data in a project that I am working with every now and then. It has worked rather well:
```
internal static void RunScriptFile(SqlConnection conn, string fileName)
{
long fileSize = 0;
using (FileStream stream = File.OpenRead(fileName))
{
fileSize = stream.Length;
using (StreamReader reader = new StreamReader(stream))
{
StringBuilder sb = new StringBuilder();
string line = string.Empty;
while (!reader.EndOfStream)
{
line = reader.ReadLine();
if (string.Compare(line.Trim(), "GO", StringComparison.InvariantCultureIgnoreCase) == 0)
{
RunCommand(conn, sb.ToString());
sb.Length = 0;
}
else
{
sb.AppendLine(line);
}
}
}
}
}
private static void RunCommand(SqlConnection connection, string commandString)
{
using (SqlCommand command = new SqlCommand(commandString, connection))
{
try
{
command.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Exception while executing statement: {0}", commandString));
Console.WriteLine(ex.ToString());
}
}
}
```
I have used the [Database Publishing Wizard](http://www.microsoft.com/downloads/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en) to generate SQL scripts (and in some cases edited them to include only the data I want to use in the test), and just pass the script file paths into the `RunScriptFile` method before the tests. The method parses the script file and executes each part that is separated by a `GO` line separately (I found that this greatly helped in troubleshooting errors that happened while running the SQL scripts).
I has been a while since I wrote the code, but I think it requires the the script file ends with a `GO` line in order for the last part of it to be executed.
|
Have a look at these posts.
>
> Ayende Rahien - [nhibernate-unit-testing](http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx)
>
> Scott Muc - [unit-testing-domain-persistence-with-ndbunit-nhibernate-and-sqlite](http://scottmuc.com/blog/development/unit-testing-domain-persistence-with-ndbunit-nhibernate-and-sqlite/)
>
>
>
I have found them to be very usefull and basically they are extending the example by Mike Glenn
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
I have used the following utility methods for running SQL scripts for setting up databases and test data in a project that I am working with every now and then. It has worked rather well:
```
internal static void RunScriptFile(SqlConnection conn, string fileName)
{
long fileSize = 0;
using (FileStream stream = File.OpenRead(fileName))
{
fileSize = stream.Length;
using (StreamReader reader = new StreamReader(stream))
{
StringBuilder sb = new StringBuilder();
string line = string.Empty;
while (!reader.EndOfStream)
{
line = reader.ReadLine();
if (string.Compare(line.Trim(), "GO", StringComparison.InvariantCultureIgnoreCase) == 0)
{
RunCommand(conn, sb.ToString());
sb.Length = 0;
}
else
{
sb.AppendLine(line);
}
}
}
}
}
private static void RunCommand(SqlConnection connection, string commandString)
{
using (SqlCommand command = new SqlCommand(commandString, connection))
{
try
{
command.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Exception while executing statement: {0}", commandString));
Console.WriteLine(ex.ToString());
}
}
}
```
I have used the [Database Publishing Wizard](http://www.microsoft.com/downloads/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en) to generate SQL scripts (and in some cases edited them to include only the data I want to use in the test), and just pass the script file paths into the `RunScriptFile` method before the tests. The method parses the script file and executes each part that is separated by a `GO` line separately (I found that this greatly helped in troubleshooting errors that happened while running the SQL scripts).
I has been a while since I wrote the code, but I think it requires the the script file ends with a `GO` line in order for the last part of it to be executed.
|
I use Proteus (Unit Test Utility), available on Google code here :
<http://code.google.com/p/proteusproject/>
You create a set of data. Each time, you run a unit test, the current data are saved, the set of data is loaded, then you use all the time the same set of data to make your tests. At the end the original data are restored.
Very powerfull
HTH
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
You can use the SchemaExport class in NHibernate to do this in code:
```
var schema = new SchemaExport(config);
schema.Drop(true, true);
schema.Execute(true, true, false);
```
|
Have a look at these posts.
>
> Ayende Rahien - [nhibernate-unit-testing](http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx)
>
> Scott Muc - [unit-testing-domain-persistence-with-ndbunit-nhibernate-and-sqlite](http://scottmuc.com/blog/development/unit-testing-domain-persistence-with-ndbunit-nhibernate-and-sqlite/)
>
>
>
I have found them to be very usefull and basically they are extending the example by Mike Glenn
|
1,300,196 |
how to create a fresh database (everytime) before tests run from a schema file ?
|
2009/08/19
|
[
"https://Stackoverflow.com/questions/1300196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/72443/"
] |
You can use the SchemaExport class in NHibernate to do this in code:
```
var schema = new SchemaExport(config);
schema.Drop(true, true);
schema.Execute(true, true, false);
```
|
I use Proteus (Unit Test Utility), available on Google code here :
<http://code.google.com/p/proteusproject/>
You create a set of data. Each time, you run a unit test, the current data are saved, the set of data is loaded, then you use all the time the same set of data to make your tests. At the end the original data are restored.
Very powerfull
HTH
|
30,568 |
I have two shapefiles that contain position information for individuals, one is their reported location (line segments) and the other is their high-frequency recorded location (point data); they have an ID field that is common between them. What I am looking to do is identify the *reported* locations in the larger recorded data set with a spatial selection. The problem is my data is so condensed that I cannot do a simple select by location. There is too much overlap of individual locations. I also have over 1,000 individual IDs so I don't want to individually query each ID.
What I am looking for is a way to use possibly a cursor to go through each unique ID, query only the records in each table that share that ID, then do the spatial selection. I am very new to cursors and scripting in general so I don't know if a cursor can be used for two tables. *(This may be irrelevant but for this process I can convert my line data to point data if having the same type of shapefiles is important.)*
***(Removed previous code that I am no longer using)***
I am also unaware if maybe Make Query Table will work for this (I have never used it).
Thanks!
**UPDATE:** Here is a new code that I worked on with a fellow GIS person. GOOD NEWS! After leaving ArcGIS alone for a while, my code ran! It went as expected, but only did one iteration on one ID. The iteration should be implied in the Cursor as far as I know, or is there a line of code I'm missing that tells the Cursor to repeat for all IDs?
```
rows = arcpy.SearchCursor("hmb_logbook_2009")
for row in rows:
whereClause = '"trip_id" = ' + str(row.trip_id)
arcpy.MakeFeatureLayer_management("hmb_logbook_2009", "currentLines", whereClause)
arcpy.SelectLayerByLocation_management("hmb2009", "WITHIN_A_DISTANCE", "currentLines", "1 Miles", "NEW_SELECTION")
arcpy.SelectLayerByAttribute_management("hmb2009", "SUBSET_SELECTION", ' "trip_id" = ' + str(row.trip_id))
arcpy.CalculateField_management("hmb2009", "match_activity", 1)
arcpy.SelectLayerByAttribute_management("hmb2009", "CLEAR_SELECTION")
arcpy.Delete_management("currentLines")
del row, rows
```
**UPDATE 2:** So I have troubleshooted, and the reason the code only ran once is this error associated with my Make Feature Layer tool. Here is the error message: **ERROR 000622: Failed to execute (Make Feature Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter in\_features.**
I tried putting the full address into that tool (only that one) instead of referencing the layer in the map and it works!
|
2012/07/30
|
[
"https://gis.stackexchange.com/questions/30568",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/8061/"
] |
If I understand the question correctly, I would perform the buffer as normal, then intersect your buffer result with your physical barrier features (rivers?). Then do a select by location to select the features in the intersect results that do **not** touch your points. Delete these, and you are done. It is essentially what you are already doing manually, but in an automated fashion.
|
Assuming you have Spatial Analyst, you could consider transforming the problem to raster space.
Using "[cost distance](http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/spatial_analyst_tools/cost_distance.htm)" in spatial analyst, it is possible to bufffer and account for barriers. The tool has some limitations, but should suffice for your purpose. You would need to covert your river to a raster and have each cell it occupies as zero value (or perhaps novalue, I forget), which represents a barrier. The rest of the cells of your extent would need to have a value of any positive number. The input for the tool can be vector. At the end you would probably want to convert the cost path raster back to vector. From that vector you could query all the places the buffer reached. Hope that helps.
|
30,568 |
I have two shapefiles that contain position information for individuals, one is their reported location (line segments) and the other is their high-frequency recorded location (point data); they have an ID field that is common between them. What I am looking to do is identify the *reported* locations in the larger recorded data set with a spatial selection. The problem is my data is so condensed that I cannot do a simple select by location. There is too much overlap of individual locations. I also have over 1,000 individual IDs so I don't want to individually query each ID.
What I am looking for is a way to use possibly a cursor to go through each unique ID, query only the records in each table that share that ID, then do the spatial selection. I am very new to cursors and scripting in general so I don't know if a cursor can be used for two tables. *(This may be irrelevant but for this process I can convert my line data to point data if having the same type of shapefiles is important.)*
***(Removed previous code that I am no longer using)***
I am also unaware if maybe Make Query Table will work for this (I have never used it).
Thanks!
**UPDATE:** Here is a new code that I worked on with a fellow GIS person. GOOD NEWS! After leaving ArcGIS alone for a while, my code ran! It went as expected, but only did one iteration on one ID. The iteration should be implied in the Cursor as far as I know, or is there a line of code I'm missing that tells the Cursor to repeat for all IDs?
```
rows = arcpy.SearchCursor("hmb_logbook_2009")
for row in rows:
whereClause = '"trip_id" = ' + str(row.trip_id)
arcpy.MakeFeatureLayer_management("hmb_logbook_2009", "currentLines", whereClause)
arcpy.SelectLayerByLocation_management("hmb2009", "WITHIN_A_DISTANCE", "currentLines", "1 Miles", "NEW_SELECTION")
arcpy.SelectLayerByAttribute_management("hmb2009", "SUBSET_SELECTION", ' "trip_id" = ' + str(row.trip_id))
arcpy.CalculateField_management("hmb2009", "match_activity", 1)
arcpy.SelectLayerByAttribute_management("hmb2009", "CLEAR_SELECTION")
arcpy.Delete_management("currentLines")
del row, rows
```
**UPDATE 2:** So I have troubleshooted, and the reason the code only ran once is this error associated with my Make Feature Layer tool. Here is the error message: **ERROR 000622: Failed to execute (Make Feature Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter in\_features.**
I tried putting the full address into that tool (only that one) instead of referencing the layer in the map and it works!
|
2012/07/30
|
[
"https://gis.stackexchange.com/questions/30568",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/8061/"
] |
If I understand the question correctly, I would perform the buffer as normal, then intersect your buffer result with your physical barrier features (rivers?). Then do a select by location to select the features in the intersect results that do **not** touch your points. Delete these, and you are done. It is essentially what you are already doing manually, but in an automated fashion.
|
Merge all 50 sites of points if feasible (no need to do this 50 times, unless differing projections or other important reason to do so).
Create study area extent from points envelope (Minimum Bounding Geometry is one such tool to do this).
Union river with extent and Add/Calculate Field as text type named "SIDE": 'sideA', 'River', 'sideB' (alternatively, use integers - in either case you will need to interactively select polygons prior to calculating the appropriate values); example name for this output may be river\_side.
Intersect points with river\_side to associate "SIDE" attribute with points; example name for this output may be points\_side.
Buffer points\_side.
Intersect buffers with river\_side to get 'SIDE\_1' attribute (automatic field naming convention appends a '\_1' to the end).
Select Features By Attribute where "SIDE" = "SIDE\_1".
Dissolve by all required fields to get full, contiguous, and possibly overlapping buffers on one side of the river (same side as the original point).
The idea here is that the points and buffers on same correct side of river will have matching side values - all else (inside river and other side of river will get discarded).
|
38,256,682 |
I started with rails 5, I am noob in rails. I want to create a simple API, but I want to have views (such as active admin). I found the autogenerated API using the code 'rails new backend' command.
Is there a way to autogenerate views and not only Json response using this command?
|
2016/07/07
|
[
"https://Stackoverflow.com/questions/38256682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6541971/"
] |
I may not have the answer, but [I found this which may be a better answer to the question.](https://www.reddit.com/r/rails/comments/3vayy6/can_activeadmin_be_used_with_rails_api/)
Approach:
Subclass `APIController` from `ActionController::API`, rather than `ApplicationController`, make `ApplicationController` inherit from `ActionController::Base`.
You may include the `Rack::MethodOverride` middleware.
I'd try to build something similar to this in the coming week, largely to learn about `ActiveAdmin` and some newer Rails methodologies.
|
Using the standard ActiveAdmin interface won't work with an API app because those (by definition) cut away the presentation layer, i. e. all the gems for views/js/etc.
But it will work the other way around: --api is almost a subset of a full rails application and comes with, for example, json rendering by default. I say 'almost' because a few details need to be adjusted, such as (probably) cors and csrf settings.
You can get get to a functioning rails 5 app serving .json in about a minute:
```
rails new foo
rails db:setup
rails generate scaffold Post title:string body:text
rails db:migrate
rails server
-> http://localhost:3000/posts/index.json
```
Apart from reading the docs and a few tutorials, you should generate two applications, one with --api and one without, add model/views/controller scaffold and just walk through the diff. Then you can mix&match the customizations for api-mode into your app.
|
38,256,682 |
I started with rails 5, I am noob in rails. I want to create a simple API, but I want to have views (such as active admin). I found the autogenerated API using the code 'rails new backend' command.
Is there a way to autogenerate views and not only Json response using this command?
|
2016/07/07
|
[
"https://Stackoverflow.com/questions/38256682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6541971/"
] |
I may not have the answer, but [I found this which may be a better answer to the question.](https://www.reddit.com/r/rails/comments/3vayy6/can_activeadmin_be_used_with_rails_api/)
Approach:
Subclass `APIController` from `ActionController::API`, rather than `ApplicationController`, make `ApplicationController` inherit from `ActionController::Base`.
You may include the `Rack::MethodOverride` middleware.
I'd try to build something similar to this in the coming week, largely to learn about `ActiveAdmin` and some newer Rails methodologies.
|
Enabling Active Admin for Rails 5 API application
=================================================
1. Separate view-rendering controllers from API controllers
-----------------------------------------------------------
* Active Admin requires `ApplicationController` to inherit from `ActionController::Base`.
* API controllers should still inherit from `ActionController::API`
Use the following
```
class ApplicationController < ActionController::Base
class APIController < ActionController::API
```
where any API-specific controllers inherit from `APIController`.
2. Enable `flash` middleware
----------------------------
Inside `config/application.rb`
```
module MyApp
class Application < Rails::Application
# ...
# add this =>
config.middleware.use ActionDispatch::Flash
end
end
```
3. (For Devise authentication) Enable session management
========================================================
Inside `config/application.rb`
```
module MyApp
class Application < Rails::Application
# ...
# add these =>
config.middleware.use ActionDispatch::Cookies
config.middleware.use ActionDispatch::Session::CookieStore
end
end
```
Here is the [full guide](http://www.carlosramireziii.com/how-to-add-active-admin-to-a-rails-5-api-application.html?utm_source=stackoverflow)
|
26,496,802 |
Is there any way, using currently available SDK frameworks on Cocoa (touch) to create a streaming solution where I would host my mp4 content on some server and stream it to my iOS client app?
I know how to write such a client, but it's a bit confusing on server side.
AFAIK cloudKit is not suitable for that task because behind the scenes it keeps a synced local copy of datastore which is NOT what I want. I want to store media content remotely and stream it to the client so that it does not takes precious space on a poor 16 GB iPad mini.
Can I accomplish that server solution using Objective-C / Cocoa Touch at all?
Should I instead resort to Azure and C#?
|
2014/10/21
|
[
"https://Stackoverflow.com/questions/26496802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4167695/"
] |
It's not 100% clear why would you do anything like that?
If you have control over the server side, why don't you just set up a basic HTTP server, and on client side use AVPlayer to fetch the mp4 and play it back to the user? It is very simple. A basic apache setup would do the job.
If it is live media content you want to stream, then it is worth to read this guide as well:
<https://developer.apple.com/Library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/StreamingMediaGuide.pdf>
*Edited after your comment:*
If you would like to use AVPlayer as a player, then I think those two things don't fit that well. AVPlayer needs to buffer different ranges ahead (for some container formats the second/third request is reading the end of the stream). As far as I can see *CKFetchRecordsOperation* (which you would use to fetch the content from the server) is not capable of seeking in the stream.
If you have your private player which doesn't require seeking, then you might be able to use CKFetchRecordsOperation's *perRecordProgressBlock* to feed your player with data.
|
Yes, you could do that with CloudKit. First, it is not true that CloudKit keeps a local copy of the data. It is up to you what you do with the downloaded data. There isn't even any caching in CloudKit.
To do what you want to do, assuming the content is shared between users, you could upload it to CloudKit in the public database of your app. I think you could do this with the CloudKit web interface, but otherwise you could create a simple Mac app to manage the uploads.
The client app could then download the files. It couldn't stream them though, as far as I know. It would have to download all the files.
If you want a streaming solution, you would probably have to figure out how to split the files into small chunks, and recombine them on the client app.
|
26,496,802 |
Is there any way, using currently available SDK frameworks on Cocoa (touch) to create a streaming solution where I would host my mp4 content on some server and stream it to my iOS client app?
I know how to write such a client, but it's a bit confusing on server side.
AFAIK cloudKit is not suitable for that task because behind the scenes it keeps a synced local copy of datastore which is NOT what I want. I want to store media content remotely and stream it to the client so that it does not takes precious space on a poor 16 GB iPad mini.
Can I accomplish that server solution using Objective-C / Cocoa Touch at all?
Should I instead resort to Azure and C#?
|
2014/10/21
|
[
"https://Stackoverflow.com/questions/26496802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4167695/"
] |
It's not 100% clear why would you do anything like that?
If you have control over the server side, why don't you just set up a basic HTTP server, and on client side use AVPlayer to fetch the mp4 and play it back to the user? It is very simple. A basic apache setup would do the job.
If it is live media content you want to stream, then it is worth to read this guide as well:
<https://developer.apple.com/Library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/StreamingMediaGuide.pdf>
*Edited after your comment:*
If you would like to use AVPlayer as a player, then I think those two things don't fit that well. AVPlayer needs to buffer different ranges ahead (for some container formats the second/third request is reading the end of the stream). As far as I can see *CKFetchRecordsOperation* (which you would use to fetch the content from the server) is not capable of seeking in the stream.
If you have your private player which doesn't require seeking, then you might be able to use CKFetchRecordsOperation's *perRecordProgressBlock* to feed your player with data.
|
I'm not sure whether this [document](https://developer.apple.com/Library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/StreamingMediaGuide.pdf "document") is up-to-date, but there is paragraph "Requirements for Apps" which demands using HTTP Live Streaming if you deliver any video exceeding 10min. or 5MB.
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
use DateTime.now - 1
```
1.9.3p194 :040 > DateTime.now
=> Mon, 18 Nov 2013 17:58:45 +0530
1.9.3p194 :041 > DateTime.now - 1
=> Sun, 17 Nov 2013 17:58:49 +0530
```
or DateTime.yesterday
```
1.9.3p194 :042 > DateTime.yesterday
=> Sun, 17 Nov 2013
```
or we can use `rails` `advance` method for `Time` and `DateTime`
```
1.9.3p194 :043 > Time.now.advance(days: -1)
=> 2013-11-17 17:59:36 +0530
1.9.3p194 :044 > DateTime.now.advance(days: -1)
=> Sun, 17 Nov 2013 17:59:49 +0530
```
`advance` method also provides this options `:years, :months, :weeks, :days, :hours, :minutes, :seconds`
[DateTime advance method](http://apidock.com/rails/DateTime/advance)
[Time advance method](http://apidock.com/rails/Time/advance)
|
You can just subtract 86400 from a `Time` object to get one day before. If you are using Rails, or have ActiveSupport included, you can replace 86400 with `1.days`.
If you're using a `Date` object, and not a `Time` object, just subtract 1 from it.
To check if one date/time is before/after another, just compare the two objects like you would do for numbers:
```
DateTime.parse("2009-05-17T22:38:42-07:00") < DateTime.parse("2009-05-16T22:38:42-07:00")
# => false
```
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
After trying `1.day.ago` and variants on it:
```
irb(main):005:0> 1.day.ago
NoMethodError: undefined method `day' for 1:Fixnum
```
if found that `Date.today.prev_day` works for me:
```
irb(main):016:0> Date.today.prev_day
=> #<Date: 2013-04-09 ((2456392j,0s,0n),+0s,2299161j)>
```
|
Ruby 2.1.2 Native Time
Answer:
```
Time.at(Time.now.to_i - 86400)
```
Proof:
```
2.1.2 :016 > Time.now
=> 2014-07-01 13:36:24 -0400
2.1.2 :017 > Time.now.to_i
=> 1404236192
2.1.2 :018 > Time.now.to_i - 86400
=> 1404149804
2.1.2 :019 > Time.at(Time.now.to_i - 86400)
=> 2014-06-30 13:36:53 -0400
```
One Day of Seconds.
86400 = 1 day (60 \* 60 \* 24)
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
### Rails
For a date object you could use:
```
Date.yesterday
```
Or a time object:
```
1.day.ago
```
### Ruby
Or outside of rails:
```
require 'date'
Date.today.prev_day
```
|
Ruby 2.1.2 Native Time
Answer:
```
Time.at(Time.now.to_i - 86400)
```
Proof:
```
2.1.2 :016 > Time.now
=> 2014-07-01 13:36:24 -0400
2.1.2 :017 > Time.now.to_i
=> 1404236192
2.1.2 :018 > Time.now.to_i - 86400
=> 1404149804
2.1.2 :019 > Time.at(Time.now.to_i - 86400)
=> 2014-06-30 13:36:53 -0400
```
One Day of Seconds.
86400 = 1 day (60 \* 60 \* 24)
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
```
Time.now - (3600 * 24) # or Time.now - 86400
```
or
```
require 'date'
Date.today.prev_day
```
|
You can just subtract 86400 from a `Time` object to get one day before. If you are using Rails, or have ActiveSupport included, you can replace 86400 with `1.days`.
If you're using a `Date` object, and not a `Time` object, just subtract 1 from it.
To check if one date/time is before/after another, just compare the two objects like you would do for numbers:
```
DateTime.parse("2009-05-17T22:38:42-07:00") < DateTime.parse("2009-05-16T22:38:42-07:00")
# => false
```
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
### Rails
For a date object you could use:
```
Date.yesterday
```
Or a time object:
```
1.day.ago
```
### Ruby
Or outside of rails:
```
require 'date'
Date.today.prev_day
```
|
You can just subtract 86400 from a `Time` object to get one day before. If you are using Rails, or have ActiveSupport included, you can replace 86400 with `1.days`.
If you're using a `Date` object, and not a `Time` object, just subtract 1 from it.
To check if one date/time is before/after another, just compare the two objects like you would do for numbers:
```
DateTime.parse("2009-05-17T22:38:42-07:00") < DateTime.parse("2009-05-16T22:38:42-07:00")
# => false
```
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
```
Time.now - (3600 * 24) # or Time.now - 86400
```
or
```
require 'date'
Date.today.prev_day
```
|
Ruby 2.1.2 Native Time
Answer:
```
Time.at(Time.now.to_i - 86400)
```
Proof:
```
2.1.2 :016 > Time.now
=> 2014-07-01 13:36:24 -0400
2.1.2 :017 > Time.now.to_i
=> 1404236192
2.1.2 :018 > Time.now.to_i - 86400
=> 1404149804
2.1.2 :019 > Time.at(Time.now.to_i - 86400)
=> 2014-06-30 13:36:53 -0400
```
One Day of Seconds.
86400 = 1 day (60 \* 60 \* 24)
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
After trying `1.day.ago` and variants on it:
```
irb(main):005:0> 1.day.ago
NoMethodError: undefined method `day' for 1:Fixnum
```
if found that `Date.today.prev_day` works for me:
```
irb(main):016:0> Date.today.prev_day
=> #<Date: 2013-04-09 ((2456392j,0s,0n),+0s,2299161j)>
```
|
Use Date.today - 1.days.
Date.yesterday depends on the current time and your offset from GMT
```
1.9.3-p125 :100 > Date.today
=> Wed, 29 Feb 2012
1.9.3-p125 :101 > Date.yesterday
=> Wed, 29 Feb 2012
1.9.3-p125 :102 > Date.today - 1.days
=> Tue, 28 Feb 2012
```
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
Use Date.today - 1.days.
Date.yesterday depends on the current time and your offset from GMT
```
1.9.3-p125 :100 > Date.today
=> Wed, 29 Feb 2012
1.9.3-p125 :101 > Date.yesterday
=> Wed, 29 Feb 2012
1.9.3-p125 :102 > Date.today - 1.days
=> Tue, 28 Feb 2012
```
|
You can just subtract 86400 from a `Time` object to get one day before. If you are using Rails, or have ActiveSupport included, you can replace 86400 with `1.days`.
If you're using a `Date` object, and not a `Time` object, just subtract 1 from it.
To check if one date/time is before/after another, just compare the two objects like you would do for numbers:
```
DateTime.parse("2009-05-17T22:38:42-07:00") < DateTime.parse("2009-05-16T22:38:42-07:00")
# => false
```
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
### Rails
For a date object you could use:
```
Date.yesterday
```
Or a time object:
```
1.day.ago
```
### Ruby
Or outside of rails:
```
require 'date'
Date.today.prev_day
```
|
```
Time.now - (3600 * 24) # or Time.now - 86400
```
or
```
require 'date'
Date.today.prev_day
```
|
6,490,042 |
>
> **Possible Duplicate:**
>
> [Php/Java Integration](https://stackoverflow.com/questions/3319161/php-java-integration)
>
>
>
I have a java app. It has some function. How can I call It's function in PHP?
I need step by step tutorial about it.
I need solution except Java/PHP Bridge and Thrift.
|
2011/06/27
|
[
"https://Stackoverflow.com/questions/6490042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816951/"
] |
### Rails
For a date object you could use:
```
Date.yesterday
```
Or a time object:
```
1.day.ago
```
### Ruby
Or outside of rails:
```
require 'date'
Date.today.prev_day
```
|
Use Date.today - 1.days.
Date.yesterday depends on the current time and your offset from GMT
```
1.9.3-p125 :100 > Date.today
=> Wed, 29 Feb 2012
1.9.3-p125 :101 > Date.yesterday
=> Wed, 29 Feb 2012
1.9.3-p125 :102 > Date.today - 1.days
=> Tue, 28 Feb 2012
```
|
25,053,241 |
At the moment I'm programming an object oriented hotel application to learn OOP.
I chose this because in my book (PHP Design Patterns from O'Reilly) they programmed a car rental company.
Now I'm finished with the basic business logic but I still have some problems.
In the Hotel class are the following methods:
```
//All public functions, left it hhere cause of the length
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
changeRoom( HotelRoom $oldRoom, HotelRoom $newRoom, HotelCustomer $customer, DateTime $from, DateTime $to)
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
```
So for every step I do (reserving, changing the room or checkout) I have to pass the HotelRoom as a parameter. Every room has an id and a number.
Would it better to implement a method `addRoom(HotelRoom $room)` and store all rooms in a protected property `$rooms` array and then only pass the `HotelRoom::$id` for the methods or is there a better way?
I'm relatively new to OOP and just want to now what is a good practice.
|
2014/07/31
|
[
"https://Stackoverflow.com/questions/25053241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2824945/"
] |
I would go the following way:
Add object Booking, which has the from, to and reference to the hotel room and to customer
Then changeRoom becomes a method of the booking, and it only changes the room, not the dates.
Also checkout becomes a method of the booking, as it doesn't make sense to provide dates for the checkout.
The room holds when it's available and when is not and should provide methods for just that.
The Hotel holds all the rooms and one should always get the room from the hotel object
```
Hotel
getRoom($id)
getAvailableRooms($from, $to)
HotelRoom
checkIn($from, $to) - proxy to reserve($from, $to) - sets the availability
free($from, $to)
Booking
changeRoom($newRoom)
changeDates($from, $to) // this might be tricky, as it may require changing the room as well
checkOut() // sets the room from the current date to the end of the booking (in case of early checkout) as available
```
|
You can do that, but instead of having `addRoom()`, you could have a function `loadRooms()` which utilizes the DataBase access object to load all rooms. When it comes to booking you would like to load only the free rooms, same applies for the changing of the rooms. You don't need to do that in `checkout()`.
|
25,053,241 |
At the moment I'm programming an object oriented hotel application to learn OOP.
I chose this because in my book (PHP Design Patterns from O'Reilly) they programmed a car rental company.
Now I'm finished with the basic business logic but I still have some problems.
In the Hotel class are the following methods:
```
//All public functions, left it hhere cause of the length
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
changeRoom( HotelRoom $oldRoom, HotelRoom $newRoom, HotelCustomer $customer, DateTime $from, DateTime $to)
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
```
So for every step I do (reserving, changing the room or checkout) I have to pass the HotelRoom as a parameter. Every room has an id and a number.
Would it better to implement a method `addRoom(HotelRoom $room)` and store all rooms in a protected property `$rooms` array and then only pass the `HotelRoom::$id` for the methods or is there a better way?
I'm relatively new to OOP and just want to now what is a good practice.
|
2014/07/31
|
[
"https://Stackoverflow.com/questions/25053241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2824945/"
] |
I would not make your `Hotel` class responsible for your three functions that you have mentioned. They are very specific functions, whereas `Hotel` is a very broad class.
Consider having a `RoomManager` and a `CustomerManager` class. Inject these classes into the `Hotel` class, and have them responsible for retrieving `Room`'s and `Customer`'s. The `Room` and `Customer` class should contain the specific functions that you have outlined:
```
class Hotel
{
public $roomManager;
public $customerManager;
public function __construct(RoomManager $rm, CustomerManager $cm)
{
$this->roomManager = $rm;
$this->customerManager = $cm;
}
// ...
}
class RoomManager
{
public function getRoom($id)
{
// find room where Room->id == $id;
return $room;
}
// some other stuff may become relevant in here
}
class CustomerManager
{
public function getCustomer($id)
{
// find customer where Customer->id == $id;
return $customer;
}
// some other stuff may become relevant in here
}
class Room
{
public function checkout(DateTime $from, DateTime $to)
{
// ...
}
}
class Customer
{
private $room;
public function setRoom(Room $hr)
{
$this->room = $hr;
}
}
```
Client code would be something like:
```
// instantiate a Hotel and inject its 2 dependencies
$hotel = new Hotel(new RoomManager, new CustomerManager);
// checkout Room 3
$hotel->roomManager->getRoom(3)->checkout();
// change Customer 2's Room from Room 3 to Room 4
$newRoom = $hotel->roomManager->getRoom(4);
$hotel->customerManager->getCustomer(2)->setRoom($newRoom);
```
Notice how the responsibility of your classes have become more specific. A `Hotel` class simply wants to manage the specific components.
|
You can do that, but instead of having `addRoom()`, you could have a function `loadRooms()` which utilizes the DataBase access object to load all rooms. When it comes to booking you would like to load only the free rooms, same applies for the changing of the rooms. You don't need to do that in `checkout()`.
|
25,053,241 |
At the moment I'm programming an object oriented hotel application to learn OOP.
I chose this because in my book (PHP Design Patterns from O'Reilly) they programmed a car rental company.
Now I'm finished with the basic business logic but I still have some problems.
In the Hotel class are the following methods:
```
//All public functions, left it hhere cause of the length
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
changeRoom( HotelRoom $oldRoom, HotelRoom $newRoom, HotelCustomer $customer, DateTime $from, DateTime $to)
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
```
So for every step I do (reserving, changing the room or checkout) I have to pass the HotelRoom as a parameter. Every room has an id and a number.
Would it better to implement a method `addRoom(HotelRoom $room)` and store all rooms in a protected property `$rooms` array and then only pass the `HotelRoom::$id` for the methods or is there a better way?
I'm relatively new to OOP and just want to now what is a good practice.
|
2014/07/31
|
[
"https://Stackoverflow.com/questions/25053241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2824945/"
] |
I would go the following way:
Add object Booking, which has the from, to and reference to the hotel room and to customer
Then changeRoom becomes a method of the booking, and it only changes the room, not the dates.
Also checkout becomes a method of the booking, as it doesn't make sense to provide dates for the checkout.
The room holds when it's available and when is not and should provide methods for just that.
The Hotel holds all the rooms and one should always get the room from the hotel object
```
Hotel
getRoom($id)
getAvailableRooms($from, $to)
HotelRoom
checkIn($from, $to) - proxy to reserve($from, $to) - sets the availability
free($from, $to)
Booking
changeRoom($newRoom)
changeDates($from, $to) // this might be tricky, as it may require changing the room as well
checkOut() // sets the room from the current date to the end of the booking (in case of early checkout) as available
```
|
Technically the two approaches is similar. According to the clean coding it is better to pass the room object instead of a number because your code is more readable. Anyone uses your class will know he is working with "rooms" not just a number.
|
25,053,241 |
At the moment I'm programming an object oriented hotel application to learn OOP.
I chose this because in my book (PHP Design Patterns from O'Reilly) they programmed a car rental company.
Now I'm finished with the basic business logic but I still have some problems.
In the Hotel class are the following methods:
```
//All public functions, left it hhere cause of the length
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
changeRoom( HotelRoom $oldRoom, HotelRoom $newRoom, HotelCustomer $customer, DateTime $from, DateTime $to)
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
```
So for every step I do (reserving, changing the room or checkout) I have to pass the HotelRoom as a parameter. Every room has an id and a number.
Would it better to implement a method `addRoom(HotelRoom $room)` and store all rooms in a protected property `$rooms` array and then only pass the `HotelRoom::$id` for the methods or is there a better way?
I'm relatively new to OOP and just want to now what is a good practice.
|
2014/07/31
|
[
"https://Stackoverflow.com/questions/25053241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2824945/"
] |
I would not make your `Hotel` class responsible for your three functions that you have mentioned. They are very specific functions, whereas `Hotel` is a very broad class.
Consider having a `RoomManager` and a `CustomerManager` class. Inject these classes into the `Hotel` class, and have them responsible for retrieving `Room`'s and `Customer`'s. The `Room` and `Customer` class should contain the specific functions that you have outlined:
```
class Hotel
{
public $roomManager;
public $customerManager;
public function __construct(RoomManager $rm, CustomerManager $cm)
{
$this->roomManager = $rm;
$this->customerManager = $cm;
}
// ...
}
class RoomManager
{
public function getRoom($id)
{
// find room where Room->id == $id;
return $room;
}
// some other stuff may become relevant in here
}
class CustomerManager
{
public function getCustomer($id)
{
// find customer where Customer->id == $id;
return $customer;
}
// some other stuff may become relevant in here
}
class Room
{
public function checkout(DateTime $from, DateTime $to)
{
// ...
}
}
class Customer
{
private $room;
public function setRoom(Room $hr)
{
$this->room = $hr;
}
}
```
Client code would be something like:
```
// instantiate a Hotel and inject its 2 dependencies
$hotel = new Hotel(new RoomManager, new CustomerManager);
// checkout Room 3
$hotel->roomManager->getRoom(3)->checkout();
// change Customer 2's Room from Room 3 to Room 4
$newRoom = $hotel->roomManager->getRoom(4);
$hotel->customerManager->getCustomer(2)->setRoom($newRoom);
```
Notice how the responsibility of your classes have become more specific. A `Hotel` class simply wants to manage the specific components.
|
I would go the following way:
Add object Booking, which has the from, to and reference to the hotel room and to customer
Then changeRoom becomes a method of the booking, and it only changes the room, not the dates.
Also checkout becomes a method of the booking, as it doesn't make sense to provide dates for the checkout.
The room holds when it's available and when is not and should provide methods for just that.
The Hotel holds all the rooms and one should always get the room from the hotel object
```
Hotel
getRoom($id)
getAvailableRooms($from, $to)
HotelRoom
checkIn($from, $to) - proxy to reserve($from, $to) - sets the availability
free($from, $to)
Booking
changeRoom($newRoom)
changeDates($from, $to) // this might be tricky, as it may require changing the room as well
checkOut() // sets the room from the current date to the end of the booking (in case of early checkout) as available
```
|
25,053,241 |
At the moment I'm programming an object oriented hotel application to learn OOP.
I chose this because in my book (PHP Design Patterns from O'Reilly) they programmed a car rental company.
Now I'm finished with the basic business logic but I still have some problems.
In the Hotel class are the following methods:
```
//All public functions, left it hhere cause of the length
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
changeRoom( HotelRoom $oldRoom, HotelRoom $newRoom, HotelCustomer $customer, DateTime $from, DateTime $to)
checkOut( HotelRoom $room, DateTime $from, DateTime $to )
```
So for every step I do (reserving, changing the room or checkout) I have to pass the HotelRoom as a parameter. Every room has an id and a number.
Would it better to implement a method `addRoom(HotelRoom $room)` and store all rooms in a protected property `$rooms` array and then only pass the `HotelRoom::$id` for the methods or is there a better way?
I'm relatively new to OOP and just want to now what is a good practice.
|
2014/07/31
|
[
"https://Stackoverflow.com/questions/25053241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2824945/"
] |
I would not make your `Hotel` class responsible for your three functions that you have mentioned. They are very specific functions, whereas `Hotel` is a very broad class.
Consider having a `RoomManager` and a `CustomerManager` class. Inject these classes into the `Hotel` class, and have them responsible for retrieving `Room`'s and `Customer`'s. The `Room` and `Customer` class should contain the specific functions that you have outlined:
```
class Hotel
{
public $roomManager;
public $customerManager;
public function __construct(RoomManager $rm, CustomerManager $cm)
{
$this->roomManager = $rm;
$this->customerManager = $cm;
}
// ...
}
class RoomManager
{
public function getRoom($id)
{
// find room where Room->id == $id;
return $room;
}
// some other stuff may become relevant in here
}
class CustomerManager
{
public function getCustomer($id)
{
// find customer where Customer->id == $id;
return $customer;
}
// some other stuff may become relevant in here
}
class Room
{
public function checkout(DateTime $from, DateTime $to)
{
// ...
}
}
class Customer
{
private $room;
public function setRoom(Room $hr)
{
$this->room = $hr;
}
}
```
Client code would be something like:
```
// instantiate a Hotel and inject its 2 dependencies
$hotel = new Hotel(new RoomManager, new CustomerManager);
// checkout Room 3
$hotel->roomManager->getRoom(3)->checkout();
// change Customer 2's Room from Room 3 to Room 4
$newRoom = $hotel->roomManager->getRoom(4);
$hotel->customerManager->getCustomer(2)->setRoom($newRoom);
```
Notice how the responsibility of your classes have become more specific. A `Hotel` class simply wants to manage the specific components.
|
Technically the two approaches is similar. According to the clean coding it is better to pass the room object instead of a number because your code is more readable. Anyone uses your class will know he is working with "rooms" not just a number.
|
15,076 |
We have just received a large set of DEMs at work and I would like to generate contours from them. The DEMs have a resolution of 1m and a size of 1kmx1km.
Output from gdalinfo:
```
Driver: AAIGrid/Arc/Info ASCII Grid
Files: 380000_6888000_1k_1m_DEM_ESRI.asc
Size is 1000, 1000
Coordinate System is `'
Origin = (380000.000000000000000,6888000.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Corner Coordinates:
Upper Left ( 380000.000, 6888000.000)
Lower Left ( 380000.000, 6887000.000)
Upper Right ( 381000.000, 6888000.000)
Lower Right ( 381000.000, 6887000.000)
Center ( 380500.000, 6887500.000)
Band 1 Block=1000x1 Type=Float32, ColorInterp=Undefined
NoData Value=-9999
```
I know I can use gdal\_contour to generate the contours ([my blog post on the topic](http://woostuff.wordpress.com/2011/09/27/generating-contours-using-gdal-via-shell-or-qgis/)) but I'm wondering what some **best practices** for generating contours are.
Are there any rules you should follow to get the most out of the contours but not make stuff up or loose too much information?
Say I want to generate three sets of contours:
* 250mm
* 1m
* 5m
**Is there anything I should do to the DEM before each set?**
**Is post smoothing of the lines a good way to go or is smoothing the raster a better option?**
|
2011/09/27
|
[
"https://gis.stackexchange.com/questions/15076",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/97/"
] |
Cartographic rules to represent the relief as contours are presented in [Imhof's famous book on relief representation, chapter C](http://esripress.esri.com/display/index.cfm?fuseaction=display&websiteID=118&moduleID=1). Some of these rules are given on [this wikipedia page](http://en.wikipedia.org/wiki/Cartographic_relief_depiction#Contour_lines). The main recommendation when simplifying contours it to preserve the terrain main characteristics.
Smoothing the contours independently do not prevent them to overlap: It is advised to smooth the DTM first. A traditional Gaussian smoothing with a suitable parameter depending on the target resolution allows to erase the small details. A drawback is that DTM smoothing fills the valleys and depressions, and flattens the ridges and peaks. Using the douglass-peucker filter algorithm like [in this paper](http://www.isprs.org/proceedings/XXXVII/congress/1_pdf/129.pdf) may be a solution. There are also [number of methods](http://www.citeulike.org/user/jgaffuri/tag/contour) based on the use of contour smoothing algorithms constrained by the drainage network or a skeleton. Finally, to prevent the contours to overlap in sloppy parts, it is possible [to erase them locally](http://www.geos.ed.ac.uk/homes/wam/MackSteven2006.pdf) or also [deform them](http://icaci.org/documents/ICC_proceedings/ICC2009/html/refer/19_2.pdf).
|
I want to second @whuber's comment. Quantitative Analysis is always better from a DEM directly and Visual Analysis is often better when done from a Hillshade rather than contours.
To answer the question directly:
In ArcGIS I would use either Focal Statistics or Aggregate [Spatial Analyst Toolbox] to smooth the resulting contour lines. Because contours are a visual analysis feature the amount of smoothing will vary on your need. So you'll have to experiment and see what works best for your project.
Smoothing the lines after generating them does work but is a little clunky compared to modifying the raster first. One post-contour generation clean up I often do is to select the lines of a certain length (e.g. <10' long) and delete them. This rids the data of "noisy" little bits of closed contours (i.e. tiny loops) that are unlikely to reflect the actual character of the surface being modeled by the contours.
Other things you might look at [ArcGIS users] are:
Making a Raster Mosaic and/or Focal Statistics Raster Mosaic and use a model to generate contours for the whole dataset.
Making 3D contours for AutoCAD use.
Watch out for areas of unusual DEM data (e.g. large expanses of low lying ground needing different contour intervals to accurately represent the surface, areas of dense vegetation giving bogus Bare Earth values, areas of vertical relief - cliffs, etc).
|
15,076 |
We have just received a large set of DEMs at work and I would like to generate contours from them. The DEMs have a resolution of 1m and a size of 1kmx1km.
Output from gdalinfo:
```
Driver: AAIGrid/Arc/Info ASCII Grid
Files: 380000_6888000_1k_1m_DEM_ESRI.asc
Size is 1000, 1000
Coordinate System is `'
Origin = (380000.000000000000000,6888000.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Corner Coordinates:
Upper Left ( 380000.000, 6888000.000)
Lower Left ( 380000.000, 6887000.000)
Upper Right ( 381000.000, 6888000.000)
Lower Right ( 381000.000, 6887000.000)
Center ( 380500.000, 6887500.000)
Band 1 Block=1000x1 Type=Float32, ColorInterp=Undefined
NoData Value=-9999
```
I know I can use gdal\_contour to generate the contours ([my blog post on the topic](http://woostuff.wordpress.com/2011/09/27/generating-contours-using-gdal-via-shell-or-qgis/)) but I'm wondering what some **best practices** for generating contours are.
Are there any rules you should follow to get the most out of the contours but not make stuff up or loose too much information?
Say I want to generate three sets of contours:
* 250mm
* 1m
* 5m
**Is there anything I should do to the DEM before each set?**
**Is post smoothing of the lines a good way to go or is smoothing the raster a better option?**
|
2011/09/27
|
[
"https://gis.stackexchange.com/questions/15076",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/97/"
] |
Cartographic rules to represent the relief as contours are presented in [Imhof's famous book on relief representation, chapter C](http://esripress.esri.com/display/index.cfm?fuseaction=display&websiteID=118&moduleID=1). Some of these rules are given on [this wikipedia page](http://en.wikipedia.org/wiki/Cartographic_relief_depiction#Contour_lines). The main recommendation when simplifying contours it to preserve the terrain main characteristics.
Smoothing the contours independently do not prevent them to overlap: It is advised to smooth the DTM first. A traditional Gaussian smoothing with a suitable parameter depending on the target resolution allows to erase the small details. A drawback is that DTM smoothing fills the valleys and depressions, and flattens the ridges and peaks. Using the douglass-peucker filter algorithm like [in this paper](http://www.isprs.org/proceedings/XXXVII/congress/1_pdf/129.pdf) may be a solution. There are also [number of methods](http://www.citeulike.org/user/jgaffuri/tag/contour) based on the use of contour smoothing algorithms constrained by the drainage network or a skeleton. Finally, to prevent the contours to overlap in sloppy parts, it is possible [to erase them locally](http://www.geos.ed.ac.uk/homes/wam/MackSteven2006.pdf) or also [deform them](http://icaci.org/documents/ICC_proceedings/ICC2009/html/refer/19_2.pdf).
|
There is a easy way using gdal\_contour. After setting all option in the dialog window you can then edit the command line and instead the "-i interval" you can use fixed levels "-fl levels". Like the image shows bellow. You can check other options here <http://www.gdal.org/gdal_contour.html>
[](https://i.stack.imgur.com/H2Pta.png)
|
130,522 |
The Artscroll siddur says to grasp the front two tzizit while saying baruach sheomar. Why hold only 2 of the 4 tzitzit? For the shema we hold all 4.
|
2022/08/12
|
[
"https://judaism.stackexchange.com/questions/130522",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/8777/"
] |
This is from פסקי תשבות סימן נ"א:
פסקי תשובות אורח חיים סימן נא אות ג
ומש"כ המשנ"ב: ואוחז ב' הציציות לפניו בשעת אמירת ברוך שאמר. מקורו במג"א (סק"א) בשם כתבי האר"י ז"ל, וטעמו כי אור מצות ב' הציציות שלפניו מסבבים אותו מברכת ברוך שאמר עד ברכות ק"ש שאז נוסף אור מקיף גם מב' הציציות שלאחוריו
The basic concept is that in the beginning of pesukie dizimra we are on a lower level, which we manifest only in front of us, and by shema we reach a higher level which we manifest all around us on all four sides.
It is hard to understand without a broader understanding of Arizal.
|
In addition to the above it is worth noting the [SA, OC 24:5](https://www.sefaria.org/Shulchan_Arukh%2C_Orach_Chayim.24.5?lang=bi&with=all&lang2=en):
>
> כשמסתכל בציציות מסתכל בב' ציציות שלפניו שיש בהם עשרה קשרים רמז להויות וגם יש בהם ט"ז חוטים ועשרה קשרים עולות כ"ו כשם ההויה
>
>
> When one looks upon the ציצית he should look at the two fringes in front of him that have ten knots in total that allude to the Havayot (ie. Hashem's name YKVK with 10 different vowelizations), and they also have sixteen strings and ten knots that total twenty six which is the [gematria of the divine] name YKVK.
>
>
>
So it would seem that the act of holding the two tzitzis equates to Hashem's name of YKWK (gematriah of 26) when totalling the knots and strings (16 strings = 10 knots) of the two tzitzis which is appropriate for this part of our liturgy - as someone who is not adept at kabbalah I can't tell you more than that...
|
29,396,600 |
I am writing a c-extension for python. As you can see below, the aim of the code is to calculate the euclidean-dist of two vectors.
the first param n is the dimension of the vectors,
the second , the third param is the two list of float.
I call the function in python like this:
```
import cutil
cutil.c_euclidean_dist(2,[1.0,1,0],[0,0])
```
and it worked well, return the right result.
but if i do it for more than 100 times(the dimension is 1\*1000), it will cause segmentation fault - core dump:
```
#!/usr/bin/env python
#coding:utf-8
import cutil
import science
import time
a = []
b = []
d = 0.0
for x in range(2500):
a.append([float(i+x) for i in range(1000)])
b.append([float(i-x) for i in range(1000)])
t1 = time.time()
for x in range(500):
d += cutil.c_euclidean_dist(1000,a[x],b[x])
print time.time() - t1
print d
```
the C code is here:
```
#include <python2.7/Python.h>
#include <math.h>
static PyObject* cutil_euclidean_dist(PyObject* self, PyObject* args) {
PyObject *seq_a, *seq_b;
int n;
float * array_a,* array_b;
PyObject *item;
PyArg_ParseTuple(args,"iOO", &n , &seq_a, &seq_b);
if (!PySequence_Check(seq_a) || !PySequence_Check(seq_b)) {
PyErr_SetString(PyExc_TypeError, "expected sequence");
return NULL;
}
array_a =(float *)malloc(sizeof(float)*n);
array_b =(float *)malloc(sizeof(float)*n);
if (NULL == array_a || NULL == array_b){
PyErr_SetString(PyExc_TypeError, "malloc failed!");
Py_DECREF(seq_a);
Py_DECREF(seq_b);
return NULL;
}
int i;
for(i=0;i<n;i++){
item = PySequence_GetItem(seq_a,i);
if (!PyFloat_Check(item)) {
free(array_a); /* free up the memory before leaving */
free(array_b);
Py_DECREF(seq_a);
Py_DECREF(seq_b);
Py_DECREF(item);
PyErr_SetString(PyExc_TypeError, "expected sequence of float");
return NULL;
}
array_a[i] = PyFloat_AsDouble(item);
Py_DECREF(item);
item = PySequence_GetItem(seq_b,i);
if(!PyFloat_Check(item)) {
free(array_a);
free(array_b);
Py_DECREF(seq_a);
Py_DECREF(seq_b);
Py_DECREF(item);
PyErr_SetString(PyExc_TypeError, "expected sequence of float");
return NULL;
}
array_b[i] = PyFloat_AsDouble(item);
Py_DECREF(item);
}
double sum = 0;
for(i=0;i<n;i++){
double delta = array_a[i] - array_b[i];
sum += delta * delta;
}
free(array_a);
free(array_b);
Py_DECREF(seq_a);
Py_DECREF(seq_b);
return Py_BuildValue("d",sqrt(sum));
}
static PyMethodDef cutil_methods[] = {
{"c_euclidean_dist",(PyCFunction)cutil_euclidean_dist,METH_VARARGS,NULL},
{NULL,NULL,0,NULL}
};
PyMODINIT_FUNC initcutil(void) {
Py_InitModule3("cutil", cutil_methods, "liurui's c extension for python");
}
```
the error msg:
```
segmentation fault - core dump:
```
The c-extension is compiled to cutil.so, I do not know how to see the dump.
But i looked through my C code for many times,and can not find any problem..
May it be **a memory problem**?
It should be a very simple piece of C code, what's wrong with it?
I need your help~ thanks a lot !
here is the result of gdb /usr/bin/python2.7 ./core:
```
root@ubuntu:/home/rrg/workspace/opencvTest/test# gdb /usr/bin/python2.7 ./core
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python2.7...Reading symbols from /usr/lib/debug//usr/bin/python2.7...done.
done.
warning: core file may not match specified executable file.
[New LWP 13787]
[New LWP 13789]
[New LWP 13790]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `python py.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000005398b3 in list_dealloc.16846 (op=0x7f688b2faa28) at ../Objects/listobject.c:309
309 ../Objects/listobject.c: no such file or directory
#0 0x00000000005398b3 in list_dealloc.16846 (op=0x7f688b2faa28) at ../Objects/listobject.c:309
#1 0x00000000004fdb96 in insertdict_by_entry (value=<optimized out>, ep=0x1777fa8, hash=<optimized out>, key='b', mp=0x7f68a8dbb168) at ../Objects/dictobject.c:519
#2 insertdict (value=<optimized out>, hash=<optimized out>, key='b', mp=0x7f68a8dbb168) at ../Objects/dictobject.c:556
#3 dict_set_item_by_hash_or_entry (value=<optimized out>, ep=0x0, hash=<optimized out>, key='b',
op={'a': None, 'x': None, 'c': None, 'b': None, 'd': <float at remote 0x4480b30>, '__builtins__': <module at remote 0x7f68a8de6b08>, 'science': <module at remote 0x7f68a8ce4088>, '__package__': None, 'i': 999, 'cutil': <module at remote 0x7f68a8cdfbb0>, 'time': <module at remote 0x7f68a640ea28>, '__name__': '__main__', 't1': <float at remote 0xd012708>, '__doc__': None}) at ../Objects/dictobject.c:765
#4 PyDict_SetItem (
op=op@entry={'a': None, 'x': None, 'c': None, 'b': None, 'd': <float at remote 0x4480b30>, '__builtins__': <module at remote 0x7f68a8de6b08>, 'science': <module at remote 0x7f68a8ce4088>, '__package__': None, 'i': 999, 'cutil': <module at remote 0x7f68a8cdfbb0>, 'time': <module at remote 0x7f68a640ea28>, '__name__': '__main__', 't1': <float at remote 0xd012708>, '__doc__': None}, key=key@entry='b',
value=<optimized out>) at ../Objects/dictobject.c:818
#5 0x000000000055a9e1 in _PyModule_Clear (m=<optimized out>) at ../Objects/moduleobject.c:139
#6 0x00000000004f2ad4 in PyImport_Cleanup () at ../Python/import.c:473
#7 0x000000000042fa89 in Py_Finalize () at ../Python/pythonrun.c:459
#8 0x000000000046ac10 in Py_Main (argc=<optimized out>, argv=0x7fff3958d058) at ../Modules/main.c:665
#9 0x00007f68a8665ec5 in __libc_start_main (main=0x46ac3f <main>, argc=2, argv=0x7fff3958d058, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff3958d048)
at libc-start.c:287
#10 0x000000000057497e in _start ()
```
Edit:
I comment the last 2 sentences near the last return:
```
Py_DECREF(seq_a);
Py_DECREF(seq_b);
```
and then it seems to work well. I feel very very strange...
The purpose of the two sentence is to free(or release) the two pyobject, why it works well without the two sentences which I think are necessary?
|
2015/04/01
|
[
"https://Stackoverflow.com/questions/29396600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3978288/"
] |
>
> The c-extension is compiled to cutil.so, I do not know how to see the dump.
>
>
>
To solve this, I'm going to cite [GNU Radio's GDB/Python debugging mini-tutorial](http://gnuradio.org/redmine/projects/gnuradio/wiki/TutorialsGDB):
>
> Luckily, there's a feature called core dumping that allows the state of your program to be stored in a file, allowing later analysis. Usually, that feature is disabled; you can enable it by:
>
>
>
> ```
> ulimit -c unlimited
>
> ```
>
> Note that this only works for processes spawned from the shell that you used ulimit in. What happens here is that the maximum size of a core dump is set to unlimited (the original value is 0 in most cases).
>
>
> Now, the core dump file lays in the current execution directory of the program that crashed. In our case, that's build/python/, but since all core dumps should have a name like core., we can use a little find magic:
>
>
>
> ```
> marcus> find -type f -cmin 5 -name 'core.[0-9]*'
>
> ```
>
> ./build/python/core.22608
>
>
> because that will find all \_f\_iles, changed/created within the last \_5 min\_utes, having a name that matches.
>
>
> Using GDB with a core dump
> --------------------------
>
>
> having found build/python/core.22608,
> we can now launch GDB:
>
>
>
> ```
> gdb programname coredump
>
> ```
>
> i.e.
>
>
>
> ```
> gdb /usr/bin/python2 build/python/core.22608
>
> ```
>
> A lot of information might scroll by.
>
>
> At the end, you're greeted by the GDB prompt:
>
>
>
> ```
> (gdb)
>
> ```
>
> Getting a backtrace
> -------------------
>
>
> Typically, you'd just get a backtrace (or shorter, bt). A backtrace is simply the hierarchy of functions that were called.
>
>
>
> ```
> (gdb)bt
>
> ```
>
>
[...] skipped,
>
> Frame #2 and following definitely look like they're part of the Python implementation -- that sounds bad, because GDB doesn't itself know how to debug python, but luckily, there's an extension to do that. So we can try to use py-bt:
>
>
>
> ```
> (gdb) py-bt
>
> ```
>
> If we get a undefined command error, we must stop here and make sure that the python development package is installed (python-devel on Redhatoids, python2.7-dev on Debianoids); for some systems, you should append the content of /usr/share/doc/{python-devel,python2.7-dev}/gdbinit[.gz] to your ~/.gdbinit, and re-start gdb.
>
>
> The output of py-bt now states clearly which python lines correspond to which stack frame (skipping those stack frames that are hidden to python, because they are in external libraries or python-implementation routines)
>
>
> ...
>
>
>
|
thanks for the 2 kind and nice guys above who helped me.
Problem seemed to be solved.
comment the 2 lines:
```
Py_DECREF(seq_a);
Py_DECREF(seq_b);
```
for more details pls read python offical doc on C-API
I guess the reason is that the seq\_a seq\_b get from argv is a "borrowed reference" rather than a real refference , so we do not need to decref().
but as the official docs says, if you convert the borrowed refference into a real referrence using a incref() , then you should call decref()
U can also search "python c-extension referrence count" for more detail
|
25,651,217 |
I'm trying to filter an array on ngOptions:
Here a plunkr: <http://plnkr.co/edit/OxL84mDdma9iS13wMnIX?p=preview>
I have this array:
```
$scope.keys = [ {
id: 1,
name: 'ddddggggggggggggggggg',
applicationKey: 'dssssssssssssss',
kind: 'pingdom',
} , {
id: 2,
name: 'Ddd',
kind: 'moz',
accessId: 'ssss',
secretKey: 'aaaa',
} , {
id: 3,
name: 'MyAlexa',
kind: 'alexa',
secretAccessKey: 'ssssssssssssssssss',
accessKeyId: 'ssssssss',
}
]
```
And I'm trying to filter using somethig like this:
```
<select name="key" ng-model="keys"
ng-options="k.name for k in keys track by k.id | filter: {kind: 'alexa'}" >
</select>
```
|
2014/09/03
|
[
"https://Stackoverflow.com/questions/25651217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1468116/"
] |
Perhaps you might want to do the following:
```
<select name="key"
data-ng-model="keys"
data-ng-options="key.name for key.name in keys | filter: { kind: 'alexa' } track by key.id">
</select>
```
You must have the `track by` after you apply the filter.
**EDIT**:
The only issue you had in your markup is the `track by` expression being before the filter. The rest of differences are just personal preferences.
|
Try this code.
```
<select name="key" ng-model="keys"
ng-options="k.name for k in keys | filter: {kind: 'alexa'}" >
</select>
```
|
15,251,904 |
I'm developing an application that uses a MySql connection for Entity Framework 5. Building the solution works on my machine.
Running the application on a machine without MySQLConnector installed also works because I added the following to my app.config file:
```
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
```
But other programmers who just want to compile and run my solution, get the following error on the .edmx file:
>
> The specified store provider cannot be found in the configuration, or
> is not valid.
>
>
>
Is it possible to compile a project that uses MySql with EntityFramework 5, but without the MySqlConnector installed?
|
2013/03/06
|
[
"https://Stackoverflow.com/questions/15251904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76939/"
] |
I ran into the same issue and I've just found a solution for it if you don't want to install MySqlConnector everywhere
Open the edmx file in text mode and look at the Designer section in it.
You should have a ValidateOnBuild property set to True.
Set it to false and you will not have the error displayed when you build.
```
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
[...]
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="False" />
[...]
```
The same option is availabre in the property window when the diagram is opened.
|
I think No No . But surely I don't know... you can wait for other answers.
|
15,251,904 |
I'm developing an application that uses a MySql connection for Entity Framework 5. Building the solution works on my machine.
Running the application on a machine without MySQLConnector installed also works because I added the following to my app.config file:
```
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
```
But other programmers who just want to compile and run my solution, get the following error on the .edmx file:
>
> The specified store provider cannot be found in the configuration, or
> is not valid.
>
>
>
Is it possible to compile a project that uses MySql with EntityFramework 5, but without the MySqlConnector installed?
|
2013/03/06
|
[
"https://Stackoverflow.com/questions/15251904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76939/"
] |
I ran into the same issue and I've just found a solution for it if you don't want to install MySqlConnector everywhere
Open the edmx file in text mode and look at the Designer section in it.
You should have a ValidateOnBuild property set to True.
Set it to false and you will not have the error displayed when you build.
```
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
[...]
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="False" />
[...]
```
The same option is availabre in the property window when the diagram is opened.
|
You need to have `MySql.Data.dll` and `MySql.Data.Entity.dll` available on each machine, since the build is dependent on them. They can either be registered in the OS, or simply placed in the path for the build to find them.
See [here](https://stackoverflow.com/questions/10638456/entity-framework-5-0-code-first-with-mysql-in-wpf) for a related question.
|
15,251,904 |
I'm developing an application that uses a MySql connection for Entity Framework 5. Building the solution works on my machine.
Running the application on a machine without MySQLConnector installed also works because I added the following to my app.config file:
```
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
```
But other programmers who just want to compile and run my solution, get the following error on the .edmx file:
>
> The specified store provider cannot be found in the configuration, or
> is not valid.
>
>
>
Is it possible to compile a project that uses MySql with EntityFramework 5, but without the MySqlConnector installed?
|
2013/03/06
|
[
"https://Stackoverflow.com/questions/15251904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76939/"
] |
I ran into the same issue and I've just found a solution for it if you don't want to install MySqlConnector everywhere
Open the edmx file in text mode and look at the Designer section in it.
You should have a ValidateOnBuild property set to True.
Set it to false and you will not have the error displayed when you build.
```
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
[...]
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="False" />
[...]
```
The same option is availabre in the property window when the diagram is opened.
|
I found my answer:
Other machines without the MySQL Connector installed can actually compile the solution fine, without errors.
However, the edmx designer automatically pops up the error list with the *The specified store provider cannot be found in the configuration, or is not valid.* error. But it's not a build error!
|
21,718,601 |
I want to dial a phone using AT command.I did it successfully. Now i want to get last call duration..In order to get that i tried with AT+CLCC Command..It should return some string..But still it won't.
Here is my c# code...
```
string phonenr = "";
// string mesaj;
if (!_serialPort.IsOpen)
{
_serialPort.Open();
}
_serialPort.WriteLine("AT\r");
{
Console.WriteLine("Enter the phone number:", phonenr);
phonenr = Console.ReadLine();
_serialPort.WriteLine("ATD" + phonenr + ";" + "\r");
Console.WriteLine("Ring...");
Thread.Sleep(3000);
_serialPort.WriteLine("AT"+"CLAC");
_serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
private static void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string indata = sp.ReadExisting();
Console.WriteLine("Data Received:");
Console.Write(indata);
}
```
How could i do this????I want to asign the return string to variable
|
2014/02/12
|
[
"https://Stackoverflow.com/questions/21718601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3292311/"
] |
On this line:
```
_serialPort.WriteLine("AT"+"CLAC");
```
It should be:
```
_serialPort.WriteLine("AT+CLAC");
```
|
"Don't roll your own."
Use the GSMCommands library. It is specifically built for SMS management, but allows you to send custom commands as well.
It's free.
<http://www.scampers.org/steve/sms/libraries.htm>
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
**The problem**
As far as I can tell it isn't currently possible to load CKEDITOR directly into webpack as a chunck without getting some errors, especially when starting to load additional plugins. One of the reasons for this seems to be that ckeditor does it's own async requests at runtime causing various things to break in nearly all of the implementations I have tried.
**The solution**
Use scriptjs to load it as an external library.
```
npm install scriptjs --save
```
Now in your code you can call it like so:
```
var $s = require('scriptjs');
$s('./vendor/ckeditor/ckeditor.js', function(){
CKEDITOR.replace('editor1');
});
```
**Please Note.**
This will not work on the uncompressed source because the ckeditor functions are not directly in the ckeditor.js file. This will cause the rest of your logic to run before the CKEDITOR object is fully constructed due to unfinished network requests.
If you wish to modify the source code of CKEDITOR clone <https://github.com/ckeditor/ckeditor-dev> and run it's build script to get a working customised version.
It looks like CKEditor is embracing ES6 in version 5 and I suspect they will have webpack support in this version but who knows how long it will be in development before it is released.
If there is a better way of doing this, please let me know.
|
CKEditor was published on [NPM](https://www.npmjs.com/package/ckeditor).
Now you can use exactly the commands you want.
Install
-------
```
npm install ckeditor --save-dev
```
Inject
------
```
var CK = require('ckeditor');
```
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
It is posible to use CKEditor with Webpack, it requires that you bundle with Webpack the CKEditor files will be loading from the browser, like plugins and language files.
It is done with the [`require.context()`](https://webpack.js.org/guides/dependency-management/#require-context) api.
Create your own Webpack module and name it **ckeditor\_loader** with the following files:
```js
/* index.js */
import './loader.js'
import 'ckeditor/ckeditor'
// You can replace this with you own init script, e.g.:
// - jQuery(document).ready()
window.onload = function () {
window.CKEDITOR.replaceAll()
}
```
```js
/* loader.js */
window.CKEDITOR_BASEPATH = `/node_modules/ckeditor/` # This should beging with your `output.publicPath` Webpack option.
// Load your custom config.js file for CKEditor.
require(`!file-loader?context=${__dirname}&outputPath=node_modules/ckeditor/&name=[path][name].[ext]!./config.js`)
// Load files from ckeditor.
require.context(
'!file-loader?name=[path][name].[ext]!ckeditor/',
true,
/.*/
)
```
```js
/* config.js */
window.CKEDITOR.editorConfig = function (config) {
// Define changes to default configuration here.
// For complete reference see:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
}
```
Now make sure your module is loaded:
```js
// Include in one of the javascript files that webpack
// is already processing. Probably index.js or app.js:
import 'ckeditor_loader'
```
This is a very basic implementation. I wrote a more extensive tutorial, which allows for faster compilation times and more customization options:
[How to use CKEditor 4 with Webpack](https://www.fomfus.com/articles/how-to-use-ckeditor-4-with-webpack)
|
CKEditor was published on [NPM](https://www.npmjs.com/package/ckeditor).
Now you can use exactly the commands you want.
Install
-------
```
npm install ckeditor --save-dev
```
Inject
------
```
var CK = require('ckeditor');
```
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
### Install
```
npm install ckeditor --save
```
### Load
```
require('ckeditor');
```
After loading chkeditor becomes available as global variable `CKEDITOR`
### Replace
```
CKEDITOR.replace('elementId');
```
### Issues
The editor loads it's own required CSS/JS assets, likely these cannot be found. You can refer to the CDN version for these resources or you can copy the CKeditor directory to an public reachable folder. Define the URL of the public reachable resources with `CKEDITOR_BASEPATH`.
```
window.CKEDITOR_BASEPATH = '//cdn.ckeditor.com/4.6.2/full-all/';
```
Note: Define `window.CKEDITOR_BASEPATH` before your import statement!
|
CKEditor was published on [NPM](https://www.npmjs.com/package/ckeditor).
Now you can use exactly the commands you want.
Install
-------
```
npm install ckeditor --save-dev
```
Inject
------
```
var CK = require('ckeditor');
```
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
CK Editor 5 can be easily used with webpack: <https://docs.ckeditor.com/ckeditor5/latest/framework/guides/quick-start.html>
Although it should be noted that as of Feb 2018 it is still in alpha2: <https://github.com/ckeditor/ckeditor5#packages>
I was able to get started with Rails and webpacker by using the following:
```
yarn add \
css-loader \
node-sass \
raw-loader \
sass-loader \
style-loader
yarn add \
@ckeditor/ckeditor5-editor-classic \
@ckeditor/ckeditor5-essentials \
@ckeditor/ckeditor5-paragraph \
@ckeditor/ckeditor5-basic-styles
```
In the code I copied directly from the quick start guide:
```
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials'
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'
const element = document.getElementById('editor')
ClassicEditor.create(element, {
plugins: [Essentials, Paragraph, Bold, Italic],
toolbar: ['bold', 'italic']
})
.then(editor => {
console.log('Editor was initialized', editor)
})
.catch(error => {
console.error(error.stack)
})
```
Finally I had to add a loader for ckeditor svg icons as per the quick start guide. I used the webpacker reference here for that <https://github.com/rails/webpacker/blob/master/docs/webpack.md#react-svg-loader>
```
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
environment.loaders.insert('svg', {
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
use: 'raw-loader'
}, { after: 'file' })
const fileLoader = environment.loaders.get('file')
fileLoader.exclude = /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.(svg)$/i
module.exports = environment
```
|
CKEditor was published on [NPM](https://www.npmjs.com/package/ckeditor).
Now you can use exactly the commands you want.
Install
-------
```
npm install ckeditor --save-dev
```
Inject
------
```
var CK = require('ckeditor');
```
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
**The problem**
As far as I can tell it isn't currently possible to load CKEDITOR directly into webpack as a chunck without getting some errors, especially when starting to load additional plugins. One of the reasons for this seems to be that ckeditor does it's own async requests at runtime causing various things to break in nearly all of the implementations I have tried.
**The solution**
Use scriptjs to load it as an external library.
```
npm install scriptjs --save
```
Now in your code you can call it like so:
```
var $s = require('scriptjs');
$s('./vendor/ckeditor/ckeditor.js', function(){
CKEDITOR.replace('editor1');
});
```
**Please Note.**
This will not work on the uncompressed source because the ckeditor functions are not directly in the ckeditor.js file. This will cause the rest of your logic to run before the CKEDITOR object is fully constructed due to unfinished network requests.
If you wish to modify the source code of CKEDITOR clone <https://github.com/ckeditor/ckeditor-dev> and run it's build script to get a working customised version.
It looks like CKEditor is embracing ES6 in version 5 and I suspect they will have webpack support in this version but who knows how long it will be in development before it is released.
If there is a better way of doing this, please let me know.
|
It is posible to use CKEditor with Webpack, it requires that you bundle with Webpack the CKEditor files will be loading from the browser, like plugins and language files.
It is done with the [`require.context()`](https://webpack.js.org/guides/dependency-management/#require-context) api.
Create your own Webpack module and name it **ckeditor\_loader** with the following files:
```js
/* index.js */
import './loader.js'
import 'ckeditor/ckeditor'
// You can replace this with you own init script, e.g.:
// - jQuery(document).ready()
window.onload = function () {
window.CKEDITOR.replaceAll()
}
```
```js
/* loader.js */
window.CKEDITOR_BASEPATH = `/node_modules/ckeditor/` # This should beging with your `output.publicPath` Webpack option.
// Load your custom config.js file for CKEditor.
require(`!file-loader?context=${__dirname}&outputPath=node_modules/ckeditor/&name=[path][name].[ext]!./config.js`)
// Load files from ckeditor.
require.context(
'!file-loader?name=[path][name].[ext]!ckeditor/',
true,
/.*/
)
```
```js
/* config.js */
window.CKEDITOR.editorConfig = function (config) {
// Define changes to default configuration here.
// For complete reference see:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
}
```
Now make sure your module is loaded:
```js
// Include in one of the javascript files that webpack
// is already processing. Probably index.js or app.js:
import 'ckeditor_loader'
```
This is a very basic implementation. I wrote a more extensive tutorial, which allows for faster compilation times and more customization options:
[How to use CKEditor 4 with Webpack](https://www.fomfus.com/articles/how-to-use-ckeditor-4-with-webpack)
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
**The problem**
As far as I can tell it isn't currently possible to load CKEDITOR directly into webpack as a chunck without getting some errors, especially when starting to load additional plugins. One of the reasons for this seems to be that ckeditor does it's own async requests at runtime causing various things to break in nearly all of the implementations I have tried.
**The solution**
Use scriptjs to load it as an external library.
```
npm install scriptjs --save
```
Now in your code you can call it like so:
```
var $s = require('scriptjs');
$s('./vendor/ckeditor/ckeditor.js', function(){
CKEDITOR.replace('editor1');
});
```
**Please Note.**
This will not work on the uncompressed source because the ckeditor functions are not directly in the ckeditor.js file. This will cause the rest of your logic to run before the CKEDITOR object is fully constructed due to unfinished network requests.
If you wish to modify the source code of CKEDITOR clone <https://github.com/ckeditor/ckeditor-dev> and run it's build script to get a working customised version.
It looks like CKEditor is embracing ES6 in version 5 and I suspect they will have webpack support in this version but who knows how long it will be in development before it is released.
If there is a better way of doing this, please let me know.
|
### Install
```
npm install ckeditor --save
```
### Load
```
require('ckeditor');
```
After loading chkeditor becomes available as global variable `CKEDITOR`
### Replace
```
CKEDITOR.replace('elementId');
```
### Issues
The editor loads it's own required CSS/JS assets, likely these cannot be found. You can refer to the CDN version for these resources or you can copy the CKeditor directory to an public reachable folder. Define the URL of the public reachable resources with `CKEDITOR_BASEPATH`.
```
window.CKEDITOR_BASEPATH = '//cdn.ckeditor.com/4.6.2/full-all/';
```
Note: Define `window.CKEDITOR_BASEPATH` before your import statement!
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
**The problem**
As far as I can tell it isn't currently possible to load CKEDITOR directly into webpack as a chunck without getting some errors, especially when starting to load additional plugins. One of the reasons for this seems to be that ckeditor does it's own async requests at runtime causing various things to break in nearly all of the implementations I have tried.
**The solution**
Use scriptjs to load it as an external library.
```
npm install scriptjs --save
```
Now in your code you can call it like so:
```
var $s = require('scriptjs');
$s('./vendor/ckeditor/ckeditor.js', function(){
CKEDITOR.replace('editor1');
});
```
**Please Note.**
This will not work on the uncompressed source because the ckeditor functions are not directly in the ckeditor.js file. This will cause the rest of your logic to run before the CKEDITOR object is fully constructed due to unfinished network requests.
If you wish to modify the source code of CKEDITOR clone <https://github.com/ckeditor/ckeditor-dev> and run it's build script to get a working customised version.
It looks like CKEditor is embracing ES6 in version 5 and I suspect they will have webpack support in this version but who knows how long it will be in development before it is released.
If there is a better way of doing this, please let me know.
|
CK Editor 5 can be easily used with webpack: <https://docs.ckeditor.com/ckeditor5/latest/framework/guides/quick-start.html>
Although it should be noted that as of Feb 2018 it is still in alpha2: <https://github.com/ckeditor/ckeditor5#packages>
I was able to get started with Rails and webpacker by using the following:
```
yarn add \
css-loader \
node-sass \
raw-loader \
sass-loader \
style-loader
yarn add \
@ckeditor/ckeditor5-editor-classic \
@ckeditor/ckeditor5-essentials \
@ckeditor/ckeditor5-paragraph \
@ckeditor/ckeditor5-basic-styles
```
In the code I copied directly from the quick start guide:
```
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials'
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'
const element = document.getElementById('editor')
ClassicEditor.create(element, {
plugins: [Essentials, Paragraph, Bold, Italic],
toolbar: ['bold', 'italic']
})
.then(editor => {
console.log('Editor was initialized', editor)
})
.catch(error => {
console.error(error.stack)
})
```
Finally I had to add a loader for ckeditor svg icons as per the quick start guide. I used the webpacker reference here for that <https://github.com/rails/webpacker/blob/master/docs/webpack.md#react-svg-loader>
```
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
environment.loaders.insert('svg', {
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
use: 'raw-loader'
}, { after: 'file' })
const fileLoader = environment.loaders.get('file')
fileLoader.exclude = /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.(svg)$/i
module.exports = environment
```
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
It is posible to use CKEditor with Webpack, it requires that you bundle with Webpack the CKEditor files will be loading from the browser, like plugins and language files.
It is done with the [`require.context()`](https://webpack.js.org/guides/dependency-management/#require-context) api.
Create your own Webpack module and name it **ckeditor\_loader** with the following files:
```js
/* index.js */
import './loader.js'
import 'ckeditor/ckeditor'
// You can replace this with you own init script, e.g.:
// - jQuery(document).ready()
window.onload = function () {
window.CKEDITOR.replaceAll()
}
```
```js
/* loader.js */
window.CKEDITOR_BASEPATH = `/node_modules/ckeditor/` # This should beging with your `output.publicPath` Webpack option.
// Load your custom config.js file for CKEditor.
require(`!file-loader?context=${__dirname}&outputPath=node_modules/ckeditor/&name=[path][name].[ext]!./config.js`)
// Load files from ckeditor.
require.context(
'!file-loader?name=[path][name].[ext]!ckeditor/',
true,
/.*/
)
```
```js
/* config.js */
window.CKEDITOR.editorConfig = function (config) {
// Define changes to default configuration here.
// For complete reference see:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
}
```
Now make sure your module is loaded:
```js
// Include in one of the javascript files that webpack
// is already processing. Probably index.js or app.js:
import 'ckeditor_loader'
```
This is a very basic implementation. I wrote a more extensive tutorial, which allows for faster compilation times and more customization options:
[How to use CKEditor 4 with Webpack](https://www.fomfus.com/articles/how-to-use-ckeditor-4-with-webpack)
|
CK Editor 5 can be easily used with webpack: <https://docs.ckeditor.com/ckeditor5/latest/framework/guides/quick-start.html>
Although it should be noted that as of Feb 2018 it is still in alpha2: <https://github.com/ckeditor/ckeditor5#packages>
I was able to get started with Rails and webpacker by using the following:
```
yarn add \
css-loader \
node-sass \
raw-loader \
sass-loader \
style-loader
yarn add \
@ckeditor/ckeditor5-editor-classic \
@ckeditor/ckeditor5-essentials \
@ckeditor/ckeditor5-paragraph \
@ckeditor/ckeditor5-basic-styles
```
In the code I copied directly from the quick start guide:
```
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials'
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'
const element = document.getElementById('editor')
ClassicEditor.create(element, {
plugins: [Essentials, Paragraph, Bold, Italic],
toolbar: ['bold', 'italic']
})
.then(editor => {
console.log('Editor was initialized', editor)
})
.catch(error => {
console.error(error.stack)
})
```
Finally I had to add a loader for ckeditor svg icons as per the quick start guide. I used the webpacker reference here for that <https://github.com/rails/webpacker/blob/master/docs/webpack.md#react-svg-loader>
```
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
environment.loaders.insert('svg', {
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
use: 'raw-loader'
}, { after: 'file' })
const fileLoader = environment.loaders.get('file')
fileLoader.exclude = /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.(svg)$/i
module.exports = environment
```
|
29,703,325 |
Please tell me what's wrong with this. It exactly follows the syntax in the 5.5 manual:
```
SET @RunID = 55;
REPEAT
SET @RunID = @RunID + 1;
UNTIL @RunID = 100
END REPEAT;
```
It keeps telling me I have a syntax error in the REPEAT.
My wild guess is that it could have something to do with the fact that MySQL is running on Mac OS X and the client I'm using is Windows XP. End-of-line characters?
|
2015/04/17
|
[
"https://Stackoverflow.com/questions/29703325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3238181/"
] |
### Install
```
npm install ckeditor --save
```
### Load
```
require('ckeditor');
```
After loading chkeditor becomes available as global variable `CKEDITOR`
### Replace
```
CKEDITOR.replace('elementId');
```
### Issues
The editor loads it's own required CSS/JS assets, likely these cannot be found. You can refer to the CDN version for these resources or you can copy the CKeditor directory to an public reachable folder. Define the URL of the public reachable resources with `CKEDITOR_BASEPATH`.
```
window.CKEDITOR_BASEPATH = '//cdn.ckeditor.com/4.6.2/full-all/';
```
Note: Define `window.CKEDITOR_BASEPATH` before your import statement!
|
CK Editor 5 can be easily used with webpack: <https://docs.ckeditor.com/ckeditor5/latest/framework/guides/quick-start.html>
Although it should be noted that as of Feb 2018 it is still in alpha2: <https://github.com/ckeditor/ckeditor5#packages>
I was able to get started with Rails and webpacker by using the following:
```
yarn add \
css-loader \
node-sass \
raw-loader \
sass-loader \
style-loader
yarn add \
@ckeditor/ckeditor5-editor-classic \
@ckeditor/ckeditor5-essentials \
@ckeditor/ckeditor5-paragraph \
@ckeditor/ckeditor5-basic-styles
```
In the code I copied directly from the quick start guide:
```
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials'
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'
const element = document.getElementById('editor')
ClassicEditor.create(element, {
plugins: [Essentials, Paragraph, Bold, Italic],
toolbar: ['bold', 'italic']
})
.then(editor => {
console.log('Editor was initialized', editor)
})
.catch(error => {
console.error(error.stack)
})
```
Finally I had to add a loader for ckeditor svg icons as per the quick start guide. I used the webpacker reference here for that <https://github.com/rails/webpacker/blob/master/docs/webpack.md#react-svg-loader>
```
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
environment.loaders.insert('svg', {
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
use: 'raw-loader'
}, { after: 'file' })
const fileLoader = environment.loaders.get('file')
fileLoader.exclude = /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.(svg)$/i
module.exports = environment
```
|
27,030,656 |
I was unable to install -[pdfminer](http://euske.github.io/pdfminer/index.html)- using the source distribution so I was trying to use [binstar](https://binstar.org/jacksongs/pdfminer) to do so. Since I am using the Ananconda distribution of Python, I type:
```
conda install -c https://conda.binstar.org/jacksongs pdfminer
```
but, get the following error:
```
Fetching package metadata: ...
Error: No packages found in current win-32 channels matching: pdfminer
You can search for this package on Binstar with
binstar search -t conda pdfminer
```
Could you please suggest a solution?
Thank you.
PS: `binstar search -t conda pdfminer` returns the following:
```
Run 'binstar show <USER/PACKAGE>' to get more details:
Packages:
Name | Access | Package Types | Summary
------------------------- | ------------ | --------------- | --------------------
auto/pdfminer3k | published | conda |
http://bitbucket.org/hsoft/pdfminer3k
jacksongs/pdfminer | public | conda | PDF parser and analyzer
Found 2 packages
```
|
2014/11/20
|
[
"https://Stackoverflow.com/questions/27030656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4174494/"
] |
This has probably got to do with the choice of platform. Binstar only has a package for OS X 64 whereas I am using windows.
|
I myself have never used the anaconda distribution of python but judging by the information you have given, have you tried
`conda install -c http://bitbucket.org/hsoft/pdfminer3k`
Like I said before, I've never used this distribution and I have near to no idea of the solutions you have tried.
I hope I helped,
~Bobbeh
|
27,030,656 |
I was unable to install -[pdfminer](http://euske.github.io/pdfminer/index.html)- using the source distribution so I was trying to use [binstar](https://binstar.org/jacksongs/pdfminer) to do so. Since I am using the Ananconda distribution of Python, I type:
```
conda install -c https://conda.binstar.org/jacksongs pdfminer
```
but, get the following error:
```
Fetching package metadata: ...
Error: No packages found in current win-32 channels matching: pdfminer
You can search for this package on Binstar with
binstar search -t conda pdfminer
```
Could you please suggest a solution?
Thank you.
PS: `binstar search -t conda pdfminer` returns the following:
```
Run 'binstar show <USER/PACKAGE>' to get more details:
Packages:
Name | Access | Package Types | Summary
------------------------- | ------------ | --------------- | --------------------
auto/pdfminer3k | published | conda |
http://bitbucket.org/hsoft/pdfminer3k
jacksongs/pdfminer | public | conda | PDF parser and analyzer
Found 2 packages
```
|
2014/11/20
|
[
"https://Stackoverflow.com/questions/27030656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4174494/"
] |
This has probably got to do with the choice of platform. Binstar only has a package for OS X 64 whereas I am using windows.
|
I tried the following: (Anaconda Python 2.7 on Windows 10 64-bit)
This adds the conda-forge channel to your list of channels
`conda config --add channels cond`a-forge
Installs pdfminer
```
conda install pdfminer
```
This was my source: [conda-forge:pdfminer on github](https://github.com/conda-forge/pdfminer-feedstock)
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
I will preface my answer by saying I'm not a linguist, but perhaps the problem could be traced to how the verb "dedouleukamen" was translated. On the surface, it would be very hypocritical to say "we have never been slaves" because every year they were reminded at Passover "We were once slaves...", and in fact "served with great rigor".(Ex. 12:14)
But they were made free(Dt. 26:8)
>
> **"And the LORD brought us forth out of Egypt with a mighty hand, and
> with an outstretched arm, and with great terribleness, and with signs,
> and with wonders"**
>
>
>
From this passage, one could assert "freedom", although of course there was the Babylonian captivity, and the various times of servitude under different oppressor nations.
Contextually, they responded by saying **,"We are children of Abraham..."** therefore, they are the children of the promises of God through Abraham, and assert this 'right', although Jesus in further dialogue says, **"Your father is the devil..**"(John 8:44)
So what appears at issue is "moral freedom', not "political freedom"; brought on by Jesus's statement **,"You shall know the truth, and the truth shall make you free**".(vs 33)
By virtue of their circumcision, and following the Law, they were "morally free", although physical freedom from time to time was restrained. And yet Jesus confronts them, telling them **"Whoever commits sin is a servant of it**"(vs 34), to which they reply "WE are Abraham's seed..."(vs 37).
In conclusion, this issue wasn't about "Political' freedom, it was about 'moral' freedom; hence the response "We are Abraham's seed and never been enslaved to anyone" makes sense.
|
What the Pharisees say to Jesus in John 8:33 is a truth. They never were slaves. They were never chattel slaves. They were never enslaved by either a man or nation.
How we measure a slave and slavery has as its predicate an outward appearance, the color of a man's skin, wealth, or a result of war. We, as in western civilization, envision as slave in the same manner that we reckon a species of fowl or beast. It is not by the fowl's or beast's behavior, since throughout the history and legacy of the Negro in America there'd be no great exception held by those who envisioned themselves as his master as for his testimony. Since in the years after the ratification of the 13th Amendment (6 December 1865) (Jethro K. Lieberman, *A Practical Companion to the Constitution*, pg. 581) we witness the insidious reality of in which blacks lived, even where it concerned the practice of law and serving on juries (Charles E. Wynes, *Race Relations in Virginia*, 1870-1902, pg. 138-141).
So, when it comes to assigning the man the world reckons as meet for slavery it is solely a matter of his outward appearance. What we must be mindful of however is that the source of our strength. The source from which we gather and establish the strength of our convictions is not from the Bible. It is not from the spirits or teachings of Moses and Jesus. Rather it is from the spirits of the Greek philosopher. Most pressingly it is from the spirits of Aristotle, who, in his work *Politics* writes:
>
> ...doubtless if men differed from one another in the mere forms of their bodies as much as the statues of the Gods do from men, all would acknowledge that the inferior class should be slaves of the superior. And if there is a difference in the body, how much more in the soul! But the beauty of the body is seen, whereas the beauty of the soul is not seen. It is clear, then, that some men are by nature free, and others slaves, and that for these latter slavery is both expedient and right (Aristotle, Politics, Translated by Benjamin Jowett, Introduction, Analysis, and Index by H.W.C. Davis, I.5.10-11 pg. 34).
>
>
>
Jesus opens our vesicle of understanding that such spirits are not of him. In John 7:24, as for the type of judgment that is of Jesus, he impresses on us to:
>
> "Judge not according to the appearance, but judge righteous judgment" (John 7:24).
>
>
>
It is on this basis I conclude that we have no sense as for what the Bible actually teaches. It is a consequence of the philosophical beliefs and teachings that underpin our hermeneutics which are Greek philosophical beliefs and teachings. And no more is this as revealingly impactful than with the subject of Israel and slavery.
So, because it demands a greater dialogue than meet for these pages to argue biblically why the Jews were never enslaved. I turn to the philosophical teachings that serve as the means with which we interpret and understand Scripture.
In the 6th book of Plato's Laws, as it concerns the issue of what makes a slave. The Athenian in the play references the ancient Greek poet who attributes the matter to Zeus that:
>
> "If you make a man a slave, that very day / Far-sounding Zeus takes half his wits away" (Plato, Laws VI.777) (Plato, *Complete Works*, Edited by John M. Cooper, pg. 1450).
>
>
>
In essence what the Greek poet taught is of a Truth, given how you make a man a slave is that you change his name. It was and is with the Negro, as it was with the Helot, as it was with the Phoenician. It was because of how the world impressed a name upon the African (Negro), the populations of Laconia and Messenia (Helots), and the Phoencians (the Ancient Canaanites), was the world able to create for itself and perpetuate a slave. How we arrive at the truth that the children of Israel were never enslaved is because they never lost their name. Even when their name moved from "children of Israel" to "Jew" in the moment David established himself in trespass with the LORD in that he numbered the Jews (1 Chronicles 21) <http://biblehub.com/kjv/1_chronicles/21.htm> it was a movement of their own choosing.
As for the Jew's sojourn in Egypt. Joshua 5:3-7 <http://biblehub.com/kjv/joshua/5.htm> makes clear how the Jews were never enslaved in Egypt, as their name was the means by which they called into remembrance the covenant (Genesis 17:9-14) our ETERNAL FATHER (Exodus 3:14) made with Abraham that concerned circumcision. This covenant (Genesis 17:9-14) is very different from what I term as the Promised Covenant (Genesis 17:7-8). Since as for the latter, it is the LORD who makes this covenant (Genesis 17:7-8) with Abraham. This is how we come to the conclusion that we fail to understand what Scripture teaches is because we conflate LORD and God, never to appreciate the words of Balaam (Numbers 23:19).
The conclusion: Because their name never changed, the Jews were never enslaved by any man. But that does not mean that the Jews were not in bondage. For the latter all centers on what Jesus says to Pharisees as for Pharisees' association with Abraham. Though they were the natural seed of Abraham, they were not sons of Abraham, since then they'd do as Abraham (John 8:39-40). And this too is another great mystery within Scripture as for how is it possible to be a man's child, and yet not be reckoned as a child of the man.
For the person who gave me a negative response: The question we fail to consider is, is there a difference between what Scripture interprets as slavery apart from what we customarily believe evidences a slave as a result of war, debt, and crime. That is, is the Bible's sense of slavery a condition of the body or of the soul? Just because a man is enslaved as a result of war, debt, or crime does not mean he is a slave if he is able to retain his name.
It is his name that keeps a man or a people in contact with his or their fathers and the god of his or their fathers. The object in keeping your name is so that you call all things into remembrance, which is not only finds you in lock step with the Spirit of the LORD where it concerns Fourth Commandment (Exodus 20:8-11). But it is even more so in harmony with the Spirit of God that prevailed from the beginning. Where, in closing the whole of Creation (Genesis 1-2:1-3), on the Seventh Day
>
> Thus the heavens and the earth were finished, and all the host of them. And on the seventh day God ended his work which he had made; and he rested on the seventh day from all his work which he had made. And God blessed the seventh day, and sanctified it: because that in it he had rested from all his work which God created and made (Genesis 2:1-3).
>
>
>
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
A slightly larger context answers this question.
**KJV**
>
> 31 Then said Jesus to those Jews which believed on him, If ye continue
> in my word, then are ye my disciples indeed; 32 And ye shall know the
> truth, and the truth shall make you free. 33 They answered him, We be
> Abraham’s seed, and were never in bondage to any man: how sayest thou,
> Ye shall be made free? 34 Jesus answered them, Verily, verily, I say
> unto you, Whosoever committeth sin is the servant of sin.
>
>
>
Jesus states in vv.31-32 that if these who are believing on him continue in His word (i.e. the truth), then that truth will make them free. The Jews reply with your verse's content: "We be Abraham’s seed, and were never in bondage to any man: how sayest thou, Ye shall be made free?"
They are replying to Jesus' assertion that they are not free, when they believe they are. And indeed, from this statement it appears that they as *individuals* are free (they apparently were not and had never been slaves, nor incarcerated).
They are not making a statement about their national history, but themselves as individuals, and likely as the Jewish nation at that time. During these years, while the Jews were under Roman rule, they were not without freedom. To quote from the [Wikipedia article](http://en.wikipedia.org/wiki/Roman_Jews#Jews_in_Rome_and_Romans_in_Jerusalem) on Romans in Jerusalem:
>
> During the 1st century BCE, the Herodian Kingdom was established as a
> Roman client kingdom and in 6 CE parts became a province of the Roman
> Empire, named Iudaea Province.
>
>
> Julius Caesar formulated a policy of allowing Jews to follow their
> traditional religious practices,a policy which was followed, and
> extended, by Augustus, first emperor of Rome, reigned 27 BCE-14CE.
> This gave Judaism the status of a *religio licita* (permitted religion)
> throughout the Empire.
>
>
>
So they had some political freedom, religious freedom, and some were Roman citizen's (like Paul, Act 22:28). This is the type of freedom they are referring to.
And then Jesus points them to his meaning: they can be free from sin if they "continue in [His] word," (i.e obey) and "know the truth." Otherwise, they are in bondage to sin, and are serving it.
|
I will preface my answer by saying I'm not a linguist, but perhaps the problem could be traced to how the verb "dedouleukamen" was translated. On the surface, it would be very hypocritical to say "we have never been slaves" because every year they were reminded at Passover "We were once slaves...", and in fact "served with great rigor".(Ex. 12:14)
But they were made free(Dt. 26:8)
>
> **"And the LORD brought us forth out of Egypt with a mighty hand, and
> with an outstretched arm, and with great terribleness, and with signs,
> and with wonders"**
>
>
>
From this passage, one could assert "freedom", although of course there was the Babylonian captivity, and the various times of servitude under different oppressor nations.
Contextually, they responded by saying **,"We are children of Abraham..."** therefore, they are the children of the promises of God through Abraham, and assert this 'right', although Jesus in further dialogue says, **"Your father is the devil..**"(John 8:44)
So what appears at issue is "moral freedom', not "political freedom"; brought on by Jesus's statement **,"You shall know the truth, and the truth shall make you free**".(vs 33)
By virtue of their circumcision, and following the Law, they were "morally free", although physical freedom from time to time was restrained. And yet Jesus confronts them, telling them **"Whoever commits sin is a servant of it**"(vs 34), to which they reply "WE are Abraham's seed..."(vs 37).
In conclusion, this issue wasn't about "Political' freedom, it was about 'moral' freedom; hence the response "We are Abraham's seed and never been enslaved to anyone" makes sense.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
Nearly every expositor I have looked up concludes that this is actually just a hasty staement made by proud men who have a distatesfull view of Jesus. In other words **the particular Jews in the account are made to seem so proud and foolish that they straightway deny their obvious history and current situation under Rome as a vassal state**.
Owen has this view:
>
> Forgetful of their servitude in Egypt, Babylon, and at that very time to the Romans, they indignantly deny that they were ever in bondage to any man. How they could have uttered so palpable an untruth is inconceivable, unless on the general principle, that angry men do not pause to consider what they are about to say, and in consequence, often give expression to sheer fabrications. (Owen, J. J. (1861). A Commentary, Critical, Expository, and Practical, on the Gospel of John (p. 197). New York: Leavitt & Allen.)
>
>
>
Even old Cyril of Alexandria had this view:
>
> In no respect then was the speech of the Jews sane: for besides being ignorant of their truer bondage, that in sin, they utterly deny the other ignoble one and have an understanding accustomed to think highly about a mere nothing. (Cyril of Alexandria. (1874). Commentary on the Gospel according to S. John (Vol. 1, pp. 626–627). Oxford; London: James Parker & Co.; Rivingtons.)
>
>
>
Plummer has this view:
>
> On texts like these they build the proud belief that Jews have never yet been in bondage to any man. But passion once more blinds them to historical facts (see on 7:52). The bondage in Egypt, the oppressions in the times of the Judges, the captivity in Babylon, and the Roman yoke, are all forgotten. “They have an immovable love of liberty, and maintain that God is their only ruler and master” (Josephus, Ant. XVIII. i. 6). (Plummer, A. (1896). The Gospel according to S. John (p. 193). Cambridge: Cambridge University Press.)
>
>
>
Govett has again the same:
>
> They speak hastily, untruly, inconsistently; for their strongest desire for Messiah was, and is, that He might free them from the Roman yoke. And had our Lord but proposed that, to be effected by force of arms, willingly would they have enrolled themselves as volunteers. (Govett, R. (1881). Exposition of the Gospel of St. John (Vol. 1, p. 371). London: Bemrose & Sons.)
>
>
>
...And so on and so forth.
|
A slightly larger context answers this question.
**KJV**
>
> 31 Then said Jesus to those Jews which believed on him, If ye continue
> in my word, then are ye my disciples indeed; 32 And ye shall know the
> truth, and the truth shall make you free. 33 They answered him, We be
> Abraham’s seed, and were never in bondage to any man: how sayest thou,
> Ye shall be made free? 34 Jesus answered them, Verily, verily, I say
> unto you, Whosoever committeth sin is the servant of sin.
>
>
>
Jesus states in vv.31-32 that if these who are believing on him continue in His word (i.e. the truth), then that truth will make them free. The Jews reply with your verse's content: "We be Abraham’s seed, and were never in bondage to any man: how sayest thou, Ye shall be made free?"
They are replying to Jesus' assertion that they are not free, when they believe they are. And indeed, from this statement it appears that they as *individuals* are free (they apparently were not and had never been slaves, nor incarcerated).
They are not making a statement about their national history, but themselves as individuals, and likely as the Jewish nation at that time. During these years, while the Jews were under Roman rule, they were not without freedom. To quote from the [Wikipedia article](http://en.wikipedia.org/wiki/Roman_Jews#Jews_in_Rome_and_Romans_in_Jerusalem) on Romans in Jerusalem:
>
> During the 1st century BCE, the Herodian Kingdom was established as a
> Roman client kingdom and in 6 CE parts became a province of the Roman
> Empire, named Iudaea Province.
>
>
> Julius Caesar formulated a policy of allowing Jews to follow their
> traditional religious practices,a policy which was followed, and
> extended, by Augustus, first emperor of Rome, reigned 27 BCE-14CE.
> This gave Judaism the status of a *religio licita* (permitted religion)
> throughout the Empire.
>
>
>
So they had some political freedom, religious freedom, and some were Roman citizen's (like Paul, Act 22:28). This is the type of freedom they are referring to.
And then Jesus points them to his meaning: they can be free from sin if they "continue in [His] word," (i.e obey) and "know the truth." Otherwise, they are in bondage to sin, and are serving it.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
The Jews were probably referring to the the fact that they had fought for thier freedom from the Greeks (Maccabees) and were not bound to be Roman citizens, but they had thier own culture, even they were still under Roman rule. They were not really free at this writing, but allowed a certian allowance to be thier own culture. They were in denial of thier own state. They couldn't do cetain things, like maintian the death penalty in the Law, as only Rome had this ability.
|
They were not referring to their whole history, but themselves. They were not slaves under [the Roman Empire](https://www.jewishvirtuallibrary.org/roman-rule-63bce-313ce), however later in 70 BCE they were eventually massacred and sold into slavery. The Jewish theology is deeply rooted in the background of slavery, it is not something to be forgotten. The phrase, "We are Abraham's seed" only signifies their self-image of privilege and pride by stating their religious status; they thought God sees them blameless, despite their sins and won't judge them. They boasted in their status in pride by associating themselves to Abraham while abused Jesus calling him demonic and a Samaritan (John 8:48). The context makes it clear that their statement was their own defense to the mention of being freed (from sin).
>
> **[NASB John 8:31-44]**
> 31So Jesus was saying to those Jews who had believed Him, "If you continue in My word, [then] you are truly disciples of Mine; 32and you will know the truth, and the truth will make you free." 33They answered Him, "We are Abraham's descendants and have never yet been enslaved to anyone; how is it that You say, 'You will become free '?" 34Jesus answered them, "Truly, truly, I say to you, everyone who commits sin is the slave of sin. 35"The slave does not remain in the house forever; the son does remain forever. 36"So if the Son makes you free, you will be free indeed. 37"I know that you are Abraham's descendants; yet you seek to kill Me, because My word has no place in you. 38"I speak the things which I have seen with [My] Father; therefore you also do the things which you heard from [your] father." 39They answered and said to Him, "Abraham is our father." Jesus said to them, "If you are Abraham's children, do the deeds of Abraham. 40"But as it is, you are seeking to kill Me, a man who has told you the truth, which I heard from God; this Abraham did not do. 41"You are doing the deeds of your father." They said to Him, "We were not born of fornication; we have one Father: God." 42Jesus said to them, "If God were your Father, you would love Me, for I proceeded forth and have come from God, for I have not even come on My own initiative, but He sent Me. 43"Why do you not understand what I am saying? [It is] because you cannot hear My word. 44"You are of [your] father the devil, and you want to do the desires of your father. He was a murderer from the beginning, and does not stand in the truth because there is no truth in him. Whenever he speaks a lie, he speaks from his own [nature], for he is a liar and the father of lies.
>
>
>
>
> **[NASB Matt 3:7-9]**
> 7But when he saw many of the Pharisees and Sadducees coming for baptism, he said to them, "You brood of vipers, who warned you to flee from the wrath to come? 8"Therefore bear fruit in keeping with repentance; 9**and do not suppose that you can say to yourselves, 'We have Abraham for our father'; for I say to you that from these stones God is able to raise up children to Abraham.**
>
>
>
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
Nearly every expositor I have looked up concludes that this is actually just a hasty staement made by proud men who have a distatesfull view of Jesus. In other words **the particular Jews in the account are made to seem so proud and foolish that they straightway deny their obvious history and current situation under Rome as a vassal state**.
Owen has this view:
>
> Forgetful of their servitude in Egypt, Babylon, and at that very time to the Romans, they indignantly deny that they were ever in bondage to any man. How they could have uttered so palpable an untruth is inconceivable, unless on the general principle, that angry men do not pause to consider what they are about to say, and in consequence, often give expression to sheer fabrications. (Owen, J. J. (1861). A Commentary, Critical, Expository, and Practical, on the Gospel of John (p. 197). New York: Leavitt & Allen.)
>
>
>
Even old Cyril of Alexandria had this view:
>
> In no respect then was the speech of the Jews sane: for besides being ignorant of their truer bondage, that in sin, they utterly deny the other ignoble one and have an understanding accustomed to think highly about a mere nothing. (Cyril of Alexandria. (1874). Commentary on the Gospel according to S. John (Vol. 1, pp. 626–627). Oxford; London: James Parker & Co.; Rivingtons.)
>
>
>
Plummer has this view:
>
> On texts like these they build the proud belief that Jews have never yet been in bondage to any man. But passion once more blinds them to historical facts (see on 7:52). The bondage in Egypt, the oppressions in the times of the Judges, the captivity in Babylon, and the Roman yoke, are all forgotten. “They have an immovable love of liberty, and maintain that God is their only ruler and master” (Josephus, Ant. XVIII. i. 6). (Plummer, A. (1896). The Gospel according to S. John (p. 193). Cambridge: Cambridge University Press.)
>
>
>
Govett has again the same:
>
> They speak hastily, untruly, inconsistently; for their strongest desire for Messiah was, and is, that He might free them from the Roman yoke. And had our Lord but proposed that, to be effected by force of arms, willingly would they have enrolled themselves as volunteers. (Govett, R. (1881). Exposition of the Gospel of St. John (Vol. 1, p. 371). London: Bemrose & Sons.)
>
>
>
...And so on and so forth.
|
If you read the whole chapter you will see that he was talking to the Pharasees they were the ones that was out to kill him and yes they are
Abraham's seed and also never in bondage. The seed whoever that were in bondage was Jacobs seed. The most high promised him to be the father of many nations that was the covenant with Abraham but he later did another covenant with Jacob who's name was changed to Israel. Keep in mind that Abraham had three son's. He had three wives. Gen. chapters 12-25. The book of jubliees. They are still in bondage till this very day Isaiah ch. 10 you have to remember Is.,Eze.,Dan. are all prophets that is given prophetic visions to warn the masses.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
I will preface my answer by saying I'm not a linguist, but perhaps the problem could be traced to how the verb "dedouleukamen" was translated. On the surface, it would be very hypocritical to say "we have never been slaves" because every year they were reminded at Passover "We were once slaves...", and in fact "served with great rigor".(Ex. 12:14)
But they were made free(Dt. 26:8)
>
> **"And the LORD brought us forth out of Egypt with a mighty hand, and
> with an outstretched arm, and with great terribleness, and with signs,
> and with wonders"**
>
>
>
From this passage, one could assert "freedom", although of course there was the Babylonian captivity, and the various times of servitude under different oppressor nations.
Contextually, they responded by saying **,"We are children of Abraham..."** therefore, they are the children of the promises of God through Abraham, and assert this 'right', although Jesus in further dialogue says, **"Your father is the devil..**"(John 8:44)
So what appears at issue is "moral freedom', not "political freedom"; brought on by Jesus's statement **,"You shall know the truth, and the truth shall make you free**".(vs 33)
By virtue of their circumcision, and following the Law, they were "morally free", although physical freedom from time to time was restrained. And yet Jesus confronts them, telling them **"Whoever commits sin is a servant of it**"(vs 34), to which they reply "WE are Abraham's seed..."(vs 37).
In conclusion, this issue wasn't about "Political' freedom, it was about 'moral' freedom; hence the response "We are Abraham's seed and never been enslaved to anyone" makes sense.
|
If you read the whole chapter you will see that he was talking to the Pharasees they were the ones that was out to kill him and yes they are
Abraham's seed and also never in bondage. The seed whoever that were in bondage was Jacobs seed. The most high promised him to be the father of many nations that was the covenant with Abraham but he later did another covenant with Jacob who's name was changed to Israel. Keep in mind that Abraham had three son's. He had three wives. Gen. chapters 12-25. The book of jubliees. They are still in bondage till this very day Isaiah ch. 10 you have to remember Is.,Eze.,Dan. are all prophets that is given prophetic visions to warn the masses.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
The Jews were probably referring to the the fact that they had fought for thier freedom from the Greeks (Maccabees) and were not bound to be Roman citizens, but they had thier own culture, even they were still under Roman rule. They were not really free at this writing, but allowed a certian allowance to be thier own culture. They were in denial of thier own state. They couldn't do cetain things, like maintian the death penalty in the Law, as only Rome had this ability.
|
"We have never been slaves" or in bondage to any one was a true statement for those who were confronting Jesus but it was not true for the nation having been saved or rescued from Egypt. They are using an extreme literalness to avoid answering the argument Jesus set before them.
Yes, the answer is that simple.
---
David H. Stern, Jewish New Testament Commentary, (Clarksville, Maryland: Jewish New Testament Publications, Inc., 1992), WORDsearch CROSS e-book, 183.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
Nearly every expositor I have looked up concludes that this is actually just a hasty staement made by proud men who have a distatesfull view of Jesus. In other words **the particular Jews in the account are made to seem so proud and foolish that they straightway deny their obvious history and current situation under Rome as a vassal state**.
Owen has this view:
>
> Forgetful of their servitude in Egypt, Babylon, and at that very time to the Romans, they indignantly deny that they were ever in bondage to any man. How they could have uttered so palpable an untruth is inconceivable, unless on the general principle, that angry men do not pause to consider what they are about to say, and in consequence, often give expression to sheer fabrications. (Owen, J. J. (1861). A Commentary, Critical, Expository, and Practical, on the Gospel of John (p. 197). New York: Leavitt & Allen.)
>
>
>
Even old Cyril of Alexandria had this view:
>
> In no respect then was the speech of the Jews sane: for besides being ignorant of their truer bondage, that in sin, they utterly deny the other ignoble one and have an understanding accustomed to think highly about a mere nothing. (Cyril of Alexandria. (1874). Commentary on the Gospel according to S. John (Vol. 1, pp. 626–627). Oxford; London: James Parker & Co.; Rivingtons.)
>
>
>
Plummer has this view:
>
> On texts like these they build the proud belief that Jews have never yet been in bondage to any man. But passion once more blinds them to historical facts (see on 7:52). The bondage in Egypt, the oppressions in the times of the Judges, the captivity in Babylon, and the Roman yoke, are all forgotten. “They have an immovable love of liberty, and maintain that God is their only ruler and master” (Josephus, Ant. XVIII. i. 6). (Plummer, A. (1896). The Gospel according to S. John (p. 193). Cambridge: Cambridge University Press.)
>
>
>
Govett has again the same:
>
> They speak hastily, untruly, inconsistently; for their strongest desire for Messiah was, and is, that He might free them from the Roman yoke. And had our Lord but proposed that, to be effected by force of arms, willingly would they have enrolled themselves as volunteers. (Govett, R. (1881). Exposition of the Gospel of St. John (Vol. 1, p. 371). London: Bemrose & Sons.)
>
>
>
...And so on and so forth.
|
The Jews were probably referring to the the fact that they had fought for thier freedom from the Greeks (Maccabees) and were not bound to be Roman citizens, but they had thier own culture, even they were still under Roman rule. They were not really free at this writing, but allowed a certian allowance to be thier own culture. They were in denial of thier own state. They couldn't do cetain things, like maintian the death penalty in the Law, as only Rome had this ability.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
The Jews were probably referring to the the fact that they had fought for thier freedom from the Greeks (Maccabees) and were not bound to be Roman citizens, but they had thier own culture, even they were still under Roman rule. They were not really free at this writing, but allowed a certian allowance to be thier own culture. They were in denial of thier own state. They couldn't do cetain things, like maintian the death penalty in the Law, as only Rome had this ability.
|
If you read the whole chapter you will see that he was talking to the Pharasees they were the ones that was out to kill him and yes they are
Abraham's seed and also never in bondage. The seed whoever that were in bondage was Jacobs seed. The most high promised him to be the father of many nations that was the covenant with Abraham but he later did another covenant with Jacob who's name was changed to Israel. Keep in mind that Abraham had three son's. He had three wives. Gen. chapters 12-25. The book of jubliees. They are still in bondage till this very day Isaiah ch. 10 you have to remember Is.,Eze.,Dan. are all prophets that is given prophetic visions to warn the masses.
|
8,445 |
ESV:
>
> 33 They answered him, “We are offspring of Abraham and have never been enslaved to anyone. How is it that you say, ‘You will become free’?”
>
>
>
SBLGNT:
>
> 33 ἀπεκρίθησαν πρὸς αὐτόν· Σπέρμα Ἀβραάμ ἐσμεν καὶ οὐδενὶ δεδουλεύκαμεν πώποτε· πῶς σὺ λέγεις ὅτι Ἐλεύθεροι γενήσεσθε;
>
>
>
My impression is that the Egyptian slavery was central to Jewish identity.
(Not that I know anything about how first century Jews thought - educated input is appreciated.) Clearly these men had in mind their ancestry ("We are offspring of Abraham...") and remembered something of the scriptures (as they apparently embraced the teaching of v. 28), but did they really "forget" that their ancestors were slaves (and they themselves a subjugated people)?
|
2014/02/27
|
[
"https://hermeneutics.stackexchange.com/questions/8445",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/3555/"
] |
"We have never been slaves" or in bondage to any one was a true statement for those who were confronting Jesus but it was not true for the nation having been saved or rescued from Egypt. They are using an extreme literalness to avoid answering the argument Jesus set before them.
Yes, the answer is that simple.
---
David H. Stern, Jewish New Testament Commentary, (Clarksville, Maryland: Jewish New Testament Publications, Inc., 1992), WORDsearch CROSS e-book, 183.
|
If you read the whole chapter you will see that he was talking to the Pharasees they were the ones that was out to kill him and yes they are
Abraham's seed and also never in bondage. The seed whoever that were in bondage was Jacobs seed. The most high promised him to be the father of many nations that was the covenant with Abraham but he later did another covenant with Jacob who's name was changed to Israel. Keep in mind that Abraham had three son's. He had three wives. Gen. chapters 12-25. The book of jubliees. They are still in bondage till this very day Isaiah ch. 10 you have to remember Is.,Eze.,Dan. are all prophets that is given prophetic visions to warn the masses.
|
4,448,928 |
I need a directory with 777 permissions in my webserver; anyway, I would like to protect it by placing it outside the public\_html directory. Is this safe enough? A php script will be able to access that directory?
Thank you for your help.
—Albe
|
2010/12/15
|
[
"https://Stackoverflow.com/questions/4448928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/223090/"
] |
So long as your php scripts are sufficiently secure from users trying to break them with SQL injection (amongst others), placing the directory outside the web root is definitely safe to prevent others directly accessing the contents. And yes, php can still access the files, if given an appropriate path to that directory.
|
yes, the other php scripts can still access that directory, but it will not be reachable over the web.
set the correct owner/group as well,
if you set it to be the owner of the php process a 700 should be working just as well.
|
4,448,928 |
I need a directory with 777 permissions in my webserver; anyway, I would like to protect it by placing it outside the public\_html directory. Is this safe enough? A php script will be able to access that directory?
Thank you for your help.
—Albe
|
2010/12/15
|
[
"https://Stackoverflow.com/questions/4448928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/223090/"
] |
So long as your php scripts are sufficiently secure from users trying to break them with SQL injection (amongst others), placing the directory outside the web root is definitely safe to prevent others directly accessing the contents. And yes, php can still access the files, if given an appropriate path to that directory.
|
David's way is the easiest, but you could also try;
* placing a .htacces file in your folder
* changing the permissions to 700 (or 750, if you have to be able to edit it with the group)
* starting filenames in the directory with a dot (though this is easy to screw up, so you may want to avoid it)
If David's way works, I'd prefer that, but in case you have some weird extra restrictions, these ways MAY work.
|
4,448,928 |
I need a directory with 777 permissions in my webserver; anyway, I would like to protect it by placing it outside the public\_html directory. Is this safe enough? A php script will be able to access that directory?
Thank you for your help.
—Albe
|
2010/12/15
|
[
"https://Stackoverflow.com/questions/4448928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/223090/"
] |
yes, the other php scripts can still access that directory, but it will not be reachable over the web.
set the correct owner/group as well,
if you set it to be the owner of the php process a 700 should be working just as well.
|
David's way is the easiest, but you could also try;
* placing a .htacces file in your folder
* changing the permissions to 700 (or 750, if you have to be able to edit it with the group)
* starting filenames in the directory with a dot (though this is easy to screw up, so you may want to avoid it)
If David's way works, I'd prefer that, but in case you have some weird extra restrictions, these ways MAY work.
|
87,407 |
I am trying to translate some lyrics that go like
>
> We can talk about nothing
>
>
>
then I hit a snag because I am not sure what the word for "nothing" could be. Things that keep coming to mind:
>
> 話すことがない
>
> have nothing to talk about
>
>
>
>
> 何も話していない
> [we] are talking about nothing
>
>
>
Usually a sentence with "nothing" in it becomes 何も + a negative verb, but I'm not sure it could also work in this context. What would a standalone noun for "nothing" or "nothingness" be? I am not thinking of the religious/philosophical concept of nothingness (e.g. [空、無](https://japanese.stackexchange.com/questions/1646/why-is-%E7%A9%BA-%E3%81%8F%E3%81%86-and-not-%E7%84%A1-%E3%82%80-used-to-define-void-emptiness-in-a-buddhist-con)).
My best attempt:
>
> 何も話さなくてもいい
>
>
>
But I'm not really happy with it since "nothing" is not directly rendered.
|
2021/07/09
|
[
"https://japanese.stackexchange.com/questions/87407",
"https://japanese.stackexchange.com",
"https://japanese.stackexchange.com/users/30454/"
] |
"Talk about nothing" here I believe means talk about things that are not important or don't matter.
In that case you could say "くだらない話をしてもいい" you could also use 意味のない話 or similar words.
|
「何のことも話さない」 - lit. "don't talk about anything".
Maybe this would work in your context?
|
15,371,414 |
I'm having trouble styling a password field. I only need to know how can i replace the default dots with a custom image,like in the image below.

|
2013/03/12
|
[
"https://Stackoverflow.com/questions/15371414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2162707/"
] |
Check [this topic](https://stackoverflow.com/questions/6859727/styling-password-fields-in-css). I found there something curious :)
```
input[type="password"]
{
-webkit-text-security: disc;
}
```
|
You can't do that with CSS. You'll need to make a custom control.
One way to do that would be to make a custom font where every character is the same glyph.
Another would be to use JS to capture the keyup events, then produce a div with a repeating background image.
(If you don't know how to do those, I'd just leave it as is – it's not a particularly straightforward task if you are a beginner.)
|
15,371,414 |
I'm having trouble styling a password field. I only need to know how can i replace the default dots with a custom image,like in the image below.

|
2013/03/12
|
[
"https://Stackoverflow.com/questions/15371414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2162707/"
] |
Check [this topic](https://stackoverflow.com/questions/6859727/styling-password-fields-in-css). I found there something curious :)
```
input[type="password"]
{
-webkit-text-security: disc;
}
```
|
>
> how can i replace the default dots with a custom image
>
>
>
You can't cross-browser with pure CSS. You could try to build a custom password field using JavaScript and a lot of event handlers, but it would inevitably have issues in one browser or another, especially for mobile devices which may use a different design or custom interaction for password fields.
Leave it alone, use the default text, and try to avoid messing with user expectations.
|
32,412,528 |
I could successfully deliver the new Azure SQL Data Warehouse database.
If Í try to connect to the SQL Data Warehouse Database, I receive following error message:
"Parse error at line: 1 ,column: 5: Incorrect syntax near 'ANSI\_NULLS'".
This happens in VS 2013 and VS 2015! The data load process with BCP to the SQL Data Warehouse database was successfully!
Thanks, Herbert
|
2015/09/05
|
[
"https://Stackoverflow.com/questions/32412528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5271601/"
] |
Azure SQL Data Warehouse does not currently support setting ANSI\_NULLS on (SET ANSI\_NULL ON). You can simply remove that statement from your query and you should have success.
Additionally, make sure that you are running the June 2015 Preview of SSDT (<http://blogs.msdn.com/b/ssdt/archive/2015/06/24/ssdt-june-2015-preview.aspx>). This has the supported SSDT capabilities for SQL Data Warehouse.
|
I think your connection isn't actually recognised as a SQL DW connection. I bet your query window is a .sql file, not a .dsql as it needs to be. If you connect as a .sql query, it will try to set various settings that aren't supported.
Go back into the Azure portal and use the link to connect using SSDT from there. You should get a connection in the SQL Server Explorer pane which looks different, and when you start a New Query based on it, you should get a .dsql window, not a .sql one.
|
32,412,528 |
I could successfully deliver the new Azure SQL Data Warehouse database.
If Í try to connect to the SQL Data Warehouse Database, I receive following error message:
"Parse error at line: 1 ,column: 5: Incorrect syntax near 'ANSI\_NULLS'".
This happens in VS 2013 and VS 2015! The data load process with BCP to the SQL Data Warehouse database was successfully!
Thanks, Herbert
|
2015/09/05
|
[
"https://Stackoverflow.com/questions/32412528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5271601/"
] |
I had the same error, when tried to [Use Visual Studio to query Azure SQL Data Warehouse](https://azure.microsoft.com/en-us/documentation/articles/sql-data-warehouse-query-visual-studio)
and selected my database.
The Workaround was to select master database, connect to it, then in top drop-down for the query change to my database.
|
I think your connection isn't actually recognised as a SQL DW connection. I bet your query window is a .sql file, not a .dsql as it needs to be. If you connect as a .sql query, it will try to set various settings that aren't supported.
Go back into the Azure portal and use the link to connect using SSDT from there. You should get a connection in the SQL Server Explorer pane which looks different, and when you start a New Query based on it, you should get a .dsql window, not a .sql one.
|
49,668,363 |
The code is very simple:
```
<a download href="http://www.pdf995.com/samples/pdf.pdf">Download</a>
```
I expect it to save the pdf file but it always open the file on the browser.
It works with other file type, just have problem with PDF file.
|
2018/04/05
|
[
"https://Stackoverflow.com/questions/49668363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3458455/"
] |
See [the MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes):
>
> This attribute only works for same-origin URLs.
>
>
>
Presumably, the other file types, where you see it "working", are ones where the default behaviour is to download the file.
|
If the URL that you're trying to fetch has an `Access-Control-Allow-Origin` header, you can work around this by using `fetch` and blobs:
```js
function forceDownload(blob, filename) {
// Create an invisible anchor element
const anchor = document.createElement('a');
anchor.style.display = 'none';
anchor.href = window.URL.createObjectURL(blob);
anchor.setAttribute('download', filename);
document.body.appendChild(anchor);
// Trigger the download by simulating click
anchor.click();
// Clean up
window.URL.revokeObjectURL(anchor.href);
document.body.removeChild(anchor);
}
function downloadResource(url, filename) {
fetch(url, {
headers: new Headers({
Origin: window.location.origin,
}),
mode: 'cors',
})
.then(response => response.blob())
.then(blob => forceDownload(blob, filename))
.catch(e => console.error(e));
}
downloadResource('https://memegen.link/xy/fetch/all_the_things.jpg?watermark=none');
```
This has a few limitations:
* the file size limit of blobs is about 500MB
* some websites will not allow for cross-origin requests, leading to errors like this one below
>
> Failed to load <https://example.com/example.jpg>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.com' is therefore not allowed access.
>
>
>
Ref 1: [Leeroy](https://stackoverflow.com/users/5266640/leeroy) in <https://stackoverflow.com/a/49500465/1268612>
Ref 2: <https://davidwalsh.name/javascript-download>
Full explanation: <https://blog.logrocket.com/programmatic-file-downloads-in-the-browser-9a5186298d5c/>
|
438,516 |
I have the below schematic showing the equivalent circuit of a transformer under open-circuit conditions. Will the transformer behave like a resistor, inductor, or capacitor? And will this behaviour vary depending on the values of the open circuit current, open circuit voltage, etc?
I notice that we have a resistor in series with an inductive reactance, which is then in series with a parallel combination of a resistor (representing core losses), and a magnetising inductive reactance.
So far, I have ruled out the transformer behaving as a capacitor. I am thinking that perhaps the transformer is behaving as an inductor? Although, I do not have a great understanding of why this is, it's really just a wild guess.
I appreciate your time and help,
thank you.
[](https://i.stack.imgur.com/WBYqm.png)
|
2019/05/15
|
[
"https://electronics.stackexchange.com/questions/438516",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/188882/"
] |
Inductors and transformers are constructed similarly, except that a transformer has multiple windings on the same core and an inductor has only one. If you are only using one winding of a transformer, it will behave exactly as an inductor.
For most transformers, Rc and Xm would be negligible because they represent core losses, which are kept to a minimum to allow the transformer to operate efficiently.
If you neglect those nodes in the circuit, the circuit would become an ideal inductor and a resistor in series. It would behave like a real inductor with some nonzero internal resistance.
|
Go with what Thor has said. When it comes to testing, beware of using transformers in open loop conditions expecting them to work as inductors. Transformers are constructed to work with minimal magnetizing current. Using them as inductors will usually saturate the core and you would see a short circuit
|
438,516 |
I have the below schematic showing the equivalent circuit of a transformer under open-circuit conditions. Will the transformer behave like a resistor, inductor, or capacitor? And will this behaviour vary depending on the values of the open circuit current, open circuit voltage, etc?
I notice that we have a resistor in series with an inductive reactance, which is then in series with a parallel combination of a resistor (representing core losses), and a magnetising inductive reactance.
So far, I have ruled out the transformer behaving as a capacitor. I am thinking that perhaps the transformer is behaving as an inductor? Although, I do not have a great understanding of why this is, it's really just a wild guess.
I appreciate your time and help,
thank you.
[](https://i.stack.imgur.com/WBYqm.png)
|
2019/05/15
|
[
"https://electronics.stackexchange.com/questions/438516",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/188882/"
] |
Inductors and transformers are constructed similarly, except that a transformer has multiple windings on the same core and an inductor has only one. If you are only using one winding of a transformer, it will behave exactly as an inductor.
For most transformers, Rc and Xm would be negligible because they represent core losses, which are kept to a minimum to allow the transformer to operate efficiently.
If you neglect those nodes in the circuit, the circuit would become an ideal inductor and a resistor in series. It would behave like a real inductor with some nonzero internal resistance.
|
Your schematic tells you the answer.
The input impedance is dominated by the higher primary Inductance so that Xl >> Xm and Rl << Rm so it can be approximated by Zin=Rl+jXL.
For a transformer with a primary L = 1 H at 240 Vrms the primary current is ~ 0.75A with 4H it reduces by 4.
|
438,516 |
I have the below schematic showing the equivalent circuit of a transformer under open-circuit conditions. Will the transformer behave like a resistor, inductor, or capacitor? And will this behaviour vary depending on the values of the open circuit current, open circuit voltage, etc?
I notice that we have a resistor in series with an inductive reactance, which is then in series with a parallel combination of a resistor (representing core losses), and a magnetising inductive reactance.
So far, I have ruled out the transformer behaving as a capacitor. I am thinking that perhaps the transformer is behaving as an inductor? Although, I do not have a great understanding of why this is, it's really just a wild guess.
I appreciate your time and help,
thank you.
[](https://i.stack.imgur.com/WBYqm.png)
|
2019/05/15
|
[
"https://electronics.stackexchange.com/questions/438516",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/188882/"
] |
Go with what Thor has said. When it comes to testing, beware of using transformers in open loop conditions expecting them to work as inductors. Transformers are constructed to work with minimal magnetizing current. Using them as inductors will usually saturate the core and you would see a short circuit
|
Your schematic tells you the answer.
The input impedance is dominated by the higher primary Inductance so that Xl >> Xm and Rl << Rm so it can be approximated by Zin=Rl+jXL.
For a transformer with a primary L = 1 H at 240 Vrms the primary current is ~ 0.75A with 4H it reduces by 4.
|
30,256,406 |
I am trying to get a modal popup window from another modal popup window.
when i click the link from the first popup window, the second popup window is opening, but the first one not getting closed.
How can i do this?
jQuery:
```
$(".get-me-license").click(function(){
$("#license").modal('show');
});
$(".confirm-my-license").click(function(){
$("#confirm-license").modal('show');
});
```
HTML:
```
<div id="license" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img class="modal-cont" src="images/license-popup.png">
<table class="get-license-confirm">
<tr>
<td><a href="#" class="btn btn-warning confirm-my-license">GET LICENSE</a></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div id="confirm-license" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img class="modal-cont" src="images/license-popup.png">
<table class="get-license-confirm">
<tr>
<td><a href="#" class="btn btn-warning">Confirm</a></td>
</tr>
</table>
</div>
</div>
</div>
</div>
```
|
2015/05/15
|
[
"https://Stackoverflow.com/questions/30256406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2590090/"
] |
**You can try this two methods**
To hide the modal:
```
$('.YourModalElement').modal('hide');
```
Or to totally destroy the modal instance, you can try this one:
```
$('.YourModalElement').data('modal', null);
```
|
put common class in all modal and just call modal funtion with hide argument befor show new modal. Like this :
suppose common class for modal is "common-modal".
```
$('.common-modal').modal('hide');
```
then
```
$('yourmodal').modal();
```
|
230,487 |
I've already posted something similar recently, but I don't think I was really asking the right question. I'm designing a hypothetical lower-gravity planet with 0.47M, 0.79r and 0.76g, with a similar density to Earth. I've already determined that this mass, radius, and density will allow my planet to sustain a long-lived internal dynamo and strong magnetic field, as well as have an escape velocity that will permit the stability of water vapor in the atmosphere. I want to give the planet an Earth-like atmosphere (in terms of composition), but the fact that the gravity is lower might mean that the atmosphere would be less dense and expand farther out. I'm worried this might make the planet too cold, and I don't want a snowball planet scenario.
My question is - if I want the planet to be at least as warm as Earth was during the last ice age, what factors should I tweak to make the planet realistically warm enough? (I'm thinking maybe increasing the total mass of the atmosphere, ocean size/depth, rotation rate, etc). I have some general ideas but no confidence that they make sense.
|
2022/05/24
|
[
"https://worldbuilding.stackexchange.com/questions/230487",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/95908/"
] |
**More atmosphere**
<https://www.coursehero.com/study-guides/astronomy/the-massive-atmosphere-of-venus/>
>
> ...as percentages, the proportions of the major gases are very similar
> for Venus and Mars, but in total quantity, their atmospheres are
> dramatically different. With its surface pressure of 90 bars, the
> venusian atmosphere is more than 10,000 times more massive than its
> martian counterpart.
>
>
>
You can have as much atmospheric gas on your 0.76g planet as you want. Venus has 0.9g but it has a metric boatload of gas in its atmosphere. You can use that to warm your planet up too - more total gas in the atmosphere, more greenhouse effect, higher air pressure at sea level and all that.
|
It sounds like you need some atmospheric control satellites. Or if the sun is hotter/closer that would help too. Lots of volcanic activity or internal friction like on the moons of Jupiter might also help.
|
230,487 |
I've already posted something similar recently, but I don't think I was really asking the right question. I'm designing a hypothetical lower-gravity planet with 0.47M, 0.79r and 0.76g, with a similar density to Earth. I've already determined that this mass, radius, and density will allow my planet to sustain a long-lived internal dynamo and strong magnetic field, as well as have an escape velocity that will permit the stability of water vapor in the atmosphere. I want to give the planet an Earth-like atmosphere (in terms of composition), but the fact that the gravity is lower might mean that the atmosphere would be less dense and expand farther out. I'm worried this might make the planet too cold, and I don't want a snowball planet scenario.
My question is - if I want the planet to be at least as warm as Earth was during the last ice age, what factors should I tweak to make the planet realistically warm enough? (I'm thinking maybe increasing the total mass of the atmosphere, ocean size/depth, rotation rate, etc). I have some general ideas but no confidence that they make sense.
|
2022/05/24
|
[
"https://worldbuilding.stackexchange.com/questions/230487",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/95908/"
] |
**More atmosphere**
<https://www.coursehero.com/study-guides/astronomy/the-massive-atmosphere-of-venus/>
>
> ...as percentages, the proportions of the major gases are very similar
> for Venus and Mars, but in total quantity, their atmospheres are
> dramatically different. With its surface pressure of 90 bars, the
> venusian atmosphere is more than 10,000 times more massive than its
> martian counterpart.
>
>
>
You can have as much atmospheric gas on your 0.76g planet as you want. Venus has 0.9g but it has a metric boatload of gas in its atmosphere. You can use that to warm your planet up too - more total gas in the atmosphere, more greenhouse effect, higher air pressure at sea level and all that.
|
The simplest answer is the planet has evolved a biosphere that produces an output of sufficient methane to warm the atmosphere to the degree you require.
Methane is a greenhouse gas that retains heat over twenty times more of that of carbon dioxide. It's not the only greenhouse gas that can raise a planet's global temperature. Earth would have a global temperature of around minus 30 degrees centigrade if it wasn't for our atmosphere's carbon dioxide content.
The main source of methane is from biological systems. That's why a biosphere is the probable source.
|
230,487 |
I've already posted something similar recently, but I don't think I was really asking the right question. I'm designing a hypothetical lower-gravity planet with 0.47M, 0.79r and 0.76g, with a similar density to Earth. I've already determined that this mass, radius, and density will allow my planet to sustain a long-lived internal dynamo and strong magnetic field, as well as have an escape velocity that will permit the stability of water vapor in the atmosphere. I want to give the planet an Earth-like atmosphere (in terms of composition), but the fact that the gravity is lower might mean that the atmosphere would be less dense and expand farther out. I'm worried this might make the planet too cold, and I don't want a snowball planet scenario.
My question is - if I want the planet to be at least as warm as Earth was during the last ice age, what factors should I tweak to make the planet realistically warm enough? (I'm thinking maybe increasing the total mass of the atmosphere, ocean size/depth, rotation rate, etc). I have some general ideas but no confidence that they make sense.
|
2022/05/24
|
[
"https://worldbuilding.stackexchange.com/questions/230487",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/95908/"
] |
**More atmosphere**
<https://www.coursehero.com/study-guides/astronomy/the-massive-atmosphere-of-venus/>
>
> ...as percentages, the proportions of the major gases are very similar
> for Venus and Mars, but in total quantity, their atmospheres are
> dramatically different. With its surface pressure of 90 bars, the
> venusian atmosphere is more than 10,000 times more massive than its
> martian counterpart.
>
>
>
You can have as much atmospheric gas on your 0.76g planet as you want. Venus has 0.9g but it has a metric boatload of gas in its atmosphere. You can use that to warm your planet up too - more total gas in the atmosphere, more greenhouse effect, higher air pressure at sea level and all that.
|
Under your planetary scenario, the escape velocity would be 8.626 km/s, which is 77 percent of the escape velocity of Earth (11.184 km/s), but higher than the escape velocity of Mars (5.025 km/s). This means there's a chance of having a reasonable atmosphere.
One way to have a warmer planet would be to have a higher concentration of carbon dioxide in the atmosphere, but **not** too high. You want a nice greenhouse effect. One way to achieve this would be to make the planet volcanically active, with volcanoes emitting enough carbon dioxide to produce a warmer planet.
Something like a tropical jungle world might be possible, were there is enough jungle to prevent an escalating greenhouse situation where too much volcanic carbon dioxide accumulates in the atmosphere, but volcanoes keep emitting enough carbon dioxide so an equilibrium is achieved.
|
230,487 |
I've already posted something similar recently, but I don't think I was really asking the right question. I'm designing a hypothetical lower-gravity planet with 0.47M, 0.79r and 0.76g, with a similar density to Earth. I've already determined that this mass, radius, and density will allow my planet to sustain a long-lived internal dynamo and strong magnetic field, as well as have an escape velocity that will permit the stability of water vapor in the atmosphere. I want to give the planet an Earth-like atmosphere (in terms of composition), but the fact that the gravity is lower might mean that the atmosphere would be less dense and expand farther out. I'm worried this might make the planet too cold, and I don't want a snowball planet scenario.
My question is - if I want the planet to be at least as warm as Earth was during the last ice age, what factors should I tweak to make the planet realistically warm enough? (I'm thinking maybe increasing the total mass of the atmosphere, ocean size/depth, rotation rate, etc). I have some general ideas but no confidence that they make sense.
|
2022/05/24
|
[
"https://worldbuilding.stackexchange.com/questions/230487",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/95908/"
] |
The simplest answer is the planet has evolved a biosphere that produces an output of sufficient methane to warm the atmosphere to the degree you require.
Methane is a greenhouse gas that retains heat over twenty times more of that of carbon dioxide. It's not the only greenhouse gas that can raise a planet's global temperature. Earth would have a global temperature of around minus 30 degrees centigrade if it wasn't for our atmosphere's carbon dioxide content.
The main source of methane is from biological systems. That's why a biosphere is the probable source.
|
It sounds like you need some atmospheric control satellites. Or if the sun is hotter/closer that would help too. Lots of volcanic activity or internal friction like on the moons of Jupiter might also help.
|
230,487 |
I've already posted something similar recently, but I don't think I was really asking the right question. I'm designing a hypothetical lower-gravity planet with 0.47M, 0.79r and 0.76g, with a similar density to Earth. I've already determined that this mass, radius, and density will allow my planet to sustain a long-lived internal dynamo and strong magnetic field, as well as have an escape velocity that will permit the stability of water vapor in the atmosphere. I want to give the planet an Earth-like atmosphere (in terms of composition), but the fact that the gravity is lower might mean that the atmosphere would be less dense and expand farther out. I'm worried this might make the planet too cold, and I don't want a snowball planet scenario.
My question is - if I want the planet to be at least as warm as Earth was during the last ice age, what factors should I tweak to make the planet realistically warm enough? (I'm thinking maybe increasing the total mass of the atmosphere, ocean size/depth, rotation rate, etc). I have some general ideas but no confidence that they make sense.
|
2022/05/24
|
[
"https://worldbuilding.stackexchange.com/questions/230487",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/95908/"
] |
Under your planetary scenario, the escape velocity would be 8.626 km/s, which is 77 percent of the escape velocity of Earth (11.184 km/s), but higher than the escape velocity of Mars (5.025 km/s). This means there's a chance of having a reasonable atmosphere.
One way to have a warmer planet would be to have a higher concentration of carbon dioxide in the atmosphere, but **not** too high. You want a nice greenhouse effect. One way to achieve this would be to make the planet volcanically active, with volcanoes emitting enough carbon dioxide to produce a warmer planet.
Something like a tropical jungle world might be possible, were there is enough jungle to prevent an escalating greenhouse situation where too much volcanic carbon dioxide accumulates in the atmosphere, but volcanoes keep emitting enough carbon dioxide so an equilibrium is achieved.
|
It sounds like you need some atmospheric control satellites. Or if the sun is hotter/closer that would help too. Lots of volcanic activity or internal friction like on the moons of Jupiter might also help.
|
230,487 |
I've already posted something similar recently, but I don't think I was really asking the right question. I'm designing a hypothetical lower-gravity planet with 0.47M, 0.79r and 0.76g, with a similar density to Earth. I've already determined that this mass, radius, and density will allow my planet to sustain a long-lived internal dynamo and strong magnetic field, as well as have an escape velocity that will permit the stability of water vapor in the atmosphere. I want to give the planet an Earth-like atmosphere (in terms of composition), but the fact that the gravity is lower might mean that the atmosphere would be less dense and expand farther out. I'm worried this might make the planet too cold, and I don't want a snowball planet scenario.
My question is - if I want the planet to be at least as warm as Earth was during the last ice age, what factors should I tweak to make the planet realistically warm enough? (I'm thinking maybe increasing the total mass of the atmosphere, ocean size/depth, rotation rate, etc). I have some general ideas but no confidence that they make sense.
|
2022/05/24
|
[
"https://worldbuilding.stackexchange.com/questions/230487",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/95908/"
] |
Under your planetary scenario, the escape velocity would be 8.626 km/s, which is 77 percent of the escape velocity of Earth (11.184 km/s), but higher than the escape velocity of Mars (5.025 km/s). This means there's a chance of having a reasonable atmosphere.
One way to have a warmer planet would be to have a higher concentration of carbon dioxide in the atmosphere, but **not** too high. You want a nice greenhouse effect. One way to achieve this would be to make the planet volcanically active, with volcanoes emitting enough carbon dioxide to produce a warmer planet.
Something like a tropical jungle world might be possible, were there is enough jungle to prevent an escalating greenhouse situation where too much volcanic carbon dioxide accumulates in the atmosphere, but volcanoes keep emitting enough carbon dioxide so an equilibrium is achieved.
|
The simplest answer is the planet has evolved a biosphere that produces an output of sufficient methane to warm the atmosphere to the degree you require.
Methane is a greenhouse gas that retains heat over twenty times more of that of carbon dioxide. It's not the only greenhouse gas that can raise a planet's global temperature. Earth would have a global temperature of around minus 30 degrees centigrade if it wasn't for our atmosphere's carbon dioxide content.
The main source of methane is from biological systems. That's why a biosphere is the probable source.
|
8,385,016 |
I am learning C# 2010 using the book 'Microsoft VS C# 2010 Step by Step' whose Chapter 27 introduces the Task Parallel Library. When I run the provided 'GraphDemo' project, I get an XamlParseException error.
I went over several of the threads on this site on the same exception and managed to drill down the inner exception to a failure to load the PerformanceCounter.
Fearing corruption of my system's .NET Framework 4 installation, I repaired it to original state but the error persists.
The strange thing is that, none of the other readers of the book have complained about this issue; after I wrote to the publishers, the author asked me to send him a zipfile of the project and he claims it ran fine on his machine. There are seven other projects in Chapter 27 and all of them throw the same error on my system.
This the full text of the exception generated:
```
System.Windows.Markup.XamlParseException was unhandled
Message='The invocation of the constructor on type 'GraphDemo.GraphWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '5'.
Source=PresentationFramework
LineNumber=3
LinePosition=5
StackTrace:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at GraphDemo.App.Main() in E:\IT Books\Source Code Projects\Microsoft Visual C# 2010 Step By Step\Chapter 27\GraphDemo\GraphDemo\obj\x86\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.InvalidOperationException
Message=Cannot load Counter Name data because an invalid index '' was read from the registry.
Source=System
StackTrace:
at System.Diagnostics.PerformanceCounterLib.GetStringTable(Boolean isHelp)
at System.Diagnostics.PerformanceCounterLib.get_NameTable()
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.CounterExists(String category, String counter, Boolean& categoryExists)
at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.InitializeImpl()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName)
at GraphDemo.GraphWindow..ctor() in E:\IT Books\Source Code Projects\Microsoft Visual C# 2010 Step By Step\Chapter 27\GraphDemo\GraphDemo\GraphWindow.xaml.cs:line 25
InnerException:
And this is the code pinpointed by the inner exception:
public GraphWindow()
{
InitializeComponent();
PerformanceCounter memCounter = new PerformanceCounter("Memory", "Available Bytes");
availableMemorySize = Convert.ToUInt64(memCounter.NextValue());
this.pixelWidth = (int)availableMemorySize / 20000;
if (this.pixelWidth < 0 || this.pixelWidth > 15000)
this.pixelWidth = 15000;
this.pixelHeight = (int)availableMemorySize / 40000;
if (this.pixelHeight < 0 || this.pixelHeight > 7500)
this.pixelHeight = 7500;
}
```
Line 25 is the one where memCounter is initialized.
I shall appreciate all the help I can get.
|
2011/12/05
|
[
"https://Stackoverflow.com/questions/8385016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1072320/"
] |
There are several converters for it, for example this one in Ruby: <https://github.com/maxlapshin/mysql2postgres>
|
If your dataset is large and you need to do any transformation you can use open source solutions like [talend studio](http://www.talend.com/products/open-studio-di.php) and the kettle project from [pentaho](http://kettle.pentaho.com/) to create a map and it will take care of the rest; but this might be overkill unless you want to do any transformation as well (or your data set is really, really big).
EnterpriseDB (the company behind postgresql) provide a [data migration studio](http://enterprisedb.com/downloads/add-on-components-bundles) product that does this along with a [guide](http://get.enterprisedb.com/whitepapers/A_Visual_Guide_for_Migrating_to_Postgres_Plus_from_MySQL.pdf) if you want to do it yourself.
The [py-mysql2pgsql](http://pypi.python.org/pypi/py-mysql2pgsql) python package is another option.
|
5,772,064 |
Newer to creating php functions and mysql. I have function to connect to a database db\_conect\_nm(). This is in file db\_fns.php, and contains the user and password to connect to my db. I created this to have a more secure db connection. I had it in a directory outside of public\_html, and got error `PHP Warning: mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]: (28000/1045): Access denied for user 'negoti7'@'localhost' (using password: NO) ...`
Looking for solutions, I saw comments which indicated that perhaps this db user did not have permission from root, so I put it in a directory in public\_html, same directory as program where it is being called. I still get the same error.
I have tested the connection without being a function, and it works. What is wrong, and why is this not working as a function? I really want to put this somewhere other than in the code directly and make it more secure.
**db\_fns.php content**
```
<?php
//Database server
$host= 'localhost';
$nm_name= 'myname_databasename'; //sanitized data
$nm_user= 'myname_dbusername';
$nm_pword= 'password';
// db connect to nm database
function db_connect_nm()
{
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
if (!$nm_connect)
throw new Exception('Could not connect to NM database currently');
else
return $nm_connect;
}
?>
```
I call it from nm\_functions.php, db\_fns.php is included there.
**nm\_functions.php**
```
<?php require_once('sanitizedpathto/db_fns.php');
......some code
$conn_nm = db_connect_nm();
$result_sub = $conn_nm->query("select * from subscribers where uname='$username'");
.... more code
?>
```
Any ideas?
Thanks
|
2011/04/24
|
[
"https://Stackoverflow.com/questions/5772064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/722794/"
] |
Could it be the scope of the variables? Have you tried defining the variables inside the function to test?
Like this:
```
<?php
// db connect to nm database
function db_connect_nm()
{
//Database server
$host= 'localhost';
$nm_name= 'myname_databasename'; //sanitized data
$nm_user= 'myname_dbusername';
$nm_pword= 'password';
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
if (!$nm_connect)
throw new Exception('Could not connect to NM database currently');
else
return $nm_connect;
}
```
?>
|
You are :
* first, declaring some variables, outside of any functions
* then, trying to use those variables from inside a function.
Variables declared outside of a function are not, by default, visible from inside that function.
About that, you should read the [**Variable scope**](http://fr.php.net/manual/en/language.variables.scope.php) section of the manual.
Two possible solutions :
* Use the [`global`](http://fr.php.net/manual/en/language.variables.scope.php#language.variables.scope.global) keyword, to import those variables into your function -- making them visible
* Or **define [constants](http://fr.php.net/define), instead of variables** -- which makes sense, for configuration values.
In the first case, your function would look like this :
```
// db connect to nm database
function db_connect_nm()
{
// Make these outside variables visible from inside the function
global $host, $nm_user, $nm_pword, $nm_name;
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
if (!$nm_connect)
throw new Exception('Could not connect to NM database currently');
else
return $nm_connect;
}
```
And, in the second case, you'd first `define` the constants :
```
define('DB_HOST', 'localhost');
define('DB_DBNAME', 'myname_databasename');
define('DB_USER', 'myname_dbusername');
define('DB_PASSWORD', 'password');
```
And, then, use those constants :
```
// db connect to nm database
function db_connect_nm()
{
$nm_connect = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DBNAME);
if (!$nm_connect)
throw new Exception('Could not connect to NM database currently');
else
return $nm_connect;
}
```
This second solution is probably *more clean* than the first one ;-)
|
5,772,064 |
Newer to creating php functions and mysql. I have function to connect to a database db\_conect\_nm(). This is in file db\_fns.php, and contains the user and password to connect to my db. I created this to have a more secure db connection. I had it in a directory outside of public\_html, and got error `PHP Warning: mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]: (28000/1045): Access denied for user 'negoti7'@'localhost' (using password: NO) ...`
Looking for solutions, I saw comments which indicated that perhaps this db user did not have permission from root, so I put it in a directory in public\_html, same directory as program where it is being called. I still get the same error.
I have tested the connection without being a function, and it works. What is wrong, and why is this not working as a function? I really want to put this somewhere other than in the code directly and make it more secure.
**db\_fns.php content**
```
<?php
//Database server
$host= 'localhost';
$nm_name= 'myname_databasename'; //sanitized data
$nm_user= 'myname_dbusername';
$nm_pword= 'password';
// db connect to nm database
function db_connect_nm()
{
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
if (!$nm_connect)
throw new Exception('Could not connect to NM database currently');
else
return $nm_connect;
}
?>
```
I call it from nm\_functions.php, db\_fns.php is included there.
**nm\_functions.php**
```
<?php require_once('sanitizedpathto/db_fns.php');
......some code
$conn_nm = db_connect_nm();
$result_sub = $conn_nm->query("select * from subscribers where uname='$username'");
.... more code
?>
```
Any ideas?
Thanks
|
2011/04/24
|
[
"https://Stackoverflow.com/questions/5772064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/722794/"
] |
Could it be the scope of the variables? Have you tried defining the variables inside the function to test?
Like this:
```
<?php
// db connect to nm database
function db_connect_nm()
{
//Database server
$host= 'localhost';
$nm_name= 'myname_databasename'; //sanitized data
$nm_user= 'myname_dbusername';
$nm_pword= 'password';
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
if (!$nm_connect)
throw new Exception('Could not connect to NM database currently');
else
return $nm_connect;
}
```
?>
|
Your connection variables are not scoped inside the connection function. You either need to pass them as parameters to the function (preferable) or use the `global` keyword inside to reference them:
```
function db_connect_nm($host, $nm_user, $nm_pword, $nm_name)
{
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
//etc...
}
```
Alternate, not preferred:
```
function db_connect_nm()
{
global $host, $nm_user, $nm_pword, $nm_name;
$nm_connect = new mysqli($host, $nm_user, $nm_pword, $nm_name);
//etc...
}
```
|
110,336 |
Here's my issue: I need to close a process, already running, from a C# program.
The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never
have a main window.
The other requirement that I have is that the application be **closed** not **killed**. I need it to write it's memory buffers to disk - and killing it causes data loss.
Here's what I tried so far:
```
foreach (Process proc in Process.GetProcesses())
{
if (proc.ProcessName.ToLower().StartsWith("myapp"))
{
if (proc.MainWindowHandle.ToInt32() != 0)
{
proc.CloseMainWindow();
proc.Close();
//proc.Kill(); <--- not good!
}
}
}
```
I've added the **if** clause, after discovering that **MainWindowHandle == 0** when the window was minimized. Removing the **if** doesn't help. Neither the **CloseMainWindow()** nor the **Close()** work. The **Kill()** does, but as mentioned above - it's not what I need.
Any idea would be accepted, including the use of arcane Win32 API functions :)
|
2008/09/21
|
[
"https://Stackoverflow.com/questions/110336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19856/"
] |
This should work:
```
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
private const int WM_CLOSE = 0x10;
private const int WM_QUIT = 0x12;
public void SearchAndDestroy(string windowName)
{
IntPtr hWnd = FindWindow(null, windowName);
if (hWnd == IntPtr.Zero)
throw new Exception("Couldn't find window!");
SendMessage(hWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
}
```
Since some windows don't respond to `WM_CLOSE`, `WM_QUIT` might have to be sent instead. These declarations should work on both 32bit and 64bit.
|
If it's on the taskbar, it'll have a window. Or did you mean that it's in the taskbar notification area (aka the SysTray)? In which case, it'll still have a window.
Win32 applications don't really have a "main window", except by convention (the main window is the one that calls PostQuitMessage in response to WM\_DESTROY, causing the message loop to exit).
With the program running, run Spy++. To find all of the windows owned by a process, you should select Spy -> Processes from the main menu. This will display a tree of processes. From there, you can drill down to threads, and then to windows. This will tell you which windows the process has. Note down the window class and caption. With these, you can use FindWindow (or EnumWindows) to find the window handle in future.
With the window handle, you can send a WM\_CLOSE or WM\_SYSCOMMAND/SC\_CLOSE (equivalent to clicking on the 'X' on the window caption) message. This ought to cause the program to shut down nicely.
Note that I'm talking from a Win32 point-of-view here. You might need to use P/Invoke or other tricks to get this to work from a .NET program.
|
110,336 |
Here's my issue: I need to close a process, already running, from a C# program.
The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never
have a main window.
The other requirement that I have is that the application be **closed** not **killed**. I need it to write it's memory buffers to disk - and killing it causes data loss.
Here's what I tried so far:
```
foreach (Process proc in Process.GetProcesses())
{
if (proc.ProcessName.ToLower().StartsWith("myapp"))
{
if (proc.MainWindowHandle.ToInt32() != 0)
{
proc.CloseMainWindow();
proc.Close();
//proc.Kill(); <--- not good!
}
}
}
```
I've added the **if** clause, after discovering that **MainWindowHandle == 0** when the window was minimized. Removing the **if** doesn't help. Neither the **CloseMainWindow()** nor the **Close()** work. The **Kill()** does, but as mentioned above - it's not what I need.
Any idea would be accepted, including the use of arcane Win32 API functions :)
|
2008/09/21
|
[
"https://Stackoverflow.com/questions/110336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19856/"
] |
If it's on the taskbar, it'll have a window. Or did you mean that it's in the taskbar notification area (aka the SysTray)? In which case, it'll still have a window.
Win32 applications don't really have a "main window", except by convention (the main window is the one that calls PostQuitMessage in response to WM\_DESTROY, causing the message loop to exit).
With the program running, run Spy++. To find all of the windows owned by a process, you should select Spy -> Processes from the main menu. This will display a tree of processes. From there, you can drill down to threads, and then to windows. This will tell you which windows the process has. Note down the window class and caption. With these, you can use FindWindow (or EnumWindows) to find the window handle in future.
With the window handle, you can send a WM\_CLOSE or WM\_SYSCOMMAND/SC\_CLOSE (equivalent to clicking on the 'X' on the window caption) message. This ought to cause the program to shut down nicely.
Note that I'm talking from a Win32 point-of-view here. You might need to use P/Invoke or other tricks to get this to work from a .NET program.
|
Question to clarify why you're attempting this: If the only user interface on the process is the system tray icon, why would you want to kill that and but leave the process running? How would the user access the process? And if the machine is "unattended", why concern yourself with the tray icon?
|
110,336 |
Here's my issue: I need to close a process, already running, from a C# program.
The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never
have a main window.
The other requirement that I have is that the application be **closed** not **killed**. I need it to write it's memory buffers to disk - and killing it causes data loss.
Here's what I tried so far:
```
foreach (Process proc in Process.GetProcesses())
{
if (proc.ProcessName.ToLower().StartsWith("myapp"))
{
if (proc.MainWindowHandle.ToInt32() != 0)
{
proc.CloseMainWindow();
proc.Close();
//proc.Kill(); <--- not good!
}
}
}
```
I've added the **if** clause, after discovering that **MainWindowHandle == 0** when the window was minimized. Removing the **if** doesn't help. Neither the **CloseMainWindow()** nor the **Close()** work. The **Kill()** does, but as mentioned above - it's not what I need.
Any idea would be accepted, including the use of arcane Win32 API functions :)
|
2008/09/21
|
[
"https://Stackoverflow.com/questions/110336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19856/"
] |
This should work:
```
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
private const int WM_CLOSE = 0x10;
private const int WM_QUIT = 0x12;
public void SearchAndDestroy(string windowName)
{
IntPtr hWnd = FindWindow(null, windowName);
if (hWnd == IntPtr.Zero)
throw new Exception("Couldn't find window!");
SendMessage(hWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
}
```
Since some windows don't respond to `WM_CLOSE`, `WM_QUIT` might have to be sent instead. These declarations should work on both 32bit and 64bit.
|
Question to clarify why you're attempting this: If the only user interface on the process is the system tray icon, why would you want to kill that and but leave the process running? How would the user access the process? And if the machine is "unattended", why concern yourself with the tray icon?
|
110,336 |
Here's my issue: I need to close a process, already running, from a C# program.
The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never
have a main window.
The other requirement that I have is that the application be **closed** not **killed**. I need it to write it's memory buffers to disk - and killing it causes data loss.
Here's what I tried so far:
```
foreach (Process proc in Process.GetProcesses())
{
if (proc.ProcessName.ToLower().StartsWith("myapp"))
{
if (proc.MainWindowHandle.ToInt32() != 0)
{
proc.CloseMainWindow();
proc.Close();
//proc.Kill(); <--- not good!
}
}
}
```
I've added the **if** clause, after discovering that **MainWindowHandle == 0** when the window was minimized. Removing the **if** doesn't help. Neither the **CloseMainWindow()** nor the **Close()** work. The **Kill()** does, but as mentioned above - it's not what I need.
Any idea would be accepted, including the use of arcane Win32 API functions :)
|
2008/09/21
|
[
"https://Stackoverflow.com/questions/110336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19856/"
] |
This should work:
```
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
private const int WM_CLOSE = 0x10;
private const int WM_QUIT = 0x12;
public void SearchAndDestroy(string windowName)
{
IntPtr hWnd = FindWindow(null, windowName);
if (hWnd == IntPtr.Zero)
throw new Exception("Couldn't find window!");
SendMessage(hWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
}
```
Since some windows don't respond to `WM_CLOSE`, `WM_QUIT` might have to be sent instead. These declarations should work on both 32bit and 64bit.
|
Here are some answers and clarifications:
**rpetrich**:
Tried your method before and the problem is, I don't know the window name, it differs from user to user, version to version - just the exe name remains constant. All I have is the process name. And as you can see in the code above the MainWindowHandle of the process is 0.
**Roger**:
Yes, I did mean the taskbar notification area - thanks for the clarification.
I *NEED* to call PostQuitMessage. I just don't know how, given a processs only, and not a Window.
**Craig**:
I'd be glad to explain the situation: the application has a command line interface, allowing you to specify parameters that dictate what it would do and where will it save the results. But once it's running, the only way to stop it and get the results is right-click it in the tray notification are and select 'exit'.
Now my users want to script/batch the app. They had absolutely no problem starting it from a batch (just specify the exe name and and a bunch of flags) but then got stuck with a running process. Assuming no one will change the process to provide an API to stop it while running (it's quite old), I need a way to artificially close it.
Similarly, on unattended computers, the script to start the process can be started by a task scheduling or operations control program, but there's no way to shut the process down.
Hope that clarifies my situation, and again, thanks everyone who's trying to help!
|
110,336 |
Here's my issue: I need to close a process, already running, from a C# program.
The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never
have a main window.
The other requirement that I have is that the application be **closed** not **killed**. I need it to write it's memory buffers to disk - and killing it causes data loss.
Here's what I tried so far:
```
foreach (Process proc in Process.GetProcesses())
{
if (proc.ProcessName.ToLower().StartsWith("myapp"))
{
if (proc.MainWindowHandle.ToInt32() != 0)
{
proc.CloseMainWindow();
proc.Close();
//proc.Kill(); <--- not good!
}
}
}
```
I've added the **if** clause, after discovering that **MainWindowHandle == 0** when the window was minimized. Removing the **if** doesn't help. Neither the **CloseMainWindow()** nor the **Close()** work. The **Kill()** does, but as mentioned above - it's not what I need.
Any idea would be accepted, including the use of arcane Win32 API functions :)
|
2008/09/21
|
[
"https://Stackoverflow.com/questions/110336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19856/"
] |
Here are some answers and clarifications:
**rpetrich**:
Tried your method before and the problem is, I don't know the window name, it differs from user to user, version to version - just the exe name remains constant. All I have is the process name. And as you can see in the code above the MainWindowHandle of the process is 0.
**Roger**:
Yes, I did mean the taskbar notification area - thanks for the clarification.
I *NEED* to call PostQuitMessage. I just don't know how, given a processs only, and not a Window.
**Craig**:
I'd be glad to explain the situation: the application has a command line interface, allowing you to specify parameters that dictate what it would do and where will it save the results. But once it's running, the only way to stop it and get the results is right-click it in the tray notification are and select 'exit'.
Now my users want to script/batch the app. They had absolutely no problem starting it from a batch (just specify the exe name and and a bunch of flags) but then got stuck with a running process. Assuming no one will change the process to provide an API to stop it while running (it's quite old), I need a way to artificially close it.
Similarly, on unattended computers, the script to start the process can be started by a task scheduling or operations control program, but there's no way to shut the process down.
Hope that clarifies my situation, and again, thanks everyone who's trying to help!
|
Question to clarify why you're attempting this: If the only user interface on the process is the system tray icon, why would you want to kill that and but leave the process running? How would the user access the process? And if the machine is "unattended", why concern yourself with the tray icon?
|
1,576,009 |
[](https://i.stack.imgur.com/QzCx6.png)
Here $$\omega = \dfrac{x \ dy \wedge dz + y \ dz \wedge dx + z\ dx \wedge dy}{(x^2+y^2+z^2)^{3/2}}$$.
I have calculated $f^\star \omega = \sin(u) \ du \wedge dv$ which I believe is correct. Could someone help with part $d$ I have no idea how it relates to part c!
|
2015/12/14
|
[
"https://math.stackexchange.com/questions/1576009",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/298709/"
] |
This will probably only be of limited help, and is probably too late to be of any help, but...
What is your reference text? From the question, it looks like that by definition the integral depends on the parametrisation. Namely, $S^2$ denotes the unit sphere *together* with the parametrization $f(u,v) = (\,x(u,v),\ y(u,v),\ z(u,v)\,)$, and the integral is a function on $f$: $f \mapsto \int\_{S^2} \omega = \int\_f \omega$. So - taking Rudin, which takes this point of view, as reference - by definition $$\int\_{S^2} \omega =\int\_{u=0}^\pi \left( \int\_{v=0}^{2\pi}\, \sin u \,dv \right)\,du$$ (sections 10.11 and 10.1 - the former for differential forms and parametristations, and the latter for the definition of the integral in $\mathbb R^n$).
This corresponds to c), because, by the change of variables formulism, $\int\_{S^2} = \int\_{Id} f^\*\omega$, where $Id:[0,\pi]\times[0,2\pi] \to [0,\pi]\times[0,2\pi]$ is the identity (theorem 10.24).
*Edit:* in fact, in the first version of this, I was tempted to insert the pull-back into my "by definition" phrase/equality :
$$\int\_{S^2} \omega =\int \_{[0,\pi]\times [0,2\pi]} f^\*\omega = \int\_{u=0}^\pi \left( \int\_{v=0}^{2\pi}\, \sin u \,dv \right)\,du,$$
but did not because Rudin does not introduce the pull-back (with different notation) until later; instead, Rudin writes out explicitly the Jacobian formula to define the integral of a form as an integral on a certain type of set in $\mathbb R^n$ (as I did above). But the explicit Jacobian formula is the pull-back...
*Note:* Rudin allows parametrisation domains of the form $D = [a\_1,b\_1]\times \cdots [a\_n,b\_n]$, $a\_k < b\_k$, whereas by your comments to Will P., it looks like you only allow $D=[0,1]^n$. So I actually would have preferred writing this as a comment, rather than as an answer, but it's too long.
|
If you insert what you got for w in the integral, obviously, there is not much to go with. the solution is to consider how you integrate over the sphere - as a triple integral in x,y,z coordinates, the integral limits are pretty complicated, as the limit for each axis depends on the value of the others.
The trick is to change coordinate system, and transfer the integral over S^2 into an double integral of u du and v dv, where one of them goes from -pi to pi, and the other from 0 to 2\*pi. Now you transform your term for w (as shown above) to u and v, and then the integral is actually very easy to execute.
i'm not gonna do the math for you, as 1. I don't know how to make formulas here, and 2. its *your* homework. I had to do the exact same thing thirty years ago... I'm sure it still gives 4 \* pi.
|
1,576,009 |
[](https://i.stack.imgur.com/QzCx6.png)
Here $$\omega = \dfrac{x \ dy \wedge dz + y \ dz \wedge dx + z\ dx \wedge dy}{(x^2+y^2+z^2)^{3/2}}$$.
I have calculated $f^\star \omega = \sin(u) \ du \wedge dv$ which I believe is correct. Could someone help with part $d$ I have no idea how it relates to part c!
|
2015/12/14
|
[
"https://math.stackexchange.com/questions/1576009",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/298709/"
] |
This will probably only be of limited help, and is probably too late to be of any help, but...
What is your reference text? From the question, it looks like that by definition the integral depends on the parametrisation. Namely, $S^2$ denotes the unit sphere *together* with the parametrization $f(u,v) = (\,x(u,v),\ y(u,v),\ z(u,v)\,)$, and the integral is a function on $f$: $f \mapsto \int\_{S^2} \omega = \int\_f \omega$. So - taking Rudin, which takes this point of view, as reference - by definition $$\int\_{S^2} \omega =\int\_{u=0}^\pi \left( \int\_{v=0}^{2\pi}\, \sin u \,dv \right)\,du$$ (sections 10.11 and 10.1 - the former for differential forms and parametristations, and the latter for the definition of the integral in $\mathbb R^n$).
This corresponds to c), because, by the change of variables formulism, $\int\_{S^2} = \int\_{Id} f^\*\omega$, where $Id:[0,\pi]\times[0,2\pi] \to [0,\pi]\times[0,2\pi]$ is the identity (theorem 10.24).
*Edit:* in fact, in the first version of this, I was tempted to insert the pull-back into my "by definition" phrase/equality :
$$\int\_{S^2} \omega =\int \_{[0,\pi]\times [0,2\pi]} f^\*\omega = \int\_{u=0}^\pi \left( \int\_{v=0}^{2\pi}\, \sin u \,dv \right)\,du,$$
but did not because Rudin does not introduce the pull-back (with different notation) until later; instead, Rudin writes out explicitly the Jacobian formula to define the integral of a form as an integral on a certain type of set in $\mathbb R^n$ (as I did above). But the explicit Jacobian formula is the pull-back...
*Note:* Rudin allows parametrisation domains of the form $D = [a\_1,b\_1]\times \cdots [a\_n,b\_n]$, $a\_k < b\_k$, whereas by your comments to Will P., it looks like you only allow $D=[0,1]^n$. So I actually would have preferred writing this as a comment, rather than as an answer, but it's too long.
|
d) On the unit sphere $x^2+y^2+z^2=1$; then $w$ is simply the surface area form (as in
[Volume form on $(n-1)$-sphere $S^{n-1}$](https://math.stackexchange.com/questions/1284234/volume-form-on-n-1-sphere-sn-1/1427896#1427896)); integrating it over the whole sphere gives the area, $4\pi$.
c) In other words it's asking you to write the area form in spherical coordinates, which you did correctly.
|
56,991,424 |
I am using Big Query SQL and I can't use a couple of functions and more specifically WEEKNUM. Everytime I try to, it outputs unrecognized function.
[WEEKNUM](https://cloud.google.com/dataprep/docs/html/WEEKNUM-Function_118228789)
During my search I found [this](https://cloud.google.com/dataprep/docs/html/Derive-Transform_57344634#example---other-examples) that I think it meansI can't use `derive` functions, and I also think that part of it is the WEEKNUM. I could be totally wrong though.
So how can I use the WEEKNUM function or do what it does with another way?
Thanks
|
2019/07/11
|
[
"https://Stackoverflow.com/questions/56991424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2196833/"
] |
In Standard SQL, use [`EXTRACT()`](https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#extract):
```
select extract(week from current_date)
```
|
Your link to [WEEKNUM](https://cloud.google.com/dataprep/docs/html/WEEKNUM-Function_118228789) is for Google Cloud DataPrep. The [BigQuery Documentation](https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions) for date functions does not use `WEEKNUM`, but allows similar functionality through `EXTRACT` or `FORMAT_DATE`.
|
58,987,844 |
How to print student with highest score if there is more than one result?
```
var studentList = new List<Student>()
{
new Student(){ Id =1, FullName = "May", CourseScore = 90},
new Student(){ Id =2, FullName = "Joe", CourseScore = 65},
new Student(){ Id =3, FullName = "Ann", CourseScore = 50}
};
var stud = studentList.OrderByDescending(c => c.CourseScore).Take(1).SingleOrDefault();
Console.WriteLine(stud.FullName);
```
The above query works but only if highest score has only one element. But if more than one student have the same highest score? For example, May and Ann also 90 CourseScore? How do show both May and Ann?
|
2019/11/22
|
[
"https://Stackoverflow.com/questions/58987844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4971859/"
] |
You can `Group` items by `CourseScore` and select student names as following:
```
var stud = studentList.GroupBy(g => g.CourseScore)
.Select(i => new
{
CourseScore = i.Key,
StudentNames = String.Join(",", i.Select(s => s.FullName))
})
.OrderByDescending(o => o.CourseScore).FirstOrDefault();
Console.WriteLine(stud.StudentNames);
```
It will give you following result:
>
> May,Ann
>
>
>
Note: If there is only one student who has highest score, it also gives you one student name.
|
Let's assume you have the following data
```
var studentList = new List<Student>() {
new Student(){ Id =1, FullName = "May", CourseScore = 90},
new Student(){ Id =2, FullName = "Joe", CourseScore = 65},
new Student(){ Id =3, FullName = "Ann", CourseScore = 50},
new Student(){ Id =4, FullName = "Jac", CourseScore = 90},
};
```
You can try two ways
1) **process time is 15 milliseconds for my pc**
```
var names = studentList.GroupBy(x => x.CourseScore).Select(y => new { CourseScore = y.Key, Names = string.Join(",", y.Select(x => x.FullName)) }).OrderByDescending(x => x.CourseScore).Select(x => x.Names).FirstOrDefault();
Console.Write(names);
```
2) **process time is 1 milliseconds for my pc**
```
var maxScore = studentList.Max(x => x.CourseScore);
var names = studentList.Where(x => x.CourseScore == maxScore).Select(x => x.FullName);
var joinedNames = string.Join(",", names);
Console.WriteLine(joinedNames);
```
*They both prints: **"May,Jac"***
|
17,184,018 |
I have a project that loads millions of records. I will be using asp.net mvc 3 or 4. I am sure my page would load very slow because of much data retrieved from the server. I have been creating SQL Server agent job to perform early queries and save it in a temporary table which will be used in the site. I am sure there are many better ways. Please help. I have heard of IndexedDB or WebSQL for client side Database. Any help/suggestion would be appreciated.
My first Post/Question here in stackover!
Thanks, In Advance!
|
2013/06/19
|
[
"https://Stackoverflow.com/questions/17184018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2499734/"
] |
You might want to look at pagination. If the search returns 700,000+ records you can separate them into different pages (100 per page or something) so the page won't take forever to load.
Check similar question [here](https://stackoverflow.com/questions/446196/how-do-i-do-pagination-in-asp-net-mvc)
|
You need to split the data by pages. Retrieve certain range from the database. Do you really need millions of rows at once. I think there should be a filter first of all.
|
17,184,018 |
I have a project that loads millions of records. I will be using asp.net mvc 3 or 4. I am sure my page would load very slow because of much data retrieved from the server. I have been creating SQL Server agent job to perform early queries and save it in a temporary table which will be used in the site. I am sure there are many better ways. Please help. I have heard of IndexedDB or WebSQL for client side Database. Any help/suggestion would be appreciated.
My first Post/Question here in stackover!
Thanks, In Advance!
|
2013/06/19
|
[
"https://Stackoverflow.com/questions/17184018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2499734/"
] |
You might want to look at pagination. If the search returns 700,000+ records you can separate them into different pages (100 per page or something) so the page won't take forever to load.
Check similar question [here](https://stackoverflow.com/questions/446196/how-do-i-do-pagination-in-asp-net-mvc)
|
Paging is definitely the way to go. **However**, you want to make the site responsive, so what you should do is use Ajax to run in the background to load up the data continuously while the letting the user to interact with the site with initial set of data.
|
17,184,018 |
I have a project that loads millions of records. I will be using asp.net mvc 3 or 4. I am sure my page would load very slow because of much data retrieved from the server. I have been creating SQL Server agent job to perform early queries and save it in a temporary table which will be used in the site. I am sure there are many better ways. Please help. I have heard of IndexedDB or WebSQL for client side Database. Any help/suggestion would be appreciated.
My first Post/Question here in stackover!
Thanks, In Advance!
|
2013/06/19
|
[
"https://Stackoverflow.com/questions/17184018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2499734/"
] |
You might want to look at pagination. If the search returns 700,000+ records you can separate them into different pages (100 per page or something) so the page won't take forever to load.
Check similar question [here](https://stackoverflow.com/questions/446196/how-do-i-do-pagination-in-asp-net-mvc)
|
I've been dealing with a similar problem 500K data stored on client side in `IndexedDB`. I use multiple web workers to store the data on the client side (supported only in chrome) and I only post the id's and the action that is used on the data to the server side.
In order to achieve greater speed, I've found that the optimal data transfer rate is achieved using 4-8 web workers all retrieving and storing 1K - 2.5K items per call, that's about 1MB of data.
Things you should consider are:
* limiting the actions that are allowed during synchronization process
* updates of the data on server vs client side - I use the approach
of always updating data on server side and calling sync procedure
to sync the changed data back to the client side
* what are you going to store in memory - Google Chrome limit is 1.6GB so be careful with memory leaks, i currently use no more than 300MB during the synchronization - 100-150MB is the average during regular work
|
17,184,018 |
I have a project that loads millions of records. I will be using asp.net mvc 3 or 4. I am sure my page would load very slow because of much data retrieved from the server. I have been creating SQL Server agent job to perform early queries and save it in a temporary table which will be used in the site. I am sure there are many better ways. Please help. I have heard of IndexedDB or WebSQL for client side Database. Any help/suggestion would be appreciated.
My first Post/Question here in stackover!
Thanks, In Advance!
|
2013/06/19
|
[
"https://Stackoverflow.com/questions/17184018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2499734/"
] |
I've been dealing with a similar problem 500K data stored on client side in `IndexedDB`. I use multiple web workers to store the data on the client side (supported only in chrome) and I only post the id's and the action that is used on the data to the server side.
In order to achieve greater speed, I've found that the optimal data transfer rate is achieved using 4-8 web workers all retrieving and storing 1K - 2.5K items per call, that's about 1MB of data.
Things you should consider are:
* limiting the actions that are allowed during synchronization process
* updates of the data on server vs client side - I use the approach
of always updating data on server side and calling sync procedure
to sync the changed data back to the client side
* what are you going to store in memory - Google Chrome limit is 1.6GB so be careful with memory leaks, i currently use no more than 300MB during the synchronization - 100-150MB is the average during regular work
|
You need to split the data by pages. Retrieve certain range from the database. Do you really need millions of rows at once. I think there should be a filter first of all.
|
17,184,018 |
I have a project that loads millions of records. I will be using asp.net mvc 3 or 4. I am sure my page would load very slow because of much data retrieved from the server. I have been creating SQL Server agent job to perform early queries and save it in a temporary table which will be used in the site. I am sure there are many better ways. Please help. I have heard of IndexedDB or WebSQL for client side Database. Any help/suggestion would be appreciated.
My first Post/Question here in stackover!
Thanks, In Advance!
|
2013/06/19
|
[
"https://Stackoverflow.com/questions/17184018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2499734/"
] |
I've been dealing with a similar problem 500K data stored on client side in `IndexedDB`. I use multiple web workers to store the data on the client side (supported only in chrome) and I only post the id's and the action that is used on the data to the server side.
In order to achieve greater speed, I've found that the optimal data transfer rate is achieved using 4-8 web workers all retrieving and storing 1K - 2.5K items per call, that's about 1MB of data.
Things you should consider are:
* limiting the actions that are allowed during synchronization process
* updates of the data on server vs client side - I use the approach
of always updating data on server side and calling sync procedure
to sync the changed data back to the client side
* what are you going to store in memory - Google Chrome limit is 1.6GB so be careful with memory leaks, i currently use no more than 300MB during the synchronization - 100-150MB is the average during regular work
|
Paging is definitely the way to go. **However**, you want to make the site responsive, so what you should do is use Ajax to run in the background to load up the data continuously while the letting the user to interact with the site with initial set of data.
|
156,013 |
I can't quite figure out this syntax problem with a `case` expression in a `do` block.
What is the correct syntax?
If you could correct my example and explain it that would be the best.
```
module Main where
main = do
putStrLn "This is a test"
s <- foo
putStrLn s
foo = do
args <- getArgs
return case args of
[] -> "No Args"
[s]-> "Some Args"
```
A little update. My source file was a mix of spaces and tabs and it was causing all kinds of problems.
Just a tip for any one else starting in Haskell. If you are having problems check for tabs and spaces in your source code.
|
2008/10/01
|
[
"https://Stackoverflow.com/questions/156013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8965/"
] |
return is an (overloaded) function, and it's not expecting its first argument to be a keyword. You can either parenthesize:
```
module Main where
import System(getArgs)
main = do
putStrLn "This is a test"
s <- foo
putStrLn s
foo = do
args <- getArgs
return (case args of
[] -> "No Args"
[s]-> "Some Args")
```
or use the handy application operator ($):
```
foo = do
args <- getArgs
return $ case args of
[] -> "No Args"
[s]-> "Some Args"
```
Stylewise, I'd break it out into another function:
```
foo = do
args <- getArgs
return (has_args args)
has_args [] = "No Args"
has_args _ = "Some Args"
```
but you still need to parenthesize or use ($), because return takes one argument, and function application is the highest precedence.
|
Equivalently:
```
foo = do
args <- getArgs
case args of
[] -> return "No Args"
[s]-> return "Some Args"
```
It's probably preferable to do as wnoise suggests, but this might help someone understand a bit better.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.