Search Results

Search found 5171 results on 207 pages for 'whatever'.

Page 11/207 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How do I resolve this scope issue in VB .NET?

    - by froadie
    I have a code structure something like this: For row = 1 To numRows Dim arrayIndex As Integer = 0 For column As Integer = bucketStartColumn To bucketEndColumn ' whatever code arrayIndex = arrayIndex + 1 Next Next Dim arrayIndex As Integer = 0 For column As Integer = bucketStartColumn To bucketEndColumn ' whatever code arrayIndex = arrayIndex + 1 Next Not exactly the code, so I don't really need suggestions about refactoring, but my problem is this - with this code I get a compiler error for the first Dim arrayIndex As Integer = 0 - "Variable 'arrayIndex' hides a variable in an enclosing block." As far as I can tell, arrayIndex is local to the first for loop and shouldn't exist by the time we reach the second loop. If I try to change the second declaration of arrayIndex to arrayIndex = 0, I get the error "Name 'arrayIndex' is not declared", as I expected. So is it visible, or not? Does this have something to do with the Dim keyword? Any suggestions of how to get around this, other than naming the second index variable something else?

    Read the article

  • Why won't my control accept keyboard input?

    - by Mason Wheeler
    I've built a custom control that I'm trying to send input to. It will accept mouse input and report MouseDown, MouseMove and MouseUp correctly, but for whatever reason, it won't accept keyboard input. When I click on it, it doesn't receive focus, and any keys I press get interpreted by whatever control had the focus already. This is probably something really simple. The first place I thought to look was in the ControlStyle property, but the only thing I can see in the helpfile about keyboard input is csNoStdEvents, which disables it, and my control doesn't have that. So what do I need to do to make it so my control can receive input focus?

    Read the article

  • C# - How to implement multiple comparers for an IComparable<T> class?

    - by Gary Willoughby
    I have a class that implements IComparable. public class MyClass : IComparable<MyClass> { public int CompareTo(MyClass c) { return this.whatever.CompareTo(c.whatever); } etc.. } I then can call the sort method of a generic list of my class List<MyClass> c = new List<MyClass>(); //Add stuff, etc. c.Sort(); and have the list sorted according to my comparer. How do i specify further comparers to sort my collection different ways according to the other properties of MyClass in order to let users sort my collection in a number of different ways?

    Read the article

  • Why can't I read session variables

    - by Marty Goetz
    I have a c# .net web application. I create session variables but when I try to read them after I leave the page that they were created from I can't. Created on page 1 Session["UserName"] = "WhatEver"; Then I do Response.Redirect("~/whatever.aspx"); and try to read to read the session variable in the Page_Load method of the new page string userName = Session["UserName"].ToString(); I receive "Object reference not set to an instance of an object." Why am I receiving this error and what can I do to fix the problem? I would greatly appreciate any help anyone can give me.

    Read the article

  • Getting values from datagrid view column to list<>

    - by EvanRyan
    My main form in my application has a datagrid view that can have 1 to many user selected inputs. Column 8 of this grid is for the user to input "time in minutes." I have a separate class where I have built a timer that counts down from whatever time the user specifies down to 0. What I need is to create a series of alarms that go off as the timer counts down that are triggered by the user input values in column 8 of my datagrid. I think the best way to do this is to build a list< from the values in the datagrid. I for whatever reason can't quite figure out how to get the values from the datagrid in to a list< in my other class. Hopefully I explained in a way that makes sense.

    Read the article

  • jquery: if ul has li with certain classname?

    - by mathiregister
    hi guys, i wonder how i can query if a ul has a first-child li with a certain classname? like… <ul> <li>list element 1</li> <li>list element 2</li> </ul> <ul> <li class="whatever">list element 1</li> <li>list element 2</li> </ul> i want to query if ul has a child with classname whatever - do something! is that even possible? thank you

    Read the article

  • An exception to the "only one implementation" rule ?

    - by ereOn
    While I was reading the accepted answer of this question, I had the following question: Typically, methods are defined in header files (.hpp or whatever), and implementation in source files (.cpp or whatever). One of the main reasons it is bad practice to ever include a "source file" (#include <source_file.cpp>) is that its methods implementation would then be duplicated, resulting in linking errors. When one writes: #ifndef BRITNEYSPEARS_HPP #define BRITNEYSPEARS_HPP class BritneySpears { public: BritneySpears() {}; // Here the constructor has implementation. }; #endif /* BRITNEYSPEARS_HPP */ He is giving the implementation of the constructor (here an "empty" implementation, but still). But why then including this header file multiple times (aka. on different source files) will not generate a "duplicate definition" error at link time ?

    Read the article

  • What's the deal with all of the abstract stuff?

    - by JustVenting
    I see a lot of talk about MVVM, MVC, Design Patterns etc... You know, some guy has a blog, and he spent the last six months learning about one these things and desiging a program centered around that concept and then he goes on and on about it like its better than sliced bread. I read all of this crap and I wonder, whatever happened to simple logical programming? Not self-absorbed huge frameworks of design patterns and mvc and whatever else you can think of... just simple linear programming, perhaps a few classes to encapsulate things here and there.

    Read the article

  • Operations inside Rails I18n locales' strings

    - by Cristobal Viedma
    Hi, I am trying to put operations inside the locales to adapt to different languages. For example, in English a billion is 1,000,000,000, however in Spanish a billion is 1,000,000,000,000 so I would like to be able to have the following: en: billion: "You have %{money} billions" es: billion: "Tienes %{money/1000.0} billones" In order to be able to write: I18n.t :billion, :money => whatever And be right for whatever language. However, it seems that I cannot put operations inside the locales' strings. Any hint on how should I be doing this? Maybe my approach is just wrong "philosophically" talking? Thanks all!

    Read the article

  • Windows Macro + Hot Key - Paste Without Formatting

    - by JasonStoltz
    Not sure if this appropriate to put as a question or not? It's sort of a scripting question I think. Just down vote me if not :p Basically, what I'm looking for is a way to push a windows hotkey and have whatever text is in the clipboard be stripped of formatting. An example of what the macro could do: I push (whatever hotkey combo here) open notepad.exe Paste to notepad from clipboard Select all text in notepad Copy/Cut all text from notepad Close notepad I'm just wondering if someone has done something like this before, or knows how it could be accomplished. I think this could be a huge time-saver for almost anyone. I find myself doing this all the time when cutting and pasting between different office applications, etc.

    Read the article

  • How do game trainers change a address in memory thats dynamic?

    - by GameTrainersWTF
    Lets assume i am a game and i have a global int* that contains my health. A game trainers job is to modify this value to whatever in order to achieve god mode. I've looked up tutorials on game trainers to understand how they work, and the general idea is to use a memory scanner to try and find the address of a certain value. Then modify this address by injecting a dll or whatever. But i made a simple program with a global int* and its address changes every time i run the app, so i don't get how game trainers can hard code these addresses? Or is my example wrong? What am i missing?

    Read the article

  • Is referencing a selector faster in jquery than actually calling the selector? if so, how much does it make a difference?

    - by anthonypliu
    Hi, I have this code: $(preview-button).click(...) $(preview-button).slide(...) $(preview-button).whatever(...) Is it a better practice to do this: var preview-button = $(preview-button); preview-button.click(...); preview-button.click(...); preview-button).slide(...); preview-button.whatever(...); It probably would be better practice to do this for the sake of keeping code clean and modular, BUT does it make a difference performance wise? Does one take longer to process than the other? Thanks guys.

    Read the article

  • OOP PHP simple question

    - by Tristan
    Hello, I'm new to OOP in PHP, is that to seems correct ? class whatever { Function Maths() { $this->sql->query($requete); $i = 0; while($val = mysql_fetch_array($this)) { $tab[i][average] = $val['average']; $tab[i][randomData] = $val['sum']; $i=$i+1; } return $tab; } I want to access the data contained in the array $foo = new whatever(); $foo->Maths(); for ($i, $i <= endOfTheArray; i++) { echo Maths->tab[i][average]; echo Maths->tab[i][randomData]; } Thank you ;)

    Read the article

  • Language neutral plugin architectures

    - by Mmarquee
    I am looking at extending an existing application through the use of a plugin architecture. The application id written in Delphi, but I want to be able to implement various plugins in whatever language is best of the job. Currently we have skills in Delphi, C# and Java, and would like to be able to implement a plugin in whatever language is required. Does anyone know of an example system that can be used to implement this ? I am assuming that I could standardise on a particular COM interface and anything that implements that interface could be a plugin. Does anyone have any pointers ? Thanks

    Read the article

  • Adapting non-iterable containers to be iterated via custom templatized iterator

    - by DAldridge
    I have some classes, which for various reasons out of scope of this discussion, I cannot modify (irrelevant implementation details omitted): class Foo { /* ... irrelevant public interface ... */ }; class Bar { public: Foo& get_foo(size_t index) { /* whatever */ } size_t size_foo() { /* whatever */ } }; (There are many similar 'Foo' and 'Bar' classes I'm dealing with, and it's all generated code from elsewhere and stuff I don't want to subclass, etc.) [Edit: clarification - although there are many similar 'Foo' and 'Bar' classes, it is guaranteed that each "outer" class will have the getter and size methods. Only the getter method name and return type will differ for each "outer", based on whatever it's "inner" contained type is. So, if I have Baz which contains Quux instances, there will be Quux& Baz::get_quux(size_t index), and size_t Baz::size_quux().] Given the design of the Bar class, you cannot easily use it in STL algorithms (e.g. for_each, find_if, etc.), and must do imperative loops rather than taking a functional approach (reasons why I prefer the latter is also out of scope for this discussion): Bar b; size_t numFoo = b.size_foo(); for (int fooIdx = 0; fooIdx < numFoo; ++fooIdx) { Foo& f = b.get_foo(fooIdx); /* ... do stuff with 'f' ... */ } So... I've never created a custom iterator, and after reading various questions/answers on S.O. about iterator_traits and the like, I came up with this (currently half-baked) "solution": First, the custom iterator mechanism (NOTE: all uses of 'function' and 'bind' are from std::tr1 in MSVC9): // Iterator mechanism... template <typename TOuter, typename TInner> class ContainerIterator : public std::iterator<std::input_iterator_tag, TInner> { public: typedef function<TInner& (size_t)> func_type; ContainerIterator(const ContainerIterator& other) : mFunc(other.mFunc), mIndex(other.mIndex) {} ContainerIterator& operator++() { ++mIndex; return *this; } bool operator==(const ContainerIterator& other) { return ((mFunc.target<TOuter>() == other.mFunc.target<TOuter>()) && (mIndex == other.mIndex)); } bool operator!=(const ContainerIterator& other) { return !(*this == other); } TInner& operator*() { return mFunc(mIndex); } private: template<typename TOuter, typename TInner> friend class ContainerProxy; ContainerIterator(func_type func, size_t index = 0) : mFunc(func), mIndex(index) {} function<TInner& (size_t)> mFunc; size_t mIndex; }; Next, the mechanism by which I get valid iterators representing begin and end of the inner container: // Proxy(?) to the outer class instance, providing a way to get begin() and end() // iterators to the inner contained instances... template <typename TOuter, typename TInner> class ContainerProxy { public: typedef function<TInner& (size_t)> access_func_type; typedef function<size_t ()> size_func_type; typedef ContainerIterator<TOuter, TInner> iter_type; ContainerProxy(access_func_type accessFunc, size_func_type sizeFunc) : mAccessFunc(accessFunc), mSizeFunc(sizeFunc) {} iter_type begin() const { size_t numItems = mSizeFunc(); if (0 == numItems) return end(); else return ContainerIterator<TOuter, TInner>(mAccessFunc, 0); } iter_type end() const { size_t numItems = mSizeFunc(); return ContainerIterator<TOuter, TInner>(mAccessFunc, numItems); } private: access_func_type mAccessFunc; size_func_type mSizeFunc; }; I can use these classes in the following manner: // Sample function object for taking action on an LMX inner class instance yielded // by iteration... template <typename TInner> class SomeTInnerFunctor { public: void operator()(const TInner& inner) { /* ... whatever ... */ } }; // Example of iterating over an outer class instance's inner container... Bar b; /* assume populated which contained items ... */ ContainerProxy<Bar, Foo> bProxy( bind(&Bar::get_foo, b, _1), bind(&Bar::size_foo, b)); for_each(bProxy.begin(), bProxy.end(), SomeTInnerFunctor<Foo>()); Empirically, this solution functions correctly (minus any copy/paste or typos I may have introduced when editing the above for brevity). So, finally, the actual question: I don't like requiring the use of bind() and _1 placeholders, etcetera by the caller. All they really care about is: outer type, inner type, outer type's method to fetch inner instances, outer type's method to fetch count inner instances. Is there any way to "hide" the bind in the body of the template classes somehow? I've been unable to find a way to separately supply template parameters for the types and inner methods separately... Thanks! David

    Read the article

  • How do game trainers change an address in memory that's dynamic?

    - by GameTrainersWTF
    Lets assume I am a game and I have a global int* that contains my health. A game trainer's job is to modify this value to whatever in order to achieve god mode. I've looked up tutorials on game trainers to understand how they work, and the general idea is to use a memory scanner to try and find the address of a certain value. Then modify this address by injecting a dll or whatever. But I made a simple program with a global int* and its address changes every time I run the app, so I don't get how game trainers can hard code these addresses? Or is my example wrong? What am I missing?

    Read the article

  • Problem about C++ class (inheritance, variables scope and functions)

    - by Luigi Giaccari
    I have a class that contains some data: class DATA Now I would to create some functions that uses those data. I can do it easily by writing member functions like DATA::usedata(); Since there are hundreds of functions, I would to keep an order in my code, so I would like to have some "categories" (not sure of the correct name) like: DATA data; data.memory.free(); data.memory.allocate(); data.file.import(); data.whatever.foo(); where memory, file and whatever are the "categories" and free, allocate and foo are the functions. I tried the inheritance way, but I got lost since I can not declare inside DATA a memory or file object, error C2079 occurs: http://msdn.microsoft.com/en-us/library/9ekhdcxs%28VS.80%29.aspx Since I am not a programmer please don't be too complicated and if you have an easier way I am all ears.

    Read the article

  • Gaining Reference to the Dialog from Dialog content

    - by coffeeaddict
    Here's my scenario: I've got a div on Page A. When an event happens (whatever I define, a click, whatever), I do a div.Dialog, set its properties and open it The data inside is returned from an async .ajax call that grabs the data from a url and appends it to the div by calling div.html(data) inside the .ajax callback, so it's essentially loading a PageB by getting the data (content) and appending it to the div that's calling the dialog("open")...nothing special here I don't think. My question: In Page B, how do I reference the dialog so I can do some things to it? For instance in Page B's content that I received back from that .ajax call and added to the div via .html(data), there is a button and when clicked I need to close the dialog. Right now my buttons are not working because one of them closes out the dialog and the other should redirect to a new page but both do not work now because I have no reference to the dialog that it's in to manipulate it.

    Read the article

  • Getting automatic matching brace in vim

    - by Bob
    I spend WAY to much time fumbling around because vim doesn't handle closing braces like most IDEs do. Here's what I want to happen: type this: if( whatever ) { <CR> where <CR> mean hit the enter key and get this: if( whatever ) { | } where | is the position of the cursor. It's what Eclipse does. It's what Visual Studio does. And it's what I want Vim to do. I've seen a few plugins, tried a few, and none of them seem to give me this behavior. Surely I can't be the first programmer to want this.

    Read the article

  • Is it bad practice to initialize a variable to a dummy value?

    - by froadie
    This question is a result of the answers to this question that I just asked. It was claimed that this code is "ugly" because it initializes a variable to a value that will never be read: String tempName = null; try{ tempName = buildFileName(); } catch(Exception e){ ... System.exit(1); } FILE_NAME = tempName; Is this indeed bad practice? Should one avoid initializing variables to dummy values that will never actually be used? (EDIT - And what about initializing a String variable to "" before a loop that will concatenate values to the String...? Or is this in a separate category? e.g. String whatever = ""; for(String str : someCollection){ whatever += str; } )

    Read the article

  • Cadr of a list involving assoc function

    - by user3619045
    I have looked around on the net and cant find an answer to my query. I would really appreciate if someone could provide a good answer without down rating this post. In Lisp car, cdr are used on data mode like '(whatever here) which makes sense to me. Now, in the book Land of Lisp the author is explaining how to build a text engine and suddenly he uses the following description to make a function. (defun describe-location (location nodes) (cadr (assoc location nodes))) Can I ask why is he doing a cadr on a list and how come it provides a response and not an error? shouldn't it be a data mode i.e with a quote in front of the opening bracket '(whatever here)? and also why is he using assoc as in (assoc location nodes) and not (assoc 'garden *nodes*) Isn't the second correct way to use assoc ? I may be missing the big picture and as such would really appreciate someone explaining these key points please. Many thanks!

    Read the article

  • When using out parameters in a function, is it good practice to initialize them in the function?

    - by adambox
    I have a function that uses out parameters to return multiple values to the caller. I would like to initialize them in the function, but I wasn't sure if that's a bad idea since you don't know when you call the function that it's going to change the values right away. The caller might assume that after the function returns, if whatever it was doing didn't work, the values would be whatever they were initialized to in the caller. Is it ok / good for me to initialize in the function? Example: public static void SomeFunction(int ixID, out string sSomething) { sSomething = ""; sSomething = something(ixID); if (sSomething = "") { somethingelse(); sSomething = "bar" } }

    Read the article

  • Use this. to access internal class members?

    - by Sam
    On the internet I see a lot of code which uses this. to access local members of a class, like this: private String _whatever; public String Whatever { get { return this._whatever; } set { this._whatever = value; } } public void DoSomething() { String s = this.Whatever; this.DoSomething(); } (don't expect the code to do something sensible. I just wanted to show a few different uses for "this.") I wonder why to do this? To add more clarity to the source? Or is it just a waste of space?

    Read the article

  • OpenGL ES perspective projection

    - by TimeManx
    I'm having a hard time understanding how glFrustum & gluPerspective work. I understand the concept of perspective projection but the functions aren't behaving how I expect them to. For example, if I set the frustum this way glFrustumf(0, 10, 0, 10, 1, 100) and have a rectangle at points 0, 0, 1, 0, 10, 1, 10, 10, 1, 10, 0, 1 then the rectangle is drawn with its left edge at -5 & right edge at 5, so the left half of the rectangle isn't visible. And if x is translated, I'd expect y to be too. But that doesn't happen either. In whatever examples I've seen, the coordinates for the projection matrix are taken as glFrustumf(-10, 10, -10, 10, 1, 100) but either way, whatever part is shown should be dependent on the rectangle's coordinates, right?

    Read the article

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