Search Results

Search found 434 results on 18 pages for 'cos'.

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

  • JTextField that has inner fields or preformated format, something like the ip field in windows

    - by dimitar
    Hello guys, i want to create a text field that will be for date and will have dd.mm.YYYY format. Now what i want to do is the user to type only the numbers, not the dots to. So the field would be like: _ _. _ _ . _ _ _ _ So when the user wants to type the date: 15.05.2010 for example, he will only type the numbers in the sequence 15052010. Also i would like, when he preses on left or right arrow, the cursor to go from one field(not JTextField, but field in the JTextField). So lets say i have JTextField with text in it: 15.05.2010, so if user is on the beginning and he preses right arrow, the cursor to go to the .05 field. I hope you understand me 'cos right now i don't any idea how to make this, or at least how to look for it on google. Thank you.

    Read the article

  • IE 8 html parsing error message.

    - by user48408
    I'm experiencing the problem outlined in this kb article. http://support.microsoft.com/kb/927917 . Sorry I can't hyperlink cos i don't have enough points! "This problem occurs because a child container HTML element contains script that tries to modify the parent container element of the child container. The script tries to modify the parent container element by using either the innerHTML method or the appendChild method." The problem I'm having diagnosing the source of my problem is 2 fold: 1) This is only happening on some client machines (All are running IE8) and not others. How/Why only some? 2) I don't have any scripts which modify the innerHTML or call appendChild on any dom elements. I do have server side code which modify properties on asp .net server controls. (Essentially all thats happening is a panel control with some more controls is being made visbile or invisible on a button click), would these in turn then set the innerHTML property of the client rendered control(?)

    Read the article

  • Is there any valid reason radians are used as the inputs to trig function in many modern languages?

    - by johnmortal
    Is there any pressing reason trig functions should use radian inputs in modern programming languages? As far as I know radians are typically ugly to deal with except in three cases: (1) You want to compute an arc length and you know the angle of the arc and (2) You need to do symbolic calculus with trig functions (3) certain infinite series expansion look prettier if the input is in radians. None of these scenarios seem like a worthy justification for every programming language I am familiar with using radian inputs for Sin, Cos, Tangent, etc... The third one sounds good because it might mean one gets faster computations using radians (very slightly faster- the cost of one additional floating point multiplication ) , but I am dubious even of that because most commonly the developer had to take an extra step to put the angle in radians in the first place. The other two are ridiculous justifications for all the added obscurity.

    Read the article

  • Moving a Ball on iPhone

    - by Chandan Shetty SP
    I am using below formula to move the ball circular, where accelX and accelY are the values from accelerometer, it is working fine. But the problem in this code is mRadius(I fixed its value to 50), i need to change mRadius according to accelerometer values and also i need bouncing effect when it touches other circles please send your answers ASAP... I am waiting. float degrees = -atan2(accelX, accelY) * 180 / 3.14159; int x = cCentrePoint.x + mRadius * cos(degreesToRadians(degrees)); int y = cCentrePoint.y + mRadius * sin(degreesToRadians(degrees)); Here is the snap of the game i want to develop. http://iphront.com/wp-content/uploads/2009/12/bdece528ea334033.jpg.jpg

    Read the article

  • How to fix this Timer Tick Error in C#?

    - by Iman Hejazi
    I use this code to receive data from a internet address by a Timer in defined period of times. But when the timer ticks in second time an error will raised from this line: HttpWebResponse response = (HttpWebResponse)request.GetResponse(); I want to know how to fix this problem. Timer Interval: 30secs private void timer1_Tick(object sender, EventArgs e) { WebRequest request = WebRequest.Create("http://localhost/go/online.asp?prog=y&rln=" + Properties.Settings.Default.cos); request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); reader.Close(); dataStream.Close(); response.Close(); }

    Read the article

  • Why might different computers calculate different arithmetic results in VB.NET?

    - by Eyal
    I have some software written in VB.NET that performs a lot of calculations, mostly extracting jpegs to bitmaps and computing calculations on the pixels like convolutions and matrix multiplication. Different computers are giving me different results despite having identical inputs. What might be the reason? Edit: I can't provide the algorithm because it's proprietary but I can provide all the relevant operations: ULong \ ULong (Turuncating division) Bitmap.Load("filename.bmp') (Load a bitmap into memory) Bitmap.GetPixel(Integer, Integer) (Get a pixel's brightness) Double + Double Double * Double Math.Sqrt(Double) Math.PI Math.Cos(Double) ULong - ULong ULong * ULong ULong << ULong List.OrderBy(Of Double)(Func) Hmm... Is it possible that OrderBy is using a non-stable QuickSort and that QuickSort is using a random pivot? Edit: Just tested, nope. The sort is stable.

    Read the article

  • C# animation - move object from A to B or by angle

    - by Nullstr1ng
    Hi am just doing a little animation which moves an object from point a to point b or by angle/radians. what I currently have is this Point CalcMove(Point pt, double angle, int speed) { Point ret = pt; ret.X = (int)(ret.X + speed * Math.Sin(DegToRad(angle))); ret.Y = (int)(ret.Y + speed * Math.Cos(DegToRad(angle))); return ret; } but it doesn't look what i expected. please help? update: oh and am using NETCF

    Read the article

  • Corporate Environment [closed]

    - by aloneguid
    How do you guys live in corporate environment? Especially talk to each other (developer to developer). I find it extremely hard as any question goes to "please book a meeting for that". Sometimes I get a chance to ask sb sth on the kitchen but that's it. Booked meetings are just stupidest thing ever, 'cos people talk about nothing specific and you have to wait days for them to happen. Weekly "scrums" are even more stupid as they usually take about 10 mins and you could do the same in 1 minute by email, no useful info or communication et all. All that leads to zero understanding of the product, no connection to customers, development in own isolated cubible, throwing out most of your code because that's not what was needed and you never know what the product is really aimed to do. Sad :(

    Read the article

  • Function to get X, Y position of an object orbiting a point, given a distance and angle in radians?

    - by Jake Petroules
    I am trying to code a function for a camera that orbits a point. Assume a 3d coordinate plane where Z is up. Ignore Z. Let's say the camera's position starts at (0, 0, z). The object to orbit is at, say (50, 50, z). So we have a distance of ~70 units. Calling the function with {(50, 50, z), 70, x} where x is the position in orbit, in radians, should return where the position of the camera should be. I believe this involves cos and tan but my trig isn't that great... point3d getCameraPosition(point3d objectPosition, float distance, float rotationRadians) { // ??? }

    Read the article

  • Net Neutrality FAIL [closed]

    - by leeand00
    I know I'll get into all kinds of trouble for bringing this up on SO, but considering that nearly all of us programmers depend on the Internet to get our jobs done, I really think it's worth looking into today's failure of our right to use the Internet by way of Lobbying ISPs. Although something tells me there will be retribution for the actions of the ISPs/tel cos/cable and their lobbyist since, lets face it...ISPs/Telcos didn't invent the Internet. I'm not going to be the one to do it, but um I think somebody already has...as everybody I talked to was having Internet connection problems today at work. Just thought this might be relevant to all of our jobs...in the U.S.A. at least. If you work at an Big evil ISPs, by all means...try and close this question. If you don't...and your just a chap who enjoys your Internet access...please RT this: Contact The Democrats Who Are Against Net Neutrality (Full List W/ Contact Info) http://bit.ly/aMSV0W #NetNeutralityFAIL net-neutrality

    Read the article

  • Improving the join of two wave file?

    - by kaki
    I have written a code for joining two wave files.It works fine when i am joining larger segments but as i need to join very small segments the clarity is not good. I have learned that the signal processing technique such a windowed join can be used to improve the joining of file. y[n] = w[n]s[n] Multiply value of signal at sample number n by the value of a windowing function hamming window w[n]= .54 - .46*cos(2*Pi*n)/L 0 I am not understanding how to get the value to signal at sample n and how to implement this?? the code i am using for joining is import wave m=['C:/begpython/S0001_0002.wav', 'C:/begpython/S0001_0001.wav'] i=1 a=m[i] infiles = [a, "C:/begpython/S0001_0002.wav", a] outfile = "C:/begpython/S0001_00367.wav" data= [] data1=[] for infile in infiles: w = wave.open(infile, 'rb') data1=[w.getnframes] data.append( [w.getparams(), w.readframes(w.getnframes())] ) #data1 = [ord(character) for character in data1] #print data1 #data1 = ''.join(chr(character) for character in data1) w.close() output = wave.open(outfile, 'wb') output.setparams(data[0][0]) output.writeframes(data[0][1]) output.writeframes(data[1][1]) output.writeframes(data[2][1]) output.close()

    Read the article

  • Rectangle Rotation in Python/Pygame

    - by mramazingguy
    Hey I'm trying to rotate a rectangle around its center and when I try to rotate the rectangle, it moves up and to the left at the same time. Does anyone have any ideas on how to fix this? def rotatePoint(self, angle, point, origin): sinT = sin(radians(angle)) cosT = cos(radians(angle)) return (origin[0] + (cosT * (point[0] - origin[0]) - sinT * (point[1] - origin[1])), origin[1] + (sinT * (point[0] - origin[0]) + cosT * (point[1] - origin[1]))) def rotateRect(self, degrees): center = (self.collideRect.centerx, self.collideRect.centery) self.collideRect.topleft = self.rotatePoint(degrees, self.collideRect.topleft, center) self.collideRect.topright = self.rotatePoint(degrees, self.collideRect.topright, center) self.collideRect.bottomleft = self.rotatePoint(degrees, self.collideRect.bottomleft, center) self.collideRect.bottomright = self.rotatePoint(degrees, self.collideRect.bottomright, center)

    Read the article

  • vba excel: do something every time a certain variable is changed

    - by every_answer_gets_a_point
    im doing a bunch of stuff to the variable St For i = 1 To 30000 Randomize e1 = Rnd e2 = Rnd z1 = Sqr(-2 * Log(e1)) * Cos(2 * 3.14 * e2) z2 = Sqr(-2 * Log(e1)) * Sin(2 * 3.14 * e2) St = So * Exp((r - (sigma ^ 2) / 2) * T + sigma * Sqr(T) * z1) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T - sigma * Sqr(T) * z1) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T + sigma * Sqr(T) * z2) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T - sigma * Sqr(T) * z2) C = C + Application.WorksheetFunction.Max(St - K, 0) Next i how do i get notified every time the variable changes?

    Read the article

  • Why is sqrt() not a method on Float?

    - by KaptajnKold
    In Ruby everything is an object. That's why I don't understand why we have the Math module. It seems to me that most (all?) of the functions in the Math module should have been methods on the numeric types like Integer, Float and so on. E.g. instead of Math.sqrt(5) it would make more sense to have 5.sqrt The same goes for sin, cos, tan, log10 and so on. Does anyone know why all these functions ended up in the Math module?

    Read the article

  • LWJGL Circle program create's an oval-like shape

    - by N1ghtk1n9
    I'm trying to draw a circle in LWJGL, but when I draw I try to draw it, it makes a shape that's more like an oval rather than a circle. Also, when I change my circleVertexCount 350+, the shape like flips out. I'm really not sure how the code works that creates the vertices(I have taken Geometry and I know the basic trig ratios). I haven't really found that good of tutorials on creating circles. Here's my code: public class Circles { // Setup variables private int WIDTH = 800; private int HEIGHT = 600; private String title = "Circle"; private float fXOffset; private int vbo = 0; private int vao = 0; int circleVertexCount = 300; float[] vertexData = new float[(circleVertexCount + 1) * 4]; public Circles() { setupOpenGL(); setupQuad(); while (!Display.isCloseRequested()) { loop(); adjustVertexData(); Display.update(); Display.sync(60); } Display.destroy(); } public void setupOpenGL() { try { Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); Display.setTitle(title); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(-1); } glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } public void setupQuad() { float r = 0.1f; float x; float y; float offSetX = 0f; float offSetY = 0f; double theta = 2.0 * Math.PI; vertexData[0] = (float) Math.sin(theta / circleVertexCount) * r + offSetX; vertexData[1] = (float) Math.cos(theta / circleVertexCount) * r + offSetY; for (int i = 2; i < 400; i += 2) { double angle = theta * i / circleVertexCount; x = (float) Math.cos(angle) * r; vertexData[i] = x + offSetX; } for (int i = 3; i < 404; i += 2) { double angle = Math.PI * 2 * i / circleVertexCount; y = (float) Math.sin(angle) * r; vertexData[i] = y + offSetY; } FloatBuffer vertexBuffer = BufferUtils.createFloatBuffer(vertexData.length); vertexBuffer.put(vertexData); vertexBuffer.flip(); vao = glGenVertexArrays(); glBindVertexArray(vao); vbo = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER,vertexBuffer, GL_STATIC_DRAW); glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); } public void loop() { glClear(GL_COLOR_BUFFER_BIT); glBindVertexArray(vao); glEnableVertexAttribArray(0); glDrawArrays(GL_TRIANGLE_FAN, 0, vertexData.length / 2); glDisableVertexAttribArray(0); glBindVertexArray(0); } public static void main(String[] args) { new Circles(); } private void adjustVertexData() { float newData[] = new float[vertexData.length]; System.arraycopy(vertexData, 0, newData, 0, vertexData.length); if(Keyboard.isKeyDown(Keyboard.KEY_W)) { fXOffset += 0.05f; } else if(Keyboard.isKeyDown(Keyboard.KEY_S)) { fXOffset -= 0.05f; } for(int i = 0; i < vertexData.length; i += 2) { newData[i] += fXOffset; } FloatBuffer newDataBuffer = BufferUtils.createFloatBuffer(newData.length); newDataBuffer.put(newData); newDataBuffer.flip(); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferSubData(GL_ARRAY_BUFFER, 0, newDataBuffer); glBindBuffer(GL_ARRAY_BUFFER, 0); } } 300 Vertex Count(This is my main problem) 400 Vertex Count - I removed this image, it's bugged out, should be a tiny sliver cut out from the right, like a secant 500 Vertex Count Each 100, it removes more and more of the circle, and so on.

    Read the article

  • Python win32api not moving mouse cursor in VirtualBox

    - by wes
    I'm trying to use this Python code: import math for i in xrange(500): x = 500 + math.sin(math.pi * i / 100) * 500 y = 500 + math.cos(i) * 100 x, y = int(x), int(y) win32api.SetCursorPos((x, y)) time.sleep(.01) taken from here to move the mouse cursor in an XP VirtualBox. The mouse icon will flicker to the appropriate graphic (when it hits the edge of a window it turns into the <- resize image, for instance), but it doesn't actually move the visible cursor. I can move the mouse around while the code is running. Same result using the ctypes example in the above link. It works fine in the Win7 host. I have Guest Additions installed, if that matters.

    Read the article

  • Unit testing a controller in ASP.NET MVC 3

    - by Abdullah Al- Mansur
    public Double Invert(Double? id) { return (Double)(id / id); } I have done this for this test but fails please can anyone help with this cos just started with unit testing /* HINT: Remember that you are passing Invert an *integer* so * the value of 1 / input is calculated using integer arithmetic. * */ //Arrange var controller = new UrlParameterController(); int input = 7; Double expected = 0.143d; Double marginOfError = 0.001d; //Act var result = controller.Invert(input); //Assert Assert.AreEqual(expected, result, marginOfError); /* NOTE This time we use a different Assert.AreEqual() method, which * checks whether or not two Double values are within a specified * distance of one another. This is a good way to deal with rounding * errors from floating point arithmetic. Without the marginOfError * parameter the assertion fails. * */

    Read the article

  • How to create plots in multiple windows and keep them seperate in R

    - by PaulHurleyuk
    Hello SOers, I'm sure this is an easy problem, but my google / help foo has failed me, so it's up to you. I have an R script that generates several plots, and I want to view all the plots on screen at once (in seperate windows), but I can't work out how to open multiple graphics windows. I'm using ggplot2, but I feel this is a more basic problem, so I'm just using base grapics for this simple example x<-c(1:10) y<-sin(x) z<-cos(x) dev.new() plot(y=y,x=x) dev.off() dev.new() plot(x=x,y=z) But this doesn't work. I'm on Windows if this matters (Windows + Eclipse + StatEt)

    Read the article

  • [Flash 3d engine] Away3d and events (Basic questions)

    - by Simon
    I'd like to play around 3d in Flash and I'm wondering how sophisticated objects can i load from 3D Max... cos as i read it's possible to load something from 3d Max I've read that popular 3d engine is Away3d (many tutorials), so if there is nothing better... i'd like to focus on it. I've forgot to mention that i'm not familar with Flash, but the best way to learn something is to do something interesting with it... :) Main question: Can I load object from 3ds and link parts of this object to some actions in Flash. Better example: I'd like to load a Car and when user click on car's door i'd like to show some informations, about those door, or pass this event outside for example to any other application in PHP, Java etc... and when he click on car mask i'd like to raise other event... Is it possible to create such interaction?? Thx in advance :)

    Read the article

  • Can functions like sin() be redefined, in Fortran, C or Java?

    - by EOL
    Can a mathematical function like sin() be redefined, in Fortran, C or Java code, while preserving the default behavior of other mathematical functions like cos()? Or can another function named sin() but that accepts different argument types be defined in addition to the built-in sin()? I am interested in general features of these languages (I am thinking of applications like the implementation of non-usual number algebras). I tried to define a sin() function in a Fortran 95 program, but the intrinsic sin() function was called instead… Is there a way around this? what about C and Java?

    Read the article

  • Margin adjustments when using ggplot's geom_tile()

    - by chris_dubois
    From the documentation for ggplot2's geom_tile() function, we have the following simple plot: > # Generate data > pp <- function (n,r=4) { + x <- seq(-r*pi, r*pi, len=n) + df <- expand.grid(x=x, y=x) + df$r <- sqrt(df$x^2 + df$y^2) + df$z <- cos(df$r^2)*exp(-df$r/6) + df + } > p <- ggplot(pp(20), aes(x=x,y=y)) > > p + geom_tile() How do I remove the margins that border the tile?

    Read the article

  • streaming to correct network interface

    - by robin hood
    I have IP cam that supports RTSP streaming. It's connected to router with 2 network cards with IP1 and IP2 addresses. I make 2 connections to IP cam by IP1 and IP2 addresses from the same IP and I need to receive corresponding streams thru correct network card, but both streams (RTP over UDP) go thru IP1. How this can be resolved? I don't know if RTSP server binds UDP sockets to corresponding IP and I don't know what IP stack is in IP cam (weak end system or strong end system). I haven't found anything interesting in router configuration. As I understand, routing table cannot help me cos I'm connected from the same IP, is it right? Also Sorry for incomplete info but it's all I have at the moment. Thanks for your time.

    Read the article

  • HTML J2ME Problem

    - by Hesham
    i'm trying to put large amount of data in a java me application for a BlackBerry mobile and i noticed that the max file size to be accepted in BlackBerry is 150 KB, by the way i'm developping the application in arabic language so i'm converting every litter to his corresponding unicode so every char gets to 6 chars so its another big problem, some ppl told me that i can write arabic as arabic letters without the need to write its unicode, by viewing the mobile form as an html page, my problem is that i dont know how to view the page as html page and what is XMLParser ?? can anyone help me to get all this together, cos i really need some serious help thank you alot Hesham

    Read the article

  • how to configure IP cam to stream using right network card?

    - by robin hood
    I have IP cam that supports RTSP streaming. It's connected to router with 2 network cards with IP1 and IP2 addresses. I make 2 connections to IP cam by IP1 and IP2 addresses from the same IP and I need to receive corresponding streams thru correct network card, but both streams (RTP over UDP) go thru IP1. How this can be resolved? I don't know if RTSP server binds UDP sockets to corresponding IP and I don't know what IP stack is in IP cam (weak end system or strong end system). I haven't found anything interesting in router configuration. As I understand, routing table cannot help me cos I'm connected from the same IP, is it right? Also Sorry for incomplete info but it's all I have at the moment. Thanks for your time.

    Read the article

  • Questions Regarding Handling of Received SMS

    - by Edwin
    Hi, i have managed to successfully write a little test app that can receive and send SMS, but got a couple of questions. (That's 'cos part of the code i copied from elsewhere and i would like to understand better). In my AndroidManifest as well as the sub-class of BroadcastReceiver, there is reference to the string literal "android.provider.Telephony.SMS_RECEIVED". However, i couldn't find any reference in the API that mentions this. Could someone point me to some reference that lists/explains these? As part of getting the message from the Intent, i did this: Object[] pdus = (Object[]) intent.getExtras().get("pdus"); Again this question is related to the use of hardcoded string literal. Where is the string "pdus" listed and described? Thanks in advance!

    Read the article

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