Search Results

Search found 6 results on 1 pages for 'sorina'.

Page 1/1 | 1 

  • iPhone/iPod receive messages from C# tcpip server using CocoaAsyncSocket

    - by SorinA.
    Hello, i'm trying to send/receive data over wifi to an iphone/ipodtouch app from a C# tcpip server. for this i used cocoaAsyncSocket from the google project. If i push a button and i send a request from ipod to server it returns the requested data(song title for example)..i want to know every second what song is playng...so from C# server i send at intervals of 1 second messages to my app. In my app in an timer with the interval of 1 second i call the asyncSocket read readDataWithTimeout method. My problem is that after 8-9 seconds that method is not called anymore. The connection to the server is still active and the C# server still sends data.. what i want to do is the following thing: - winamp plays a song - C# server asks winamp what songs is he playing and sends the song title to my app. - iphone app receives the data and displays it i don't know why the readDataWithTimeout method is not called anymore after a short period of time..Maybe because the short time between messages sent by the C# server? Thank you, Sorin

    Read the article

  • Changing UITableViewCell textLabel background color to clear

    - by SorinA.
    In my app i have a table view with customViewCells. i subclassed the UITableViewCell class and added an image that will load async and for the text i use cell.textLabel.text = @"someThext". for the cells the background color is set alternatively to [UIColor darkGrayColor] and whitecolor. When i run the app in the simulator and on the pone the textLabel of the cell has the background white. I want to set it to be clear, because i want the background color of the cell to be full not a strip then white then another strip. in the init method of my custom cell i added hoping that the white will turn into red but it doesn't have any effect. [self.textLabel setBackgroundColor:[UIColor redColor]]; i tried also self.textLabel.backgroundColor = [UIColor redColor]; but this also didn't work...if i add a UILabel as a subview the background color of the label can be set..but i don't want to do that because when i rotate the phone i want my labels to auto enlarge... any ideas why setting the background color of cell.textLabel doesn't work? thank you

    Read the article

  • How to make an MKAnnotationView to bounce?

    - by SorinA.
    I have an application that uses the MapKit. I have a map and on it some custom pins(i changed the classic pin image with another image). In my app i have a list with the locations corespondent to the pins on my map. if i select a location from the list i want to make the corresponding pin to bounce(2-3 bounces). is there any way to do such an animation?

    Read the article

  • After drawing circles on C# form how can i know on what circle i clicked?

    - by SorinA.
    I have to represent graphically an oriented graph like in the image below. i have a C# form, when i click with the mouse on it i have to draw a node. If i click somewhere on the form where is not already a node drawn it means i cliked with the intetion of drawing a node, if it is a node there i must select it and memorize it. On the next mouse click if i touch a place where there is not already a node drawn it means like before that i want to draw a new node, if it is a node where i clicked i need to draw the line from the first memorized node to the selected one and add road cost details. i know how to draw the circles that represent the nodes of the graph when i click on the form. i'm using the following code: namespace RepGraficaAUnuiGraf { public partial class Form1 : Form { Graphics graphDrawingArea; Bitmap bmpDrawingArea; Graphics graph; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { bmpDrawingArea = new Bitmap(Width, Height); graphDrawingArea = Graphics.FromImage(bmpDrawingArea); graph = Graphics.FromHwnd(this.Handle); } private void Form1_Click(object sender, EventArgs e) { DrawCentralCircle(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y, 15); graph.DrawImage(bmpDrawingArea, 0, 0); } void DrawCentralCircle(int CenterX, int CenterY, int Radius) { int start = CenterX - Radius; int end = CenterY - Radius; int diam = Radius * 2; bmpDrawingArea = new Bitmap(Width, Height); graphDrawingArea = Graphics.FromImage(bmpDrawingArea); graphDrawingArea.DrawEllipse(new Pen(Color.Blue), start, end, diam, diam); graphDrawingArea.DrawString("1", new Font("Tahoma", 13), Brushes.Black, new PointF(CenterX - 8, CenterY - 10)); } } } My question is how can i find out if at the coordinates (x,y) on my form i drew a node and which one is it? I thought of representing the nodes as buttons, having a tag or something similar as the node number(which in drawing should be 1 for Santa Barbara, 2 for Barstow etc.)

    Read the article

  • How to determine edges in an images optimally?

    - by SorinA.
    I recently was put in front of the problem of cropping and resizing images. I needed to crop the 'main content' of an image for example if i had an image similar to this: the result should be an image with the msn content without the white margins(left& right). I search on the X axis for the first and last color change and on the Y axis the same thing. The problem is that traversing the image line by line takes a while..for an image that is 2000x1600px it takes up to 2 seconds to return the CropRect = x1,y1,x2,y2 data. I tried to make for each coordinate a traversal and stop on the first value found but it didn't work in all test cases..sometimes the returned data wasn't the expected one and the duration of the operations was similar.. Any idea how to cut down the traversal time and discovery of the rectangle round the 'main content'? public static CropRect EdgeDetection(Bitmap Image, float Threshold) { CropRect cropRectangle = new CropRect(); int lowestX = 0; int lowestY = 0; int largestX = 0; int largestY = 0; lowestX = Image.Width; lowestY = Image.Height; //find the lowest X bound; for (int y = 0; y < Image.Height - 1; ++y) { for (int x = 0; x < Image.Width - 1; ++x) { Color currentColor = Image.GetPixel(x, y); Color tempXcolor = Image.GetPixel(x + 1, y); Color tempYColor = Image.GetPixel(x, y + 1); if ((Math.Sqrt(((currentColor.R - tempXcolor.R) * (currentColor.R - tempXcolor.R)) + ((currentColor.G - tempXcolor.G) * (currentColor.G - tempXcolor.G)) + ((currentColor.B - tempXcolor.B) * (currentColor.B - tempXcolor.B))) > Threshold)) { if (lowestX > x) lowestX = x; if (largestX < x) largestX = x; } if ((Math.Sqrt(((currentColor.R - tempYColor.R) * (currentColor.R - tempYColor.R)) + ((currentColor.G - tempYColor.G) * (currentColor.G - tempYColor.G)) + ((currentColor.B - tempYColor.B) * (currentColor.B - tempYColor.B))) > Threshold)) { if (lowestY > y) lowestY = y; if (largestY < y) largestY = y; } } } if (lowestX < Image.Width / 4) cropRectangle.X = lowestX - 3 > 0 ? lowestX - 3 : 0; else cropRectangle.X = 0; if (lowestY < Image.Height / 4) cropRectangle.Y = lowestY - 3 > 0 ? lowestY - 3 : 0; else cropRectangle.Y = 0; cropRectangle.Width = largestX - lowestX + 8 > Image.Width ? Image.Width : largestX - lowestX + 8; cropRectangle.Height = largestY + 8 > Image.Height ? Image.Height - lowestY : largestY - lowestY + 8; return cropRectangle; } }

    Read the article

  • How to determine edges in an image optimally?

    - by SorinA.
    I recently was put in front of the problem of cropping and resizing images. I needed to crop the 'main content' of an image for example if i had an image similar to this: the result should be an image with the msn content without the white margins(left& right). I search on the X axis for the first and last color change and on the Y axis the same thing. The problem is that traversing the image line by line takes a while..for an image that is 2000x1600px it takes up to 2 seconds to return the CropRect = x1,y1,x2,y2 data. I tried to make for each coordinate a traversal and stop on the first value found but it didn't work in all test cases..sometimes the returned data wasn't the expected one and the duration of the operations was similar.. Any idea how to cut down the traversal time and discovery of the rectangle round the 'main content'? public static CropRect EdgeDetection(Bitmap Image, float Threshold) { CropRect cropRectangle = new CropRect(); int lowestX = 0; int lowestY = 0; int largestX = 0; int largestY = 0; lowestX = Image.Width; lowestY = Image.Height; //find the lowest X bound; for (int y = 0; y < Image.Height - 1; ++y) { for (int x = 0; x < Image.Width - 1; ++x) { Color currentColor = Image.GetPixel(x, y); Color tempXcolor = Image.GetPixel(x + 1, y); Color tempYColor = Image.GetPixel(x, y + 1); if ((Math.Sqrt(((currentColor.R - tempXcolor.R) * (currentColor.R - tempXcolor.R)) + ((currentColor.G - tempXcolor.G) * (currentColor.G - tempXcolor.G)) + ((currentColor.B - tempXcolor.B) * (currentColor.B - tempXcolor.B))) > Threshold)) { if (lowestX > x) lowestX = x; if (largestX < x) largestX = x; } if ((Math.Sqrt(((currentColor.R - tempYColor.R) * (currentColor.R - tempYColor.R)) + ((currentColor.G - tempYColor.G) * (currentColor.G - tempYColor.G)) + ((currentColor.B - tempYColor.B) * (currentColor.B - tempYColor.B))) > Threshold)) { if (lowestY > y) lowestY = y; if (largestY < y) largestY = y; } } } if (lowestX < Image.Width / 4) cropRectangle.X = lowestX - 3 > 0 ? lowestX - 3 : 0; else cropRectangle.X = 0; if (lowestY < Image.Height / 4) cropRectangle.Y = lowestY - 3 > 0 ? lowestY - 3 : 0; else cropRectangle.Y = 0; cropRectangle.Width = largestX - lowestX + 8 > Image.Width ? Image.Width : largestX - lowestX + 8; cropRectangle.Height = largestY + 8 > Image.Height ? Image.Height - lowestY : largestY - lowestY + 8; return cropRectangle; } }

    Read the article

1