Search Results

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

Page 19/82 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Noise Estimation / Noise Measurement in Image

    - by Drazick
    Hello. I want to estimate the noise in an image. Let's assume the model of an Image + White Noise. Now I want to estimate the Noise Variance. My method is to calculate the Local Variance (3*3 up to 21*21 Blocks) of the image and then find areas where the Local Variance is fairly constant (By calculating the Local Variance of the Local Variance Matrix). I assume those areas are "Flat" hence the Variance is almost "Pure" noise. Yet I don't get constant results. Is there a better way? Thanks.

    Read the article

  • Theory of Computation - Showing that a language is regular..

    - by Tony
    I'm reviewing some notes for my course on Theory of Computation and I'm a little bit stuck on showing the following statement and I was hoping somebody could help me out with an explanation :) Let A be a regular language. The language B = {ab | a exists in A and b does not exist in A*} Why is B a regular language? Some points are obvious to me. If b is simply a constant string, this is trivial. Since we know a is in A and b is a string, regular languages are closed under union, so unioning the language that accepts these two strings is obviously regular. I'm not sure that b is constant, however. Maybe it is, and if so, then this isn't really an issue. I'm having a hard time making sense of it. Thanks!

    Read the article

  • Problem with constants in application.ini after PHP upgrade

    - by Marek
    Hi, I've upgraded PHP on my local dev system to version 5.3.0, and there is some problem when I use constants in application.ini - following manual http://framework.zend.com/manual/en/learning.quickstart.create-project.html I have: bootstrap.path = APPLICATION_PATH "/Bootstrap.php" which leads to: Warning: require_once(APPLICATION_PATH/Bootstrap.php) [function.require-once]: failed to open stream: No such file or directory in Zend\Application.php on line 320 any ideas? SOLVED: Actually name of my constant was _DIR_APPLICATION (code above was copied from ZF manual) - problem lies in this underscore at the begining - it seems that parse_ini_file() in PHP 5.3.0 doesn't replace constants named like this. Short test - you need two files: test.ini bootstrap.path = _DIR_APPLICATION "/Bootstrap.php" bootstrap.class = "Bootstrap" and test.php <?php define('_DIR_APPLICATION', 'test'); $data = parse_ini_file('test.ini'); print_r($data); try to run, then change constant name to 'DIR_APPLICATION' (in both files) and compare result ;)

    Read the article

  • Are there any syntax errors in the code snippet here?

    - by Mask
    typedef union YYSTYPE { int64_t iConst; // constant value float fConst; // constant value int iAttrLocator; // attribute locator (rowitem for int/float; offset+size for bits) int iFunc; // function id int iNode; // node index } YYSTYPE; It looks valid to me,but the cdt reports the following for the line int64_t iConst;: Multiple markers at this line: - syntax error before "int64_t" - no semicolon at the end of structure or union There are two files that defines int64_t,one is within the project itself(sphinxstd.h),the other is the MinGW/include/stdint.h,is it caused by this conflict?

    Read the article

  • i have problem with include file

    - by user309381
    //this is intializer.php defined('DS')? null :define('DS',DIRECTORY_SEPARATOR); defined('SITE_ROOT')? null : define('SITE_ROOT',DS.'C:',DS.'wamp',DS.'www',DS.'photo_gallery'); defined('LIB_PATH')?null:define('LIB_PATH',SITE_ROOT.DS.'includes'); require_once(LIB_PATH.DS.'datainfo.php'); require_once(LIB_PATH.DS.'function.php'); require_once(LIB_PATH.DS.'session.php'); require_once(LIB_PATH.DS.'database.php'); require_once(LIB_PATH.DS.'user.php'); //this is other file where i call php file // ERROR Use of undefined constant LIB_PATH - assumed 'LIB_PATH' in //C:\wamp\www\photo_gallery\includes\database.php on //Notice: Use of undefined constant DS - assumed 'DS' in //C:\wamp\www\photo_gallery\includes\database.php on include(LIB_PATH.DS."database.php") ?

    Read the article

  • mysql gem for snow leopard

    - by Will
    I had trouble with the gem at first but got it to work when I installed the 64-bit MySQL and reinsatlled the gem with arch flags. So it work in rails. The error I used to get was uninitialized constant MysqlCompat::MysqlRes but that is now gone :) However in Xcode when I run a RubyCocoa project I still get the old error of uninitialized constant MysqlCompat::MysqlRes Does anyone know why this may be? Is it because the gdb is 64-bit? How can it work in Rails but not in RubyCocoa? A little debugging shows that it fails to load mysql_api.bundle /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle, 9): no suitable image found. Did find: (LoadError) /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'

    Read the article

  • Generate dynamic html

    - by Fred
    Hi all, to export some data i want to be able to generate an html output. I have some constant content to output, like html headers and footers. My question is how to deal with that ? Do I have to embed some template (in a ressource file) and parse it to make it dynamic ? Do I store my static content in some constant (is there a 255 char limit?) and append them while generating the dynamic content ? Do you have some hints, useful links, or best practices to share? Thanks

    Read the article

  • Precompile Lambda Expression Tree conversions as constants?

    - by Nathan
    It is fairly common to take an Expression tree, and convert it to some other form, such as a string representation (for example this question and this question, and I suspect Linq2Sql does something similar). In many cases, perhaps even most cases, the Expression tree conversion will always be the same, i.e. if I have a function public string GenerateSomeSql(Expression<Func<TResult, TProperty>> expression) then any call with the same argument will always return the same result for example: GenerateSomeSql(x => x.Age) //suppose this will always return "select Age from Person" GenerateSomeSql(x => x.Ssn) //suppose this will always return "select Ssn from Person" So, in essence, the function call with a particular argument is really just a constant, except time is wasted at runtime re-computing it continuously. Assuming, for the sake of argument, that the conversion was sufficiently complex to cause a noticeable performance hit, is there any way to pre-compile the function call into an actual constant?

    Read the article

  • Making my XNA sprite jump properly

    - by Matthew Morgan
    I have been having great trouble getting my sprite to jump. So far I have a section of code which with a single tap of "W" will send the sprite in a constant velocity upwards. I need to be able to make my sprite come back down to the ground a certain time or height after begining the jump. There is also a constant pull of velocity 2 on the sprite to simulate some kind of gravity. // Walking = true when there is collision detected between the sprite and ground if (Walking == true) if (keystate.IsKeyDown(Keys.W)) { Jumping = true; } if (Jumping == true) { spritePosition.Y -= 10; } Any ideas and help would be appreciated but I'd prefer a modified version of my code posted if at all possible.

    Read the article

  • F# return type coercion

    - by Alex
    Hi, In F# I have a function that returns System.Linq.Expression instances: and System.Object with member this.ToExpression() = match this with | :? System.Int32 -> Expression.Constant(this) :> Expression | :? System.Boolean -> Expression.Constant(this) :> Expression | :? Tml.Runtime.Seq as s -> s.ToExpression() | _ -> failwith "bad expression" If I omit the type coercions on the return values F# will infer the return type of the function to ConstantExpression. My first thought was to explicitly mark the return type as being : #Expression, but that didn't work. Is there a more elegant way of doing this that doesn't involve manually casting return types to the most generic type? Thanks.

    Read the article

  • Is it possible to load a new Applescript scripting addition whilst my script is running?

    - by jkp
    According to various documents and discussions this used to be possible: you needed a block something like this in your script: try tell me to «event ascrgdut» end try tell me to doTheFunkyNewThing The event corresponds to hidden event with the undocumented C constant kUpdateAEUT (see here for the declaration of the constant) which should force the scripting additions to be reloaded. I've written a scripting addition and played around with this method of getting it to load but I have had no luck at all. I can only make it load by starting my script after the extension has been installed. Does anyone know if there is a way to make this work? Has this functionality been disabled in more recent OS X releases? I'm using OS X 10.6.2 FWIW.

    Read the article

  • Unreachable code detected by using const variables

    - by Anton Roth
    I have following code: private const FlyCapture2Managed.PixelFormat f7PF = FlyCapture2Managed.PixelFormat.PixelFormatMono16; public PGRCamera(ExamForm input, bool red, int flags, int drawWidth, int drawHeight) { if (f7PF == FlyCapture2Managed.PixelFormat.PixelFormatMono8) { bpp = 8; // unreachable warning } else if (f7PF == FlyCapture2Managed.PixelFormat.PixelFormatMono16){ bpp = 16; } else { MessageBox.Show("Camera misconfigured"); // unreachable warning } } I understand that this code is unreachable, but I don't want that message to appear, since it's a configuration on compilation which just needs a change in the constant to test different settings, and the bits per pixel (bpp) change depending on the pixel format. Is there a good way to have just one variable being constant, deriving the other from it, but not resulting in an unreachable code warning? Note that I need both values, on start of the camera it needs to be configured to the proper Pixel Format, and my image understanding code needs to know how many bits the image is in. So, is there a good workaround, or do I just live with this warning?

    Read the article

  • TemplateBinding and additional string in Silverlight

    - by aaginor
    Hi folks, In my Silverlight 3 application, I created a custom Tooltip, that is shown when the mouse is over a part of a Pie-Chart. The displayed values are set via TemplateBinding: <ToolTipService.ToolTip> <StackPanel> <ContentControl Content="{TemplateBinding IndependentValue}" FontWeight="Bold" /> <ContentControl Content="{TemplateBinding FormattedDependentValue}"/> <ContentControl Content="{TemplateBinding FormattedRatio}"/> </StackPanel> </ToolTipService.ToolTip> The tooltip shows the title of the pie-slice, the value that the size of the slice is based on and the percentage regarding the whole pie: MyTitel 9 12% Now, I want to add a constant string to the value, to show the following: MyTitel 9 items 12% the string 'items' shall be added to the displayed number. Is there a way to add the constant string to the Content-Property of the ContentControl? (I have no influence on the binded value FormattedDependentValue) Thanks in advance, Frank

    Read the article

  • c++ queue template

    - by Dalton Conley
    ALright, pardon my messy code please. Below is my queue class. #include <iostream> using namespace std; #ifndef QUEUE #define QUEUE /*---------------------------------------------------------------------------- Student Class # Methods # Student() // default constructor Student(string, int) // constructor display() // out puts a student # Data Members # Name // string name Id // int id ----------------------------------------------------------------------------*/ class Student { public: Student() { } Student(string iname, int iid) { name = iname; id = iid; } void display(ostream &out) const { out << "Student Name: " << name << "\tStudent Id: " << id << "\tAddress: " << this << endl; } private: string name; int id; }; // define a typedef of a pointer to a student. typedef Student * StudentPointer; template <typename T> class Queue { public: /*------------------------------------------------------------------------ Queue Default Constructor Preconditions: none Postconditions: assigns default values for front and back to 0 description: constructs a default empty Queue. ------------------------------------------------------------------------*/ Queue() : myFront(0), myBack(0) {} /*------------------------------------------------------------------------ Copy Constructor Preconditions: requres a reference to a value for which you are copying Postconditions: assigns a copy to the parent Queue. description: Copys a queue and assigns it to the parent Queue. ------------------------------------------------------------------------*/ Queue(const T & q) { myFront = myBack = 0; if(!q.empty()) { // copy the first node myFront = myBack = new Node(q.front()); NodePointer qPtr = q.myFront->next; while(qPtr != NULL) { myBack->next = new Node(qPtr->data); myBack = myBack->next; qPtr = qPtr->next; } } } /*------------------------------------------------------------------------ Destructor Preconditions: none Postconditions: deallocates the dynamic memory for the Queue description: deletes the memory stored for a Queue. ------------------------------------------------------------------------*/ ~Queue() { NodePointer prev = myFront, ptr; while(prev != NULL) { ptr = prev->next; delete prev; prev = ptr; } } /*------------------------------------------------------------------------ Empty() Preconditions: none Postconditions: returns a boolean value. description: returns true/false based on if the queue is empty or full. ------------------------------------------------------------------------*/ bool empty() const { return (myFront == NULL); } /*------------------------------------------------------------------------ Enqueue Preconditions: requires a constant reference Postconditions: allocates memory and appends a value at the end of a queue description: ------------------------------------------------------------------------*/ void enqueue(const T & value) { NodePointer newNodePtr = new Node(value); if(empty()) { myFront = myBack = newNodePtr; newNodePtr->next = NULL; } else { myBack->next = newNodePtr; myBack = newNodePtr; newNodePtr->next = NULL; } } /*------------------------------------------------------------------------ Display Preconditions: requires a reference of type ostream Postconditions: returns the ostream value (for chaining) description: outputs the contents of a queue. ------------------------------------------------------------------------*/ void display(ostream & out) const { NodePointer ptr; ptr = myFront; while(ptr != NULL) { out << ptr->data << " "; ptr = ptr->next; } out << endl; } /*------------------------------------------------------------------------ Front Preconditions: none Postconditions: returns a value of type T description: returns the first value in the parent Queue. ------------------------------------------------------------------------*/ T front() const { if ( !empty() ) return (myFront->data); else { cerr << "*** Queue is empty -- returning garbage value ***\n"; T * temp = new(T); T garbage = * temp; delete temp; return garbage; } } /*------------------------------------------------------------------------ Dequeue Preconditions: none Postconditions: removes the first value in a queue ------------------------------------------------------------------------*/ void dequeue() { if ( !empty() ) { NodePointer ptr = myFront; myFront = myFront->next; delete ptr; if(myFront == NULL) myBack = NULL; } else { cerr << "*** Queue is empty -- " "can't remove a value ***\n"; exit(1); } } /*------------------------------------------------------------------------ pverloaded = operator Preconditions: requires a constant reference Postconditions: returns a const type T description: this allows assigning of queues to queues ------------------------------------------------------------------------*/ Queue<T> & operator=(const T &q) { // make sure we arent reassigning ourself // e.g. thisQueue = thisQueue. if(this != &q) { this->~Queue(); if(q.empty()) { myFront = myBack = NULL; } else { myFront = myBack = new Node(q.front()); NodePointer qPtr = q.myFront->next; while(qPtr != NULL) { myBack->next = new Node(qPtr->data); myBack = myBack->next; qPtr = qPtr->next; } } } return *this; } private: class Node { public: T data; Node * next; Node(T value, Node * first = 0) : data(value), next(first) {} }; typedef Node * NodePointer; NodePointer myFront, myBack, queueSize; }; /*------------------------------------------------------------------------ join Preconditions: requires 2 queue values Postconditions: appends queue2 to the end of queue1 description: this function joins 2 queues into 1. ------------------------------------------------------------------------*/ template <typename T> Queue<T> join(Queue<T> q1, Queue<T> q2) { Queue<T> q1Copy(q1), q2Copy(q2); Queue<T> jQueue; while(!q1Copy.empty()) { jQueue.enqueue(q1Copy.front()); q1Copy.dequeue(); } while(!q2Copy.empty()) { jQueue.enqueue(q2Copy.front()); q2Copy.dequeue(); } cout << jQueue << endl; return jQueue; } /*---------------------------------------------------------------------------- Overloaded << operator Preconditions: requires a constant reference and a Queue of type T Postconditions: returns the ostream (for chaining) description: this function is overloaded for outputing a queue with << ----------------------------------------------------------------------------*/ template <typename T> ostream & operator<<(ostream &out, Queue<T> &s) { s.display(out); return out; } /*---------------------------------------------------------------------------- Overloaded << operator Preconditions: requires a constant reference and a reference of type Student Postconditions: none description: this function is overloaded for outputing an object of type Student. ----------------------------------------------------------------------------*/ ostream & operator<<(ostream &out, Student &s) { s.display(out); } /*---------------------------------------------------------------------------- Overloaded << operator Preconditions: requires a constant reference and a reference of a pointer to a Student object. Postconditions: none description: this function is overloaded for outputing pointers to Students ----------------------------------------------------------------------------*/ ostream & operator<<(ostream &out, StudentPointer &s) { s->display(out); } #endif Now I'm having some issues with it. For one, when I add 0 to a queue and then I output the queue like so.. Queue<double> qdub; qdub.enqueue(0); cout << qdub << endl; That works, it will output 0. But for example, if I modify that queue in any way.. like.. assign it to a different queue.. Queue<double> qdub1; Queue<double> qdub2; qdub1.enqueue(0; qdub2 = qdub1; cout << qdub2 << endl; It will give me weird values for 0 like.. 7.86914e-316. Help on this would be much appreciated!

    Read the article

  • Cakephp Localization, Cannot Change language when DEFAULT_LANGUAGE is set

    - by ion
    I am confused :) I'm using the p18n component in cakephp found here: http://www.palivoda.eu/2008/04/i18n-in-cakephp-12-database-content-translation-part-2/ This component requires me to set in core.php the following constant: define("DEFAULT_LANGUAGE", 'eng') However when this is set I cannot change the language using: Configure::write('Config.language', 'eng'); At the moment, into my knowledge, the only way to change the locale of my static content is the use of the Configure::write. But for the dynamic content to change through the use of the p28n component I must have the DEFINE_LANGUAGE constant set to a value. This is all very confusing. Any help will be much appreciated.

    Read the article

  • Boost signals and passing class method

    - by Ockonal
    Hello, I've defined some signal: typedef boost::signals2::signal<void (int temp)> SomeSig; typedef SomeSig::slot_type SomeSigType; I have some class: class SomeClass { SomeClass() { SomeSig.connect(&SomeClass::doMethod); } void doMethod(const SomeSig &slot); }; And got a lot of errors: error: ‘BOOST_PP_ENUM_SHIFTED_PARAMS_M’ was not declared in this scope error: ‘T’ was not declared in this scope error: a function call cannot appear in a constant-expression error: a function call cannot appear in a constant-expression error: template argument 1 is invalid error: ‘BOOST_SIGNALS2_MISC_STATEMENT’ has not been declared error: expected identifier before ‘~’ token error: expected ‘)’ before ‘~’ token error: expected ‘;’ before ‘~’ token

    Read the article

  • WPF: Turning off animations, data binding temporarly for invisible objects?;)

    - by TomTom
    I have a window that contains a tab control - basically multiple sheets with visualizations on them. The visualtizations are: possible very resource intensive during rendering relying on constant data updates to update their underlying models Obviously only one sheet can be visible every time ;) Anyone knows of a good way to turn off all visualization, animations, data binding for a control / panel and it's contained controls? If I would find a way to do that, I could simply turn off all the invisible sheets and reactivate them as needed. The models must be kept running - some of the visual stuff is pretty complex and really relies on constant data updates, and recalculating it when someone switches tabs would be too hard.

    Read the article

  • Can I mix compile time string comparison with MPL templates?

    - by Negative Zero
    I got this compile time string comparison from another thread using constexpr and C++11 (http://stackoverflow.com/questions/5721813/compile-time-assert-for-string-equality). It works with constant strings like "OK" constexpr bool isequal(char const *one, char const *two) { return (*one && *two) ? (*one == *two && isequal(one + 1, two + 1)) : (!*one && !*two); } I am trying to use it in the following context: static_assert(isequal(boost::mpl::c_str<boost::mpl::string<'ak'>>::value, "ak"), "should not fail"); But it gives me an compilation error of static_assert expression is not an constant integral expression. Can I do this?

    Read the article

  • O(log N) == O(1) - Why not?

    - by phoku
    Whenever I consider algorithms/data structures I tend to replace the log(N) parts by constants. Oh, I know log(N) diverges - but does it matter in real world applications? log(infinity) < 100 for all practical purposes. I am really curious for real world examples where this doesn't hold. To clarify: I understand O(f(N)) I am curious about real world examples where the asymptotic behaviour matters more than the constants of the actual performance. If log(N) can be replaced by a constant it still can be replaced by a constant in O( N log N). This question is for the sake of (a) entertainment and (b) to gather arguments to use if I run (again) into a controversy about the performance of a design.

    Read the article

  • How to distinguish properties from constants if they both use PascalCasing for naming?

    - by Gishu
    As stated in the framework design guidelines and the WWW in general, the current guideline is to name your constants like this LastTemplateIndex as opposed to LAST_TEMPLATE_INDEX With the PascalCasing approach, how do you differentiate between a Property and a Constant. ErrorCodes.ServerDown is fine. But what about private constants within your class ? I use quite a lot of them for naming magic numbers.. or for expected values in my unit tests and so on. The ALL_CAPS style helps me know that it is a constant . _testApp.SelectTemplate(LAST_TEMPLATE_INDEX); *Disclosure: I have been using the SCREAMING_CAPS style for a while for constants + I find it more readable than squishedTogetherPascalCasedName. It actually STANDS_OUT in a block of text*

    Read the article

  • Need help for this syntax: "#define LEDs (char *) 0x0003010"

    - by Noge
    I'm doing programming of a softcore processor, Nios II from Altera, below is the code in one of the tutorial, I manage to get the code working by testing it on the hardware (DE2 board), however, I could not understand the code. #define Switches (volatile char *) 0x0003000 #define LEDs (char *) 0x0003010 void main() { while (1) *LEDs = *Switches; } What I know about #define is that, it is either used to define a constant, or a macro, but why in the above code, there are casting like, (char *) 0x0003010, in #define? why the 2 constants, Switches and LEDs act like a variable instead of a constant? Thanks in advance !

    Read the article

  • Draw and move animation from xml in android

    - by Muahammad Yousuf Saif
    What I want to do: I want to draw image from xml and then animate it from xml. this image should move with constant speed anywhere on our screen. Now the problem is: I can draw and animate image from xml but i can not move this image with constant speed. I am using two xml files: One for animate and other for moving. XML for animation: android:duration="200"/ XML file for move: <translate android:interpolator="@android:anim/linear_interpolator" android:fromXDelta="2%" android:toXDelta="400%" android:fromYDelta="2%" android:toYDelta="800%"/> Activity.java file code in onCreate() method: ImageView rocketImage = (ImageView) findViewById(R.id.rocket_image); Animation hyperspaceJump = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump); rocketImage.setBackgroundResource(R.drawable.rocket_thrust); AnimationDrawable rocketAnimation = (AnimationDrawable) rocketImage.getBackground(); rocketAnimation.start(); rocketImage.startAnimation(hyperspaceJump);

    Read the article

  • Need help with Drupal bulk mail low open rate for legitimate mailing list

    - by Ron Williams
    I've moved from constant contact to Drupal Simplenews/Mimemail/SMTP. Previously the open rate was around 50% for constant contact, but now it's 4-5% for the same list via the mentioned setup. Mail is getting out from the server, but it's having an issue anyway. Here's the setup: -The e-mail list consists of approximately 80,000 addresses which is queued at 10,000 e-mails per cron run (which runs hourly). -The server is a Dual Core2Quad machine with 2GB of RAM. -When mail is being sent, the mail queue will usually go up to ~1000 at the beginning of the hour before reducing to ~250 by the time the next cron occurs. -Newsletter is themed to display custom style for newsletter on send -Newsletter is received by some, but appears to be bounced by many (based on low open rate_ -I've added SPF, domain keys, and a PTR record to the DNS -Server hostname (listed in ptr) is different from hosted domain -Very low spam number via Spamassassin -IP and domain are not blacklisted -Mail goes out via SMTP module on delivery. Any ideas?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >