Search Results

Search found 7 results on 1 pages for 'swilliams'.

Page 1/1 | 1 

  • Just installed Ubuntu 10.10, can't connect via SSH

    - by swilliams
    I've just downloaded and installed Ubuntu 10.10 in a VM on virtualbox (4.0.4). Everything on the VM is set to the defaults: NAT adapter. When installing the OS, I selected OpenSSH, and nothing else. I've tried to connect to the server via ssh from the host (running Mac OS X), but it only timeouts. Can't scp my credentials to it or ping the server either. As far as I can tell, the server is connected fine, has a valid IP, and can ping google.com. I know I'm missing something basic here... I don't believe I have any kind of firewall up, unless there's one I don't know about that comes with the install. iptables has the default configuration.

    Read the article

  • Getting an empty response when calling CouchDB over ajax

    - by swilliams
    I'm new to CouchDB, so please bear with me. I have an instance of CouchDB running on a VM. I can access it just fine through the browser via futon or directly at: http://192.168.62.128:5984/articles/hot_dog Calling that URL in a browser returns the proper JSON. But, when I try to call that exact same URL via ajax, I get nothing: var ajaxUrl = 'http://192.168.62.128:5984/articles/hot_dog'; $.getJSON(ajaxUrl, null, function(data) { alert(data); }); Looking at the response header with Firebug shows me that the HTTP response was 200 and the content-length is the right size. Even the Etag matches with what is in CouchDB. But the response itself is empty! The URL is absolutely right; I've triple checked, and copy/pasted it directly (and besides it wouldn't give a 200 response if it weren't). I'm using jQuery 1.4.2, and CouchDB 0.8 What's going on?

    Read the article

  • How to create a backup from SqlAlchemy?

    - by swilliams
    I'm writing a Pylons app, and am trying to create a simple backup system where every table is serialized and tarred up into a single file for an administrator to download, and use to restore the app should something bad happen. I can serialize my table data just fine using the SqlAlchemy serializer, and I can deserialize it fine as well, but I can't figure out how to commit those changes back to the database. In order to serialize my data I am doing this: from myproject.model.meta import Session from sqlalchemy.ext.serializer import loads, dumps q = Session.query(MyTable) serialized_data = dumps(q.all()) In order to test things out, I go ahead and truncation MyTable, and then attempt to restore using serialized_data: from myproject.model import meta restore_q = loads(serialized_data, meta.metadata, Session) This doesn't seem to do anything... I've tried calling a Session.commit after the fact, individually walking through all the objects in restore_q and adding them, but nothing seems to work. What am I missing? Or is there a better way to do what I'm aiming for? I don't want to shell out and directly touch the database, since SqlAlchemy supports different database engines.

    Read the article

  • How do you rotate a two dimensional array?

    - by swilliams
    Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff. [1][2][3][4] [5][6][7][8] [9][0][1][2] [3][4][5][6] Becomes: [3][9][5][1] [4][0][6][2] [5][1][7][3] [6][2][8][4] Update: Nick's answer is the most straightforward, but is there a way to do it better than n^2? What if the matrix was 10000x10000?

    Read the article

  • Rails has-and-belongs-to-many form question

    - by swilliams
    Sorry for the semi-generic title, but I'm still pretty new at rails and couldn't think of a succinct way to put the question. I have a basic habtm model setup: a Project has many Resources and a Resource can have many Projects. I have the database and models setup properly, and can do everything I need to via the console, but I'm having trouble translating it all into the view. On the show view for the Project, I want to be able to create a Resource and automatically assign it to the current Project. Here's my basic html: <p> <b>Name:</b> <%=h @project.name %> </p> <h2>Equipment</h2> <ul> <% @project.resources.each do |r| %> <li><%=h r.name %></li> <% end %> </ul> <h2>Add A Resource</h2> <% form_for(@project) do |f| %> <%= f.error_messages %> <p> Resource Name:<br /> <%= f.text_field :resources %> </p> <p> <%= f.submit 'Create' %> </p> <% end %> Obviously, that form won't work, but I'm at a loss for what to do next. I've searched around for various examples, but haven't found one for what I'm trying to do here. One thing I've thought of was to change the form to be form_for(Resource.new) and include a hidden input of the @project.id. And then when the resource_controller handles the form, check for that id and go from there. That seems like an ugly kludge though.

    Read the article

  • How to create and restore a backup from SqlAlchemy?

    - by swilliams
    I'm writing a Pylons app, and am trying to create a simple backup system where every table is serialized and tarred up into a single file for an administrator to download, and use to restore the app should something bad happen. I can serialize my table data just fine using the SqlAlchemy serializer, and I can deserialize it fine as well, but I can't figure out how to commit those changes back to the database. In order to serialize my data I am doing this: from myproject.model.meta import Session from sqlalchemy.ext.serializer import loads, dumps q = Session.query(MyTable) serialized_data = dumps(q.all()) In order to test things out, I go ahead and truncation MyTable, and then attempt to restore using serialized_data: from myproject.model import meta restore_q = loads(serialized_data, meta.metadata, Session) This doesn't seem to do anything... I've tried calling a Session.commit after the fact, individually walking through all the objects in restore_q and adding them, but nothing seems to work. What am I missing? Or is there a better way to do what I'm aiming for? I don't want to shell out and directly touch the database, since SqlAlchemy supports different database engines.

    Read the article

  • Generating the input id with an ActiveRecord model

    - by swilliams
    How do you generate an input's id attribute, given a model? For example, if I have a model of Person with a first_name attribute, the form helper prints out a textbox with this html: <input type="text" id="person_first_name" /> How can I generate that person_first_name from some other place in the code (like in a controller or some place)?

    Read the article

1