Search Results

Search found 2028 results on 82 pages for 'constant'.

Page 13/82 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Any example on how to implement the new VerificationController and the KNOWN_TRANSACTIONS_KEY constant?

    - by Carles Estevadeordal
    I've been looking at implementing the new VerificationController to verify in-App-Purchases: http://developer.apple.com/library/ios/#releasenotes/StoreKit/IAP_ReceiptValidation/_index.html And I wonder if there is some example anywhere en how to validate a transaction, since it seems that the - (BOOL)verifyPurchase:(SKPaymentTransaction *)transaction; is not enough and it has to be implemented internally to verify the purchase when the data form the server is received. Another question is if anyone has a clue on what the KNOWN_TRANSACTIONS_KEY is and how to fill it, is it just the product id of the purchase?

    Read the article

  • How this is code is getting compiled even though we are using a constant which is defined later?

    - by GK
    In the following code DEFAULT_CACHE_SIZE is declared later, but it is used to assign a value to String variable before than that, so was curious how is it possible? public class Test { public String getName() { return this.name; } public int getCacheSize() { return this.cacheSize; } public synchronized void setCacheSize(int size) { this.cacheSize = size; System.out.println("Cache size now " + this.cacheSize); } private final String name = "Reginald"; private int cacheSize = DEFAULT_CACHE_SIZE; private static final int DEFAULT_CACHE_SIZE = 200; }

    Read the article

  • Why do bind1st and bind2nd require constant function objects?

    - by rlbond
    So, I was writing a C++ program which would allow me to take control of the entire world. I was all done writing the final translation unit, but I got an error: error C3848: expression having type 'const `anonymous-namespace'::ElementAccumulator<T,BinaryFunction>' would lose some const-volatile qualifiers in order to call 'void `anonymous-namespace'::ElementAccumulator<T,BinaryFunction>::operator ()(const point::Point &,const int &)' with [ T=SideCounter, BinaryFunction=std::plus<int> ] c:\program files (x86)\microsoft visual studio 9.0\vc\include\functional(324) : while compiling class template member function 'void std::binder2nd<_Fn2>::operator ()(point::Point &) const' with [ _Fn2=`anonymous-namespace'::ElementAccumulator<SideCounter,std::plus<int>> ] c:\users\****\documents\visual studio 2008\projects\TAKE_OVER_THE_WORLD\grid_divider.cpp(361) : see reference to class template instantiation 'std::binder2nd<_Fn2>' being compiled with [ _Fn2=`anonymous-namespace'::ElementAccumulator<SideCounter,std::plus<int>> ] I looked in the specifications of binder2nd and there it was: it took a const AdaptibleBinaryFunction. So, not a big deal, I thought. I just used boost::bind instead, right? Wrong! Now my take-over-the-world program takes too long to compile (bind is used inside a template which is instantiated quite a lot)! At this rate, my nemesis is going to take over the world first! I can't let that happen -- he uses Java! So can someone tell me why this design decision was made? It seems like an odd decision. I guess I'll have to make some of the elements of my class mutable for now...

    Read the article

  • Constant CMS Session Expiry On 1&1 Cloud Server?

    - by leen3o
    I have a couple of 1&1's 'Dynamic Cloud Servers' and running Win2008R2 and they are setup as web servers, I have a number of Umbraco CMS installs on them and they have been running fine for over a year. On Saturday on BOTH servers, a very strange thing happened - As soon as I login to the CMS/Umbraco admin I am logged out with about 5 seconds? It's as if my session expires the moment I login? I have checked everything I can as I'm not really a server admin, and everything seems to be exactly as it was last week? Like I say this has happened EXACTLY the same time (Saturday) on TWO different servers? I'm just looking for ideas of what I should be looking for? Also the front end of the sites seem fine... Its only the backend when I login. I have gone to 1&1 about this, and as usual they have washed their hands saying its nothing to do with them - When I am certain it is. How can this happen on two different servers, and affect the same sites in exactly the same way? Any help, tips, things to try would be greatly appreciated.

    Read the article

  • Is there a standard literal constant that I can use instead of "utf-8" in C# (.Net 3.5)?

    - by Hamish Grubijan
    Hi, I would like to find a better way to do this: XmlNode nodeXML = xmlDoc.AppendChild( xmlDoc.CreateXmlDeclaration( "1.0", "utf-8", String.Empty) ); I do not want to think about "utf-8" vs "UTF-8" vs "UTF8" vs "utf8" as I type code. I would like to make my code less prone to typos. I am sure that some standard library has declatred "utf-8" as a const / readonly string. How can I find it? Also, what about "1.0"? I am assuming that major XML versions have been enumerated somewhere as well. Thanks!

    Read the article

  • Why only the constant expression can be used as case expression in Switch statement?

    - by sinec
    Hi, what is bothering me is that I can't found an info regarding the question from the title. I found that assembly form the Switch-case statement is compiled into bunch of (MS VC 2008 compiler) cmp and je calls: 0041250C mov eax,dword ptr [i] 0041250F mov dword ptr [ebp-100h],eax 00412515 cmp dword ptr [ebp-100h],1 0041251C je wmain+52h (412532h) 0041251E cmp dword ptr [ebp-100h],2 00412525 je wmain+5Bh (41253Bh) 00412527 cmp dword ptr [ebp-100h],3 0041252E je wmain+64h (412544h) 00412530 jmp wmain+6Bh (41254Bh) where for above code will in case that if condition (i) is equal to 2, jump to address 41253Bh and do execution form there (at 41253Bh starts the code for 'case 2:' block) What I don't understand is why in case that,for instance, function is used as 'case expression', why first function couldn't be evaluated and then its result compared with the condition? Am I missing something? Thank you in advance

    Read the article

  • How can I use the compile time constant __LINE__ in a string?

    - by John
    I can use __LINE__ as a method parameter just fine, but I would like an easy way to use it in a function that uses strings. For instance say I have this: 11 string myTest() 12 { 13 if(!testCondition) 14 return logError("testcondition failed"); 15 } And I want the result of the function to be: "myTest line 14: testcondition failed" How can I write logError? Does it have to be some monstrosity of a macro?

    Read the article

  • Should constant contructor aguments be passed by reference or value?

    - by Mike
    When const values are passed to an object construct should they be passed by reference or value? If you pass by value and the arguments are immediately fed to initializes are two copies being made? Is this something that the compiler will automatically take care of. I have noticed that all textbook examples of constructors and intitializers pass by value but this seems inefficient to me. class Point { public: int x; int y; Point(const int _x, const int _y) : x(_x), y(_y) {} }; int main() { const int a = 1, b = 2; Point p(a,b); Point q(3,5); cout << p.x << "," << p.y << endl; cout << q.x << "," << q.y << endl; } vs. class Point { public: int x; int y; Point(const int& _x, const int& _y) : x(_x), y(_y) {} }; Both compile and do the same thing but which is correct?

    Read the article

  • Does a c/c++ compiler optimize constant divisions by power-of-two value into shifts?

    - by porgarmingduod
    Question says it all. Does anyone know if the following... size_t div(size_t value) { const size_t x = 64; return value / x; } ...is optimized into? size_t div(size_t value) { return value >> 6; } Do compilers do this? (My interest lies in GCC). Are there situations where it does and others where it doesn't? I would really like to know, because every time I write a division that could be optimized like this I spend some mental energy wondering about whether precious nothings of a second is wasted doing a division where a shift would suffice.

    Read the article

  • How can I declare constant strings for use in both an unmanaged C++ dll and in a C# application?

    - by Surfbutler
    Curently I'm passing my const string values up from my C++ into my C# at startup via a callback, but I'm wondering if there's a way of defining them in a C++ header file that I can then also refer to in C#. I already do this with enums as they are easy. I include a file in both my C++ library project (via a .h file with a pragma once at the top), and my C# application (as a link): #if _NET public #endif enum ETestData { First, Second }; I know it sounds messy, but it works :) But...how can I do the same with string constants - I'm initially thinking the syntax is too different between the platforms, but maybe there's a way? Using clever syntax involving #if _NET, #defines etc? Using resource files? Using a C++/CLI library? Any ideas?

    Read the article

  • Member variable in C++ class that is always constant for all objects of that class?

    - by user1799323
    I'm constructing a class where I have three member variables that I want to always be the same value NO MATTER WHAT. I have class foo{ public: double var_1, var_2, var_3; double x=1, y=2, z=3; [functions go here] }; that gave me an error since I can't initialize a variable like that. But I want x, y and z to always be 1, 2 and 3 respectively. I tried defining them outside the class but that doesn't work since I want them to be member variables of the class. How do I do this?

    Read the article

  • Is it possible for a parent to use a child's constant or static variables from inside a static metho

    - by ryeguy
    Below is an example of what I'm trying to do. The parent can't access any of the child's variables. It doesn't matter what technique I use (static or constants), I just need some kind of functionality like this. class ParentClass { public static function staticFunc() { //both of these will throw a (static|const) not defined error echo self::$myStatic; echo self::MY_CONSTANT; } } class ChildClass extends ParentClass { const MY_CONSTANT = 1; public static $myStatic = 2; } ChildClass::staticFunc();

    Read the article

  • Error while installing a .net setup executable locally

    - by Constant Learner
    Hello I have created a setup for my windows application in .NET 2008 After building the same i have the .msi and setup.exe files in my release folder. The problem i am facing is : I can install the application using the msi installer files from the shared network folder. But when i copy the installer locally and tried to install it, i get the following error: Error reading file.Please Try again. Anybody having any ideas if there are any properties to set in the installer project. Regards Constant Learner

    Read the article

  • Display page numbers in a excel sheet generated using C#.NET

    - by constant learner
    Hello Stackers Does anyone have an idea on how to include or input the page numbers in the excel sheet generated using C# code. I use the libraries available in Microsoft.Office.Interop.Excel to generate the file. However by default in the output i cannot see the page numbers. I know to enable this via excel options (View -- Header and Footer ...) but i want to automate this via C#. Is this possible, if yes kindly share the snippet for the same. Thanks Constant Learner

    Read the article

  • The Benefits of Constants

    - by onaclov2000
    I understand one of the big deals about constants is that you don't have to go through and update code where that constant is used all over the place. Thats great, but let's say you don't explicitly declare it as a constant. What benefit(s) exist(s) to take a variable that HAPPENS to actually not be changed and make it a constant, will this save on processing, and/or size of code...etc? Basically I have a program that the compiler is saying that a particular variable is not changed and thus can be declared a constant, I just wanted to know what the benefit to adding the constant qualifier to it would be, if it makes no difference then making that change adds no value and thus no point wasting time (this same scenario occurs in more then one place) going back and "fixing" all these variables. Thank you, onaclov

    Read the article

  • Installing bitarray in Python 2.6 on Windows

    - by John Fouhy
    I would like to install bitarray in Windows running python 2.6. I have mingw32 installed, and I have C:\Python26\Lib\distutils\distutils.cfg set to: [build] compiler = mingw32 If I type, in a cmd.exe window: C:\Documents and Settings\john\My Documents\bitarray-0.3.5>python setup.py install I get: [normal python messages skipped] C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python26\include -IC:\Python26\PC -c bitarray/_bitarray.c -o build\temp.win32-2.6\Release\bitarray\_bitarray.o bitarray/_bitarray.c:2197: error: initializer element is not constant bitarray/_bitarray.c:2197: error: (near initialization for `BitarrayIter_Type.tp_getattro') bitarray/_bitarray.c:2206: error: initializer element is not constant bitarray/_bitarray.c:2206: error: (near initialization for `BitarrayIter_Type.tp_iter') bitarray/_bitarray.c:2232: error: initializer element is not constant bitarray/_bitarray.c:2232: error: (near initialization for `Bitarraytype.tp_getattro') bitarray/_bitarray.c:2253: error: initializer element is not constant bitarray/_bitarray.c:2253: error: (near initialization for `Bitarraytype.tp_alloc') bitarray/_bitarray.c:2255: error: initializer element is not constant bitarray/_bitarray.c:2255: error: (near initialization for `Bitarraytype.tp_free') error: command 'gcc' failed with exit status 1 Can anyone help?

    Read the article

  • Calculate posterior distribution of unknown mis-classification with PRTools in MATLAB

    - by Samuel Lampa
    I'm using the PRTools MATLAB library to train some classifiers, generating test data and testing the classifiers. I have the following details: N: Total # of test examples k: # of mis-classification for each classifier and class I want to do: Calculate and plot Bayesian posterior distributions of the unknown probabilities of mis-classification (denoted q), that is, as probability density functions over q itself (so, P(q) will be plotted over q, from 0 to 1). I have that (math formulae, not matlab code!): P(q|k,N) = Posterior * Prior / Normalization constant = P(k|q,N) * P(q|N) / P(k|N) The prior is set to 1, so I only need to calculate the posterior and normalization constant. I know that the posterior can be expressed as (where B(N,k) is the binomial coefficient): P(k|q,N) = B(N,k) * q^k * (1-q)^(N-k) ... so the Normalization constant is simply an integral of the posterior above, from 0 to 1: P(k|N) = B(N,k) * integralFromZeroToOne( q^k * (1-q)^(N-k) ) (The Binomial coefficient ( B(N,k) ) can be omitted thoughappears in both the posterior and normalization constant, so it can be omitted.) Now, I've heard that the integral for the normalization constant should be able to be calculated as a series ... something like: k!(N-k)! / (N+1)! Is that correct? (I have some lecture notes from with this series, but can't figure out if it is for the normalization constant integral, or for the posterior distribution of mis-classification (q)) Also, hints are welcome as how to practically calculate this? (factorials are easily creating truncation errors right?) ... AND, how to practically calculate the final plot (the posterior distribution over q, from 0 to 1).

    Read the article

  • Beware of const members

    - by nmarun
    I happened to learn a new thing about const today and how one needs to be careful with its usage. Let’s say I have a third-party assembly ‘ConstVsReadonlyLib’ with a class named ConstSideEffect.cs: 1: public class ConstSideEffect 2: { 3: public static readonly int StartValue = 10; 4: public const int EndValue = 20; 5: } In my project, I reference the above assembly as follows: 1: static void Main(string[] args) 2: { 3: for (int i = ConstSideEffect.StartValue; i < ConstSideEffect.EndValue; i++) 4: { 5: Console.WriteLine(i); 6: } 7: Console.ReadLine(); 8: } You’ll see values 10 through 19 as expected. Now, let’s say I receive a new version of the ConstVsReadonlyLib. 1: public class ConstSideEffect 2: { 3: public static readonly int StartValue = 5; 4: public const int EndValue = 30; 5: } If I just drop this new assembly in the bin folder and run the application, without rebuilding my console application, my thinking was that the output would be from 5 to 29. Of course I was wrong… if not you’d not be reading this blog. The actual output is from 5 through 19. The reason is due to the behavior of const and readonly members. To begin with, const is the compile-time constant and readonly is a runtime constant. Next, when you compile the code, a compile-time constant member is replaced with the value of the constant in the code. But, the IL generated when you reference a read-only constant, references the readonly variable, not its value. So, the IL version of the Main method, after compilation actually looks something like: 1: static void Main(string[] args) 2: { 3: for (int i = ConstSideEffect.StartValue; i < 20; i++) 4: { 5: Console.WriteLine(i); 6: } 7: Console.ReadLine(); 8: } I’m no expert with this IL thingi, but when I look at the disassembled code of the exe file (using IL Disassembler), I see the following: I see our readonly member still being referenced by the variable name (ConstVsReadonlyLib.ConstSideEffect::StartValue) in line 0001. Then there’s the Console.WriteLine in line 000b and finally, see the value of 20 in line 0017. This, I’m pretty sure is our const member being replaced by its value which marks the upper bound of the ‘for’ loop. Now you know why the output was from 5 through 19. This definitely is a side-effect of having const members and one needs to be aware of it. While we’re here, I’d like to add a few other points about const and readonly members: const is slightly faster, but is less flexible readonly cannot be declared within a method scope const can be used only on primitive types (numbers and strings) Just wanted to share this before going to bed!

    Read the article

  • Implication of variable context switching time

    - by Rob
    Hi, I know that constant switching time of the Linux scheduler was a big achievement. I was just asking myself the question what would be the implication of a non-constant switching time. The only obvious reason I can think of is real-time systems where we have to meet deadlines. There it is obviously no ideal if the switching time is "random". Are there any other good reasons that favour constant switching times? Many thanks, Rob

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >