Search Results

Search found 5 results on 1 pages for 'sebastiangeiger'.

Page 1/1 | 1 

  • Find out if there is a local user logged in when logging in over ssh

    - by sebastiangeiger
    I need to run some calculations on a machine that I can only access remotely but also serves as a work station. There are many of them and I want to pick a "free" one. Free means in this case that no one is logged in locally. My first try was the who command, but for some reason it only lists "selected" users and I can't really find out how they are selected. Next try: ps aux | cut -d " " -f1 | sort | uniq: better showing a bunch of demons but also the local user that was not displayed by who. My current solution is to go in and do ps aux | grep "gnome-session" which is better but still gives me a lot of junk. Ideally I am looking for something that I can include in my ssh profile that warns me about (active) local users when I log in.

    Read the article

  • Map/Reduce on an array of hashes in CouchDB

    - by sebastiangeiger
    Hello everyone, I am looking for a map/reduce function to calculate the status in a Design Document. Below you can see an example document from my current database. { "_id": "0238f1414f2f95a47266ca43709a6591", "_rev": "22-24a741981b4de71f33cc70c7e5744442", "status": "retrieved image urls", "term": "Lucas Winter", "urls": [ { "status": "retrieved", "url": "http://...." }, { "status": "retrieved", "url": "http://..." } ], "search_depth": 1, "possible_labels": { "gender": "male" }, "couchrest-type": "SearchTerm" } I'd like to get rid of the status key and rather calculate it from the statuses of the urls. My current by_status view looks like the following: function(doc) { if (doc['status']) { emit(doc['status'], null); } } I tried some things but nothing actually works. Right now my Map Function looks like this: function(doc) { if(doc.urls){ emit(doc._id, doc.urls) } } And my Reduce Function function(key, value, rereduce){ var reduced_status = "retrieved" for(var url in value){ if(url.status=="new"){ reduced_status = "new"; } } return reduced_status; } The result is that I get retrieved everywhere which is definitely not right. I tried to narrow down the problem and it seems to be that value is no array, when I use the following Reduce Function I get length 1 everywhere, which is impossible because I have 12 documents in my database, each containing between 20 to 200 urls function(key, value, rereduce){ return value.length; } What am I doing wrong? (I know I want you to write code for me and I'm feeling guilty, but right now I do the calculation of the statuses in ruby after getting the data from the database. It would be nice to already get the right data from the database)

    Read the article

  • Find the "name" of a library (-L -l switches)

    - by sebastiangeiger
    Being fairly new to C++ I have a question bascially concerning the g++ compiler and especially the inclusion of libraries. Consider the following makefile: CPPFLAGS= -I libraries/boost_1_43_0-bin/include/ -I libraries/jpeg-8b-bin/include/ LDLIBS= libraries/jpeg-8b-bin/lib/libjpeg.a # LDLIBS= -L libraries/jpeg-8b-bin/lib -llibjpeg all: main main: main.o c++ -o main main.o $(LDLIBS) main.o: main.cpp c++ $(CPPFLAGS) -c main.cpp clean: rm -rf *.o main As you can see I declared the LDLIBS variable twice. My code is compiling and working if I use the makefile above. But if I deactivate the first LDLIBS entry and active the second one I get ld: library not found for -llibjpeg. I assume my libjpeg.a is just not called libjpeg but bears some different name. Is there a way to find out the name of a given "libraryfile" libsomething.a or libsomething.dyn?

    Read the article

  • "Overriding" instance variables in subtype: Possible risks?

    - by sebastiangeiger
    Say I had a class SuperClass and two subclasses SubClassA and SubClassB that inherit from SuperClass. abstract class SuperClass{ ... List someList; ... } class SubClassA extends SuperClass{ ... List<String> someList; ... } class SubClassB extends SuperClass{ ... List<Integer> someList; ... } That way it is convenient because I can get someList.size() in Superclass and have Typesafety in the Subclasses. The problem is that it does not "feel" right, can you think of potential hazards this apporach has that I am not aware of?

    Read the article

  • RSpec View testing: How to modify params?

    - by sebastiangeiger
    I am trying to test my views with RSpec. The particular view that is causing me troubles changes its appearance depending on a url parameter: link_to "sort>name", model_path(:sort_by => 'name') which results in http://mydomain/model?sort_by=name My view then uses this parameter like that: <% if params[:sort_by] == 'name' %> <div>Sorted by Name</div> <% end %> The RSpec looks like this: it "should tell the user the attribute for sorting order" do #Problem: assign params[:sort_for] = 'name' render "/groups/index.html.erb" response.should have_tag("div", "Sorted by Name") end I would like to test my view (without controller) in RSpec but I can't get this parameter into my params variable. I tried assign in all different flavours: assign[:params] = {:sort_by => 'name'} assign[:params][:sort_by] = 'name' ... no success so far. Every idea is appreciated.

    Read the article

1