Search Results

Search found 1585 results on 64 pages for 'psycho bob'.

Page 43/64 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • Is it faster to count down than it is to count up?

    - by Bob
    Our computer science teacher once said that for some reason it is more efficient to count down that count up. For example if you need to use a FOR loop and the loop index is not used somewhere (like printing a line of N * to the screen) I mean that code like this : for (i=N; i>=0; i--) putchar('*'); is better than: for (i=0; i<N; i++) putchar('*'); Is it really true? and if so does anyone know why?

    Read the article

  • CMD For Loop does not hold set /a value

    - by Bob Hope
    Didn't know how to explain this well, so here is the code @echo off set test=0 for /f %%a in (textfile.txt) do ( rem loops five times(5 lines in textfile.txt) set /a test=test+1 rem Adds 1 to Test echo %%a rem Echo's correct line in file echo %test% rem Echo's whatever X was before the loop ) echo %test% rem Displays the correct value of X pause this is just an example of where I am finding the problem, txtfile.txt has 5 lines, so the for loop goes 5 times, each time, test gets +1 to it, and the /a displays the correct value of X, but the last echo on the for loop displays 0, which is what test is set to before the loop. The value of test is not changing until the loop is finished... is there any way to fix this? Here is what I want to accomplish, as there may be an easier way: I want to run a for loop that findstr's all rtf's in a series of sub folders, and copies them all to a all directory with a new name, 1.rtf,2.rtf,3.rtf, etc. The reason I need to rename them on the transfer is they all have the same name.

    Read the article

  • Rails Variable across all controller actions

    - by bob
    Hello, This should be a very simple rails question. I have a variable like the following. @administration = Administration.first I want this variable to be accessible through every controller action across all my controllers so for example if I have a Product controller and inside of it I have the usual CRUD actions, I want the @administration variable as defined above to be put into all the CRUD actions. (It would not be needed in destroy or create or update). I have many controllers throughout my project and I was wondering if there is an easier way than adding it manually through all of the actions that I want it in. I tried a global variable $administration = Administration.first but I run into an issue where it is not updated when I update the actual content of the Administration.first table. Also, I would like to avoid global variables. Any help would be much appreciated. Thanks! :)

    Read the article

  • Linq to Entities Joins

    - by Bob Avallone
    I have a question about joins when using Linq to Entities. According to the documentation the use on the join without a qualifier performs like a left outer join. However when I execute the code below, I get a count returned of zero. But if I comment out the three join lines I get a count of 1. That would indicate that the join are acting as inner join. I have two questions. One which is right inner or outer as the default? Second how do I do the other one i.e. inner or outer? The key words on inner and outer do not work. var nprs = (from n in db.FMCSA_NPR join u in db.FMCSA_USER on n.CREATED_BY equals u.ID join t in db.LKUP_NPR_TYPE on n.NPR_TYPE_ID equals t.ID join s in db.LKUP_AUDIT_STATUS on n.NPR_STATUS_ID equals s.ID where n.ROLE_ID == pRoleId && n.OWNER_ID == pOwnerId && n.NPR_STATUS_ID == pNPRStatusId && n.ACTIVE == pActive select n).ToList(); if (nprs.Count() == 0) return null;

    Read the article

  • Repeated Rake Task Using Delayed Job

    - by bob
    Hello, I am currently using the delayed_job gem and I was wondering how to run a rake task every 5 minutes. I want to run "rake ts:reindex RAILS_ENV=production" every 5 minutes but I'm not sure where to start. I really don't have much more I can say about this because I am VERY inexperienced in this area of rails development.

    Read the article

  • Can g++ fill uninitialized POD variables with known values?

    - by Bob Lied
    I know that Visual Studio under debugging options will fill memory with a known value. Does g++ (any version, but gcc 4.1.2 is most interesting) have any options that would fill an uninitialized local POD structure with recognizable values? struct something{ int a; int b; }; void foo() { something uninitialized; bar(uninitialized.b); } I expect uninitialized.b to be unpredictable randomness; clearly a bug and easily found if optimization and warnings are turned on. But compiled with -g only, no warning. A colleague had a case where code similar to this worked because it coincidentally had a valid value; when the compiler upgraded, it started failing. He thought it was because the new compiler was inserting known values into the structure (much the way that VS fills 0xCC). In my own experience, it was just different random values that didn't happen to be valid. But now I'm curious -- is there any setting of g++ that would make it fill memory that the standard would otherwise say should be uninitialized?

    Read the article

  • Easy way to convert c code to assembly?

    - by Bob
    Is there an easy way (like a free program) that can covert c/c++ code to x86 assembly? I know that any c compiler does something very similar and that I can just compile the c code and then disassemble the complied executable, but that's kind of an overkill, all I want is to convert a few lines of code. Does anyone know of some program that can do that?

    Read the article

  • Deserializing only select properties of an Entity using JDOQL query string?

    - by user246114
    Hi, I have a rather large class stored in the datastore, for example a User class with lots of fields (I'm using java, omitting all decorations below example for clarity): @PersistenceCapable class User { private String username; private String city; private String state; private String country; private String favColor; } For some user queries, I only need the favColor property, but right now I'm doing this: SELECT FROM " + User.class.getName() + " WHERE username == 'bob' which should deserialize all of the entity properties. Is it possible to do something instead like: SELECT username, favColor FROM " + User.class.getName() + " WHERE username == 'bob' and then in this case, all of the returned User instances will only spend time deserializing the username and favColor properties, and not the city/state/country properties? If so, then I suppose all the other properties will be null (in the case of objects) or 0 for int/long/float? Thank you

    Read the article

  • How to determine the radius and center of a circle when only three noncollinear points are known?

    - by Bob
    I'm working on a C# program that deals with Oracle Spatial geometry. When circle data is stored in a geometry field only three non-collinear points are stored to represent the circle. The problem is that I need to use this data on a Google Maps web page and need the center point and radius of the circle (since my circle drawing function uses that information). Can anyone help with the math involved and translating said math to C#? I think this page may hold the answer, but I'm having a hard time following it. There are formulas for radius and center given three points, but then they define the variables as matrices and I get lost at that point. How would I solve that in code?

    Read the article

  • JPA polymorphic oneToMany

    - by bob
    I couldn't figure out how to cleanly do a tag cloud with JPA where each db entity can have many tags. E.g Post can have 0 or more Tags User can have 0 or more Tags Is there a better way in JPA than having to make all the entities subclass something like Taggable abstract class? Where a a Tag entity would reference many Taggables. thank you

    Read the article

  • jquery specific show buttons on hover

    - by bob
    I have an application creating a bunch of divs through a loop. Each div has the class "product" so it looks like <div class="product"> !.....stuff here ....! <div class="show_on_hover">...buttons here... </div> </div> so there are about 12 of these same divs per page. I would like to hover over a specific one and show the specific "show_on_hover" div which is initially set to display:none. $('.product').hover(function() { $(.show_on_hover).show(); }, function () { $(.show_on_hover).hide(); } ); That is what I have so far but it will show ALL of the .show_on_hovers on the page so I am wondering how to get only the specific one you have moused over to show. This effect is seen on youtube when you mouseover any of the comments, and some comment tools pop up. Thanks!

    Read the article

  • Simple way to print value of a register in x86 assembly.

    - by Bob
    I need to write a program in 8086 Assembly that receives data from the user, does some mathematical calculations and prints the answer on the screen, I have written all parts of the program and all work fine but I don't know how to print the number to the screen. At the end of all my calculation the answer is AX and it is treated as an unsigned 16 bit integer. How do I print the decimal (unsigned) value of the AX register?

    Read the article

  • Adding a Jar to ext and using it in Eclipse

    - by Bob Breznak
    I am providing a client with a lab station image for a school program. There is a library that I'd like to directly add to the JRE so that students can use the library without needing to fiddle with adding the classpath. As this is a basic after school program, the goal is to just get students into programming with as little overhead additions as possible. At this point, I have the lib put into the jre/lib/ext and Eclipse is able to find it, however it will not allow access to any of the classes. I see it in the JRE System Library and the classes and packages are showing up there but when I go to use it, I am getting an "Access restriction" error. When I remove the JRE System Library then add it back in, everything works swimmingly. The library is accessible exactly as intended. Any ideas on how to resolve this?

    Read the article

  • Drupal Webform textfield dynamic growing list

    - by Bob Crowley
    Just curious... I have a project where people can input their cooking recipes. I would like to build a webform that will have a textfield and when it is filled in a new textfield appears below. A "growing textfield list". Let me try to show it here: Ingredient #1 _________________________________ [add] When you type and ingredient click "add" you then are going to see: Ingredient #1 Potatoes_________________________ Ingredient #2 _________________________________ [add] Sorry for not knowing the proper markup. However if anyone knows: a) the proper term for this ( I call a growing textfield list )? b) how to do it with webform in drupal?

    Read the article

  • How would you calculate all possible permutations of 0 through N iteratively?

    - by Bob Aman
    I need to calculate permutations iteratively. The method signature looks like: int[][] permute(int n) For n = 3 for example, the return value would be: [[0,1,2], [0,2,1], [1,0,2], [1,2,0], [2,0,1], [2,1,0]] How would you go about doing this iteratively in the most efficient way possible? I can do this recursively, but I'm interested in seeing lots of alternate ways to doing it iteratively.

    Read the article

  • Does ReleaseStringUTF do more than free memory?

    - by Bayou Bob
    Consider the following C code segments. Segment 1: char * getSomeString(JNIEnv *env, jstring jstr) { char * retString; retString = (*env)->GetStringUTFChars(env, jstr, NULL); return retString; } void useSomeString(JNIEnv *env, jobject jobj, char *mName) { jclass cl = (*env)->GetObjectClass(env, jobj); jmethodId mId = (*env)->GetMethodID(env, cl, mName, "()Ljava/lang/String;"); jstring jstr = (*env)->CallObjectMethod(env, obj, id, NULL); char * myString = getSomeString(env, jstr); /* ... use myString without modifing it */ free(myString); } Because myString is freed in useSomeString, I do not think I am creating a memory leak; however, I am not sure. The JNI spec specifically requires the use of ReleaseStringUTFChars. Since I am getting a C style 'char *' pointer from GetStringUTFChars, I believe the memory reference exists on the C stack and not in the JAVA heap so it is not in danger of being Garbage Collected; however, I am not sure. I know that changing getSomeString as follows would be safer (and probably preferable). Segment 2: char * getSomeString(JNIEnv *env, jstring jstr) { char * retString; char * intermedString; intermedString = (*env)->GetStringUTFChars(env, jstr, NULL); retString = strdup(intermedString); (*env)->ReleaseStringUTFChars(env, jstr, intermedString); return retString; } Because of our 'process' I need to build an argument on why getSomeString in Segment 2 is preferable to Segment 1. Is anyone aware of any documentation or references which detail the behavior of GetStringUTFChars and ReleaseStringUTFChars in relation to where memory is allocated or what (if any) additional bookkeeping is done (i.e. local Reference Pointer to the Java Heap being created, etc). What are the specific consequences of ignoring that bookkeeping. Thanks in advance.

    Read the article

  • Oracle SQL: Multiple Subqueries Unioned Without Running Original Query Multiple Times.

    - by Bob
    So I've got a very large database, and need to work on a subset ~1% of the data to dump into an excel spreadsheet to make a graph. Ideally, I could select out the subset of data and then run multiple select queries on that, which are then UNION'ed together. Is this even possible? I can't seem to find anyone else trying to do this and would improve the performance of my current query quite a bit. Right now I have something like this: SELECT ( SELECT ( SELECT( long list of requirements ) UNION SELECT( slightly different long list of requirements ) ) ) and it would be nice if i could group the commonalities of the two long requirements and have simple differences between the two select statements being unioned.

    Read the article

  • How to port C# code which uses a callback to VB.NET?

    - by Bob
    I need to port the following from the ASP.NET MVC 2 sourcecode from C# to VB.NET. It's from AuthorizeAttribute.cs beginning on line 86: HttpCachePolicyBase cachePolicy = filterContext.HttpContext.Response.Cache; cachePolicy.SetProxyMaxAge(new TimeSpan(0)); cachePolicy.AddValidationCallback(CacheValidateHandler, null /* data */); where CacheValidateHandler is: private void CacheValidateHandler(HttpContext context, object data, ref HttpValidationStatus validationStatus) { validationStatus = OnCacheAuthorization(new HttpContextWrapper(context)); } The VB.NET port from http://converter.telerik.com doesn't quite work for this line: cachePolicy.AddValidationCallback(CacheValidateHandler, Nothing) ' Error where CacheValidateHandler is: Private Sub CacheValidateHandler(ByVal context As HttpContext, ByVal data As Object, _ ByRef validationStatus As HttpValidationStatus) validationStatus = OnCacheAuthorization(New HttpContextWrapper(context)) End Sub VS2008 complains that CacheValidateHandler does not specify its arguments for context, data, and validationStatus. Any ideas how to port this code?

    Read the article

  • Is there a Java data structure that is effectively an ArrayList with double indicies and built-in in

    - by Bob Cross
    I am looking for a pre-built Java data structure with the following characteristics: It should look something like an ArrayList but should allow indexing via double-precision rather than integers. Note that this means that it's likely that you'll see indicies that don't line up with the original data points (i.e., asking for the value that corresponds to key "1.5"). As a consequence, the value returned will likely be interpolated. For example, if the key is 1.5, the value returned could be the average of the value at key 1.0 and the value at key 2.0. The keys will be sorted but the values are not ensured to be monotonically increasing. In fact, there's no assurance that the first derivative of the values will be continuous (making it a poor fit for certain types of splines). Freely available code only, please. For clarity, I know how to write such a thing. In fact, we already have an implementation of this and some related data structures in legacy code that I want to replace due to some performance and coding issues. What I'm trying to avoid is spending a lot of time rolling my own solution when there might already be such a thing in the JDK, Apache Commons or another standard library. Frankly, that's exactly the approach that got this legacy code into the situation that it's in right now.... Is there such a thing out there in a freely available library?

    Read the article

  • how to copy from one column to another but with different format

    - by Bob
    I hv a table like this:- Item Model Remarks ----------------------------------------- A 10022009 B 10032006 C 05081997 I need to copy the info from "Model" to "Remarks" with the following format:- Item Model Remarks ----------------------------------------- A 10022009 20090210 B 10032006 20060310 C 05081997 19970805 Thanks

    Read the article

  • ASP.NET Custom/User Control With Children

    - by Bob Fincheimer
    I want a create a custom/user control that has children (NOT a template control). For Example, I want my control to have the following markup: <div runat="server" id="div"> <label runat="server" id="label"></label> <div class="field"> <!-- INSERT CHILDREN HERE --> </div> </div> and when I want to use it on a page I simply: <ctr:MyUserControl runat="server" ID="myControl"> <span>This is a child</span> <div>And another <b>child</b> </ctr:MyUserControl> The child controls inside my user control will be inserted into my user control somewhere. What is the best way to accomplish this. The functionality is similar to a asp:PlaceHolder but I want to add a couple more options as well as additional markup and the such. Also the child controls still need to be able to be accessed by the page.

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >