Search Results

Search found 8367 results on 335 pages for 'temporal difference'.

Page 30/335 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • what is the exact difference between PHP static class and singleton class

    - by Saif Bechan
    I have always used a Singleton class for a registry object in PHP. As all Singleton classes I think the main method looks like this: class registry { public static function singleton() { if( !isset( self::$instance ) ) { self::$instance = new registry(); } return self::$instance; } public function doSomething() { echo 'something'; } } So whenever I need something of the registry class I use a function like this: registry::singleton()->doSomethine(); Now I do not understand what the difference is between creating just a normal static function. Will it create a new object if I just use a normal static class. class registry { public static function doSomething() { echo 'something'; } } Now I can just use: registry::doSomethine(); Can someone explain to me what the function is of the singleton class. I really do not understand this.

    Read the article

  • Difference between static const char* and const char*.

    - by Will MacDonagh
    Could someone please explain the difference in how the 2 snippets of code are handled below? They definitely compile to different assembly code, but I'm trying to understand how the code might act differently. I understand that string literals are thrown into read only memory and are effectively static, but how does that differ from the explicit static below? struct Obj1 { void Foo() { const char* str( "hello" ); } }; and struct Obj2 { void Bar() { static const char* str( "hello" ); } };

    Read the article

  • What is the difference between remote procedure call and web service

    - by xiao
    Is there any clear definition about RPC and Web Service? A quick wikipedia search shows: RPC: Remote procedure call (RPC) is an Inter-process communication technology that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction. Web Service: Web services are typically application programming interfaces (API) or web APIs that are accessed via Hypertext Transfer Protocol and executed on a remote system hosting the requested services. Web services tend to fall into one of two camps: Big Web Services[1] and RESTful Web Services. I am not quite clear what the real difference between the two things. It seems that one thing could belongs to RPC and is kind of web service at the same time. Is Web Service a higher level representation of RPC?

    Read the article

  • What is the difference between declaring data attributes inside or outside __init__

    - by user1898540
    I'm trying to get my head around OOP in Python and I'm a bit confused when it comes to declare variables within a class. Should I declare them inside of the __init__ procedure or outside it? What's the difference? The following code works just fine: # Declaring variables within __init__ class MyClass: def __init__(self): country = "" city = "" def information(self): print "Hi! I'm from %s, (%s)"%(self.city,self.country) me = MyClass() me.country = "Spain" me.city = "Barcelona" me.information() But declaring the variables outside of the __init procedure also works: # Declaring variables outside of __init__ class MyClass: country = "" city = "" def information(self): print "Hi! I'm from %s, (%s)"%(self.city,self.country) me = MyClass() me.country = "Spain" me.city = "Barcelona" me.information()

    Read the article

  • What is the difference between if ($this-> _hasParam('name') and if($this->_getParam('name')), Ze

    - by Linto davis
    I want to check in zend, whether a posted form value 'name' contains a value.For this i have used the following code one method if ($this->_getPatram('name') != null ) { echo 'field name contains value'; } else { echo 'field name contains no value'; } second method if ($this->_hasParam('name')) { echo 'field name contains value'; } else { echo 'field name contains no value'; } output , when submitting the form with the 'name' field contains no value in first method field name contains no value (result is correct) in second method field name contains value (result is wrong) So what is the difference between these two ? _hasParam and _getParam

    Read the article

  • What is the difference between IEditableObject and IRevertibleChangeTracking?

    - by open-collar
    What is the difference between IEditableObject and IRevertibleChangeTracking (both from the System.ComponentModel namespace)? It looks as if the first supports explicit transaction whilst the second is more implicit - but the net result is the same. How should I go about implementing this in code? At the moment I do nothing in BeginEdit and call RejectChanges and AcceptChanges in EndEdit and CancelEdit respectively. My problem is that this will also accept the changes made prior to the BeginEdit. Is that really what MS wanted or am I trying to implement two mutually exclusive interfaces?

    Read the article

  • What's the difference between PATH_NOT_FOUND and NAME_NOT_FOUND

    - by Benjamin
    In Win32 layer, we often meet ERROR_PATH_NOT_FOUND, ERROR_NAME_NOT_FOUND. When does WinAPI(eg CreateFileW, RemoveDirectoryW) return these values? And What's the difference? If I write a file system driver, when do I set STATUS_OBJECT_PATH_NOT_FOUND or STATUS_OBJECT_NAME_NOT_FOUND? I'm so confused. Is there anyone who can explain clearly? Or are there any documents explain this? I couldn't find them. Thanks in advance.

    Read the article

  • Difference in techniques for setting a stubbed method's return value with Rhino Mocks

    - by CRice
    What is the main difference between these following two ways to give a method some fake implementation? I was using the second way fine in one test but in another test the behaviour can not be achieved unless I go with the first way. These are set up via: IMembershipService service = test.Stub<IMembershipService>(); so (the first), using (test.Record()) //test is MockRepository instance { service.GetUser("dummyName"); LastCall.Return(new LoginUser()); } vs (the second). service.Stub(r => r.GetUser("dummyName")).Return(new LoginUser()); Edit The problem is that the second technique returns null in the test, when I expect it to return a new LoginUser. The first technique behaves as expected by returning a new LoginUser. All other test code used in both cases is identical.

    Read the article

  • Difference between redirecting to a page and coming to the same page after pressing back button

    - by Mac
    Actually i have a page in which i am not using cache by using this code HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); HttpContext.Current.Response.Cache.SetValidUntilExpires(false); HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.Cache.SetNoStore(); now i want to know is there any difference between coming to this page using a proper link or coming back using browser back button or is there any way to detect this.

    Read the article

  • How to difference sockaddr_in struct from same subnetwork and different IP/users

    - by user1428926
    I am developing a gaming server using the Winsock2 API from Windows, just for now until porting it to Linux. The main problem I have found is that I don't know how to differentiate gaming clients that come from the same router/network. Let´s imagine 2 gamers that are in the same network going to the Internet through the same router IP and port with, for example IP 220.100.100.100 and port 5000, how can my C/C++ server differentiate both TCP connections and know that they are two different gamers? Can I find any difference in the sockaddr_in struct that returns the socket when accept(...) returns ??

    Read the article

  • difference in using virtual and not using virtual

    - by numerical25
    In C++, whether you choose to use virtual or not, you can still override the base class function. The following compiles just fine... class Enemy { public: void SelectAnimation(); void RunAI(); void Interact() { cout<<"Hi I am a regular Enemy"; } private: int m_iHitPoints; }; class Boss : public Enemy { public: void Interact() { cout<<"Hi I am a evil Boss"; } }; So my question is what is the difference in using or not using the virtual function. And what is the disadvantage.

    Read the article

  • getting values by time difference in SQL

    - by Maestro1024
    I want to get the difference of two values within a time frame. so I have a table like this Data Table TimeStamp DataValue 2010-06-01 21 2010-06-03 33 2010-06-05 44 So I want to first get all data over the last month which I can do with something like. ([TimeStamp] < GETDATE()-0 and ([TimeStamp] > GETDATE()-31) But I want to see how much value added on over the course of the month. So it started at 21 and went to 44. So I would expect this example to to return 23 (as in 44-21). How would I build a query like this?

    Read the article

  • C++ difference of keywords 'typename' and 'class' in templates

    - by Mat
    For templates I have seen both declarations: template < typename T > And: template < class T > What's the difference? And what exactly do those keywords mean in the following example (taken from the German Wikipedia article about templates)? template < template < typename, typename > class Container, typename Type > class Example { Container< Type, std::allocator < Type > > baz; };

    Read the article

  • In Blackberry's Application class what is the difference between hasEventThread() and isHandlingEven

    - by Eric Sniff
    In Blackberry's Application class what is the difference between hasEventThread() and isHandlingEvents(). I'm just curious, because I have only found hasEventThread useful. From BB's docs for Applicaiton: public boolean hasEventThread() Determines if this application has entered the event dispatcher. Returns: True if this application has entered the event dispatcher (i.e. has invoked Application.enterEventDispatcher()); otherwise, false. isHandlingEvents public final boolean isHandlingEvents() Determines if this application has entered the event dispatch loop. Returns: True if the application has entered the event dispatch loop; otherwise, false. My only guess is that isHandlingEvents most happen sometime after hasEventThread. But is that really that useful?

    Read the article

  • What are the difference between Cygwin on windows and real UNIX environment

    - by Tarun
    Hi, I am a C/C++ developer. I have never done C++ programming on UNIX, I have done only on windows. I want to practice C++ on Unix. (Because all big companies ask C++ with Unix). I have a laptop on which i do not want to install any other OS (because i have installed very important software on it and i don't have setups) So, I searched and found CygWin which is Unix emulator for Windows. I am thinking to practice C++ on this. Please help me, how can I practice/learn in more close to the environment(Unix Environment) that is used in Big companies like IBM. What will be the difference between Unix and Cygwin?

    Read the article

  • Difference between jQuery click, bind, live, delegate & trigger functions( with example)

    - by I Like PHP
    Hello All, I know there are a lot of questions similar to this, but I want to know clear difference between all of these jQuery functions together on this page with an example, so that it will be very helpful for me to understand the mechanism of all of these functions. I have also read the reference on jQuery main site, but there is no comparison between these: $().click(fn) $().bind('click',fn) $().live('click',fn) $().delegate('td','click',fn) $().trigger('click') // UPDATED Please do not refer any link if there is a part of question belong to that. Please describe how all four function exactly works in different manner, and which should be preferred in which situation. Note: If there are any other function with same functionality/mechanism , then please share. Thanks a lot. Update i have also seen $(trigger) function? is this works similar to above four function ?

    Read the article

  • The difference between delete and delete [] in C++

    - by Ilya Melamed
    I've written a class that contains two pointers, one is char* color_ and one in vertexesset* vertex_ where vertexesset is a class I created. In the destractor I've written at start delete [] color_; delete [] vertex_; When It came to the destructor it gave me a segmentation fault. Then I changed the destructor to: delete [] color_; delete vertex_; And now it works fine. What is the difference between the two?

    Read the article

  • What is the difference between release and nil

    - by HML
    I am new to iPhone SDK. I want to know that what is difference between release and nil. Yes, basic, I know. But my application crashing every time when I use release. If I use nil then its working fine. Here is code : cellName=[cellArray objectAtIndex:5]; UITextField *txtFieldTown = (UITextField *)[cellName.contentView viewWithTag:2]; StrTown=txtFieldTown.text; [txtFieldTown release]; txtFieldTown = nil; Here, if release line is removed, then its working fine. I know that I am not allocating txtFieldTown,so I should not worry but its retain count is 4. So I am trying to decrease that. Please help me.Thanking you...

    Read the article

  • How do I find the cause for a huge difference in performance between two identical Ubuntu servers?

    - by the.duckman
    I am running two Dell R410 servers in the same rack of a data center. Both have the same hardware configuration, run Ubuntu 10.4, have the same packages installed and run the same Java web servers. No other load. One of them is 20-30% faster than the other, very consistently. I used dstat to figure out, if there are more context switches, IO, swapping or anything, but I see no reason for the difference. With the same workload, (no swapping, virtually no IO), the cpu usage and load is higher on one server. So the difference appears to be mainly CPU bound, but while a simple cpu benchmark using sysbench (with all other load turned off) did yield a difference, it was only 6%. So maybe it is not only CPU but also memory performance. I tried to figure out if the BIOS settings differ in some parameter, did a dump using dmidecode, but that yielded no difference. I compared /proc/cpuinfo, no difference. I compared the output of cpufreq-info, no difference. I am lost. What can I do, to figure out, what is going on?

    Read the article

  • Difference between DataTable.Load() and DataTable = dataSet.Tables[];

    - by subbu
    Hi All , I have a doubt i use the following piece of code get data from a SQLlite data base and Load it into a data table "SQLiteConnection cnn = new SQLiteConnection("Data Source=" + path); cnn.Open(); SQLiteCommand mycommand = new SQLiteCommand(cnn); string sql = "select Company,Phone,Email,Address,City,State,Zip,Country,Fax,Web from RecordsTable"; mycommand.CommandText = sql; SQLiteDataReader reader = mycommand.ExecuteReader(); dt.Load(reader); reader.Close(); cnn.Close();" In some cases when I try to load it Gives me "Failed to enable constraints exception" But when I tried this below given piece of code for same table and same set of records it worked "SQLiteConnection ObjConnection = new SQLiteConnection("Data Source=" + path); SQLiteCommand ObjCommand = new SQLiteCommand("select Company,Phone,Email,Address,City,State,Zip,Country,Fax,Web from RecordsTable", ObjConnection); ObjCommand.CommandType = CommandType.Text; SQLiteDataAdapter ObjDataAdapter = new SQLiteDataAdapter(ObjCommand); DataSet dataSet = new DataSet(); ObjDataAdapter.Fill(dataSet, "RecordsTable"); dt = dataSet.Tables["RecordsTable"]; " Can any one tell me what is the difference between two

    Read the article

  • What is the difference between the Lego Mindstorms 1.0 and 2.0

    - by Gavimoss
    I am thinking about buying a mindstorms kit (I don't currently own one but I have used 1.0 at university) and I am a bit unsure as to the benefits of 2.0 over 1.0. I have seen other posts on the subject all saying generally 2.0 is better but I have some more specific questions about this that I can't seem to find any answers on. Apart from the different lego pieces and sensors you get with the 2.0 kit, is there any difference between a 1.0 nxt brick and 2.0 nxt brick? From what I can determine from other sources, they are the same except for the firmware installed. Am I right in saying I could buy a 1.0 kit and install the same firmware that comes with the 2.0 kit and the bricks would be the same or is the 1.0 brick not compatible with the 2.0 firmware??? Also, I plan to use a different programming language like c or java so I need to install specific firmware for that anyway like librcx or lejos right? So if using c or java as opposed to the provided lego coding methods it doesn't matter if I am using 1.0 or 2.0 (except for the lego pieces in the kit) am I right? In a nutshell, assuming I am using librcx or lejos and I don't care about the sensors and lego pieces included, is there any benefit to buying a 2.0 kit over the 1.0 kit? Thanks in advance

    Read the article

  • Difference between GL10 and GLES10 on Android

    - by kayahr
    The GLSurfaceView.Renderer interface of the Android SDK gives me a GL interface as parameter which has the type GL10. This interface is implemented by some private internal jni wrapper class. But there is also the class GLES10 where all the GL methods are available as static methods. Is there an important difference between them? So what if I ignore the gl parameter of onDrawFrame and instead use the static methods of GLES10 everywhere? Here is an example. Instead of doing this: void onDrawFrame(GL10 gl) { drawSomething(gl); } void drawSomething(GL10 gl) { gl.glLoadIdentity(); ... } I could do this: void onDrawFrame(GL10 gl) { drawSomething(); } void drawSomething() { GLES10.glLoadIdentity(); ... } The advantage is that I don't have to pass the GL context to all called methods. But even it it works (And it works, I tried it) I wonder if there are any disadvantages and reasons to NOT do it like that.

    Read the article

  • Odd difference between Python 2.5 and Python 2.6 on MacOS 10.6 using ctypes and libproc proc_pidinfo

    - by cemasoniv
    I'm trying to determine the current working directory of a process given its PID. The command-line utility lsof does something similar. Here's the source to the python script: import ctypes from ctypes import util import sys PROC_PIDVNODEPATHINFO = 9 proc = ctypes.cdll.LoadLibrary(util.find_library("libproc")) print(proc.proc_pidinfo) class vnode_info(ctypes.Structure): _fields_ = [('data', ctypes.c_ubyte * 152)] class vnode_info_path(ctypes.Structure): _fields_ = [('vip_vi', vnode_info), ('vip_path', ctypes.c_char * 1024)] class proc_vnodepathinfo(ctypes.Structure): _fields_ = [('pvi_cdir', vnode_info_path), ('pvi_rdir', vnode_info_path)] inst = proc_vnodepathinfo() pid = int(sys.argv[1]) ret = proc.proc_pidinfo( pid, PROC_PIDVNODEPATHINFO, 0, ctypes.byref(inst), ctypes.sizeof(inst) ) print(ret, inst.pvi_cdir.vip_path) However, even though this script behaves as expected on Python 2.6, it does not work in Python 2.5: host:dir user$ sudo /usr/bin/python2.6 script.py 2698 <_FuncPtr object at 0x100419ae0> (2352, '/') host:dir user$ sudo /usr/bin/python2.5 script.py 2698 <_FuncPtr object at 0x19fdc0> (0, '') (PID 2698 is "Activity Monitor.app"). Note the different return values. Since this program strongly based on ctypes, I can't imagine any difference in Python itself that would cause this. The same behavior (as Python 2.5) occurs with my self-built Python 3.2. I'm not sure what versioning information I can give to help track down the weirdness -- or even come up with a solution for 2.5 -- but here's some stuff: host:dir user$ otool -L /usr/bin/python2.6 /usr/bin/python2.6: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0) host:dir user$ otool -L /usr/bin/python2.5 /usr/bin/python2.5 (architecture i386): /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0) /usr/bin/python2.5 (architecture ppc7400): /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0) host:dir user$ uname -a Darwin host.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 Thanks to anyone that has a clue about what's going on here:)

    Read the article

  • What is the difference: LoadUserProfile -vs- RegOpenCurrentUser

    - by Will5801
    These two APIs are very similar but it is unclear what the differences are and when each should be used (Except that LoadUserProfile is specified for use with CreateProcessAsUser which I am not using. I am simply impersonating for hive accesss). LoadUserProfile http://msdn.microsoft.com/en-us/library/bb762281(VS.85).aspx RegOpenCurrentUser http://msdn.microsoft.com/en-us/library/ms724894(VS.85).aspx According to the Services & the Registry article: http://msdn.microsoft.com/en-us/library/ms685145(VS.85).aspx we should use RegOpenCurrentUser when impersonating. But what does/should RegOpenCurrentUser do if the user profile is roaming - should it load it? As far as I can tell from these docs, both APIs provide a handle to the HKEY_CURRENT_USER for the user the thread is impersonating. Therefore, they both "load" the hive i.e. lock it as a database file and give a handle to it for registry APIs. It might seem that LoadUserProfile loads the user profile in the same way as the User does when he/she logs on, whereas RegOpenCurrentUser does not - is this correct? What is the fundamental difference (if any) in how these two APIs mount the hive? What are the implications and differences (if any) between what happens IF A user logs-on or logs-off while each of these impersonated handles is already in use? A user is already logged-on when each matching close function (RegCloseKey and UnloadUserProfile) is called?

    Read the article

  • Strange C++ performance difference?

    - by STingRaySC
    I just stumbled upon a change that seems to have counterintuitive performance ramifications. Can anyone provide a possible explanation for this behavior? Original code: for (int i = 0; i < ct; ++i) { // do some stuff... int iFreq = getFreq(i); double dFreq = iFreq; if (iFreq != 0) { // do some stuff with iFreq... // do some calculations with dFreq... } } While cleaning up this code during a "performance pass," I decided to move the definition of dFreq inside the if block, as it was only used inside the if. There are several calculations involving dFreq so I didn't eliminate it entirely as it does save the cost of multiple run-time conversions from int to double. I expected no performance difference, or if any at all, a negligible improvement. However, the perfomance decreased by nearly 10%. I have measured this many times, and this is indeed the only change I've made. The code snippet shown above executes inside a couple other loops. I get very consistent timings across runs and can definitely confirm that the change I'm describing decreases performance by ~10%. I would expect performance to increase because the int to double conversion would only occur when iFreq != 0. Chnaged code: for (int i = 0; i < ct; ++i) { // do some stuff... int iFreq = getFreq(i); if (iFreq != 0) { // do some stuff with iFreq... double dFreq = iFreq; // do some stuff with dFreq... } } Can anyone explain this? I am using VC++ 9.0 with /O2. I just want to understand what I'm not accounting for here.

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >