Search Results

Search found 8953 results on 359 pages for 'human resources'.

Page 104/359 | < Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >

  • Ruby on Rails: Simple way to select all records of a nested model?

    - by Josh Pinter
    Just curious, I spent an embarrassing amount of time trying to get an array of all the records in a nested model. I just want to make sure there is not a better way. Here is the setup: I have three models that are nested under each other (Facilities Tags Inspections), producing code like this for routes.rb: map.resources :facilities do |facilities| facilities.resources :tags, :has_many => :inspections end I wanted to get all of the inspections for a facility and here is what my code ended up being: def facility_inspections @facility = Facility.find(params[:facility_id]) @inspections = [] @facility.tags.each do |tag| tag.inspections.each do |inspection| @inspections << inspection end end end It works but is this the best way to do this - I think it's cumbersome. Thanks in advance. Josh

    Read the article

  • get pure text form odt file in console

    - by naugtur
    I am looking for a small linux tool that would be able to extract text from odt file. It just needs to be human-readable and it can have problems with complicated objects etc. It's almost a duplicate of this question but I need it to be small and have no dependencies on OpenOffice or X server I remember having a 1MB MS-DOS program that could render .doc files quite readibly (with some weird markup getting through from time to time), so i expect it to be possible in the linux world too ;)

    Read the article

  • Unset/Change Binding in WPF

    - by captcalamares
    How can I unset the binding applied to an object so that I can apply another binding to it from a different location? Suppose I have two data templates binded to the same object reference. Data Template #1 is the default template to be loaded. I try to bind a button command to a Function1 from my DataContext class: <Button Content="Button 1" CommandParameter="{Binding }" Command="{Binding DataContext.Function1, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"/> This actually works and the function gets binded. However, when I try to load Data Template # 2 to the same object (while trying to bind another button command to a different function (Function2) from my DataContext class): <Button Content="Button 2" CommandParameter="{Binding }" Command="{Binding DataContext.Function2, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" /> It doesn't work and the first binding is still the one executed. Is there a workaround to this? EDIT (for better problem context): I defined my templates in my Window.Resources: <Window.Resources> <DataTemplate DataType="{x:Type local:ViewModel1}"> <local:View1 /> </DataTemplate> <DataTemplate DataType="{x:Type local:ViewModel2}"> <local:View2 /> </DataTemplate> </Window.Resources> The View1.xaml and the View2.xaml contain the button definitions that I described above (I want them to command the control of my process flow). ViewModel1 and ViewModel2 are my ViewModels that implement the interface IPageViewModel which is the type of my variable CurrentPageViewModel. In my XAML, I binded ContentControl to the variable CurrentPageViewModel: <ContentControl Content="{Binding CurrentPageViewModel}" HorizontalAlignment="Center"/> In my .CS, I have a list defined as List<IPageViewModel> PageViewModels, which I use to contain the instances of my two View Models: PageViewModels.Add(new ViewModel1()); PageViewModels.Add(new ViewModel2()); // Set starting page CurrentPageViewModel = PageViewModels[0]; When I try to change my CurrentPageViewModel to the other view model, this is when I want the new binding to work. Unfortunately, it doesn't. Am I doing things the right way?

    Read the article

  • Is it possible to programmatically edit a sound file based on frequency?

    - by K-RAN
    Just wondering if it's possible to go through a flac, mp3, wav, etc file and edit portions, or the entire file by removing sections based on a specific frequency range? So for example, I have a recording of a friend reciting a poem with a few percussion instruments in the background. Could I write a C program that goes through the entire file and cuts out everything except the vocals (human voice frequency ranges from 85-255 Hz, from what I've been reading)? Thanks in advance for any ideas!

    Read the article

  • How can i add an image in html email from lotus domino agent?

    - by mike_x_
    i want to add a simple image into an email which i want to send from a lotus agent. I paste below a part of the code: StringBuilder sb = new StringBuilder(); sb.append("<div><img src=\"http://goo.gl/lziMZN\"></div>"); email.setHTMLPart(sb.toString()); email.send("[email protected]"); I also tried to use an image from my image resources in the nsf. Whatever i tried i get an empty image area (browser-no-image icon) in the email i receive. I also have checked "Allow restricted operations" in my agent. I would prefer it if there is a solution to use an image from my resources and not an external link. Any solutions?

    Read the article

  • How can i localize asp.net mvc application using a external assembly

    - by allrast
    i want to create a external dll to store my .resx files. i want to do this because i need to access this files from both presentation and business layers. I have created a external project that contains the default and the es-Es resx files. i have mark it as PublicResXFileCodeGenerator to be able to access it from another dll. on my view i have this test <%=localization.Common.title.ToString() % when i'm run the application i always get this error "Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "localization.Common.resources" was correctly embedded or linked into assembly "localization" at compile time, or that all the satellite assemblies required are loadable and fully signed." i have read some this related to ddl signing... but i don't now if this is the problem.

    Read the article

  • How to write "good" user interface text?

    - by Roddy
    Many applications are let down by the quality of the 'writing' in their user interfaces: typically, poor spelling, grammar, inconsistent tone, and worse yet, "humour" are the usual offenders. Are there good resources that can help developers to write UI messages that give a professional and positive impression to your customers, even when your code's going to hell in a handcart? Thanks, all — Some great resources here, so I will CW this question. I'm accepting Adam Sill's answer because it's the one that (as a developer of desktop apps) I found most pertinent.

    Read the article

  • Captcha replacement

    - by portoalet
    Hi, I stumbled upon http://www.kettletime.com.au/chance where the user needs to drag and drop a box with a number into another box to prove that he is human. How do you implement this? Any free library to do this? Thanks

    Read the article

  • Symfony2 Syntax Errors (in vendor files)

    - by user1665246
    To maintain code integrity across our servers we'd like to keep the /vendor/* directory under source control, rather than use composer to download files each time we roll out onto another server - i.e. we can be certain that the /vendor/* files are identical. We run a syntax checker against all files committed to source control and run across the following error: File '/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/bundle/Bundle.php' failed the PHP syntax check with the following error: PHP Parse error: syntax error, unexpected '}', expecting T_NS_SEPARATOR in /vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/bundle/Bundle.php on line 3 Is the "error" in this file intentional ? Any help appreciated. File contents below: <?php namespace {{ namespace }}; use Symfony\Component\HttpKernel\Bundle\Bundle; class {{ bundle }} extends Bundle { }

    Read the article

  • how to model a many to many relationship

    - by Maulin
    Here is the scenario, Articles have many Comments Users can write many Comments for many Articles The comments table contains both user_id article_id as foreign keys My models are set up like so class User < ActiveRecord::Base has_many :comments has_many :articles, :through => :comments class Article < ActiveRecord::Base has_many :comments has_many :users, :through => :comments class Comment < ActiveRecord::Base belongs_to :users belongs_to :articles My routes.rb has the following code map.resources :articles, :has_many => :comments map.resources :users, :has_many => :comments which produces the following routes new_article_comment edit_article_comment new_user_comment edit_user_comment etc... This is not what I want (atleast not what I think I want), since comments must always be related to users and article, how can I get a route like so new_user_article_comment edit_user_article_comment Then I could just do new_user_article_comment_path([@user, @article]) to create a new comment

    Read the article

  • No resource found when using style Theme.Sherlock

    - by Vitaly Menchikovsky
    I am trying to use Sherlock. The steps That I did bring up the library of abc to my project while my project min sdk 2.2 and max api 15. the problem that I cant set up the style to use it. the error Error retrieving parent for item: No resource found that matches the given name '@style/ Theme.Sherlock'. my code of xml: <resources> <style name="AppTheme" parent="@style/Theme.Sherlock" /> </resources> the java that I use is 1.6. I am runing 4.0.3 avd. I know that you will give me a link for webs but didnt find any thing that can help. I am using eclipse and Sherlock 4.0.3.If you can give me the solution how to do it simple way with instructions. thanks.

    Read the article

  • best way to add route under resource in Laravel 4

    - by passingby
    I would like know if there is a better way to add additional route aside from the default of resource in Laravel 4. I have this code below which is no problem with regard to the functionality, it's just that it seems to be long: <?php Route::group(array('before' => 'auth'), function() { # API Route::group(array('prefix' => 'api'), function() { Route::resource('projects', 'ProjectsController'); Route::resource('projects.groups', 'GroupsController'); Route::post('/projects/{projects}/groups/{groups}/reorder', 'GroupsController@reorder'); }); }); If in Rails Rails.application.routes.draw do # API namespace :api, defaults: { format: 'json' } do scope module: :v1 do resources :projects do resources :groups do member do post :reorder end end end end end end

    Read the article

  • Efficient file buffering & scanning methods for large files in python

    - by eblume
    The description of the problem I am having is a bit complicated, and I will err on the side of providing more complete information. For the impatient, here is the briefest way I can summarize it: What is the fastest (least execution time) way to split a text file in to ALL (overlapping) substrings of size N (bound N, eg 36) while throwing out newline characters. I am writing a module which parses files in the FASTA ascii-based genome format. These files comprise what is known as the 'hg18' human reference genome, which you can download from the UCSC genome browser (go slugs!) if you like. As you will notice, the genome files are composed of chr[1..22].fa and chr[XY].fa, as well as a set of other small files which are not used in this module. Several modules already exist for parsing FASTA files, such as BioPython's SeqIO. (Sorry, I'd post a link, but I don't have the points to do so yet.) Unfortunately, every module I've been able to find doesn't do the specific operation I am trying to do. My module needs to split the genome data ('CAGTACGTCAGACTATACGGAGCTA' could be a line, for instance) in to every single overlapping N-length substring. Let me give an example using a very small file (the actual chromosome files are between 355 and 20 million characters long) and N=8 import cStringIO example_file = cStringIO.StringIO("""\ header CAGTcag TFgcACF """) for read in parse(example_file): ... print read ... CAGTCAGTF AGTCAGTFG GTCAGTFGC TCAGTFGCA CAGTFGCAC AGTFGCACF The function that I found had the absolute best performance from the methods I could think of is this: def parse(file): size = 8 # of course in my code this is a function argument file.readline() # skip past the header buffer = '' for line in file: buffer += line.rstrip().upper() while len(buffer) = size: yield buffer[:size] buffer = buffer[1:] This works, but unfortunately it still takes about 1.5 hours (see note below) to parse the human genome this way. Perhaps this is the very best I am going to see with this method (a complete code refactor might be in order, but I'd like to avoid it as this approach has some very specific advantages in other areas of the code), but I thought I would turn this over to the community. Thanks! Note, this time includes a lot of extra calculation, such as computing the opposing strand read and doing hashtable lookups on a hash of approximately 5G in size. Post-answer conclusion: It turns out that using fileobj.read() and then manipulating the resulting string (string.replace(), etc.) took relatively little time and memory compared to the remainder of the program, and so I used that approach. Thanks everyone!

    Read the article

  • How Two Programs Can Talk To Each Other In Java?

    - by Arnon
    My first time here... I want to ?reduce? the CPU usage/ROM usage/RAM usage - in general ?speaking?, all system resources that my App use - how doesn't? :) For this reason i want to split the preferences window from the rest of the application, and let the preferences window to run as ?independent? program. The preferences program ?should? write to a Property file(not a problem at all) and to send a "update signal" to the main program - which mean, to call the update method(that i wrote) that found in the Main class. How can i call the update method in the Main program from the preferences program? Or in the other hand... There is a way to build preferences window that take system resources just when it's appear? Is this approach - of separating programs and let them talk to each other(somehow) - is a right approach for speeding up my programs? tnx

    Read the article

  • iPhone webapp: my ressources don't get cached

    - by Savageman
    Hello, First of all, I'd like to say I'm not using any off-line feature from HTML5. I have a web-application which runs on the iPhone. When viewing it from safari, everything works quite well. But when I launch the application from the home screen (to remove the navigation bar), it can be really slow. I checked the logs in Apache and it appears that Safari does a good work to cache the resources (css / js / images), with Apache answering "304 Not Modified" when needed. However, when the web app run as a "real" application (navigation bar hidden), those resources doesn't get cached and Apache the content has to be transferred over and over again (response code 200 Ok + content), resulting in a significantly slower page load. How can I prevent this behavior? Do I need to always run my webapp inside Safari, even when it's launched from the home screen? Thank you!

    Read the article

  • Write easily readable XML in Python

    - by dutch
    Is there any way other than creating a method myself to write XML using python which are easily readable? xMLFile.write(xmlDom.toxml()) does create proper xml but reading them is pretty difficult. I tried toprettyxml but doesn't seem like it does much. e.g. following is what I would consider a human readable xml:

    Read the article

  • Choosing the right and learning assembler for compiler-writing

    - by X A
    I'm writing a compiler and I have gone through all the steps (tokenizing, parsing, syntax tree structures, etc.) that they show you in all the compiler books. (Please don't comment with the link to the "Resources for writing a compiler" question!). I have chosen to use NASM together with alink as my backend. Now my problem is: I just can't find any good resources for learning NASM and assembly in general. The wikibook (german) on x86 assembly is horrible. They don't even explain the code they write there, I currently can't even get simple things like adding 1 to 2 and outputting the result working. Where can I learn NASM x86 assembly?

    Read the article

  • Java applet icon doesn't show

    - by user295744
    I have a java applet where I've changed the image icon that appears in the top left corner of the window. The code I use is this: Toolkit kit = Toolkit.getDefaultToolkit(); Image frameIcon = kit.getImage("src/myapp/resources/logo.png"); getFrame().setIconImage(frameIcon); Everything works fine until I deploy the applet to a standalone jar. In this case the icon that shows is the default icon, as if the code couldn't find the image. But the image is inside, although it is in the folder: myapp/resources/ What am I doing wrong here? Is this some weird java bug?

    Read the article

  • Rails 3 routes and using GET to create clean URLs?

    - by Hard-Boiled Wonderland
    I am a little confused with the routes in Rails 3 as I am just starting to learn the language. I have a form generated here: <%= form_tag towns_path, :method => "get" do %> <%= label_tag :name, "Search for:" %> <%= text_field_tag :name, params[:name] %> <%= submit_tag "Search" %> <% end %> Then in my routes: get "towns/autocomplete_town_name" get "home/autocomplete_town_name" match 'towns' => 'towns#index' match 'towns/:name' => 'towns#index' resources :towns, :module => "town" resources :businesses, :module => "business" root :to => "home#index" So why when submitting the form do I get the URL: /towns?utf8=?&name=townname&commit=Search So the question is how do I make that url into a clean url like: /towns/townname Thanks, Andrew

    Read the article

  • Multi language CMS?

    - by Adam
    Is there any CMS such as expression engine or wordpress that allows a user to click a button and convert all the text to another language (it would have to be human generated otherwise it has too many mistakes probably). I'd like to know if there are any good solutions out there that work for real world use, in like business company websites.

    Read the article

< Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >