Search Results

Search found 24 results on 1 pages for 'sa125'.

Page 1/1 | 1 

  • Machine freezes when configuring dual display on Ubuntu 9.10 (karmic)

    - by sa125
    Hi - I'm trying to configure dual displays on an Ubuntu 9.10 machine. When I connect the 2 screens (1 VGA input, the other DVI), I see them in a mirrored display. I opened up Display Settings and unchecked the 'mirror screens' box, and when I clicked apply, the machine froze and I had to force restart it. This happened repeatedly for about 6 times until I gave up. How do I set it up to boot up normally with dual display working? thanks. edit: I thought it might be related to the virtual screen size, so I tried to edit /etc/X11/xorg.conf to add: SubSection "Display" Virtual 2560 1024 EndSubSection But that didn't do much. Each screen works fine on it's own, and together with mirrored display.

    Read the article

  • Full disk encryption on linux (ubuntu) w/o re-installing - possible?

    - by sa125
    Hi - I work at a company that takes security very seriously (like most). Our IT guy came in today to prepare us mentally to re-install our systems after he'll apply the new encryption policy (which will basically scrape our HD clean). For our team this means about a week of re-configuring, installing, and tweaking our desktops until we are back to work capacity - anyone who has to re-install a development machine probably knows what I'm talking about. So, I guess my question is if there's any way to perform full disk encryption on a linux (ubuntu = 9.04) system without having to re-install EVERYTHING [sigh]. IT guy said there isn't any - please prove him wrong. thanks :)

    Read the article

  • msi netbook refuses to connect to home wireless network (windows xp)

    - by sa125
    Hi - I'm trying to connect my girlfriend's MSI netbook to the wireless network in my house, and failing repeatedly. It's not a hardware issue, b/c it connects to other networks successfully, and, it's not a network issue, because I have another mac and linux laptops that have no problem detecting and connecting to the same network. When I open windows' network connections box, I can see the network available, and when I try to connect to it (using a password), I get a "network no longer in range.." error (the router is 2 ft away). This has been the case for the past 6 months, and I'm about to give up. I've reset the router, erased all saved network preferences and pretty much all I could think of short of re-installing XP. Any idea what else could be done? thanks.

    Read the article

  • MSI netbook refuses to connect to home wireless network with Windows XP

    - by sa125
    I'm trying to connect my girlfriend's MSI netbook to the wireless network in my house, and failing repeatedly. It's not a hardware issue, b/c it connects to other networks successfully, and, it's not a network issue, because I have another mac and linux laptops that have no problem detecting and connecting to the same network. When I open windows' network connections box, I can see the network available, and when I try to connect to it (using a password), I get a "network no longer in range.." error (the router is 2 ft away). This has been the case for the past 6 months, and I'm about to give up. I've reset the router, erased all saved network preferences and pretty much all I could think of short of re-installing XP. Any idea what else could be done? thanks.

    Read the article

  • Load login shell inside user cronjob

    - by sa125
    I'm trying to run a rake task using a scheduled cronjob. My crontab looks something like this: 0 1 * * 1-7 /bin/bash -l -c "cd ~/jobs/rake && rake reports:create >> ~/jobs/logs/cron.log" Ruby on my account is provided by RVM, which is loaded via ~/.bashrc (before the no-interaction check): # load RVM env [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm # If not running interactively, don't do anything [ -z "$PS1" ] && return # ... rest of logic Time and again, this task fails to run since RVM isn't loaded when the task is called (uses system's /usr/bin/ruby instead), and gem dependencies are missing. How can I make crontab load my shell environment before executing my scheduled jobs? thanks.

    Read the article

  • help with number calculation algorithm [hw]

    - by sa125
    Hi - I'm working on a hw problem that asks me this: given a finite set of numbers, and a target number, find if the set can be used to calculate the target number using basic math operations (add, sub, mult, div) and using each number in the set exactly once (so I need to exhaust the set). This has to be done with recursion. So, for example, if I have the set {1, 2, 3, 4} and target 10, then I could get to it by using ((3 * 4) - 2)/1 = 10. I'm trying to phrase the algorithm in pseudo-code, but so far haven't gotten too far. I'm thinking graphs are the way to go, but would definitely appreciate help on this. thanks.

    Read the article

  • Rails - How can I display nicely indented JSON?

    - by sa125
    Hi - I have a controller action that returns JSON data for api purposes, and plenty of it. I want to be able to inspect it in the browser, and have it nicely indented for the viewer. For example, if my data is data = { :person => { :id => 1, :name => "john doe", :age => 30 }, :person => ... } I want to see { "person" : { "id" : 1, "name" : "john doe", "age" : 30, }, "person" : { "id" : 2, "name" : "jane doe", "age" : 31, }, ...etc } In the view. I thought about using different routes to get the bulk/pretty data: # GET /api/json # ... respond_to do |format| format.html { render :json => data.to_json } end # GET /api/json/inspect # ... respond_to do |format| format.html { render :text => pretty_json } end Anyone knows of a gem/plugin that does this or something similar? I tried using JSON.pretty_generate, but it doesn't seem to work inside rails (2.3.5). thanks.

    Read the article

  • Rails 2.3 uniqueness validation - how can I capture the value causing the error

    - by sa125
    Hi - I'm trying to capture the value that's throwing a uniqueness error (or for that matter, any other type of built-in validation) to display it in the :message option. Here's what I tried (didn't work) # inside the model validate_uniqueness_of :name, :message => "#{name} has already been taken" # also tried using #{:name} I could use a custom validation, but this beats the point of using something that's already integrated into AR. Any thoughts? thanks.

    Read the article

  • processing an audio wav file with C

    - by sa125
    Hi - I'm working on processing the amplitude of a wav file and scaling it by some decimal factor. I'm trying to wrap my head around how to read and re-write the file in a memory-efficient way while also trying to tackle the nuances of the language (I'm new to C). The file can be in either an 8- or 16-bit format. The way I thought of doing this is by first reading the header data into some pre-defined struct, and then processing the actual data in a loop where I'll read a chunk of data into a buffer, do whatever is needed to it, and then write it to the output. #include <stdio.h> #include <stdlib.h> typedef struct header { char chunk_id[4]; int chunk_size; char format[4]; char subchunk1_id[4]; int subchunk1_size; short int audio_format; short int num_channels; int sample_rate; int byte_rate; short int block_align; short int bits_per_sample; short int extra_param_size; char subchunk2_id[4]; int subchunk2_size; } header; typedef struct header* header_p; void scale_wav_file(char * input, float factor, int is_8bit) { FILE * infile = fopen(input, "rb"); FILE * outfile = fopen("outfile.wav", "wb"); int BUFSIZE = 4000, i, MAX_8BIT_AMP = 255, MAX_16BIT_AMP = 32678; // used for processing 8-bit file unsigned char inbuff8[BUFSIZE], outbuff8[BUFSIZE]; // used for processing 16-bit file short int inbuff16[BUFSIZE], outbuff16[BUFSIZE]; // header_p points to a header struct that contains the file's metadata fields header_p meta = (header_p)malloc(sizeof(header)); if (infile) { // read and write header data fread(meta, 1, sizeof(header), infile); fwrite(meta, 1, sizeof(meta), outfile); while (!feof(infile)) { if (is_8bit) { fread(inbuff8, 1, BUFSIZE, infile); } else { fread(inbuff16, 1, BUFSIZE, infile); } // scale amplitude for 8/16 bits for (i=0; i < BUFSIZE; ++i) { if (is_8bit) { outbuff8[i] = factor * inbuff8[i]; if ((int)outbuff8[i] > MAX_8BIT_AMP) { outbuff8[i] = MAX_8BIT_AMP; } } else { outbuff16[i] = factor * inbuff16[i]; if ((int)outbuff16[i] > MAX_16BIT_AMP) { outbuff16[i] = MAX_16BIT_AMP; } else if ((int)outbuff16[i] < -MAX_16BIT_AMP) { outbuff16[i] = -MAX_16BIT_AMP; } } } // write to output file for 8/16 bit if (is_8bit) { fwrite(outbuff8, 1, BUFSIZE, outfile); } else { fwrite(outbuff16, 1, BUFSIZE, outfile); } } } // cleanup if (infile) { fclose(infile); } if (outfile) { fclose(outfile); } if (meta) { free(meta); } } int main (int argc, char const *argv[]) { char infile[] = "file.wav"; float factor = 0.5; scale_wav_file(infile, factor, 0); return 0; } I'm getting differing file sizes at the end (by 1k or so, for a 40Mb file), and I suspect this is due to the fact that I'm writing an entire buffer to the output, even though the file may have terminated before filling the entire buffer size. Also, the output file is messed up - won't play or open - so I'm probably doing the whole thing wrong. Any tips on where I'm messing up will be great. Thanks!

    Read the article

  • Rails 2.3 - Storing sessions in different schema

    - by sa125
    Hi - I want to config my app to use a different schema than the default for storing sessions. Basically, I want the app to store all its active_record objects in app_development and only its sessions in app_sessions. Normally this could be done by defining the sessions db in database.yml: development: # ... sessions: host: localhost database: app_sessions username: blah password: sssshhh #.... And then setting in the model: class Session < ActiveRecord::Base establish_connection :sessions #... end But since session doesn't have a model class defined, I'm looking for a way to tell it where to store its data. I've noticed the session comes from ActionController::Session, but couldn't find what I needed there. Any thoughts? thanks.

    Read the article

  • How to place search params in URL?

    - by sa125
    Hi - How do I get a form to submit it's params in the url, such that the rendered page will contain the query (rails 2.3)? Something like this: example.com/search?name=john&age=25&city=atlanta Simple, I know, but I'm not sure how to do it... :) thanks.

    Read the article

  • How to drag items between 2 sorted lists with jQuery?

    - by sa125
    Hi - I'm trying to implement drag/drop/sort between 2 list elements: <ul id="first"> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> <ul id="second"> <li>item 4</li> <li>item 5</li> <li>item 6</li> </ul> Basically I just want to be able to pass items between the lists and sort the items in each list. What's the simplest way to implement this using jQuery?

    Read the article

  • image scaling with C

    - by sa125
    Hi - I'm trying to read an image file and scale it by multiplying each byte by a scale its pixel levels by some absolute factor. I'm not sure I'm doing it right, though - void scale_file(char *infile, char *outfile, float scale) { // open files for reading FILE *infile_p = fopen(infile, 'r'); FILE *outfile_p = fopen(outfile, 'w'); // init data holders char *data; char *scaled_data; // read each byte, scale and write back while ( fread(&data, 1, 1, infile_p) != EOF ) { *scaled_data = (*data) * scale; fwrite(&scaled_data, 1, 1, outfile); } // close files fclose(infile_p); fclose(outfile_p); } What gets me is how to do each byte multiplication (scale is 0-1.0 float) - I'm pretty sure I'm either reading it wrong or missing something big. Also, data is assumed to be unsigned (0-255). Please don't judge my poor code :) thanks

    Read the article

  • Rspec-rails doesn't seem to find my models

    - by sa125
    Hi - I'm trying out rspec, and immediately hit a wall when it doesn't seem to load db records I know exist. Here's my fairly simple spec (no tests yet). require File.expand_path(File.dirname(__FILE__) + '../spec_helper') describe SomeModel do before :each do @user1 = User.find(1) @user2 = User.find(2) end it "should do something fancy" end I get an ActiveRecord::RecordNotFound exception, saying it couldn't find User w/ ID=1 or ID=2, which I know for a fact exist. I set both test and development databases to point to the same schema in database.yml, so this shouldn't be database mixup. I also ran script/generate rspec after installing the gems (rspec, rspec-rails), and gem.config both environment.rb and test.rb. Any idea what I'm missing? thanks. EDIT Seems I was running the tests with rake spec:models, which emptied the db and thus no records were found. When I used % spec spec/models/some_model_spec.rb, everything worked as expected.

    Read the article

  • is it possible to achieve an image clipping/masking effect with html + css3?

    - by sa125
    Hi - I'm trying to place a nice border around an image that's 250x250, using only html and css. The markup is this: <div id="img-container"><img src="pic.jpg" border="0"/></div> And the css is: #img-container { height: 225px; width: 225px; padding: 3px; border: 1px solid black; z-index: 10; position: relative; overflow: hidden; border-radius: 10px; } #img-container img { z-index: 5; } Basically, I want the div container to clip the picture's edges that exceed its boundaries. This will achieve the rounded edges effect using the border-radius property (-moz-border-radius, -webkit-border-radius, etc) - if it actually works or could even be done. Looking for tips and tricks on this. Thanks. And, yes, I'm obviously not a web designer :)

    Read the article

  • How to dynamically expand a string in C

    - by sa125
    Hi - I have a function that recursively makes some calculations on a set of numbers. I want to also pretty-print the calculation in each recursion call by passing the string from the previous calculation and concatenating it with the current operation. A sample output might look like this: 3 (3) + 2 ((3) + 2) / 4 (((3) + 2) / 4) x 5 ((((3) + 2) / 4) x 5) + 14 ... and so on So basically, the second call gets 3 and appends + 2 to it, the third call gets passed (3) + 2 , etc. My recursive function prototype looks like this: void calc_rec(int input[], int length, char * previous_string); I wrote a 2 helper functions to help me with the operation, but they implode when I test them: /********************************************************************** * dynamically allocate and append new string to old string and return a pointer to it **********************************************************************/ char * strapp(char * old, char * new) { // find the size of the string to allocate int len = sizeof(char) * (strlen(old) + strlen(new)); // allocate a pointer to the new string char * out = (char*)malloc(len); // concat both strings and return sprintf(out, "%s%s", old, new); return out; } /********************************************************************** * returns a pretty math representation of the calculation op **********************************************************************/ char * mathop(char * old, char operand, int num) { char * output, *newout; char fstr[50]; // random guess.. couldn't think of a better way. sprintf(fstr, " %c %d", operand, num); output = strapp(old, fstr); newout = (char*)malloc( 2*sizeof(char)+sizeof(output) ); sprintf(newout, "(%s)", output); free(output); return newout; } void test_mathop() { int i, total = 10; char * first = "3"; printf("in test_mathop\n"); while (i < total) { first = mathop(first, "+", i); printf("%s\n", first); ++i; } } strapp() returns a pointer to newly appended strings (works), and mathop() is supposed to take the old calculation string ("(3)+2"), a char operand ('+', '-', etc) and an int, and return a pointer to the new string, for example "((3)+2)/3". Any idea where I'm messing things up? thanks.

    Read the article

  • Rails - how can I query the db w/o touching the sessions table

    - by sa125
    Hi - I'm trying to provide a HTTP api to my app that queries a db that's read-only (for replication purposes). I find that my app crashes repeatedly when making a request b/c the call is trying to update the sessions table whenever I query the db. This doesn't happen when I return some text without hitting the database for info. class APIController < AplicationController def view data = Product.find(params[:id]).to_json # will fail data = { :one => 1, :two => 2 }.to_json # will succeed respond_to do |format| format.html { render :json => data } end end end How do I restrict it from touching the sessions table on this request (it's currently issuing an UPDATE on the updated_at field for that session). thanks.

    Read the article

  • Rails - why would a model inside RAILS_ROOT/lib not be available in production mode?

    - by sa125
    Hi - I have a class located inside RAILS_ROOT/lib folder, which I use in one of my helpers, and it works great in development. When I switch to production, the application throws a NameError (uninitialized constant SomeHelper::SomeClass), and I have to load it manually in the helper: load "#{Rails.root}/lib/some_class.rb" module SomeHelper def some_method sc = SomeClass.new # blah end end I was under the impression that everything inside RAILS_ROOT/lib/* should be available all to the app - is there anything I need to configure to make this happen in prod mode? thanks.

    Read the article

  • Rails - how can I capture the URL that directed to the current action in my app?

    - by sa125
    Hi - I need to see what page a request came from in my controller so I could be able to redirect back to it. For example, if I'm on a page showing a specific product (say /products/1) and it has a link to its vendor (/vendors/12), I want to be able to detect inside the vendors_controller that I came to that page from /products/1. Is there a simple way in Rails to achieve this, so that I could access it via params or session? thanks.

    Read the article

1