Search Results

Search found 5650 results on 226 pages for 'ref counted pointer'.

Page 7/226 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Fortran pointer as an argument to interface procedure

    - by icarusthecow
    Im trying to use interfaces to call different subroutines with different types, however, it doesnt seem to work when i use the pointer attribute. for example, take this sample code MODULE ptr_types TYPE, abstract :: parent INTEGER :: q END TYPE TYPE, extends(parent) :: child INTEGER :: m END TYPE INTERFACE ptr_interface MODULE PROCEDURE do_something END INTERFACE CONTAINS SUBROUTINE do_something(atype) CLASS(parent), POINTER :: atype ! code determines that this allocation is correct from input ALLOCATE(child::atype) WRITE (*,*) atype%q END SUBROUTINE END MODULE PROGRAM testpass USE ptr_types CLASS(child), POINTER :: ctype CALL ptr_interface(ctype) END PROGRAM This gives error Error: There is no specific subroutine for the generic 'ptr_interface' at (1) however if i remove the pointer attribute in the subroutine it compiles fine. Now, normally this wouldnt be a problem, but for my use case i need to be able to treat that argument as a pointer, mainly so i can allocate it if necessary. Any suggestions? Mind you I'm new to fortran so I may have missed something edit: forgot to put the allocation in the parents subroutine, the initial input is unallocated EDIT 2 this is my second attempt, with caller side casting MODULE ptr_types TYPE, abstract :: parent INTEGER :: q END TYPE TYPE, extends(parent) :: child INTEGER :: m END TYPE TYPE, extends(parent) :: second INTEGER :: meow END TYPE CONTAINS SUBROUTINE do_something(this, type_num) CLASS(parent), POINTER :: this INTEGER type_num IF (type_num == 0) THEN ALLOCATE (child::this) ELSE IF (type_num == 1) THEN ALLOCATE (second::this) ENDIF END SUBROUTINE END MODULE PROGRAM testpass USE ptr_types CLASS(child), POINTER :: ctype SELECT TYPE(ctype) CLASS is (parent) CALL do_something(ctype, 0) END SELECT WRITE (*,*) ctype%q END PROGRAM however this still fails. in the select statement it complains that parent must extend child. Im sure this is due to restrictions when dealing with the pointer attribute, for type safety, however, im looking for a way to convert a pointer into its parent type for generic allocation. Rather than have to write separate allocation functions for every type and hope they dont collide in an interface or something. hopefully this example will illustrate a little more clearly what im trying to achieve, if you know a better way let me know

    Read the article

  • Remote mouse pointer not visible in VNC

    - by aef
    I used VNC desktops as a kind of collaboration server, as shared planning and pair programming environment for a long time. Now my latest iteration uses a KVM guest running Fedora 17 "Beefy Miracle", the Cinnamon desktop environment and an X11VNC server. The X11VNC server is automatically started with the desktop environment using the following command: x11vnc -localhost -many -shared -display :0 -bg My problem is that depending on the VNC client, the mouse pointer of the remote system which is shown through VNC is not synchronized to my client. I really need this, so I can see what my partner is doing on the desktop. When using Vinagre 3.2.1 on Ubuntu Oneiric Ocelot (11.10) or Vinagre 2.3.0.3 on Debian Squeeze (6.0) and I don't have my local mouse pointer inside the VNC view, I cannot see the mouse pointer of my remote system, nor its movement. When using TightVNC on Windows 7, I can recognize a mouse pointer trace for very short amounts of time after moving the mouse, but it is not clearly visible. Using UltraVNC on Windows 7 the mouse pointer is clearly visible all the time. With Gnome 2 I never had any problems with remote pointer synchronization, using exactly the same clients. I suspect this could have something to do with Cinnamon's dependency on 3D acceleration. On the other hand, it doesn't change anything to start Cinnamon's fallback environment Cinnamon 2D. Update: Same effect when I use Gnome 3.

    Read the article

  • How to format a function pointer?

    - by Longpoke
    Is there any way to print a pointer to a function in ANSI C? Of course this means you have to cast the function pointer to void pointer, but it appears that's not possible?? #include <stdio.h> int main() { int (*funcptr)() = main; printf("%p\n", (void* )funcptr); printf("%p\n", (void* )main); return 0; } $ gcc -ansi -pedantic -Wall test.c -o test test.c: In function 'main': test.c:6: warning: ISO C forbids conversion of function pointer to object pointer type test.c:7: warning: ISO C forbids conversion of function pointer to object pointer type $ ./test 0x400518 0x400518 It's "working", but non-standard...

    Read the article

  • Word Spell Check pops up hidden and "freezes" my App

    - by Refracted Paladin
    I am using Word's Spell Check in my in house WinForm app. My clients are all XP machines with Office 2007 and randomly the spell check suggestion box pops up behind the App and makes everything "appear" frozen as you cannot get at it. Suggestions? What do other people do to work around this or stop it altogether? Thanks Below is my code, for reference, though I am doubtful that this has anything to do with my code but I'll take anything. public class SpellCheckers { public string CheckSpelling(string text) { Word.Application app = new Word.Application(); object nullobj = Missing.Value; object template = Missing.Value; object newTemplate = Missing.Value; object documentType = Missing.Value; object visible = false; object optional = Missing.Value; object savechanges = false; app.ShowMe(); Word._Document doc = app.Documents.Add(ref template, ref newTemplate, ref documentType, ref visible); doc.Words.First.InsertBefore(text); Word.ProofreadingErrors errors = doc.SpellingErrors; var ecount = errors.Count; doc.CheckSpelling(ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional); object first = 0; object last = doc.Characters.Count - 1; var results = doc.Range(ref first, ref last).Text; doc.Close(ref savechanges, ref nullobj, ref nullobj); app.Quit(ref savechanges, ref nullobj, ref nullobj); Marshal.ReleaseComObject(doc); Marshal.ReleaseComObject(app); Marshal.ReleaseComObject(errors); return results; } } And I call it from my WinForm app like so -- public static void SpellCheckControl(Control control) { if (IsWord2007Available()) { if (control.HasChildren) { foreach (Control ctrl in control.Controls) { SpellCheckControl(ctrl); } } if (IsValidSpellCheckControl(control)) { if (control.Text != String.Empty) { control.BackColor = Color.FromArgb(180, 215, 195); control.Text = Spelling.CheckSpelling(control.Text); control.Text = control.Text.Replace("\r", "\r\n"); control.ResetBackColor(); } } } }

    Read the article

  • are deleted entries counted in the load factor of a hash table using open addressing

    - by Dr. Monkey
    When calculating the load factor of a hashtable with an open-addressing array implementation I am using: numberOfKeysInArray/sizeOfArray however it occurred to me that since deleted entries must be marked as such (to distinguish them from empty spaces), it might make sense to include these in the number of keys. My thinking is that as far as estimating the average number of probes to find an entry, deleted entries should count towards the load factor, but as far as inserting a new key they should not. Which is the proper calculation: including deleted keys or not?

    Read the article

  • word automation problem

    - by daemonkid
    I am trying open a word document for manipulation. However in the code below 'wordApp.Selection' is always null object missing = System.Reflection.Missing.Value; Word._Application wordApp = new Word.Application(); Word._Document aDoc =wordApp.Documents.Open(ref fPath1, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); Word.Selection selection = wordApp.Selection Any ideas on how what I am missing here. Why is wordApp.Selection getting set as null.? Thanks.

    Read the article

  • STL class for reference-counted pointers?

    - by hasen j
    This should be trivial but I can't seem to find it (unless no such class exists!) What's the STL class (or set of classes) for smart pointers? UPDATE Thanks for the responses, I must say I'm surprised there's no standard implementation. I ended up using this one: http://www.gamedev.net/reference/articles/article1060.asp

    Read the article

  • How to put comma in counted numbers?

    - by Ronnie Chester Lynwood
    hey huys im counting my table with this code: $county = mysql_query("SELECT COUNT(id) from table where type = 'application'"); $county = mysql_result($county, 0); $applications = ''.$county.''; this give me result like 1156563. but I want to see it like 1,156,563 with commas. how can i do this?

    Read the article

  • runtime error: invalid memory address or nil pointer dereference

    - by Klink
    I want to learn OpenGL 3.0 with golang. But when i try to compile some code, i get many errors. package main import ( "os" //"errors" "fmt" //gl "github.com/chsc/gogl/gl33" //"github.com/jteeuwen/glfw" "github.com/go-gl/gl" "github.com/go-gl/glfw" "runtime" "time" ) var ( width int = 640 height int = 480 ) var ( points = []float32{0.0, 0.8, -0.8, -0.8, 0.8, -0.8} ) func initScene() { gl.Init() gl.ClearColor(0.0, 0.5, 1.0, 1.0) gl.Enable(gl.CULL_FACE) gl.Viewport(0, 0, 800, 600) } func glfwInitWindowContext() { if err := glfw.Init(); err != nil { fmt.Fprintf(os.Stderr, "glfw_Init: %s\n", err) glfw.Terminate() } glfw.OpenWindowHint(glfw.FsaaSamples, 1) glfw.OpenWindowHint(glfw.WindowNoResize, 1) if err := glfw.OpenWindow(width, height, 0, 0, 0, 0, 32, 0, glfw.Windowed); err != nil { fmt.Fprintf(os.Stderr, "glfw_Window: %s\n", err) glfw.CloseWindow() } glfw.SetSwapInterval(1) glfw.SetWindowTitle("Title") } func drawScene() { for glfw.WindowParam(glfw.Opened) == 1 { gl.Clear(gl.COLOR_BUFFER_BIT) vertexShaderSrc := `#version 120 attribute vec2 coord2d; void main(void) { gl_Position = vec4(coord2d, 0.0, 1.0); }` vertexShader := gl.CreateShader(gl.VERTEX_SHADER) vertexShader.Source(vertexShaderSrc) vertexShader.Compile() fragmentShaderSrc := `#version 120 void main(void) { gl_FragColor[0] = 0.0; gl_FragColor[1] = 0.0; gl_FragColor[2] = 1.0; }` fragmentShader := gl.CreateShader(gl.FRAGMENT_SHADER) fragmentShader.Source(fragmentShaderSrc) fragmentShader.Compile() program := gl.CreateProgram() program.AttachShader(vertexShader) program.AttachShader(fragmentShader) program.Link() attribute_coord2d := program.GetAttribLocation("coord2d") program.Use() //attribute_coord2d.AttribPointer(size, typ, normalized, stride, pointer) attribute_coord2d.EnableArray() attribute_coord2d.AttribPointer(0, 3, false, 0, &(points[0])) //gl.DrawArrays(gl.TRIANGLES, 0, len(points)) gl.DrawArrays(gl.TRIANGLES, 0, 3) glfw.SwapBuffers() inputHandler() time.Sleep(100 * time.Millisecond) } } func inputHandler() { glfw.Enable(glfw.StickyKeys) if glfw.Key(glfw.KeyEsc) == glfw.KeyPress { //gl.DeleteBuffers(2, &uiVBO[0]) glfw.Terminate() } if glfw.Key(glfw.KeyF2) == glfw.KeyPress { glfw.SetWindowTitle("Title2") fmt.Println("Changed to 'Title2'") fmt.Println(len(points)) } if glfw.Key(glfw.KeyF1) == glfw.KeyPress { glfw.SetWindowTitle("Title1") fmt.Println("Changed to 'Title1'") } } func main() { runtime.LockOSThread() glfwInitWindowContext() initScene() drawScene() } And after that: panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x41bc6f74] goroutine 1 [syscall]: github.com/go-gl/gl._Cfunc_glDrawArrays(0x4, 0x7f8500000003) /tmp/go-build463568685/github.com/go-gl/gl/_obj/_cgo_defun.c:610 +0x2f github.com/go-gl/gl.DrawArrays(0x4, 0x3, 0x0, 0x45bd70) /tmp/go-build463568685/github.com/go-gl/gl/_obj/gl.cgo1.go:1922 +0x33 main.drawScene() /home/klink/Dev/Go/gogl/gopher/exper.go:85 +0x1e6 main.main() /home/klink/Dev/Go/gogl/gopher/exper.go:116 +0x27 goroutine 2 [syscall]: created by runtime.main /build/buildd/golang-1/src/pkg/runtime/proc.c:221 exit status 2

    Read the article

  • mouse pointer doesn't move

    - by Alessandro Cosentino
    From one week ago, I am experiencing this issue with a USB mouse on Kubuntu 12.04: the mouse pointer doesn't move unless I hit a click on the left button. After the click, it moves regularly, but as soon as I stop it, it needs another click to reactivate. The weird thing is that the same mouse behaves normally on my desktop computer, which has the same linux distribution with the same updates. Update: I realized that on my laptop this happens only when the machine runs on battery.

    Read the article

  • Launcher Disappears, Mouse Pointer Stops Moving

    - by Zachary Rogers
    Quite frequently, when using Ubuntu 12.04 I will have a problem where the launcher disappears and at the same time the mouse cursor will appear to stop moving. However I can actually click on things on other parts of the screen and the pointer will change shape appropriate for what it's actually pointing at. I can left click on things and a menu will appear as normal. I do not have the launcher set to automatically disappear.

    Read the article

  • LOB Pointer Indexing Proposal

    - by jchang
    My observations are that IO to lob pages (and row overflow pages as well?) is restricted to synchronous IO, which can result in serious problems when these reside on disk drive storage. Even if the storage system is comprised of hundreds of HDDs, the realizable IO performance to lob pages is that of a single disk, with some improvement in parallel execution plans. The reason for this appears to be that each thread must work its way through a page to find the lob pointer information, and then generates...(read more)

    Read the article

  • Returning a struct pointer

    - by idealistikz
    Suppose I have the following struct and function returning a pointer: typedef struct { int num; void *nums; int size; } Mystruct; Mystruct *mystruct(int num, int size) { .... } I want to define any Mystruct pointer using the above function. Should I declare a Mystruct variable, define the properties of Mystruct, assign a pointer to it, and return the pointer or define the properties of a mystruct property through a pointer immediately?

    Read the article

  • How does compiler understand the pointer type?

    - by Narek
    How c++ compiler understands the pointer type? As I know pointer has a size equal to WORD of the OS (32 or 64). So does it store dome info in that 32(or 64) bits about type? Just because you can not have a pointer on one type and assign to that pointer another pointer with a different type.

    Read the article

  • RK4 Bouncing a Ball

    - by Jonathan Dickinson
    I am trying to wrap my head around RK4. I decided to do the most basic 'ball with gravity that bounces' simulation. I have implemented the following integrator given Glenn Fiedler's tutorial: /// <summary> /// Represents physics state. /// </summary> public struct State { // Also used internally as derivative. // S: Position // D: Velocity. /// <summary> /// Gets or sets the Position. /// </summary> public Vector2 X; // S: Position // D: Acceleration. /// <summary> /// Gets or sets the Velocity. /// </summary> public Vector2 V; } /// <summary> /// Calculates the force given the specified state. /// </summary> /// <param name="state">The state.</param> /// <param name="t">The time.</param> /// <param name="acceleration">The value that should be updated with the acceleration.</param> public delegate void EulerIntegrator(ref State state, float t, ref Vector2 acceleration); /// <summary> /// Represents the RK4 Integrator. /// </summary> public static class RK4 { private const float OneSixth = 1.0f / 6.0f; private static void Evaluate(EulerIntegrator integrator, ref State initial, float t, float dt, ref State derivative, ref State output) { var state = new State(); // These are a premature optimization. I like premature optimization. // So let's not concentrate on that. state.X.X = initial.X.X + derivative.X.X * dt; state.X.Y = initial.X.Y + derivative.X.Y * dt; state.V.X = initial.V.X + derivative.V.X * dt; state.V.Y = initial.V.Y + derivative.V.Y * dt; output = new State(); output.X.X = state.V.X; output.X.Y = state.V.Y; integrator(ref state, t + dt, ref output.V); } /// <summary> /// Performs RK4 integration over the specified state. /// </summary> /// <param name="eulerIntegrator">The euler integrator.</param> /// <param name="state">The state.</param> /// <param name="t">The t.</param> /// <param name="dt">The dt.</param> public static void Integrate(EulerIntegrator eulerIntegrator, ref State state, float t, float dt) { var a = new State(); var b = new State(); var c = new State(); var d = new State(); Evaluate(eulerIntegrator, ref state, t, 0.0f, ref a, ref a); Evaluate(eulerIntegrator, ref state, t + dt * 0.5f, dt * 0.5f, ref a, ref b); Evaluate(eulerIntegrator, ref state, t + dt * 0.5f, dt * 0.5f, ref b, ref c); Evaluate(eulerIntegrator, ref state, t + dt, dt, ref c, ref d); a.X.X = OneSixth * (a.X.X + 2.0f * (b.X.X + c.X.X) + d.X.X); a.X.Y = OneSixth * (a.X.Y + 2.0f * (b.X.Y + c.X.Y) + d.X.Y); a.V.X = OneSixth * (a.V.X + 2.0f * (b.V.X + c.V.X) + d.V.X); a.V.Y = OneSixth * (a.V.Y + 2.0f * (b.V.Y + c.V.Y) + d.V.Y); state.X.X = state.X.X + a.X.X * dt; state.X.Y = state.X.Y + a.X.Y * dt; state.V.X = state.V.X + a.V.X * dt; state.V.Y = state.V.Y + a.V.Y * dt; } } After reading over the tutorial I noticed a few things that just seemed 'out' to me. Notably how the entire simulation revolves around t at 0 and state at 0 - considering that we are working out a curve over the duration it seems logical that RK4 wouldn't be able to handle this simple scenario. Never-the-less I forged on and wrote a very simple Euler integrator: static void Integrator(ref State state, float t, ref Vector2 acceleration) { if (state.X.Y > 100 && state.V.Y > 0) { // Bounce vertically. acceleration.Y = -state.V.Y * t; } else { acceleration.Y = 9.8f; } } I then ran the code against a simple fixed-time step loop and this is what I got: 0.05 0.20 0.44 0.78 1.23 1.76 ... 74.53 78.40 82.37 86.44 90.60 94.86 99.23 103.05 105.45 106.94 107.86 108.42 108.76 108.96 109.08 109.15 109.19 109.21 109.23 109.23 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 109.24 ... As I said, I was expecting it to break - however I am unsure of how to fix it. I am currently looking into keeping the previous state and time, and working from that - although at the same time I assume that will defeat the purpose of RK4. How would I get this simulation to print the expected results?

    Read the article

  • C# function normal return value VS out or ref argument

    - by misha-r
    Hi People, I've got a method in c# that needs to return a very large array (or any other large data structure for that matter). Is there a performance gain in using a ref or out parameter instead of the standard return value? I.e. is there any performance or other gain in using void function(sometype input, ref largearray) over largearray function(sometype input) ? Thanks in advance!

    Read the article

  • SpriteBatch.end() generating null pointer exception

    - by odaymichael
    I am getting a null pointer exception using libGDX that the debugger points as the SpriteBatch.end() line. I was wondering what would cause this. Here is the offending code block, specifically the batch.end() line: batch.begin(); for (int j = 0; j < 3; j++) for (int i = 0; i < 3; i++) if (zoomgrid[i][j].getPiece().getImage() != null) zoomgrid[i][j].getPiece().getImage().draw(batch); batch.end(); The top of the stack is actually a line that calls lastTexture.bind(); In the flush() method of com.badlogic.gdx.graphics.g2d.SpriteBatch. I appreciate any input, let me know if I haven't included enough information.

    Read the article

  • Mouse pointer size problem

    - by Rasmus Pedersen
    My mouse cursor is double the normal size. Its only the default pointer that is enlarged. Variations like resize, busy and so on are the correct size. The problem persists even when I change cursor theme. If I move the cursor inside a Firefox window it changes to the correct size. My resolution is 2560x1440, its a single screen setup. Nvidia-settings reports my DPI to be: 108x107. I've tired to force that DPI in the LightDM conf, since I figured it must have something to-do with the DPI calculation. I have tried to change the cursor size through dconf but the problem still remains. I haven't seen this problem before, it arrived after the upgrade from Beta 2 to release version of Ubuntu 11.10. Anybody got any idea what the problem might be, its pretty annoying with the huge cursor.

    Read the article

  • Pointer initialization doubt

    - by Jestin Joy
    We could initialize a character pointer like this in C. char *c="test"; Where c points to the first character(t). But when I gave code like below. It gives segmentation fault. #include<stdio.h> #include<stdlib.h> main() { int *i; *i=0; printf("%d",*i); } But when I give #include<stdio.h> #include<stdlib.h> main() { int *i; i=(int *)malloc(2); *i=0; printf("%d",*i); } It works( gives output 0). Also when I give malloc(0), It also works( gives output 0). Please tell what is happening

    Read the article

  • Choppy/unresponsive keyboard and mouse pointer until suspend

    - by Stefan Thyberg
    I had a problem where my mouse and keyboard would be choppy, the mouse pointer would work at 1-2 fps and the keyboard would keep missing letters as I was typing them. Since they were both USB I suspected there was a problem there immediately. Whenever I got this problem I would suspend the computer and start it again and the problem would be gone. The problem started appearing when I plugged the mouse and keyboard directly into the computer rather than the USB hub in the screen. I'm using a Logitech UltraX Flat and a Razer Lachesis, but I'm not sure if that matters.

    Read the article

  • Choppy/unresponsive keyboard and mouse pointer until suspend

    - by Stefan Thyberg
    I had a problem where my mouse and keyboard would be choppy. The mouse pointer would work at "1-2 fps" and the keyboard would keep missing letters as i was typing them. Since both are USB-Devices, i suspected a problem there immediately, so whenever i got this problem, i would suspend the computer and start it again, for the problem to be gone. The problem started appearing when I plugged the mouse and keyboard directly into the computer rather than the USB-Hub in the screen. I'm using a Logitech UltraX Flat and a Razer Lachesis, on a Dell Latitude E6510.

    Read the article

  • Take Camera Phone Macro Photos with a Cheap Laser Pointer Lens

    - by Jason Fitzpatrick
    Inside those cheap laser pointers you see in the grocery store checkout line there’s a handy little plastic lens that, when slapped on your phone’s camera, makes it easy to take macro photographs. In this tutorial, they take the lens from a laser point and secure it using tape and a bobby pin. An alternative method to achieve the same end (and with a higher quality lens) is to dismantle a CD/DVD drive to source the lens and use painter’s tape to hold the lens in place–this is the technique I used several years ago, check out the tutorial video here. Laser Pointer Macro Lens [via Apartment Therapy] How to Get Pro Features in Windows Home Versions with Third Party Tools HTG Explains: Is ReadyBoost Worth Using? HTG Explains: What The Windows Event Viewer Is and How You Can Use It

    Read the article

  • Mouse pointer position to screen space

    - by Ylisar
    If I have a mouse pointer position in pixels of canvas, I can easily convert it to the -1..1 range for both X & Y by lerping by dividing with canvas dimensions. However, the problem is what I should put in Z & W if I want my screen space position to be on the near plane? The step afterwards would be for me to multiply by the inverse of view-projection to take me to world space, where I easily can construct a ray from the cameras world space position.

    Read the article

  • Rotate 2d sprite towards pointer

    - by Phil
    I'm using Crafty.js and am trying to point a sprite towards the mouse pointer. I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under unit tests). At least it responds that the degree between { 0,0} and {1,1} is 45, which seems right. However, when I set the sprite rotation to the returned degree, it's just wrong all the time. If I manually set it to 90, 45, etc, it gets the right direction.. I have a jsfiddle that shows what I've done so far. Any ideas?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >