Daily Archives

Articles indexed Friday April 2 2010

Page 15/105 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Scaling an image using the mouse in C#

    - by Gaax
    Hey guys... I'm trying to use the position of the mouse to calculate the scaling factor for scaling an image. Basically, the further you get away from the center of the image, the bigger it gets; and the closer to the center you get, the smaller it gets. I have some code so far but it's acting really strange and I have absolutely no more ideas. First I'll let you know, one thing I was trying to do is average out 5 distances to get a more smooth resize animation. Here's my code: private void pictureBoxScale_MouseMove(object sender, MouseEventArgs e) { if (rotateScaleMode && isDraggingToScale) { // For Scaling int sourceWidth = pictureBox1.Image.Width; int sourceHeight = pictureBox1.Image.Height; float dCurrCent = 0; // distance between the current mouse pos and the center of the image float dPrevCent = 0; // distance between the previous mouse pos and the center of the image System.Drawing.Point imgCenter = new System.Drawing.Point(); imgCenter.X = pictureBox1.Location.X + (sourceWidth / 2); imgCenter.Y = pictureBox1.Location.Y + (sourceHeight / 2); // Calculating the distance between the current mouse location and the center of the image dCurrCent = (float)Math.Sqrt(Math.Pow(e.X - imgCenter.X, 2) + Math.Pow(e.Y - imgCenter.Y, 2)); // Calculating the distance between the previous mouse location and the center of the image dPrevCent = (float)Math.Sqrt(Math.Pow(prevMouseLoc.X - imgCenter.X, 2) + Math.Pow(prevMouseLoc.Y - imgCenter.Y, 2)); if (smoothScaleCount < 5) { dCurrCentSmooth[smoothScaleCount] = dCurrCent; dPrevCentSmooth[smoothScaleCount] = dPrevCent; } if (smoothScaleCount == 4) { float currCentSum = 0; float prevCentSum = 0; for (int i = 0; i < 4; i++) { currCentSum += dCurrCentSmooth[i]; } for (int i = 0; i < 4; i++) { prevCentSum += dPrevCentSmooth[i]; } float scaleAvg = (currCentSum / 5) / (prevCentSum / 5); int destWidth = (int)(sourceWidth * scaleAvg); int destHeight = (int)(sourceHeight * scaleAvg); // If statement is for limiting the size of the image if (destWidth > (currentRotatedImage.Width / 2) && destWidth < (currentRotatedImage.Width * 3) && destHeight > (currentRotatedImage.Height / 2) && destWidth < (currentRotatedImage.Width * 3)) { AForge.Imaging.Filters.ResizeBilinear resizeFilter = new AForge.Imaging.Filters.ResizeBilinear(destWidth, destHeight); pictureBox1.Image = resizeFilter.Apply((Bitmap)currentRotatedImage); pictureBox1.Size = pictureBox1.Image.Size; pictureBox1.Refresh(); } smoothScaleCount = -1; } prevMouseLoc = e.Location; currentScaledImage = pictureBox1.Image; smoothScaleCount++; } }

    Read the article

  • How does one decrypt a PDF with an owner password, but no user password?

    - by Tony Meyer
    Although the PDF specification is available from Adobe, it's not exactly the simplest document to read through. PDF allows documents to be encrypted so that either a user password and/or an owner password is required to do various things with the document (display, print, etc). A common use is to lock a PDF so that end users can read it without entering any password, but a password is required to do anything else. I'm trying to parse PDFs that are locked in this way (to get the same privileges as you would get opening them in any reader). Using an empty string as the user password doesn't work, but it seems (section 3.5.2 of the spec) that there has to be a user password to create the hash for the admin password. What I would like is either an explanation of how to do this, or any code that I can read (ideally Python, C, or C++, but anything readable will do) that does this so that I can understand what I'm meant to be doing. Standalone code, rather than reading through (e.g.) the gsview source, would be best.

    Read the article

  • Clustering and DB Replication in virtualized (and cloud) environments

    - by devdude
    Both replication and clustering are terms for servers setups with physical (real) servers, usually implemented on a DB or AS level. Now the question: In a virtualized environment with "easy" scalable servers (touching clustering) and a higher availability (DB replication) through the means of high availability of the virtual server by the cloudserver provider, do we really need replication and clustering (as in covering the problems of traditional servers) ? Question is asked from a soultion/application provider viewpoint. Please exclude the need of replication with a business requirement background, eg. the need to replicate a DB at 2 different geographical locations to ensure performance and data. Thanks for your insights !

    Read the article

  • Filter subform using combobox

    - by TT1611
    This has taken me nearly 2 weeks and I dont know what else to do. I have a main form (UserSearch) that has a subform (TestUserSub). The associated table for both forms is tblusers. very simple; on the main form (UserSearch) I have a comboboxes associated with the fields in the tblusers eg cmbid, cmbname, cmbdept and so on. All I want, is for a user to make a selection from any of these comboboxes and for the associated fields to display in the subform (TestUserSub). I have tried several different versions of code in the afterupdate event in a couple of the comboboxes and nothing is happening in the subform or in other instances I get error message. One example i have tried is filtering running an SQL command Private Sub cmbid_AfterUpdate() Dim strSQL As String If IsNull(Me.cmbaccess) Then Me.RecordSource = "tblusers" Else strSQL = "SELECT tblUsers.[Team Member_ID] FROM tblUsers " & _ "WHERE (((tblUsers.[Team Member_ID])= " & [form_testusersub].[txtid2]))& ";" Me.RecordSource = strSQL End If End Sub The above didnt work..Can someone please help me with this. I have a sample database that i have been working off and by some very strange way, they have managed to do this same thing without calling any code. Is this possible?

    Read the article

  • Is there any way to monitor the number of CAS stackwalks that are occurring?

    - by Anonymous
    I'm working with a time sensitive desktop application that uses p/invoke extensively, and I want to make sure that the code is not wasting a lot of time on CAS stackwalks. I have used the SuppressUnmanagedCodeSecurity attribute where I think it is necessary, but I might have missed a few places. Does anyone know if there is a way to monitor the number of CAS stackwalks that are occurring, and better yet pinpoint the source of the security demands?

    Read the article

  • Where does _CrtDbgReportW ouput in Windows Mobile?

    - by Ignas Limanauskas
    I am using ASSERTE macro to check for pre-conditions. According to its definition it is using ASSERT_BASE, which in turn calls _CrtDbgReportW to print out the message. Where does _CrtDbgReportW output goes to? I would assume that if the application is started from debugger, it would go to debugger window. Where would the messages go if it is not under debugger?

    Read the article

  • Using VB6 to search for existence of DataFile in Outlook

    - by Graeme
    Hi, I am wanting to write an Add-In for Outlook 2003 which, when Outlook is opened, search for the existence of a datafile called DMSDataStore and if it doesn't exist will install the datafile. I have managed to create the Add-In using VB6 and it runs when I open Outlook. However I haven't found the best/easiest way to search for the existence of the datafile. If the datafile exists it is visible within Outlook under the user's mailbox, much the same as an archive folder is. I would like to be able to search for it by name which is DMSDataFile. I did try - Set tmpInbox = parentFolder.Folders("DMSDataFile") This works OK if the datafile exists but will throw an error if it doesn't. I can create an error handler which will then install the datafile but this doesn't seem like a very tidy way of doing things. I guess I might have to recursively search for the datafile. Can someone let me know what is the best / easiest way to search for the datafile using the name of the datafile and give me some code with which to do it. Thanks G

    Read the article

  • How can I use fossil (DVCS) in a home environment?

    - by Mosh
    I'm trying fossil as my new VCS, since I'm a lone developer working on small projects. I started testing fossil but I encountered a (probably major newbie) problem. How does one push or pull to another directory (which is easy on Hg). Fossil pull or push commands expect a URL and not a directory. When I start a server in one directory and try to push from another directory I get the "server loop" error message. Any ideas?

    Read the article

  • Rails editing multiple records at once

    - by Joseph Silvashy
    I feel like this might be really simple but I'm just not getting it right, so I have like a settings page in my app and I want each setting to be like a key value store, for example: +-------------------+--------------------------------+ | setting | value | +-------------------+--------------------------------+ | twitter_username | something | +-------------------+--------------------------------+ | facebook_url | http://facebook.com/someguy | +-------------------+--------------------------------+ My form looks something like this: <% form_tag set_admin_settings_path, :method => :put do %> <ol> <% for setting in @settings %> <li class="field"> <label><%= setting.setting_name.humanize %></label> <%= text_field_tag "[setting_value][]", setting.setting_value %> </li> <% end %> <li class="submit"> <%= submit_tag "Update settings" %> </li> </ol> <% end %> Everything renders fine but when I try to save the form, nothing is saved :(

    Read the article

  • ASP.NET MVC solution to a forms application?

    - by Gloria Huang
    Hello, We're building a survey system and utilising ASP.NET MVC and wondered if anyone can offer suggestions on the architecture. Here's the problem we're trying to solve. Essentially an agency sends out several surveys every year. They're very structured and not like SurveyMonkey style of surveys - they're actually applications of feedback. Much like a Visa Application there are lots of things they need to do and sometimes it takes them 2-3 weeks to fill it out. They can upload files (proofs of purchase etc - PDF/JPG) and also multiple "items". Eg. Say for instance they've worked for McDonalds, there could be 20 different franchises, they build a list of locations they've worked. 3 weeks later there could be another 3 new locations and 2 may have closed down. So we need to ensure the forms are able to handle those situations. The forms themselves (markup and data) change every year - I should mention that this for a taxation/finance/budget system. We were thinking of using MVC, using Xml to store the data (temporarily), XSD to validate the data, XSL to transform the data to presentable markup (for them to fill out) and then once they "Submit" an application it gets stored into the DB in relevant areas. When the user starts the application process, they can save the progress so far (we validate whatever they entred and ignore any they havent), save it as an Xml blob and store in the DB. When they're finally ready to submit it, then we do a full validation and upload the files and store them securely (it has their business proofs and accounting statements) and then run some workflows. What I'm really concerned about is how to manage changing forms versions (a year later). How are form/application systems written these days? We have 2 months to pull this off and about 30 forms to deliver. So 30xXML, 30xXSD, 30xXSL.

    Read the article

  • PayPal Payments Pro Sandbox requires membership?

    - by Kevin
    Do I need to pay the $30 just to play around in the sandbox for Website Payments Pro? I'm trying to get Active Merchant working in Rails, and it's giving me an error "invalid merchant configuration"... after digging around a bit it says I need to "accept the billing agreement" and/or sign up for the Payments Pro first. So, do I need to pay the $30 just to test in sandbox? Or is there another workaround for this error?

    Read the article

  • ClickOnce Deployment

    This article is taken from the book Continuous Integration in .NET. The authors discuss ClickOnce, a simple way to make a Windows application available over the net without using installation files. They show how to use ClickOnce within the Continuous Integration process.

    Read the article

  • Find wait reason in Oracle

    - by thewolfgang
    I'm running a Java application with an Oracle 10g. I've discovered kind of a race condition that leads to an inifite long waiting time for an UPDATE statement. To solve this situation I'd like to find out what this statement is waiting for (locks on certain tables caused by statement xy etc.). I tried to use the Oracle Enterprise Manager which has found this situation as well but it doesn't tell my the reason for the wait.

    Read the article

  • Can't boot into XP after setting up dual boot with Win 7 vhd.

    - by bebop
    I set up a dual boot for win 7 from vhd on 2 xp machines. One of them everything went fine, and I get the option to choose the os when I turn the machine on. The other was slightly different in that rather than seeing the current OS disk (the one with XP on) as the c:\ when I was setting up windows 7 vhd during install it saw the disk as d:. I didn't think anything of it and went ahead and created a vhd on the d: drive. Now when I turn this machine on, it boots straight to win7 and I never get the option to choose xp. When I look at the boot option in msconfig, I only see Windows 7. How can I go about adding the old XP drive as a boot option at startup again? Edit: Strangely when I rebooted this time (perhaps the first time since I removed the install DVD) it boots to XP. I suppose I'll just have to reinstall windows 7 again in a new vhd...

    Read the article

  • Migrate OS Install to VMWare Virtual Machine

    - by rockinthesixstring
    I have Windows Server 2003 installed on my server. I'd really like to be running it via VMWare EXSi as a virtual machine, but I don't what to have to reconfigure the whole deal. Is there a relatively painless way to move it to a virtual machine? It will be staying on the same box with the exact same hardware... nothing changes. Thoughts?

    Read the article

  • How to preserve paragraph breaks when text copy from PDF and paset ito Notepad?

    - by metal gear solid
    For example when I copy text from PDF which has paragraph breaks like this xxxxx xxxxxx xxxxxxx xxxxxx xxxxxx xxxxxxxx xxxxxx x xxxx xx xxxx xxxx xxxxxxxxxxx x xxxxxxxx x x xxxxxxxxxxxxxx xxxx xxx xxxx xxxxxx xxxxx xxxxxx xxxxxxx xxxxxx xxxxxx xxxxxxxx xxxxxx x xxxx xx xxxx xxxx xxxxxxxxxxx x xxxxxxxx x x xxxxxxxxxxxxxx xxxx xxx xxxx xxxxxx but when i copy text from PDF and paste into Notepad, Word 2007 etc. output comes without paragraph breaks. Lke this xxxxx xxxxxx xxxxxxx xxxxxx xxxxxx xxxxxxxx xxxxxx x xxxx xx xxxx xxxx xxxxxxxxxxx x xxxxxxxx x x xxxxxxxxxxxxxx xxxx xxx xxxx xxxxxx xxxxx xxxxxx xxxxxxx xxxxxx xxxxxx xxxxxxxx xxxxxx x xxxx xx xxxx xxxx xxxxxxxxxxx x xxxxxxxx x x xxxxxxxxxxxxxx xxxx xxx xxxx xxxxxx How to preserve paragraph breaks when text copy from PDF and paset ito Notepad?

    Read the article

  • Can thunderbird with -no-remote launch firefox without it?

    - by Simon
    We have two thunderbird profiles, and we launch thunderbird using -no-remote as follows: thunderbird -no-remote -P Profile1 and thunderbird -no-remote -P Profile2 unfortunately, this means that if either of us click on a link in an email, and firefox is already running, we get a warning message telling us that firefox is already running, rather than having it open the link. Is it possible for thunderbird to use firefox's remote, even though it has been launched with -no-remote? (if it makes a difference, this is on Xubuntu Karmic)

    Read the article

  • With Ubuntu 9.10, my DVD keeps spinning up

    - by Ken
    I have Ubuntu 9.10 on my Intel Mac Mini. When there's a DVD in the drive, and even if there's no program open at all (just looking at the desktop), every minute or so the disc spins up with a loud whirring noise, and I can hear it cranking the motor to seek across the disc. How do I find out what's causing this? And how can I make it stop? Thanks! EDIT: I straced nautilus, and saw nothing it's doing directly, even when the disc spins up. It does poll inotify regularly, but I don't know how to trace what it's watching, or if that's even how it receives disc-inserted notifications. It doesn't call inotify_add_watch when I insert a disc or mount it (or eject or umount), but it could be watching all of /dev already or something like that. Of course, a DVD is mounted read-only, so whether it's inotify or something else, it should never need to poll anything on that. And if it is inotify, it's happening in the kernel, and the kernel should really never need to poll a device it's mounted to check for notifications.

    Read the article

  • Any tool to monitor which softwares consume the connexion?

    - by user23392
    Hello, i have a weired problem here, i'm running windows vista which is connected to the internet throught a 3g key, so sometimes i go to see how much datas are being downloaded and i find 200kb/s even if i don't use the internet, i closed all softwares like antivirus and everything and still the internet being consumed, thanks god because i only pay by month. So is there a tool for pc to monitor the softwares that are using my connexion? Thanks

    Read the article

  • How does the below program work in c++?

    - by Srinivasa Varadan
    I have just created 2 pointers which has undefined behavior and try to invoke a class member function which has no object created ? I don't understand this? #include<iostream> using namespace std; class Animal { public: void talk() { cout<<"I am an animal"<<endl; } }; class Dog : public Animal { public: void talk() { cout<<"bark"<<endl; } }; int main() { Animal * a; Dog * d; d->talk(); a->talk(); }

    Read the article

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