Search Results

Search found 2221 results on 89 pages for 'equal'.

Page 55/89 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • R: Change the fields' (slots') values of the class assigning a value to some other field

    - by Max Li
    Assgning a value to one field, how can I make the other fields changing. Consider the following R5 class C<-setRefClass("C", fields=list(a="numeric",b="numeric") , methods=list( seta = function(x){ a<<-x b<<-x+10 cat("The change took place!") } ) # end of the methods list ) # end of the class Now create the instance of the class c<-C$new() This command c$seta(10) will result in that c$a is 10 and c$b is 20. So it actually works, however, I want to achieve this result by the command c$a<-10 (i.e. after that I want c$b to be equal to 20 as defined in the class in the logic of seta() function) How can I do it?

    Read the article

  • Breaking out of .emacs script

    - by prosseek
    I use two emacs (Aquamcs and text based emacs) on my Mac. I normally use text based emacs for just editing something, so I don't want to load anything with it. What I came up with is to have the checking code in .emacs to exit/break if it's text based emacs (darwin system but not aquamacs). (when (and (equal system-type 'darwin) (not (boundp 'aquamacs-version))) (exit) ??? (break) ???? ) It seems to work, but I don't know how to break out of .emacs. How to do that? ADDED I just wanted to speed up in loading text based emacs on my mac, and I thought about breaking out as a solution. Based on the helpful answers, I came up with the following code that runs .emacs only when it's not a text based emacs. (setq inhibit-splash-screen t) (unless (null window-system)

    Read the article

  • Combining Arrays in Javascript

    - by Bigbohne
    Maybe it's to late in germany (1:04AM) or I'm missing something... How can I combine these two arrays: a = [1, 2, 3] and b = [a, b, c] so that i get: [[1, a], [2, b], [3, c]] Thank and ... spend more time sleeping! :) Edit: Ok, i see this function i called "zip". +1 Knowledge And there is no builtin function in Javascript for this. +1 Knowledge And I should have said that the arrays are equal in length. -1 Knowledge ... = positiv day. Thx

    Read the article

  • Retrieving a single Guid in CRM 4.0

    - by user1746560
    I'm new to CRM (version 4.0) and i'm trying to return a 'yearid' guide based on a given year (which is also stored in the entity).So far i've got: public static Guid GetYearID(string yearName) { ICrmService service = CrmServiceFactory.GetCrmService(); // Create the query object. QueryExpression query = new QueryExpression("year"); ColumnSet columns = new ColumnSet(); columns.AddColumn("yearid"); query.ColumnSet = columns; FilterExpression filter = new FilterExpression(); filter.FilterOperator = LogicalOperator.And; filter.AddCondition(new ConditionExpression { AttributeName = "yearName", Operator = ConditionOperator.Equal, Values = new object[] { yearName} }); query.Criteria = filter; } But my questions are: A) What code do in addition to this to actually store the Guid? B) Is using a QueryExpression the most efficient way to do this?

    Read the article

  • Check if exists, if so, update by 1++, if not insert

    - by Scarface
    Hey guys quick question, I currently have an insert statement $query= "INSERT into new_mail VALUES ('$to1', '0')"; where fields are username, and message_number Currently what I would do to check if the entry exists, is do a select query then check the number of rows with mysql_num_rows (php). If rows==1 then I get the current message_number and set it equal to $row['message_number']++1. Then I update that entry with another query. Is there an easier way to do all this in just mysql with just one query (check if exists, if not insert, if so update message_number, increase by 1)?

    Read the article

  • menu items not displaying properly

    - by Senthilkumar
    Hi I am using Xml Data source to build menu for my application.. but the problem I am facing is, when i click on the menu it display all submenu right below the menu.. but when i scroll down a little in the page and click on the menu it display the menu items not at the right place.. which means it display the items not right below the menu it leaves some space in between (which is equal to legth i come down using scrollbar).. can any one help me???????

    Read the article

  • ActiveRecord and transactionsin between `before_save` and `save`

    - by JP
    I have some logic in before_save whereby (only) when some conditions are met I let the new row be created with special_number equal to the maximum special_number in the database + 1. (If the conditions aren't met then I do something different, so I can't use auto-increments) My worry is that two threads acting on this database at once might pick the same special_number if the second is executed while the first is saving. Is there way to lock the database between before_save and finishing the save, but only in some cases? I know all saves are sent in transactions, will this do the job for me? def before_save if things_are_just_right # -- Issue some kind of lock? # -- self.lock? I have no idea # Pick new special_number new_special = self.class.maximum('special_number') + 1 write_attribute('special_number',new_special) else # No need to lock in this case write_attribute('special_number',some_other_number) end end

    Read the article

  • [C++] Run codes for only 60 times each second.

    - by djzmo
    Hello there, I'm creating a directx application that relies on the system time (because it must be accurate), and I need to run lines of code for 60 times each second in the background (in a thread created by boost::thread). that's equal to 60 FPS (frame per second), but without depending on the main application frame rate. //................. void frameThread() { // I want to run codes inside this loop for *exactly* 60 times in a second. // In other words, every 16.67 (1000/60) milliseconds for(;;) { DoWork(); //......... } } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { initialize(); //.....stuffs boost::thread framethread(frameThread); //...... } Is there a way to do this? Any kind of help would be appreciated :)

    Read the article

  • iphone - Images (slide show) and audio snychronization

    - by Qaiser
    I have 20 images and some audio. I would like to show a single image at a time and change the images at (unequal) intervals. For example, I want to show image 1 for 1.44 seconds and image 2 for 1.67 seconds and so on. Can someone suggest how to go about doing this please? What I have seen are examples that show how to setup an array of images with one field that denotes total time. This causes the images to show for an equal amount of time (each). ... and that not what I am looking for ...

    Read the article

  • Caveates on the html options of <pre> <code> [on hold]

    - by user2935199
    Over at html syntax to display literal string i asked about displaying a literal. When i tried : http://sdrv.ms/1bEsPWz (as the posted sample will not display, i need to show a picture, as i don't have 10 xxx, i can't insert a picture, I am only left with a skydrive reference) In english, the and syntax was tried but it failed to show all content inside the block. It only showed the "is equal to - pre sample " part. I thought - did not care what was inside ? Can some explain how to make a truely literal block display ? I have my reasons why i don't want to have the " syntax in the html. Thanks

    Read the article

  • Makefile: expand dependencies

    - by Danyel
    First off, the title is very generic because there are just tons of ways of how to possibly solve this. However, I'm looking for a clean and neat way. Situation: I have two equal object files foo.o and foo-pi.o, the latter of which is position-independent (compiled with -fPIC). Both depend on foo.h and bar.h. Problem: How do I, without code duplication, declare dependency of all foo*.o to bar.h? Solutions so far: $(shell bash -c 'echo -ne foo{-pi,}.o'}: bar.h $(addsuffix .o, $(addprefix fo, o-pi o)): bar.h The first solution is not portable on systems that don't support bash, the second is a dirty solution since I could not figure out how to use empty strings in addprefix.

    Read the article

  • C# String builder, displaying data nicely spaced out.

    - by Sef
    Hello, I am wondering how exactly can i order my date nicely in a stringbuilder? Meaning something equal to ("{0,2}", ....) to space the data nicely out. I do not want to use consolewrites of any kind, so the class can be re-used in a form, console code etc... Currently i am using " " for the spacing, but in overall it does not give a proper display. (it messed up when i have numbers with more then 1 digit) public override string ToString() { StringBuilder builder = new StringBuilder(); foreach (int value in tabel) { builder.Append(value); // should have something similiar to ("{0,2}", ....) builder.Append(" "); // should have something similiar to ("{0,2}", ....) } builder.Append("(top:"); builder.Append(top); builder.Append(")"); return builder.ToString(); }/*ToString*/ Regards.

    Read the article

  • In the context of an asp.net website, what's the most efficient way to check whether a User has acce

    - by scaramouch
    I have a webpage that you pass in an id parameter (via a querystring), which it then uses to fetch data from a database. Typically, a user would navigate to this page from another page that lists only those records that the user has access to. However, if they go directly to the page by typing in the URL in the Address Bar, they can effectively view any record they like. Eg. If they were to type something like http://localhost/TestSite/ClientAdmin/ManageLocation.aspx?LocationID=5 into their Address Bar, they can access the database record with the LocationID equal to five - even though they shouldn't have access to it. Now, I could solve this by doing a database check every time the page is loaded to see whether the current user has access to the record they're trying to view. However this doesn't seem very efficient given that in most cases a user won't be trying to access a record that isn't theirs. Does anyone have a better suggestion? Thanks.

    Read the article

  • comparing int values in android

    - by user1183066
    I am making an android game that is checking the players health value when this method is being runned. But however, it's not reacting. It doesn't do anything, when the value is less than 3, it shouldn't do anything, but when it is equal to 3, it should run a method. Please help me and thanks SO much in advance! This is the code that i am using: private void checkLivesLeftValue() { if (livesLeftValue == 3) { //Message to display: "You lost! onMethod(); } else { livesLeftValue = livesLeftValue + 1; } }

    Read the article

  • How to know if the argument that is passed to the function is a class, union or enum in c++?

    - by Narek
    I want to define an operator<< for all enums, to cout the value and print that it is an enum like this: code: enum AnyEnum{A,B,C}; AnyEnum enm = A; cout << enm <<endl; output: This is an enum which has a value equal to 0 I know a way of doing this with Boost library by using is_enum struct. But I don’t understand how it works. So that's why, in general, I am interested how to identify if the veriable is a class type, union type or an enum (in compile time).

    Read the article

  • Will PHP script running on top of Apache be faster than C# stand alloun programm doing same thing (s

    - by Ole Jak
    I mean PHP scripts on Apache are oriented for many users to use tham at the same time. So will 1000 requests which came at the (relativly) same time be fully responsed faster than C# .Net programm perfoming algorithm 1000 times in while loop? So we input same data, we perform same algorithm, which is written in a wary same way (respecting language diferencis ofcourse), outputing same data (lat us say saving it to file for tham to be relativly equal) Who will be faster on some 1000 times of performing O(NN) algorithm, in which case (if it is possible) one will owerrun another?

    Read the article

  • send javaScript variable to php variable

    - by mrbunyrabit
    First i thought that i had to convert javascript to php, but then i found out that cant because of server and client side executions. So now I simply want to send ONE variable <script type="text/javascript"> function scriptvariable() { var theContents = "the variable"; } </script> to a php variable <?php $phpvariable ?> That function in the javascript executes when lets say i click on a button. Now i have Nooo idea how to get that phpvariable Equal to the javascript one so i can use that phpvariable to look up stuff in my Database. I know i can add it to my url or some thing, and just refresh the page.. But id like to do it with AJAX as further in my webpage i might have to use this Ajax method.. So is there an easy way to do this without having to dump pages of code on my page to do one simple thing?

    Read the article

  • How can i find and take in my local machine any file in remote machine?

    - by programmerist
    i try to write any codes. For example i have 2 machine: A computer, B computer. My local machine A computer. i also have sql data base . with "select * from" i can learn PatientID. ForExample PatientID :123456. But this patient's pictures file in B Computer.Picture File Name is equal to PatientID. B Computer ports is open for me. I can listen B Computer's 51124 port. How can i get Files from B machine via Port(But this files includes pics ). But this is Windows App. But i don't know files path. My program must find it automatically

    Read the article

  • What key concepts and nuances in C++ you know?

    - by Narek
    What kind of key points and concepts should a person know from C++ (and from programming in general) to be considered that he/she possesses C++ (and programming, in general) skills good. e.g. //Even if sizeof(T) may not be equal to 1, this code steps over array elements T v[]; for(T *p = v ; *p != 0 ; p++) cout<<*p<<endl; P.S. I hope by exchanging this info we will help each other to know C++ and programing thechnics better by doing explicit our notion that we got from practice.

    Read the article

  • Design cache mechanism

    - by Delashmate
    Hi All, I got assignment to write design for cache mechanism, This is my first time writing a design document, Our program display images for doctors, and we wan't to reduce the parsing time of the images So we want to save the parsed data in advance (in files or inside database) Currently I have several design key ideas Handle locks - each shared data structure should be handled, also files Test - add test to verify the data from the cache is equal to the data from the files To decouple the connection to the database- not to call directly to the database Cleanup mechanisem- to delete old files if the cahce directory exceed configurable threshold Support config file Support performance tool in the feature I will also add class diagram, data flow charts, and workflow What do you think I should add to the key ideas? Do you know good link to atricales about design? Thanks in advance, Dan

    Read the article

  • NSDate compare is false?

    - by user1280535
    i compare 2 NSDates which are the same and i get false result. i cant show how i get this dates because its too long , but i can show what i do : NSLog(@"this date is:%@ , and date we check to equality is:%@",thisDate,dateToFind); if([thisDate isEqualToDate:dateToFind] ) { NSLog(@"equal date!"); // not printed! } the NSLog show me this : this date is:2012-09-13 14:23:54 +0000 , and date we check to equality is:2012-09-13 14:23:54 +0000 he doesnt print the NSLog . why ?

    Read the article

  • C++ MFC how to compare LPCTSTR in a if statement?

    - by user1078510
    I have the following code: LPCTSTR strPermission = Method(); if (strPermission == L"0") { return true; } else { return false; } While debugging I can see that strPermission does equal "0", yet when I compare it like in the if statement it always returns false. The only thing I can think of is that it is comparing the memory address of the variable rather than the variable value. How do I compare strPermission to L"0" so that it would return true if strPermission equals "0". Thank you!

    Read the article

  • How do stop form posting to mysql if database contains a specific ID?

    - by user342391
    I have a form that I am using to post data to mysql. Before submitting the form I want to check the database and see if there are any fields in the column 'customerid' that equal 'userid' and if so not to post the form. Basically, I am trying to limit my users from posting more than once. Users will be able to login to my system and make ONE post. They will be able to delete and modify their post but are only limited to one post. How would I do this??? Code so far: <?php include '../login/dbc.php'; page_protect(); $userid = $_SESSION['user_id']; $sql="INSERT INTO content (customerid, weburl, title, description) VALUES ('$_POST[userid]','$_POST[webaddress]','$_POST[pagetitle]','$_POST[pagedescription]')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 record added"; ?>

    Read the article

  • Check for element equality in an animation function.

    - by Zardoz
    I have the the below code and would expect that in the first pass of the fadeTo function "yes" would be printed as those first two console logs tell me it is the same element. But it doesn't recognize them as equal. What do I miss here? var tds = self.element.find("td:nth-child(" + (columnIndex + 1) + ")"); tds.fadeTo(options.columnFadeOutTime, 0, function() { window.console.log(tds.first()); window.console.log($(this)); if ($(this) == tds.first()) { window.console.log("yes"); } else { window.console.log("no"); } }

    Read the article

  • previousFailureCount always stays on 0 (zero)

    - by itai alter
    Hello all, First of all, I'd like to thank the good people who helped me around on this site. Thanks. I'm trying to detect a failed authentication attempt in my app... I'm using the didReceiveAuthenticationChallenge method, and the checking if [challenge previousFailureCount] is equal to 0. The problem is that it's always stays on zero, even if the username and password that I send with the credentials are incorrect. I couldn't find any info about this kind of issue, any help will be much appreciated. Thanks!

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >