EzDevInfo.com

soda

Selenium Node.JS adapter

db4o SODA compare field values

class SomeClass
{
  private DateTime fieldA;
  private DateTime fieldB;
}

Using SODA, what is the proper way to select all objects whose fieldA is greater than fieldB?

Something like this?

var query = this.ObjectContainer.Query();
query.Constrain(typeof(SomeClass));
query.Descend("fieldA").Constrain(query.Descend("fieldB")).Greater();
var list = query.Execute();

Source: (StackOverflow)

Trouble applying the Soda Theme in Sublime Text 2

I've installed the Soda Theme using the Package Control in Sublime Text 2, then activated it via Preferences -> Settings - User. However it doesn't get applied. Instead my theme now is Solarized, which is declared at the top of my Preferences.sublime-settings file (line 3):

When I query the console for the theme, the output is correct:

>>> view.settings().get('theme')
u'Soda Light.sublime-theme'

This is correct, as well:

>>> view.settings().get('color_scheme')
u'Packages/Color Scheme - Default/Solarized (Light).tmTheme'

Why do I see the Solarized theme and not Soda?

Thanks!


Source: (StackOverflow)

Advertisements

Using Socrata SODA API to query most recent rows by datetime

I am new to this site and this is my first question. I am trying to query the "Seattle Real Time Fire 911 Calls" database from the Socrata Seattle Open Data site: https://data.seattle.gov/Public-Safety/Seattle-Real-Time-Fire-911-Calls/kzjm-xkqj. I'm not an expert at using the SODA API, and I'm having difficulty figuring out how to query the most recent entries in the database. All attempts to use the "order" or "where" SoQL statements give me data from 2010 or 2011, and I cannot figure out how to query the most recent 300 entries. Querying the "top" rows yields the oldest entries. Using a full OData feed pull yields data as recent as today, but I need to use a fast json or csv SODA API query.

Note: The datetime field does not respond to any "where" statements that I use.

Thank you!


Source: (StackOverflow)

how to check for an empty collection in a db4o's SODA query

As the title says, is there a way to check for an empty collection in a SODA query?

I can check if the collection field is set to null and check property values in the collection elements, but don't know how to check if the collection has no elements.

Any help is appreciated :)


Edit 1: I do know how to make the query happen outside the db4o filtering i.e. by switching to use Native Queries or LINQ; or doing the equivalent that happens when checking the collection's count, which is using an Evaluation.

I'm actually trying to avoid the activations caused by a Native Query that was in there, as it really hits us in performance in our scenario.


Source: (StackOverflow)

Does the Socrata SODA API support getting a list of dates on which the dataset was modified?

Does the Socrata SODA API support a method to query out all the dates a dataset has been updated? Basically a changelog for the dataset that has an object for every modification/update to a dataset.

There is an existing question that asks for the last modified date (you can get it through the "/data.json API available on all Socrata-powered sites".

There is also a method to get the modified dates of individual rows using System Fields and the :update_at field. But this is incomplete, a data provider might update every row each time. This means there is no guarantee that we are really getting back a history of modifications, just the top layer of modification on each row.

I'm looking for the complete list of modification dates, at least. We are trying to get a sense of activity on datasets and we need to know how often they are being updated.


Source: (StackOverflow)

Using DateTime under db4o with native SODA queries?

Under db4o, I'm attempting to constrain by a "new DateTime(2010,10,14)" but it doesn't seem to work - any opinions on how to fix this?


Source: (StackOverflow)

How to set SODA API end points programatically in asp.net MVC

I am developing an application with open data hosted by socrata using the information from the below link http://dev.socrata.com/consumers/examples/creating-an-application-with-asp-dotnet.html How ever you need to specify the API end point in the code.

private const string _APIEndPoint4x4 = “4tka-6guv”;

Suppose there are 5000 records in the data set, it will list all the data in your applications. But you can change the end point by filtering this data by login in to socrata and saving it. For example we can filter the data say with year 2015 which will give us 100 records. When next time you run the application it will show only 100 records(We dont need to change API end point in code). I have gone through Soql query methods in Socrata which say you can set the api end points with conditions like this

https://soda.demo.socrata.com/resource/4tka-6guv?$where=magnitude > 3.0

My question is how can i use this in my application? I tried

private const string _APIEndPoint4x4 = "4tka-6guv?$where=magnitude > 3.0”;

But it gives the following error

The provided resourceId is not a valid Socrata (4x4) resource identifier.


Source: (StackOverflow)

Selenium (with soda) getEval returning [object Object]

I'm using soda (https://github.com/LearnBoost/soda) to help me write a couple of selenium tests. However, I'm running into a problem with getEval.

I have these helpers defined:

soda.prototype.two = function() {
  return this.getEval('this.browserbot.getCurrentWindow().document.getElementsByTagName("body").length == 1;');                               
}

soda.prototype.one = function() {
  var x = this.two();
  return this.assertValue(x, true);
}

In the test, I have:

browser                                                                                                                                       
  .chain                                                                                                                                      
  .session()                                                                                                                                  
  .open('/g/48hLQZPRj')
  .one()    
  ...            

However, this is the test result logs:

open: /g/48hLQZPRj
getEval: this.browserbot.getCurrentWindow().document.getElementsByTagName("body").length == 1;
assertValue: [object Object], S
testComplete: 
[Error: assertValue([object Object], S): Element  not found]

Why is getEval returning an object? Why is it not returning a boolean like I expect it to? What am I missing? Thanks!


Source: (StackOverflow)

'in(..)' function not working in SoQL query

Using SoQL (Socrata Query Language) we can filter the values of a data set using the in(...) function. A sample example is shown in the socrata website using the Chicago open data portal.

https://data.cityofchicago.org/resource/6zsd-86xi.json?$where=primary_type in('THEFT', 'ROBBERY', 'INTIMIDATION')

But when I try this functionality using a different data set of the same data portal I don't get the answer. Here is the SoQL I used

https://data.cityofchicago.org/resource/uupf-x98q.json?$where=police_district in('12','24')

I get the following error.

{
  "code" : "query.compiler.malformed",
  "error" : true,
  "message" : "Error, could not parse SoQL query \"select * from #uupf-x98q where police_district in('12','24')\"",
  "data" : {
    "query" : "select * from #uupf-x98q where police_district in('12','24')"
  }
}

Source: (StackOverflow)

socrata soda upload file as attachment capability

Can I upload files as attachments to my Socrata Dataset using soda-ruby?

I saw an example that used a method named upload_file

When I tried that, I received the following error

undefined method error.


Source: (StackOverflow)

How to query a list of OpenData end points

How can a query to get a list of end-points provided by a OpenData site using Socrata?


Source: (StackOverflow)

Can't target fields in SODA api because of whitespace

I'm trying to use the Socrata SODA API on a NYC gov database by searching for specific street addresses. The URL would look as follows:

http://data.cityofnewyork.us/resource/eabe-havv.json?house_street=PARK+PLACE

However, although I know that PARK PLACE exists in multiple entries in the database, there are no results that appear, and it seems that this is due to a large amount of whitespace following each value:

{
"date_entered": "05/26/1989",
"status": "CLOSED",
"special_district": "   ",
"inspection_date": "09/23/2014",
"unit": "MAN.",
"house_number": "75          ",
"dobrundate": "2014-09-24T00:00:00",
"complaint_category": "05",
"complaint_number": "1002073",
"disposition_code": "L2",
"bin": "1061700",
"house_street": "PARK PLACE               ",
"community_board": "109",
"disposition_date": "09/23/2014"
}

Any tips on how I can access both the house_street value and house_number value through a SoQl query appended to the API url? Thanks!


Source: (StackOverflow)

Node-based automated testing of browser key events

I'm trying to write automated tests for Hashify Editor. Here are the sorts of assertions I'd like to make:

  1. Assert that a textarea matches a particular selector.

  2. Assert that the textarea is currently empty.

  3. Type "_" into the textarea. Assert that it now contains __, and that the caret is positioned between the two underscores.

  4. Type "hello" into the textarea. Assert that it now contains _hello_, and that the caret is positioned before the second underscore.

  5. Type "_" into the textarea. Assert that it still contains _hello_, and that the caret is now positioned after the second underscore.

I've spent the day playing with Soda and Zombie.js, trying to get this work in either. I've managed to get close with Soda:

soda = require 'soda'

browser = soda.createClient ...

browser
  .chain
  .session()
  .open('/')
  .typeKeys('editor', '_')
  .assertValue('editor', '__')

This assertion success, but the following doesn't:

  .typeKeys('editor', 'hello')
  .assertValue('editor', '_hello_')
  # ERROR: Actual value '__' did not match '_hello_'

Using .type fails in a different manner:

  .type('editor', 'hello')
  .assertValue('editor', '_hello_')
  # ERROR: Actual value 'hello' did not match '_hello_'

The suggestion on #275 of assaf/zombie got my hopes up, but I wasn't able to trigger the textarea's keypress handler using this approach.

Perhaps I'm going about this in the wrong way. Has anyone had success testing keypress handlers using Node? What's the best tool for the job?


Source: (StackOverflow)

How to edit Sublime Text 3 Soda Theme

I installed the Soda Theme on Sublime Text 3 on OSX and I was wondering where are the actual files and folder to the theme that way I could look at the theme file and make my own edits to it, along with I would like to adjust a few of the images used in the theme.

On the Git documents it says if you are to manually install Soda on Sublime you place the soda folder in the package directory, although when I install Soda via Control Package I don't see the Soda theme in package directory.


Source: (StackOverflow)

offset and limit in the /api/views call

I am using the the /api/views/.../rows.json call to access the data and the metadata for a dataset, e.g. - https://data.colorado.gov/api/views/wumm-7awb/rows.json

Problem is I don't want to access all of the data but using limit and offset parameters does not seem to have any effect.

I know about the SODA API endpoint, e.g. https://data.colorado.gov/resource/wumm-7awb.json, that has limit and offset but it doesn't contain the metadata that the /api/views returns

Alternative question - can the /resource API include the metadata?

Thanks


Source: (StackOverflow)