Search Results

Search found 44 results on 2 pages for 'matias fidemraizer'.

Page 2/2 | < Previous Page | 1 2 

  • drag to pan on an UserControl

    - by Matías
    Hello, I'm trying to build my own "PictureBox like" control adding some functionalities. For example, I want to be able to pan over a big image by simply clicking and dragging with the mouse. The problem seems to be on my OnMouseMove method. If I use the following code I get the drag speed and precision I want, but of course, when I release the mouse button and try to drag again the image is restored to its original position. using System.Drawing; using System.Windows.Forms; namespace Testing { public partial class ScrollablePictureBox : UserControl { private Image image; private bool centerImage; public Image Image { get { return image; } set { image = value; Invalidate(); } } public bool CenterImage { get { return centerImage; } set { centerImage = value; Invalidate(); } } public ScrollablePictureBox() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); Image = null; AutoScroll = true; AutoScrollMinSize = new Size(0, 0); } private Point clickPosition; private Point scrollPosition; protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); clickPosition.X = e.X; clickPosition.Y = e.Y; } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { scrollPosition.X = clickPosition.X - e.X; scrollPosition.Y = clickPosition.Y - e.Y; AutoScrollPosition = scrollPosition; } } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.FillRectangle(new Pen(BackColor).Brush, 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height); if (Image == null) return; int centeredX = AutoScrollPosition.X; int centeredY = AutoScrollPosition.Y; if (CenterImage) { //Something not relevant } AutoScrollMinSize = new Size(Image.Width, Image.Height); e.Graphics.DrawImage(Image, new RectangleF(centeredX, centeredY, Image.Width, Image.Height)); } } } But if I modify my OnMouseMove method to look like this: protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { scrollPosition.X += clickPosition.X - e.X; scrollPosition.Y += clickPosition.Y - e.Y; AutoScrollPosition = scrollPosition; } } ... you will see that the dragging is not smooth as before, and sometimes behaves weird (like with lag or something). What am I doing wrong? I've also tried removing all "base" calls on a desperate movement to solve this issue, haha, but again, it didn't work. Thanks for your time.

    Read the article

  • What is the simplest and most impressive piece of jQuery code you've seen?

    - by Matias
    I think the question is clear enough, but I'd like to clarify it because it's subjective at some point and I don't want it closed. I want to see some short jQuery examples with awesome results (either from the user or from the programmer perspective), that would not be that easy using straight javascript without any library. I find this question useful to be aware how using jQuery simplifies your js code.

    Read the article

  • ASP.NET How expensive is it to call an Application Variable many times?

    - by Matias Nino
    The short of it is: Is it costly to check an Application Variable such as Application("WebAppName") more 10-20 times each time a page loads? Background: (feel free to critique) Some includes in my site contain many links and images which cannot use relative urls due to their inclusion in different paths. Hence these includes contain frequent instances of <img src="<%=Application("Webroot")%>images\image.gif"> Is it expensive to keep calling an Application variable like this? Should I just put the Application value in some local variable to use where needed? IMPORTANT NOTE: I need my webapp to run fine on a server whether it be in the root web ("/") or in a virtual subweb ("/app"). Thanks in advance for any wisdom shared.

    Read the article

  • WebClient.DownloadDataAsync is freezing my UI

    - by Matías
    Hi, I have in my Form constructor, after the InitializeComponent the following code: using (WebClient client = new WebClient()) { client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadDataAsync("http://example.com/version.txt"); } When I start my form, the UI doesn't appears till client_DownloadDataCompleted is raised. The client_DownloadDataCompleted method is empty, so there's no problem there. What I'm doing wrong? How is supposed to do this without freezing the UI? Thanks for your time. Best regards. FULL CODE: Program.cs using System; using System.Windows.Forms; namespace Lala { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } Form1.cs using System; using System.Net; using System.Windows.Forms; namespace Lala { public partial class Form1 : Form { WebClient client = new WebClient(); public Form1() { client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadDataAsync(new Uri("http://www.google.com")); InitializeComponent(); } void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { textBox1.Text += "A"; } } partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(12, 12); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(12, 41); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(468, 213); this.textBox1.TabIndex = 1; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(492, 266); this.Controls.Add(this.textBox1); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox textBox1; } }

    Read the article

  • Jquery .Filter Function Question

    - by Matias
    Hi Guys, This is kindof a simple question, however, I don´t seem to figure out how to do it: I´ve got a slider filtering some stuff $("#price").slider( { range: true, step: 5, change: function(e,ui) { $('total').filter(function(index) { return ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1))); }).parents('div.item').hide(); } }); Basically, I want an array with index of each of elements which have been filtered so I can reuse them for other purpose. I was thinking of editing filter function to something like: $('total').filter(function(index) { var matches = ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1))); return matches; }.myFunction(matches){ //do some stuff here with matched elements } This is not correct, your help is greatly appreciated.

    Read the article

  • Sometimes, scaling down a bitmap generates a bigger file. Why?

    - by Matías
    Hello, I'm trying to write a method to reduce the size of any image 50% each time is called but I've found a problem. Sometimes, I end up with a bigger filesize while the image is really just half of what it was. I'm taking care of DPI and PixelFormat. What else am I missing? Thank you for your time. public Bitmap ResizeBitmap(Bitmap origBitmap, int nWidth, int nHeight) { Bitmap newBitmap = new Bitmap(nWidth, nHeight, origBitmap.PixelFormat); newBitmap.SetResolution(origBitmap.HorizontalResolution, origBitmap.VerticalResolution); using (Graphics g = Graphics.FromImage((Image)newBitmap)) { g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(origBitmap, 0, 0, nWidth, nHeight); } return newBitmap; }

    Read the article

  • passing an array structure as an array

    - by Matias
    I'm having trouble passing a structure array as a parameter of a function struct Estructure{ int a; int b; }; and a funtion Begining(Estructure &s1[]) { //modifi the estructure s1 }; and the main would be something like this int main() { Estructure m[200]; Begining(m); }; is this valid?

    Read the article

  • PHP XMLREADER - QUESTION

    - by Matias
    Hi Guys, I am pretty new to xml parsing and I am using XMLREADER to parse a huge file. Given the following XML (sample): <hotels> <hotel> <name>Bla1</name> </hotel> <hotel> <name>Bla2</name> </hotel> </hotels> And then the XMLREADER in PHP which pulls up the values to my Database: $reader = new XMLReader(); $reader->open('hotels.xml'); while ($reader->read()) { if ($reader->name == "name") { $reader->read(); mysql_query("INSERT INTO MyHotels (hotelName) VALUES (\"$reader->value\")"); } } $reader->close(); The problem is that I've got a single empty row between each of the parsed nodes!! Not sure why this happens! | ID | hotelName | | 1 | Bla1 | | 2 | | | 3 | Bla2 | | 4 | | Help is greatly appreciated.

    Read the article

  • passing an array struture as an array

    - by Matias
    I'm having trouble passing a struture array as a parameter of a funtion struct Estructure{ int a; intb; }; and a funtion Begining(Estructure &s1[]) { //modifi the estructure s1 }; and the main would be something like this int main() { Estructure m[200]; Begining(m); }; is this valid?

    Read the article

  • Jquery to max number from a set of divs

    - by Matias
    Guys, Given the following HTML <div class"myclass">10</div> <div class"myclass">25</div> <div class"myclass">50</div> <div class"myclass">20</div> I want Jquery to return the maximum value found on divs with class:"myclass". (This is 50) I thought of using .find.text() will be a good starting point but cant figure out exactly how, Help is greatly appreciatted, Thanks

    Read the article

  • PHP+MYSQL Server Config

    - by Matias
    Hi guys, I am parsing an XML file with PHP and inserting the rows in a MYSQL database. I am using PHP simplexml_load_files to load the XML and a foreach to loop through the array and insert the rows into my database. It works perfectly fine with small files i am testing, but it comes to reality I need to parse a large 500mb XML file and nothing happens. I was wondering what was the right Php.ini config for this case ? I have a VPS Linux Cent OS, with 256 mb of dedicated Memory and MYSQL 5.0.5. I have also set php memory_limit = 256M (maximum of my server) Any suggestions, similar experiences will be greatly appreciated Thanks

    Read the article

  • Jquery Google Maps Problem

    - by Matias
    Here is the problem: Lets say a Jquery toggle button which loads a Google Map upon request and hides its later when toggled: $('#showmeMap').toggle(function() { var map = new GMap2($("#map").get(0)); var mapCenter = new GLatLng(-2, 20); map.setCenter(mapCenter, 12); $('#map').show(); } }, function() { $('#map').hide(); }); Then I add some random markers and later another function which removes markers from the map: $('#destroyMarkersButton').click(function() { for (var i=0; i<gmarkers.length; i++) { map.removeOverlay(gmarkers[i]); } }); When clicking on the button I´ve got the error Map is undefined. My thought was defining Google Map object globally: map = new GMap2($("#map").get(0)); Which works perfectly in Firefox, however, map fails to load on internet explorer!! Any suggestions ?

    Read the article

  • Patterns for avoiding jQuery silent fails

    - by Matias
    Is there any good practice to avoid your jQuery code silently fail? For example: $('.this #is:my(complexSelector)').doSomething(); I know that every time this line get executed, the selector is intended to match at least one element, or certain amount of elements. Is there any standard or good way to validate that? I thought about something like this: var $matchedElements = $('.this #is:my(complexSelector)'); if ($matchedElements.length < 0) throw 'No matched elements'; $matchedElements.doSomething(); Also I think unit testing would be a valid option instead of messing the code. My question may be silly, but I wonder whether there is a better option than the things that I'm currently doing or not. Also, maybe I'm in the wrong way checking if any element match my selector. However, as the page continues growing, the selectors could stop matching some elements and pieces of functionality could stop working inadvertently.

    Read the article

  • how to read a string from a \n delimited file

    - by Matias
    I'm trying to read a return delimited file. full of phrases. I'm trying to put each phrase into a string. The problem is that when I try to read the file with fscanf(file,"%50s\n",string); the string only contains one word. when it bumps with a space it stops reading the string

    Read the article

  • Deploy Java application on MacOSX (from a Windows system)

    - by Matías
    Hello, Here's the deal. I'm just starting with Java programming, I've made a simple application that uses SWT graphic library and I want to deploy it on a Mac (running the latest version of MacOS X). I did all the programming in my Windows 7 machine, so here are my questions: Q1) Can I make an executable file for MacOS X from my Windows machine? How? (I saw that it's possible to create .exe files on Windows, instead of using .jar; I want to do the same for the Mac, of course it won't be an .exe) Q2) If I export my project in Eclipse and I choose Runnable JAR File and then on Library Handling I pick Extract required libraries into generated JAR or Package required libraries into generated JAR I end up with a huge .JAR (about 15MB of size, my application consist in just a button on a Window and a tiny method that doesn't do much). Is that considered normal? Here's the list of libraries that my project appears to be using: Thanks in advance.

    Read the article

  • RUN 2012 Buenos Aires - Desarrollando para dispositivos móviles con HTML5 y ASP.NET

    - by MarianoS
    El próximo Viernes 23 de Marzo a las 8:30 hs en la Universidad Católica Argentina se realizará una nueva edición del Run en Buenos Aires, el evento Microsoft más importante del año. Particularmente, voy a estar junto con Rodolfo Finochietti e Ignacio Lopez presentando nuestra charla “Desarrollando para dispositivos móviles con HTML5 y ASP.NET” donde voy a presentar algunas novedades de ASP.NET MVC 4. Esta es la agenda completa de sesiones para Desarrolladores: Keynote: Un mundo de dispositivos conectados. Aplicaciones al alcance de tu mano: Windows Phone – Ariel Schapiro, Miguel Saez. Desarrollando para dispositivos móviles con HTML5 y ASP.NET – Ignacio Lopez, Rodolfo Finochietti, Mariano Sánchez. Servicios en la Nube con Windows Azure – Matias Woloski, Johnny Halife. Desarrollo Estilo Metro en Windows 8 – Martin Salias, Miguel Saez, Adrian Eidelman, Rubén Altman, Damian Martinez Gelabert. El evento es gratuito, con registro previo: http://bit.ly/registracionrunargdev

    Read the article

  • Google I/O 2012 - Android Design for Success

    Google I/O 2012 - Android Design for Success Rachel Garb, Jens Nagel, Nate Streu, Matias Duarte You have a great idea for an Android app. You want it to stand out among hundreds of thousands. You want your users to love it and tell everyone they know. The Android User Experience team is here to help. We'll talk about the Android Design guide and other tricks of the trade for creating apps that delight users and help them accomplish their goals. No design background is required. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 46 5 ratings Time: 01:03:04 More in Science & Technology

    Read the article

  • Access Control Service: Walkthrough Videos of Web Application, SOAP, REST and Silverlight Integration

    - by Your DisplayName here!
    Over the weekend I worked a little more on my ACS2 sample. Instead of writing it all down, I decided to quickly record four short videos that cover the relevant features and code. Have fun ;) Part 1 – Overview This video does a quick walkthrough of the solution and shows the web application part. This includes driving the sign in UI via JavaScript (thanks Matias) as well as the registration logic I wrote about here. watch Part 2 – SOAP Service and Client The sample app also exposes a WCF SOAP service. This video shows how to wire up the service to ACS and hows how to create a client that first requests a token from an IdP and then sends this token to ACS. watch Part 3 – REST Service and Client This part shows how to set up a WCF REST service that consumes SWT tokens from ACS. Unfortunately there is currently no standard WIF plumbing for REST. For the service integration I had to combine a lot of code from different sources (kzu, zulfiq) as well as the WIF SDK and OAuth CTPs together. But it is working. watch Part 4 – Silverlight and Web Identity Integration This part took by far the most time to write. The Silverlight Client shows ho to sign in to the application using a registered identity provider (including web identities) and using the resulting SWT token to call our REST service. This is designed to be a desktop (OOB) client application (thanks to Jörg for the UI magic). watch code download

    Read the article

< Previous Page | 1 2