Search Results

Search found 14958 results on 599 pages for 'non technical'.

Page 34/599 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • rails validate_format_of non-negative integers

    - by ash34
    Hi, I am trying to validate the format of non-negative integers with the following validates_format_of :fundays, :with => /\A[\d]+\Z/, :message => "invalid fundays" And here is the form field used in the view <%= f.text_field :fundays, :maxlength => 3, :style => 'width:50px;' %> However, when I input a non-digit into this field and submit the form, it does not fail the validation. Instead it saves a value of 0 in the database. How do I make it write to the list of error messages. thanks

    Read the article

  • [C++]Advantage of using a static member function instead of an equivalent non-static member function

    - by jonathanasdf
    I was wondering whether there's any advantages to using a static member function when there is a non-static equivalent. Will it result in faster execution (because of not having to care about all of the member variables), or maybe less use of memory (because of not being included in all instances)? Basically, the function I'm looking at is an utility function to rotate an integer array representing pixel colours an arbitrary number of degrees around an arbitrary centre point. It is placed in my abstract Bullet base class, since only the bullets will be using it and I didn't want the overhead of calling it in some utility class. It's a bit too long and used in every single derived bullet class, making it probably not a good idea to inline. How would you suggest I define this function? As a static member function of Bullet, of a non-static member function of Bullet, or maybe not as a member of Bullet but defined outside of the class in Bullet.h? What are the advantages and disadvantages of each?

    Read the article

  • how to iterate over non-English file names in PHP

    - by Sabya
    I have a directory which contains several files, many of which has non-english name. I am using PHP in Windows 7. I want to list the filename and their content using PHP. Currently I am using DirectoryIterator and file_get_contents. This works for English files names but not for non-English (chinese) file names. For example, I have filenames like "?? ?? ?????????.eml", "hello ??????.eml". DirectoryIterator is not able to get the filename using ->getFilename() file_get_contents is also not able to open even if I hard code the filename in its parameter. How can I do it?

    Read the article

  • Connect to an elevated COM server from a non-elevated process

    - by JS Bangs
    We have a program which launches a child process that hosts a local COM server, which for various reasons must be launched elevated. Everything works fine so long as both the parent and the child process are elevated. However, we also want to run when the parent process is non-elevated. Launching the child process results in a UAC dialog (which is acceptable), and the child appears to start correctly and successfully calls CoRegisterClassObject. However, the parent process gets REGDB_E_CLASSNOTREG when calling CoCreateInstance with the same CLSID. I assume this is some sort of permissions issue. How can I register my class in the elevated server to allow it to be called from a non-elevated process.

    Read the article

  • Strategy for developing namespaced and non-namespaced versions of same PHP code

    - by porneL
    I'm maintaining library written for PHP 5.2 and I'd like to create PHP 5.3-namespaced version of it. However, I'd also keep non-namespaced version up to date until PHP 5.3 becomes so old, that even Debian stable ships it ;) I've got rather clean code, about 80 classes following Project_Directory_Filename naming scheme (I'd change them to \Project\Directory\Filename of course) and only few functions and constants (also prefixed with project name). Question is: what's the best way to develop namespaced and non-namespaced versions in parallel? Should I just create fork in repository and keep merging changes between branches? Are there cases where backslash-sprinkled code becomes hard to merge? Should I write script that converts 5.2 version to 5.3 or vice-versa? Should I use PHP tokenizer? sed? C preprocessor? Is there a better way to use namespaces where available and keep backwards compatibility with older PHP?

    Read the article

  • Non-graphical linearity estimation

    - by aL3xa
    In my previous post, I was looking for correlation ratio (η or η2) routines in R. I was surprised by the fact that no one uses η for linearity checking in the GLM procedures. Let's start form a simple example: how do you check linearity of bivariate correlation? Solely with scatterplot? There are several ways of doing this, one way is to compare linear and non-linear model R2, then to apply F test to seek for significant difference between them. Finally, the question is: How do you check linearity, the "non-grafical" way?

    Read the article

  • A Simulator for a non-deterministic Push-Down Automaton

    - by shake
    Well, i need to make simulator for non-deterministic Push-Down Automaton. Everything is okey, i know i need to do recursion or something similar. But i do not know how to make that function which would simulate automaton. I got everything else under control, automaton generator, stack ... I am doing it in java, so this is maybe only issue that man can bump on, and i did it. So if anyone have done something similar, i could use advices. This is my current organisation of code: C lasses: class transit: list -contains non deterministic transitions state input sign stack sign class generator it generate automaton from file clas NPA public boolean start() - this function i am having trouble with Of course problem of separate stacks, and input for every branch. I tried to solve it with collection of objects NPA and try to start every object, but it doesn work :((..

    Read the article

  • ASP.NET MVC, JSON & non JavaScript clients

    - by redsquare
    I need to ensure that an application I am developing is accessable and also works with JavaScript turned off. I just need a pointer to assist with the following. I had 3 'chained' select boxes and I wanted JavaScript enabled clients to have a nice Ajax experience. I can easily write the required functionality to populate the chained boxes on the change event of the preceeding select using jQuery and JSON with a WCF service. However what about the non JavaScript client? Would I wrap a submit next to the select and place these inside their own form to post back with a certain action or different querstring parameter? Can the same controller give me a partial JSON response as well as feeding the full HTML response. Can anyone point me to a good demo that utilises both JSON and normal HTTP posts to produce the same result in ASP.NET MVC. All ASP.NET MVC demo/examples I see forget about the non JavaScript enabled client.

    Read the article

  • Non laggy movement in Flex or WPF

    - by PaN1C_Showt1Me
    I'm trying to learn something about 2D games programming. For this purpose I've downloaded many samples developed in: Flex and Microsoft WPF. I've noticed that all the animations / moving objects are kind of non-smooth. I've seen a Flex example with double buffering which solved the image flickering, but it was laggy too. WPF example too. Just to mentioned, all examples were drawing on Canvas. I'm just curious, is it possible to have a wonderful non-laggy movement on the GUI in Flash or WPF ? (e.g. like a real game, coded in C++)

    Read the article

  • ADO.NET Data Service -- non .NET consumers

    - by SwampyFox
    Has anyone come across an example of a non .Net consumer of an ADO.NET Data Service? I am on the second day of looking at what Astoria is and how it can be used. I am also trying to answer why would I use this instead of a web service? After getting my examples running, I kind get the RESTful approach to getting data out the system. And, plugging it into a .net client is incredibly easy. But, then I wondered how a non-.NET consumer would go about it. Any ideas (pointers) definitely appreciated...

    Read the article

  • Cannot initialize non-const reference from convertible type

    - by Julien L.
    Hi, I cannot initialize a non-const reference to type T1 from a convertible type T2. However, I can with a const reference. long l; const long long &const_ref = l; // fine long long &ref = l; // error: invalid initialization of reference of // type 'long long int&' from expression of type // 'long int' Most problems I encountered were related to r-values that cannot be assigned to a non-const reference. This is not the case here -- can someone explain? Thanks.

    Read the article

  • Recommendations with hierarchical data on non-relational databases?

    - by Luki
    I'm developing an web application that uses a non-relational database as a backend (django-nonrel + AppEngine). I need to store some hierarchical data (projects/subproject_1/subproject_N/tasks), and I'm wondering which pattern should I use. For now I thought of: Adjacency List (store the item's parent id) Nested sets (store left and right values for the item) In my case, the depth of nesting for a normal user will not exceed 4-5 levels. Also, on the UI, I would like to have a pagination for the items on the first level, to avoid to load too many items at the first page load. From what I understand so far, nested sets are great when the hierarchy is used more for displaying. Adjacency lists are great when editing on the tree is done often. In my case I guess I need the displaying more than the editing (when using nested sets, even if the display would work great, the above pagination could complicate things on editing). Do you have any thoughts and advice, based on your experience with the non-relational databases?

    Read the article

  • Java - Handling Non-Blocking Calls

    - by sarav
    In my application I am using a third-party API. It is a non-blocking method which returns immediately. I have a collection of elements over which I have to invoke this method. Now, my problem is that I have to find a way till all the method execution gets completed and do my next operation. How can I handle this? I cannot modify the third-party API. In short it looks like this for(Object object: objects){ methodA(object); //this is a non-blocking call and returns immediately } // here I want to do my next task only after all the methodA calls completed execution

    Read the article

  • file_get_contents not working with non english filenames in DRUPAL

    - by Novarg
    Hello. I have a problem. file_get_contents and other file functions (like file, fopen, glob etc) not working when i try to get file with non english symbols. I getting error that file not exist. It is going when i using any of that functions from my simple drupal module. But same time when i try to use file_get_contents outside drupal's code (just created separated php file) this function work as it should. Can you advice something?? What drupal doing so i can't use file functions on file with non english name from my module? Thanks.

    Read the article

  • PowerShell: How to add XmlElement to a non-root element

    - by Ariel
    I'm having trouble adding an XmlElement to a non-root element in PowerShell. Basically, given this xml: <clubs> <club name="boca" position="1"> <field>bombonera</field> <field>bombonerita</field> </club> <club name="racing" position="19"> <field>cilindro</field> </club> </clubs> I create an element, $new = $clubs.CreateElement("Barracas") When I try to add this element to a non-root node i.e. $clubs.clubs.club += $new I get Cannot set "club" because only strings can be used as values to set XmlNode properties. What am I missing? Thanks in advance.

    Read the article

  • Copying a 2D non-space array to another

    - by Jay
    I'm a total programming newb who started learning java programming this sem at uni. I'm up to a step where i need to copy some elements from one method to another. This program i'm creating is called an L_Game. The question I'm stuck is: the project(Slide other) method should take another slide as a parameter, and copy each non-space cell from this slide into the other slide (i.e. like a projector projecting slides onto a screen. I previously made a constructor with the parameter cells in it and believe i copied it to the project(Slide other) method. But i'm not sure what to do to copy each "non-space cell" With the "for" method or the "if" method? If my question isn't typed correctly or have information missing, please let me know. Any help will be appreciated. (I obviously have no idea with what i'm doing...)

    Read the article

  • Pseudorandom Number Generation with Specific Non-Uniform Distributions

    - by carnun
    Hello all, I'm writing a program that simulates various random walks (with differing distributions). At each timestep, I need randomly generated, two dimensional step distances and angles from the distribution of the random walk. I'm hoping someone can check my understanding of how to generate these random numbers. As I understand it I can use Inverse Transform Sampling as follows: If f(x) is the pdf of our random walk that has a non-uniform distribution, and y is a random number from a uniform distribution. Then if we let f(x) = y and solve to find x then we have a random number from the non-uniform distribution. Is this a feasible solution?

    Read the article

  • Merging and splitting overlapping rectangles to produce non-overlapping ones

    - by uj
    I am looking for an algorithm as follows: Given a set of possibly overlapping rectangles (All of which are "not rotated", can be uniformly represented as (left,top,right,bottom) tuplets, etc...), it returns a minimal set of (non-rotated) non-overlapping rectangles, that occupy the same area. It seems simple enough at first glance, but prooves to be tricky (at least to be done efficiently). Are there some known methods for this/ideas/pointers? Methods for not necessarily minimal, but heuristicly small, sets, are interesting as well, so are methods that produce any valid output set at all.

    Read the article

  • A non-blocking server with java.io

    - by Jon
    Everybody knows that java IO is blocking, and java NIO is non-blocking. In IO you will have to use the thread per client pattern, in NIO you can use one thread for all clients. Now my question follows: is it possible to make a non-blocking design using only the Java IO api. (not NIO) I was thinking about a pattern like this (obviously very simplified); List<Socket> li; for (Socket s : li) { InputStream in = s.getInputStream(); byte[] data = in.available(); in.read(data); // processData(data); (decoding packets, encoding outgoing packets } Also note that the client will always be ready for reading data. What are your opinions on this? Will this be suitable for a server that should at least hold a few hundred of clients without major performance issues?

    Read the article

  • Perl - Reading .txt files line-by-line and using compare function (printing non-matches only once)

    - by Kurt W
    I am really struggling and have spent about two full days on this banging my head against receiving the same result every time I run this perl script. I have a Perl script that connects to a vendor tool and stores data for ~26 different elements within @data. There is a foreach loop for @data that breaks the 26 elements into $e-{'element1'), $e-{'element2'), $e-{'element3'), $e-{'element4'), etc. etc. etc. I am also reading from the .txt files within a directory (line-by-line) and comparing the server names that exist within the text files with what exists in $e-{'element4'}. The Problem: Matches are working perfectly and only printing one line for each of the 26 elements when there is a match, however non-matches are producing one line for every entry within the .txt files (37 in all). So if there are 100 entries (each entry having 26 elements) stored within @data, then there are 100 x 37 entries being printed. So for every non-match in the: if ($e-{'element4'} eq '6' && $_ =~ /$e-{element7}/i) statement below, I am receiving a print out saying that there is not a match. 37 entries for the same identical 26 elements (because there are 37 total entries in all of the .txt files). The Goal: I need to print out only 1 line for each unique entry (a unique entry being $e-{element1} thru $e-{element26}). It is already printing one 1 line for matches, but it is printing out 37 entries when there is not a match. I need to treat matches and non-matches differently. Code: foreach my $e (@data) { # Open the .txt files stored within $basePath and use for comparison: opendir(DIRC, $basePath . "/") || die ("cannot open directory"); my @files=(readdir(DIRC)); my @MPG_assets = grep(/(.*?).txt/, @files); # Loop through each system name found and compare it with the data in SC for a match: foreach(@MPG_assets) { $filename = $_; open (MPGFILES, $basePath . "/" . $filename) || die "canot open the file"; while(<MPGFILES>) { if ($e->{'element4'} eq '6' && $_ =~ /$e->{'element7'}/i) { ## THIS SECTION WORKS PERFECTLY AND ONLY PRINTS MATCHES WHERE $_ ## (which contains the servernames (1 per line) in the .txt files) ## EQUALS $e->{'element7'}. print $e->{'element1'} . "\n"; print $e->{'element2'} . "\n"; print $e->{'element3'} . "\n"; print $e->{'element4'} . "\n"; print $e->{'element5'} . "\n"; # ... print $e->{'element26'} . "\n"; } else { ## **THIS SECTION DOES NOT WORK**. FOR EVERY NON-MATCH, THERE IS A ## LINE PRINTED WITH 26 IDENTICAL ELEMENTS BECAUSE ITS LOOPING THRU ## THE 37 LINES IN THE *.TXT FILES. print $e->{'element1'} . "\n"; print $e->{'element2'} . "\n"; print $e->{'element3'} . "\n"; print $e->{'element4'} . "\n"; print $e->{'element5'} . "\n"; # ... print $e->{'element26'} . "\n"; } # End of 'if ($e->{'element4'} eq..' statement } # End of while loop } # End of 'foreach(@MPG_assets)' } # End of 'foreach my $e (@data)' I think I need something to identical unique elements and define what fields make up a unique element but honestly I have tried everything I know. If you would be so kind to provide actual code fixes, that would be wonderful because I am headed to production with this script quite soon. Also. I am looking for code (ideally) that is very human-readable because I will need to document it so others can understand. Please let me know if you need additional information.

    Read the article

  • if non zero elements in same column count only once

    - by George
    I want to check the elements above the main diagonal and if I found non zero values , count one. If the non zero values are found in the same column ,then count just one ,not the number of the non zero values. For example , it should be count = 2 and not 3 in this example because 12 and 6 are in the same column. A= 1 11 12 4 5 6 0 7 0 #include <stdio.h> #include <stdlib.h> #include <math.h> int main( int argc, const char* argv[] ){ int Rows = 3 , Cols = 3; float *A = (float *) malloc ( Rows * Cols * sizeof (float) ); A[0] = 1.0; A[1] = 11.0; A[2] = 12.0; A[3] = 4.0; A[4] = 5.0; A[5] = 6.0; A[6] = 0.0; A[7] = 7.0; A[8] = 0.0; // print input matrix printf("\n Input matrix \n\n"); for ( int i = 0; i < Rows; i++ ) for ( int j = 0; j < Cols; j++ ) { printf("%f\t",A[ i * Cols + j ]); if( j == Cols-1 ) printf("\n"); } printf("\n"); int count = 0; for ( int j = 0 ; j < Cols; j++ ) { for ( int i = ( Rows - 1 ); i >= 0; i-- ) { // check the diagonal elements above the main diagonal if ( j > i ) { if ( ( A[ i * Cols + j ] != 0 ) ) { printf("\n Above nonzero Elmts = %f\n",( A[i * Cols + j] ) ); count++; } } } } printf("\ncount = %d\n",count ); return 0; }

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >