Search Results

Search found 3255 results on 131 pages for 'pointers'.

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

  • Why is a c++ reference considered safer than a pointer?

    - by anand.arumug
    When the c++ compiler generates very similar assembler code for a reference and pointer, why is using references preferred (and considered safer) compared to pointers? I did see Difference between pointer variable and reference variable in C++ which discusses the differences between them. EDIT-1: I was looking at the assembler code generated by g++ for this small program: int main(int argc, char* argv[]) { int a; int &ra = a; int *pa = &a; }

    Read the article

  • C++ print value of a pointer

    - by user69514
    I have an array of double pointers, but every time I try do print one of the values the address gets printed. How do I print the actual value? cout << arr[i] ? cout << &arr[i] ? they both print the address Does anyone know?

    Read the article

  • How do you delete a pointer without deleting the data the pointer points to?

    - by Faken
    I have a pointer that points to an array and another pointer referencing the same array. How do i delete any one of those pointers without killing the array such that the second undeleted pointer still works? for example: int* pointer1 = new int [1000]; int* pointer2; pointer2 = pointer1; Now i want to get rid of pointer1, how would i do it such that i can continue to access the array normaly through pointer2?

    Read the article

  • How to pass objects to functions in C++?

    - by Rakesh K
    I am new to C++ programming, but I have experience in Java. I need guidance on how to pass objects to functions in C++. Do I need to pass pointers, references, or non-pointer and non-reference values? I remember in Java there are no such issues since we pass just the variable that holds reference to the objects. It would be great if you could also explain where to use each of those options.

    Read the article

  • At What point should you understand References?

    - by Vaccano
    I asked a question like this in an interview for a entry level programmer: var instance1 = new myObject{Value = "hello"} var instance2 = instance1; instance1.Value = "bye"; Console.WriteLine(instance1.Value); Console.WriteLine(instance2.Value); The applicant responded with "hello", "bye" as the output. Some of my co-workers said that "pointers" are not that important anymore or that this question is not a real judge of ability. Are they right?

    Read the article

  • managing IB objects without iboutlets

    - by palominoz
    i have got 24 buttons in my project.I need to manage them but I don't want to get my MainViewController polluted by 24 declarations of pointers, properties & synthesizes. i was thinking about using buttonPushed functions and do it like: -(IBAction)buttonPushed:(id)sender{ UIbutton *button=sender; [buttons addObjectAtIndex:[sender tag]]; } my question is:is sender a pointer to the IBObject?

    Read the article

  • C++ return object

    - by Pauff
    I have a class that has a vector of objects. What do I need to do to return one of this objects and change it outside the class, keeping the changings? Is it possible to do with regular pointers? Is there a standard procedure? (And yes, my background is in Java.)

    Read the article

  • C/C++ opaque pointer library

    - by aaa
    hello Is there library/header already written to manage C++ objects from C using opaque pointers/handles? I can write one myself, but I would rather use already made solution, especially if it has fortran bindings. Thanks

    Read the article

  • Dissertation about website and database security - in need of some pointers

    - by ClarkeyBoy
    Hi, I am on my dissertation in my final year at university at the moment. One of the areas I need to research is security - for both websites and for databases. I currently have sections on the following: Website Form security - such as data validation. This section is more about preventing errors made by legitimate users as much as possible rather than stopping hackers, for example comparing a field to a regular expression and giving them meaningful feedback on any errors which did occur so as to stop it happening again. Constraints. For example if a value must be true or false then use a checkbox. If it is likely to be one of several values then use a dropdown or a set of radio boxes, and so on. If the value is unpredictable then use regular expressions to limit what characters they are allowed to enter, and to restrict the length of the string, and sometimes to limit the format (such as for dates / times, post codes and so on). Sometimes you can limit permissions to the form. This is on the occasion that you know exactly who (whether it be peoples names or a group of people - such as administrators or employees) is going to need access to the form. Restricting permissions will stop members of the public from being able to access the form. Symbols or strings which could be used maliciously or cause the website to act incorrectly (such as the script tag) should be filtered out or html encoded. Captcha images can be used to prevent automated systems from filling in and submitting the form. There are some hacks for file uploads - such as using double extensions - which can allow hackers to upload malicious files. Databases (this is nowhere near done yet but the sections I have planned are listed below) SQL statements vs stored procedures Throwing an error when one of the variables contains particular characters or groups of characters (I cant remember what characters they are, but I have seen a message thrown back at me before where I have tried to enter html or something into a text area). SQL Injection - and ways around it, with some examples. Does anyone have any hints and tips on where I could go for some decent, reliable information either about these areas or about other areas of security that I could cover? Thanks in advance. Regards, Richard PS I am a complete newbie when it comes to security, so please be patient with me. If any of the information I have put down is wrong or could be sub-sectioned then please feel free to say so.

    Read the article

  • initializing char and char pointers

    - by ra170
    What's the difference between these: This one works: char* pEmpty = new char; *pEmpty = 'x'; However if I try doing: char* pEmpty = NULL; pEmpty = 'x'; // <---- doesn't work! and: char* pEmpty = "x"; // putting in double quotes works! why??

    Read the article

  • Need advice or pointers on Release Management Strategies

    - by Murray
    I look after an internal web based (Java, JSP, Mediasurface, etc.) system that is in constant use (24/5). Users raise tickets for enhancements, bug fixes and other business changes. These issues are signed off individually and assigned to one of three or four developers. Once the issue is complete it is built and the code only committed to SVN. The changed files (templates, html, classes, jsp) are then copied to a dev server and committed to a different repository from where they are checked out to the UAT server for testing. (this often requires the Tomcat service to be restarted and occasionally the Mediasurface service as well). The users then test and either reject or approve the release. If approved the edited files are checked out to the Live server and the same process as with UAT undertaken. If rejected the developer makes the relevant changes and starts the release process again. This is all done manually without much control. Where different developers are working on similar files, changes sometimes get overwritten by builds done on out of sync code in other cases changes in UAT are moved to live in error as they are mixed up in files associated with a signed off release. I would like to move this to a more controlled and automated process where all source code and output files are held in SVN and releases to Dev, UAT and Live managed by a CI system (We have TeamCity in house for our .NET applications). My question is on how to manage the releases of multiple changes where some will be signed off and moved on and others rejected and returned to the developer. The changes may be on overlapping files and simply merging each release in to a Release Branch means that the rejected changes would have to be backed out of the branch. Is there a way to manage this using SVN and CI or will I simply have to live with the current system.

    Read the article

  • Objective-C classes, pointers to primitive types, etc.

    - by Toby Wilson
    I'll cut a really long story short and give an example of my problem. Given a class that has a pointer to a primitive type as a property: @interface ClassOne : NSObject { int* aNumber } @property int* aNumber; The class is instantiated, and aNumber is allocated and assigned a value, accordingly: ClassOne* bob = [[ClassOne alloc] init]; bob.aNumber = malloc(sizeof(int)); *bob.aNumber = 5; It is then passed, by reference, to assign the aNumber value of a seperate instance of this type of class, accordingly: ClassOne* fred = [[ClassOne alloc] init]; fred.aNumber = bob.aNumber; Fred's aNumber pointer is then freed, reallocated, and assigned a new value, for example 7. Now, the problem I'm having; Since Fred has been assigned the same pointer that Bob had, I would expect that Bob's aNumber will now have a value of 7. It doesn't, because for some reason it's pointer was freed, but not reassigned (it is still pointing to the same address it was first allocated which is now freed). Fred's pointer, however, has the allocated value 7 in a different memory location. Why is it behaving like this? What am I minsunderstanding? How can I make it work like C++ does?

    Read the article

  • Pointers to structures

    - by blacktooth
    typedef struct queue { int q[max]; int qhead; int qrear; } queue; void init_queue(queue *QUEUE) { QUEUE.qhead = 0; QUEUE.qrear = -1; } void enqueue(queue *QUEUE,int data) { QUEUE.qrear++; QUEUE.q[QUEUE.qrear] = data; } int process_queue(queue *QUEUE) { if(QUEUE.qhead > QUEUE.qrear) return -1; else return QUEUE.q[QUEUE.qhead++]; } I am implementing queues using arrays just to keep it simple. Wats the error with the above code?

    Read the article

  • Stack / base pointers in assembly

    - by flyingcrab
    I know this topic has been covered ad-naseum here, and other places on the internet - but hopefully the question is a simple one as I try to get my head around assembly... So if i understand correctly the ebp (base pointer) will point to the top of the stack, and the esp (stack pointer) will point to the bottom -- since the stack grows downward. esp therefore points to the 'current location'. So on a function call, once you've saved the ebp on the stack you insert a new stack frame - for the function. So in the case of the image below, if you started from N-3 you would go to N-2 with a function call. But when you are at N-2 - is your ebp == 25 and the esp == 24 (at least initially, before any data is placed on the stack)? Is this correct or am I of on a tangent here? Thanks!

    Read the article

  • Objective-C Implementation Pointers

    - by Dwaine Bailey
    Hi, I am currently writing an XML parser that parses a lot of data, with a lot of different nodes (the XML isn't designed by me, and I have no control over the content...) Anyway, it currently takes an unacceptably long time to download and read in (about 13 seconds) and so I'm looking for ways to increase the efficiency of the read. I've written a function to create hash values, so that the program no longer has to do a lot of string comparison (just NSUInteger comparison), but this still isn't reducing the complexity of the read in... So I thought maybe I could create an array of IMPs so that, I could then go something like: for(int i = 0; i < [hashValues count]; i ++) { if(currHash == [[hashValues objectAtIndex:i] unsignedIntValue]) { [impArray objectAtIndex:i]; } } Or something like that. The only problem is that I don't know how to actually make the call to the IMP function? I've read that I perform the selector that an IMP defines by going IMP tImp = [impArray objectAtIndex:i]; tImp(self, @selector(methodName)); But, if I need to know the name of the selector anyway, what's the point? Can anybody help me out with what I want to do? Or even just some more ways to increase the efficiency of the parser...

    Read the article

  • iPad/iPhone: Form filling application pointers

    - by raj.tiwari
    Folks, I am starting work on an iPad/iPhone application that is essentially a form-filing UI. The requirement is to present a (rather large) form to the user. The form is composed of sections and questions, like so: Form Question 0.1 Question 0.2 Section 1 Question 1.1 etc. The user can take various paths down the form based on answers to questions. I would like to architect this by defining a declarative markup that can be used to author the form questionnaire including traversal rules. My questions are: Can anyone recommend a markup/language that would satisfy the declaration requirement? Is there any existing library that would ease the implementation as described above? Thanks for your time.

    Read the article

  • Vim OmniCppComplete on vectors of pointers

    - by Alex
    Hi, I might have done something wrong in the set up but is OmniCppComplete supposed to provide the members/functions of classes when doing this? vectorofpointers[0]-> At the moment all I get when trying that are things relating to the vector class itself, which obviously isn't very useful. I think it might have been working before I tagged /usr/include/ but I could be wrong. Also, is it possible to disable the preview window? I find it just clutters up my workspace. And since I enabled ShowPrototypeInAbbr I don't really need it. Thanks, Alex

    Read the article

  • OpenCV to use in memory buffers or file pointers

    - by The Unknown
    The two functions in openCV cvLoadImage and cvSaveImage accept file path's as arguments. For example, when saving a image it's cvSaveImage("/tmp/output.jpg", dstIpl) and it writes on the disk. Is there any way to feed this a buffer already in memory? So instead of a disk write, the output image will be in memory. I would also like to know this for both cvSaveImage and cvLoadImage (read and write to memory buffers). Thanks! My goal is to store the Encoded (jpeg) version of the file in Memory. Same goes to cvLoadImage, I want to load a jpeg that's in memory in to the IplImage format.

    Read the article

  • C: Proper syntax for allocating memory using pointers to pointers.

    - by ~kero-05h
    This is my first time posting here, hopefully I will not make a fool of myself. I am trying to use a function to allocate memory to a pointer, copy text to the buffer, and then change a character. I keep getting a segfault and have tried looking up the answer, my syntax is probably wrong, I could use some enlightenment. /* My objective is to pass a buffer to my Copy function, allocate room, and copy text to it. Then I want to modify the text and print it.*/ #include <stdio.h> #include <stdlib.h> #include <string.h> int Copy(char **Buffer, char *Text); int main() { char *Text = malloc(sizeof(char) * 100); char *Buffer; strncpy(Text, "1234567890\n", 100); Copy(&Buffer, Text); } int Copy(char **Buffer, char *Text) { int count; count = strlen(Text)+1; *Buffer = malloc(sizeof(char) * count); strncpy(*Buffer, Text, 5); *Buffer[2] = 'A'; /* This results in a segfault. "*Buffer[1] = 'A';" results in no differece in the output. */ printf("%s\n", *Buffer); }

    Read the article

  • printing reverse in singly link list using pointers

    - by theoneabhinav
    i have been trying this code. i think the logic is ok but the program terminates abruptly when the display_rev function is called here is code of display_rev void display_rev(emp_node *head) { emp_node *p=head, *q; while(p->next != NULL) p=p->next; while(p!=head || p==head){ q=head; display_rec(p); while(q->next != p) q=q->next; p=q; } } here is my whole code #include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> //Declarations=============================================================== typedef struct //employee record { int emp_id; char name[150]; char mob_no[11]; float salary; int proj[5]; struct emp_node *next; } emp_node; emp_node* add_rec(emp_node*); emp_node* create_db(emp_node*); emp_node* search_db(emp_node*, int); emp_node* delete_rec(emp_node*, int); void read_name(emp_node*); void read_mob(emp_node*); void display_db(emp_node*); void display_rec(emp_node*); void display_rev(emp_node*); void modify_rec(emp_node*); void swtch(emp_node*); //=========================================================================== int main() { char ans; emp_node *head = NULL; head = create_db(head); display_db(head); do { swtch(head); printf("\n\n\tDo you want to continue (y/n) : "); getchar(); scanf("%c", &ans); } while (ans == 'y' || ans == 'Y'); return 0; } //Definitions================================================================ emp_node* create_db(emp_node *head) //database creation { int i = 1, no; emp_node *p; printf("Enter number of employees:"); scanf("%d", &no); printf("\n\n"); head = (emp_node *) malloc(sizeof(emp_node)); head = add_rec(head); head->next = NULL; p = head; while (i < no) { p->next = (emp_node *) malloc(sizeof(emp_node)); p = p->next; p = add_rec(p); p->next = NULL; i++; } return head; } emp_node* add_rec(emp_node *p) //new record { int j; printf("\n\tEmployee ID : "); scanf("%d", &(p->emp_id)); printf("\n\tFirst Name:"); read_name(p); printf("\n\tMobile No.:"); read_mob(p); printf("\n\tSalary :"); scanf("%f", &(p->salary)); printf( "\n\tEnter \"1\" for the projects employee is working on, otherwise enter \"0\": \n"); for (j = 0; j < 5; j++) { printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); while (p->proj[j] != 1 && p->proj[j] != 0) { printf("\n\nInvalid entry!! Please re-enter."); printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); } } printf("\n\n\n"); return p; } void read_name(emp_node *p) //validation for name { int j, len; scanf("%s", p->name); len = strlen(p->name); for (j = 0; j < len; j++) { if (!isalpha(p->name[j])) { printf( "\n\n\tInvalid name!!Can contain only characters. Please Re-enter.\n"); printf("\n\tName : "); read_name(p); } } } void read_mob(emp_node *p) //validation for mobile no. { int j; scanf("%s", p->mob_no); while (strlen(p->mob_no) != 10) { printf("\n\nInvalid Mobile No!!Please Re-enter"); printf("\n\n\tMobile No.:"); read_mob(p); } for (j = 0; j < 10; j++) { if (!(48 <= p->mob_no[j] && p->mob_no[j] <= 57)) { printf( "\n\nInvalid Mobile No!!Can contain only digits. Please Re-enter."); printf("\n\n\tMobile No.:"); read_mob(p); } } } void display_db(emp_node *head) //displaying whole database { emp_node *p; p = head; printf("\n\n\t\t****** EMPLOYEE DATABASE ******\n"); printf( "\n=============================================================================="); printf("\n Id.\t Name\t\t Mobile No\t Salary\t Projects\n"); while (p != NULL) { display_rec(p); p = p->next; printf("\n\n\n"); } printf( "\n=============================================================================="); } void swtch(emp_node *head) //function for menu and switch case { int cho, x; emp_node *p; printf("\n\n\t\t****** MENU ******"); printf( "\n\n\t1. insert Record\n\t2. Search Record\n\t3. Modify Record\n\t4. Delete Record\n\t5. Display Reverse\n\t6. Exit"); printf("\n\tWhich operation do you want to perform? "); scanf("%d", &cho); switch (cho) { case 1: p=head; while(p->next != NULL) p=p->next; p->next = (emp_node *) malloc(sizeof(emp_node)); p=p->next; p = add_rec(p); p->next = NULL; display_db(head); break; case 2: printf("\n\n\tEnter employee ID whose record is to be Searched :"); scanf("%d", &x); p = search_db(head, x); if (p == NULL) printf("\n\nRecord not found."); else display_rec(p); break; case 3: printf("\n\n\tEnter employee ID whose record is to be modified :"); scanf("%d", &x); p = search_db(head, x); if (p == NULL) printf("\n\nRecord not found."); else modify_rec(p); display_db(head); break; case 4: printf("\n\n\tEnter employee ID whose record is to be deleted :"); scanf("%d", &x); head = delete_rec(head, x); display_db(head); break; case 5: display_rev(head); case 6: exit(0); default: printf("Invalid Choice!! Please try again."); } } emp_node* search_db(emp_node *head, int id) //search database { emp_node *p = head; while (p != NULL) { if (p->emp_id == id) return p; p = p->next; } return NULL; } void display_rec(emp_node *p) //display a single record { int j; printf("\n %d", p->emp_id); printf("\t %10s", p->name); printf("\t %10s", p->mob_no); printf("\t %05.2f", p->salary); printf("\t "); for (j = 0; j < 5; j++) { if (p->proj[j] == 1) printf(" %d,", j + 1); } } void modify_rec(emp_node *p) //modifying a record { int j, cho; char ch1, edt; do { printf( "\n\t1. Name\n\t2. Email Address\n\t3. Mobile No.\n\t4. Salary\n\t5. Date of birth\n\t6. Projects\n"); printf("Enter your choice : "); scanf("%d", &cho); switch (cho) { case 1: printf("\n\tPrevious name:%s", p->name); printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf("\n\tEnter New Name:"); read_name(p); } break; case 2: printf("\n\tPrevious Mobile No. : %s", p->mob_no); printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf("\n\tEnter New Mobile No. :"); read_mob(p); } break; case 3: printf("\n\tPrevious salary is : %f", p->salary); printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf("\n\tEnter New salary:"); scanf("%f", &(p->salary)); } break; case 4: printf("the employee is currently working on project no. "); for (j = 0; j < 5; j++) { if (p->proj[j] == 1) printf(" %d,", j + 1); } printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf( "\n\tEnter \"1\" for the projects employee is working on : \n"); for (j = 0; j < 5; j++) { printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); while (p->proj[j] != 1) { printf("\n\nInvalid entry!! Please re-enter."); printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); } } } break; default: printf("\n\nInvalid Choice!! Please Try again."); } printf("\n\nDo you want to edit any other fields ?(y/n)"); getchar(); scanf("%c", &edt); } while (edt == 'y' || edt == 'Y'); } emp_node* delete_rec(emp_node *head, int id) //physical deletion of record { emp_node *p = head, *q; if (head->emp_id == id) { head = head->next; free(p); return head; } else { q = p->next; while (q->emp_id != id) { p = p->next; q = q->next; } if (q->next == NULL) p->next = NULL; else p->next = q->next; free(q); return head; } } void display_rev(emp_node *head) { emp_node *p=head, *q; while(p->next != NULL) p=p->next; while(p!=head || p==head){ q=head; display_rec(p); while(q->next != p) q=q->next; p=q; } }

    Read the article

  • Pointers to Derived Class Objects Losing vfptr

    - by duckworthd
    To begin, I am trying to write a run-of-the-mill, simple Ray Tracer. In my Ray Tracer, I have multiple types of geometries in the world, all derived from a base class called "SceneObject". I've included the header for it here. /** Interface for all objects that will appear in a scene */ class SceneObject { public: mat4 M, M_inv; Color c; SceneObject(); ~SceneObject(); /** The transformation matrix to be applied to all points of this object. Identity leaves the object in world frame. */ void setMatrix(mat4 M); void setMatrix(MatrixStack mStack); void getMatrix(mat4& M); /** The color of the object */ void setColor(Color c); void getColor(Color& c); /** Alter one portion of the color, leaving the rest as they were. */ void setDiffuse(vec3 rgb); void setSpecular(vec3 rgb); void setEmission(vec3 rgb); void setAmbient(vec3 rgb); void setShininess(double s); /** Fills 'inter' with information regarding an intersection between this object and 'ray'. Ray should be in world frame. */ virtual void intersect(Intersection& inter, Ray ray) = 0; /** Returns a copy of this SceneObject */ virtual SceneObject* clone() = 0; /** Print information regarding this SceneObject for debugging */ virtual void print() = 0; }; As you can see, I've included a couple virtual functions to be implemented elsewhere. In this case, I have only two derived class -- Sphere and Triangle, both of which implement the missing member functions. Finally, I have a Parser class, which is full of static methods that do the actual "Ray Tracing" part. Here's a couple snippets for relevant portions void Parser::trace(Camera cam, Scene scene, string outputFile, int maxDepth) { int width = cam.getNumXPixels(); int height = cam.getNumYPixels(); vector<vector<vec3>> colors; colors.clear(); for (int i = 0; i< width; i++) { vector<vec3> ys; for (int j = 0; j<height; j++) { Intersection intrsct; Ray ray; cam.getRay(ray, i, j); vec3 color; printf("Obtaining color for Ray[%d,%d]\n", i,j); getColor(color, scene, ray, maxDepth); ys.push_back(color); } colors.push_back(ys); } printImage(colors, width, height, outputFile); } void Parser::getColor(vec3& color, Scene scene, Ray ray, int numBounces) { Intersection inter; scene.intersect(inter,ray); if(inter.isIntersecting()){ Color c; inter.getColor(c); c.getAmbient(color); } else { color = vec3(0,0,0); } } Right now, I've forgone the true Ray Tracing part and instead simply return the color of the first object hit, if any. As you have no doubt noticed, the only way the computer knows that a ray has intersected an object is through Scene.intersect(), which I also include. void Scene::intersect(Intersection& i, Ray r) { Intersection result; result.setDistance(numeric_limits<double>::infinity()); result.setIsIntersecting(false); double oldDist; result.getDistance(oldDist); /* Cycle through all objects, making result the closest one */ for(int ind=0; ind<objects.size(); ind++){ SceneObject* thisObj = objects[ind]; Intersection betterIntersect; thisObj->intersect(betterIntersect, r); double newDist; betterIntersect.getDistance(newDist); if (newDist < oldDist){ result = betterIntersect; oldDist = newDist; } } i = result; } Alright, now for the problem. I begin by creating a scene and filling it with objects outside of the Parser::trace() method. Now for some odd reason, I cast Ray for i=j=0 and everything works wonderfully. However, by the time the second ray is cast all of the objects stored in my Scene no longer recognize their vfptr's! I stepped through the code with a debugger and found that the information to all the vfptr's are lost somewhere between the end of getColor() and the continuation of the loop. However, if I change the arguments of getColor() to use a Scene& instead of a Scene, then no loss occurs. What crazy voodoo is this?

    Read the article

  • I need some pointers on how to implement inertia

    - by gargantaun
    Ok, so I've created a little plugin that takes a bunch of elements and creates a sort of never ending list. I'll try to explain... I have a div, and it's got about 20 elements tags in it. When the user scrolls up, the top element moves out of view and is moved to the bottom of the list. And vice-versa so that when the user scrolls down, the bottom element is moved to the top of the list. This is specifically for Mobile Safari (iPad, iPhone) web content and you can see the work in progress here... http://appliedworks.co.uk/files/times/SVGTests/drumView/drum.html You'll need an iPad or iPhone top see the scrolling in action. You can see the plugin code here... http://appliedworks.co.uk/files/times/SVGTests/drumView/drumView-0.1b.js What I would like to do is implement inertia so the scrolling slows to a halt in response to how fast or slow the user is scrolling when their finger leaves the screen. Just like the inertia commonly found in the iPhone / iPad UI. The problem is, every time an element moves to the top or the bottom of the list, the scollTop value for the parent div is adjusted to make it look like all the elements are staying in the same place. Which means the scrollTop value is never more than the top elements total height. So there's no value I can think of that I can keep on manipulating to give the illusion of inertia. I'm stumped. Does anyone have any suggestions?

    Read the article

  • Pointers to structs

    - by Bobby
    I have the following struct: struct Datastore_T { Partition_Datastores_T cmtDatastores; // bytes 0 to 499 Partition_Datastores_T cdhDatastores; // bytes 500 to 999 Partition_Datastores_T gncDatastores; // bytes 1000 to 1499 Partition_Datastores_T inpDatastores; // bytes 1500 1999 Partition_Datastores_T outDatastores; // bytes 2000 to 2499 Partition_Datastores_T tmlDatastores; // bytes 2500 to 2999 Partition_Datastores_T sm_Datastores; // bytes 3000 to 3499 }; I want to set a char* to struct of this type like so: struct Datastore_T datastores; // Elided: datastores is initialized with data here char* DatastoreStartAddr = (char*)&datastores; memset(DatastoreStartAddr, 0, sizeof(Datastore_T)); The problem I have is that the value that DatastoreStartAddr points to always has a value of zero when it should point to the struct that has been initialized with data. Meaning if I change the values in the struct using the struct directly, the values pointed to by DatastoreStartAddr should also change b/c they are pointing to the same address. But this is not happening. What am I doing wrong?

    Read the article

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