Search Results

Search found 18677 results on 748 pages for 'current'.

Page 71/748 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • XNA - 2D Rotation of an object to a selected direction

    - by lobsterhat
    I'm trying to figure out the best way of rotating an object towards the directional input of the user. I'm attempting to mimic making turns on ice skates. For instance, if the player is moving right and the input is down and left, the player should start rotating to the right a set amount each tick. I'll calculate a new vector based on current velocity and rotation and apply that to the current velocity. That should give me nice arcing turns, correct? At the moment I've got eight if/else statements for each key combination which in turn check the current rotation: // Rotate to 225 if (keyboardState.IsKeyDown(Keys.Up) && keyboardState.IsKeyDown(Keys.Left)) { // Rotate right if (rotation >= 45 || rotation < 225) { rotation += ROTATION_PER_TICK; } // Rotate left else if (rotation < 45 || rotation > 225) { rotation -= ROTATION_PER_TICK; } } This seems like a sloppy way to do this and eventually, I'll need to do this check about 10 times a tick. Any help toward a more efficient solution is appreciated.

    Read the article

  • Splitting a tetris game apart - where to put time-management?

    - by nightcracker
    I am creating a tetris game in C++ & SDL, and I'm trying to do it "good" by making it object-oriented and keeping scopes small. So far I have the following structure: A main with some lowlevel SDL set up and handling input A game class that keeps track of score and provides the interface for main (move block down, etc) A map class that keeps track of the current game field, which blocks are where. Used by the game class. A block class that consists of the current falling block, used by game. A renderer class abstracting low level SDL to a format where you render "tetris blocks". Used by map and block. Now I have a though time where to place the time-management of this game. For example, where should be decided when a block bumps the bottom of the screen how long it takes the current block locks in place and a new block spawns? I also have an other unrelated question, is there some place where you can find some standard data on tetris like standard score tables, rulesets, timings, etc?

    Read the article

  • Importing an existing project into Git

    - by Andy
    Background During the course of developing our site (ASP.NET), we discovered that our existing source control (SourceGear Vault) wasn't working for us. So, we decided to migrate to Git. The translation has been less than smooth though. Our site is broken up into three environments DEV, QA, and PROD. For tho most part, DEV and the source control repo have been in sync with each other. There is one branch in the repo, if a page was going to be moved up to QA then the file was moved manually, same thing with stuff that was ready for PROD. So, our current QA and PROD environments do not correspond to any particular commit in the master branch. Clarification: The QA and PROD branches are not currently, nor have they ever been in source control. The Question How do I move QA and PROD into Git? Should I forget about the history we've maintained up to this point and start over with a new repo? I could start with everything on PROD, then make a branch and pull in everything from QA, and then make another branch off of that with DEV. That way not only will the branches reflect the differences in the environments, they'll be in the right order chronologically with the newest commits in the DEV branch. What I've tried so far I thought about creating a QA branch off of the current master and using robocopy to make the working folder look like the current QA environment. This doesn't work because the new commit from QA will remove new files from DEV and that will remove them when we merge up, I suspect there will be similar problems if I started QA at an earlier (though not exact) commit from DEV.

    Read the article

  • More NASM with GVim

    - by MarkPearl
    Today I am bashing around with nasm again… some useful things I found… Set the current working directory of gvim to the current file path I have found setting the current working directory of gvim to the file location is very useful, especially if you are wanting to use commands in gvim to run your compiled code. It can be done by typing in the following in the command mode in gvim… cd %:p:h Once you have set it, you can use the ! to run commands you would normally run in the dos shell.. e.g. !dir Compiling code to make an executable There are three thing you need to specify to compile a basic file in name, they are… The output file format The output file name The source file name An example of this would be the following (where you have a file called temp.asm which is the source file) nasm –f bin temp.asm –o temp.com Output file format The –f specifies the output file format (in this case a binary file). To get a list of the available output file formats you can type nasm –hf (for my installation bin is the default, in which case I can omit it) Output file name This is just the name you want the compiled file to be called. For windows machines I specify .com as my default format.

    Read the article

  • Translating an object along its heading

    - by Kuros
    I am working on a simulation that requires me to have several objects moving around in 3D space (text output of their current position on the grid and heading is fine, I do not need graphics), and I am having some trouble getting objects to move along their relative headings. I have a basic understanding of vectors and matrices. I am using a vector to represent their position, and I am also using Euler Angles. I can translate one of my entities with a matrix along whatever axis, and I can alter their heading. For example, if I have an entity at (order is XYZ) 1, 1, 1, with a heading of 0, I can apply a translation matrix to get them to talk to 1, 1, 2 fine. However, if I change their heading to 270, they still walk to 1, 1, 3, instead of 2, 1, 2 as I desire. I have a feeling that my problem lies in not translating my matrix from world space to object space, but I am not sure how to go about that. How can I do this? Addition: I am using 3D vectors to represent their current position and their heading (using the three euler angles). For now, all I want to do is have an entity walk in a square, reporting their current position at each step. So, assuming it starts at 10, 10, 10 I want it to walk as follows: 10,10,10 -> 10, 10, 15 10, 10, 15 -> 5, 10, 15 5, 10, 15 -> 5, 10, 10 5, 10, 10 -> 10, 10, 10 My 1 Z unit translation matrix is as follows: [1 0 0 0] [0 1 0 0] [0 0 1 1] [0 0 0 1] My rotation matrix is as follows: [0 0 1 0] [0 1 0 0] [-1 0 0 0] [0 0 0 1]

    Read the article

  • How to make TortoiseHg pull certain branch only?

    - by mark
    I have cloned the default branch of a big repository and now I wish to pull from the server using the TortoiseHg client. However, TortoiseHg proposes to pull from all the branches. Is it possible to instruct it to pull from the current branch only? So far I have seen suggestions to: Setup a hook on the client side to reject pulls from unwanted branches Check incoming revisions in TortoiseHg and only pull the ones belonging to the current branch Use the Mercurial ACL extension to deny access to all the branches, but the current one. I dislike all of these solutions, since all of them are client based. In all of them TortoiseHg actually pulls all of the branches (even in the second, where the pulled revisions are arranged into a bundle presented in the incoming revisions view) Is there an hg pull -b BRANCH equivalent in TortoiseHg? Thanks. EDIT I know how to do all of this using the Mercurial command line client - hg.exe. This question is specifically about the TortoiseHg GUI client.

    Read the article

  • What is a Relational Database Management System (RDBMS)?

    A Relational Database Management System (RDBMS)  can also be called a traditional database that uses a Structured Query Language (SQL) to provide access to stored data while insuring the integrity of the data. The data is stored in a collection of tables that is defined by relationships between data items. In addition, data permitted to be joined in new relationships. Traditional databases primarily process data through transactions called transaction processing. Transaction processing is the methodology of grouping related business operations based predefined business events. An example of this can be seen when a person attempts to purchase an item from an online e-tailor. The business must execute specific operations for a related  business event. In this case, a business must store the following information: Customer Info, Order Info, Order Item Info, Customer Payment Data, Payment Results, and Current Order Status. Example: Pseudo SQL Operations needed for processing an online e-tailor sale. Insert Customer into Customers Insert New Order into Orders Insert Each New Order Item into OrderItems Insert Customer Payment Info into PaymentInfo Insert Payment Processing Result into PaymentDetails Update Customer for Current Order Status Common Relational Database Management System Microsoft SQL Server Microsoft Access Oracle MySQL DB2 It is important to note that no current RDBMS has fully implemented all of the Relational Principles. Common RDBMS Traits Volatile Data Supports Transaction Processing Optimized for Updates and Simple Queries 

    Read the article

  • Moving to New Machine... also upgrade to 64bit. What steps?

    - by Kendor
    I am about to move to a new Lenovo X201 from current X61. Current setup has separate \home, separate swap file, also separate \Data partition. Am currently running 10.04 32 bit. Am considering running 64 bit on new machine because I will now have 8 GB of RAM. And would like to also move to 10.10. Ideally I would like preserve as much of my current setup as possible... New machine has Win7 on it, but will blow that away, as I've made a clonezilla copy of it, and will use VirtualBox for when I need Windows. Can someone suggest a good step by step for me? I'm networked to a NAS and also have plenty of external USB storage in case I need intermediary steps. So do I set up new machine first with 64bit 10.10, with partition scheme I want? then rsnyc over \home from old machine (over write target home)? Do I need to upgrade the X61 first to 10.10?

    Read the article

  • Fresh Ubuntu 12.10 install no desktop or wing bar

    - by Travis
    After a fresh installm of ubuntu 12.10 (complete erase) after logging in it appears i have no taskbar or much of anything, although i can still execute my terminal with CTRL+ALT+T. i looked around a little, seems i'm not the only person who has had this problem. I found here: http://ubuntuforums.org/showthread.php?p=12303179#post12303179 From there, i found myself here: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-updates/+bug/1068341 I followed precisely the instructions provided which were: this problem is solved this way Switch to a terminal (Ctrl-Alt-F1). Login as your username. Install linux source (sudo apt-get install linux-source) and headers (sudo apt-get install linux-headers-3.5.0-17-generic). Uninstall nvidia driver - this depends on which version you installed (sudo apt-get remove nvidia-current or sudo apt-get remove nvidia-current-updates or sudo apt-get remove nvidia-experimental-304). Reinstall nvidia driver (sudo apt-get install nvidia-current-updates). If it successfully installs, restart the computer (sudo shutdown -r now). Source Desktop does not show when I installed nvidia drivers! I have rebooted, and i am still having the exact same problem. so i back at square one. can someone help me please? this is my room mates computer and i told him i was "fixing" it and now i feel like i've ruined it. Any help is greatly appreciated. Thank you for your time.

    Read the article

  • Setting up a LAMP VM server for Development and Testing?

    - by TdotThomas
    Info: I would like to set up a VM server on my local computer which will serve pages in the exact same way as my current hosting (but only to me on my local computer). I currently pay a big web hosting company to host my website & web store and they are doing a great job, but I would like to be able to work on my Web site and its corresponding MySQL DB, HTML, and PHP code without being at risk of messing something completely up on the live servers. My current plan of action: Set up a VM webserver with Debian, MySQL, PHP, Apache. Copy web store (PHP/HTML) code to VM server. Copy my current MySQL databases from my hosting provider and install on VM server. Modify and test new features on VM server. Upload MySQL DB and HTML/PHP code back to web host's server where it should work as before but with new modifications. Questions: Now I'm pretty sure I have steps one and two down correctly but I can't for the life of me figure out how to proceed next, so here are my questions. I have my /etc/host file set up so www.MySite.test redirects to the IP address of the local VM webserver. Once I import my PHP/HTML files and MySQL file whats the best way to navigate around the fact that all of my files and DBs will reference www.MySite.com. I can export my MySQL dbs but do I also have to export my MySQL users and passwords to access those db or are those coded into my html/php code?

    Read the article

  • Location Change Salary Differences [closed]

    - by GameDev
    DISCLAIMER: I know that this might be a "regional" question but I'm also asking for help as far as what resources to use to determine my decision. I'm currently talking to a recruiter for a game developer in the SF Bay area. I work in a relatively low-cost area in the south. I really want to get into game development but my current career is general web development. I'm very interested in taking the job, but my concern is that the amount they're willing to pay might be a relative pay cut. Here are some factors: It's not an entry-level position, the title is Senior Software Engineer. I have 5+ years of experience. The calculators online tell me that I should be expecting around 2x my current pay rate(http://www.bestplaces.net/col/). My current pay is in the mid $60k/yr, so that's like 120-130k. The recruiter told me at my experience level I can expect about $90-100/yr, and that those cost of living calculators were way off. The benefits will definitely be better, it's much larger company (help with commuting, catered meals, etc). But is the recruiter trying to give me a snow job on the pay scale, or is that a reasonable change from a smallish town in the south to somewhere in the SF bay area? How can I find this out? Glassdoor and Payscale seem to say "senior software developers" in that area make around 110 in median salary, but Payscale says it's closer to $135k, that range seems pretty large.

    Read the article

  • What exactly are Link Relation Values?

    - by bckpwrld
    From REST in Practice: Hypermedia and Systems Architecture: For computer-to-computer interactions, we advertise protocol information by embedding links in representations, much as we do with the human Web. To describe a link's purpose, we annotate it. Annotations indicate what the linked resource means to the current resource: “status of your coffee order” “payment” and so on. We call such annotated links hypermedia controls, reflecting their enhanced capabilities over raw URIs. ... link relation values, which describe the roles of linked resources ... Link relation values help consumers understand why they might want to activate a hypermedia control. They do so by indicating the role of the linked resource in the context of the current representation. I interpret the above quotes as saying that Hypermedia control contains both a link to a resource and an annotation describing the role of linked resource in the context of the current representation. And we call this annotation ( which describes the role of linked resource ) a link relation value. Is my assumption correct or does the term link relation value actually describe something different? Thank you

    Read the article

  • How do you make a precise countdown timer using clock_gettime? [migrated]

    - by Joshun
    Could somebody please explain how to make a countdown timer using clock_gettime, under Linux. I know you can use the clock() function to get cpu time, and multiply it by CLOCKS_PER_SEC to get actual time, but I'm told the clock() function is not well suited for this. So far I have attempted this (a billion is to pause for one second) #include <stdio.h> #include <time.h> #define BILLION 1000000000 int main() { struct timespec rawtime; clock_gettime(CLOCK_MONOTONIC_RAW, &rawtime); unsigned long int current = ( rawtime.tv_sec + rawtime.tv_nsec ); unsigned long int end = (( rawtime.tv_sec + rawtime.tv_nsec ) + BILLION ); while ( current < end ) { clock_gettime(CLOCK_MONOTONIC_RAW, &rawtime); current = ( rawtime.tv_sec + rawtime.tv_nsec ); } return 0; } I know this wouldn't be very useful on its own, but once I've found out how to time correctly I can use this in my projects. I know that sleep() can be used for this purpose, but I want to code the timer myself so that I can better integrate it in my projects - such as the possibility of it returning the time left, as opposed to pausing the whole program.

    Read the article

  • Can I use stronger power supply to charge Kindle? [closed]

    - by Bobb
    I have power supply for Kindle with output 5V 0.85A. And I have Samsung Galaxy Pad one with output of 5V 2A. My guess is that a device will consume as much current as it can but no more than max power supply current. For example if Kindle device consumes 0.6A for charging its battery then it shouldnt create more than 0.6A current using Galaxy Pad power supply. So my guess - if I charge Kindle with Galaxy Pad power supply it wont burn out. Is that right?

    Read the article

  • how to remove the link from the following javascript?

    - by murali
    hi i am unable to the remove the link from the keywords which are coming from database.... var googleurl="http://www.google.com/#hl=en&source=hp&q="; function displayResults(keyword, results_array) { // start building the HTML table containing the results var div = "<table>"; // if the searched for keyword is not in the cache then add it to the cache try { // if the array of results is empty display a message if(results_array.length == 0) { div += "<tr><td>No results found for <strong>" + keyword + "</strong></td></tr>"; // set the flag indicating that no results have been found // and reset the counter for results hasResults = false; suggestions = 0; } // display the results else { // resets the index of the currently selected suggestion position = -1; // resets the flag indicating whether the up or down key has been pressed isKeyUpDownPressed = false; /* sets the flag indicating that there are results for the searched for keyword */ hasResults = true; // loop through all the results and generate the HTML list of results for (var i=0; i<results_array.length-1; i++) { // retrieve the current function crtFunction = results_array[i]; // set the string link for the for the current function // to the name of the function crtFunctionLink = crtFunction; // replace the _ with - in the string link while(crtFunctionLink.indexOf("_") !=-1) crtFunctionLink = crtFunctionLink.replace("_","-"); // start building the HTML row that contains the link to the // help page of the current function div += "<tr id='tr" + i + "' onclick='location.href=document.getElementById(\"a" + i + "\").href;' onmouseover='handleOnMouseOver(this);' " + "onmouseout='handleOnMouseOut(this);'>" + "<td align='left'><a id='a" + i + "' href='" + googleurl + crtFunctionLink ; // check to see if the current function name length exceeds the maximum // number of characters that can be displayed for a function name if(crtFunction.length <= suggestionMaxLength) { div += "'>" + crtFunction.substring(0, httpRequestKeyword.length) + "" div += crtFunction.substring(httpRequestKeyword.length, crtFunction.length) + "</a></td></tr>"; } else { // check to see if the length of the current keyword exceeds // the maximum number of characters that can be displayed if(httpRequestKeyword.length < suggestionMaxLength) { div += "'>" + crtFunction.substring(0, httpRequestKeyword.length) + "" div += crtFunction.substring(httpRequestKeyword.length, suggestionMaxLength) + "</a></td></tr>"; } else { div += "'>" + crtFunction.substring(0,suggestionMaxLength) + "</td></tr>" } } } } // end building the HTML table div += "</table>"; var oSuggest = document.getElementById("suggest"); var oScroll = document.getElementById("scroll"); // scroll to the top of the list //oScroll.scrollTop = 1; -- murali commented // update the suggestions list and make it visible oSuggest.innerHTML =div; oScroll.style.visibility = "visible"; // if we had results we apply the type ahead for the current keyword if(results_array.length > 0) autocompleteKeyword(); } catch(e) { } } how to remove href tag from the following snippet... when i remove anything the drop down vanishes.... pls help me how to remove the href from the above snippet

    Read the article

  • Losing data after reading them correct from file

    - by user1388172
    i have the fallowing class of object with a class a data structure which i use in main combined. The ADT(abstract data type) is a linked list. After i read from file the input data and create and object which at print looks just fine after a print. after i push_back() the 3-rd int variable get initializated to 0. So example and code: Example: ex.in: 1 7 31 2 2 2 3 3 3 now i create objects from each line, which at print look as they suppose, but after push_back(): 1 7 0 2 2 0 3 3 0 Class.h: class RAngle { private: int x,y,l,b; public: int solution,prec; RAngle(){ x = y = solution = prec = b = l =0; } RAngle(int i,int j,int k){ x = i; y = j; l = k; solution = 0; prec=0; b=0; } friend ostream& operator << (ostream& out, const RAngle& ra){ out << ra.x << " " << ra.y << " " << ra.l <<endl; return out; } friend istream& operator >>( istream& is, RAngle& ra){ is >> ra.x; is >> ra.y; is >> ra.l; return is ; } }; ADT.h: template <class T> class List { private: struct Elem { T data; Elem* next; }; Elem* first; T pop_front(){ if (first!=NULL) { T aux = first->data; first = first->next; return aux; } T a; return a; } void push_back(T data){ Elem *n = new Elem; n->data = data; n->next = NULL; if (first == NULL) { first = n; return ; } Elem *current; for(current=first;current->next != NULL;current=current->next); current->next = n; } Main.cpp(after i call this function in main which prints object as they suppose to be the x var(from RAngle class) changes to 0 in all cases.) void readData(List <RAngle> &l){ RAngle r; ifstream f_in; f_in.open("ex.in",ios::in); for(int i=0;i<10;++i){ f_in >> r; cout << r; l.push_back(r); }

    Read the article

  • JQuery Slide Onclick

    - by everreadyeddy
    I am using the code in example http://www.faridesign.net/2012/05/create-a-awesome-vertical-tabbed-content-area-using-css3-jquery/ I am trying to slide the div tags on a button click on the list so the current tab-content will slide in and the tab just clicked will slide out. I currently have the working example where I can switch between divs fine, but I need to slide in and out between divs. Is there any script I can do this with the current code. using .slide or .effect instead of .show() looks to display two divs at the same time. I'm not sure what I am doing wrong. <div id="v-nav"> <ul> <li tab="tab1" class="first current">Main Screen</li> <li tab="tab2">Div 1</li> <li tab="tab3">Div 2</li> <li tab="tab4">Div 3</li> <li tab="tab5">Div 4</li> <li tab="tab6">Div 5</li> <li tab="tab7">Div 6</li> <li tab="tab8" class="last">Div 7</li> </ul> <div class="tab-content"> <h4>Main Screen</h4> </div> <div class="tab-content"> <h4>Div 1</h4> </div> <div class="tab-content"> <h4>Div 2</h4> </div> <div class="tab-content"> <h4>Div 3</h4> </div> <div class="tab-content"> <h4>Div 4</h4> </div> <div class="tab-content"> <h4>Div 5</h4> </div> <div class="tab-content"> <h4>Div 6</h4> </div> <div class="tab-content"> <h4>Div 7</h4> </div> My Script looks like $(function () { var items = $('#v-nav>ul>li').each(function () { $(this).click(function () { //remove previous class and add it to clicked tab items.removeClass('current'); $(this).addClass('current'); //hide all content divs and show current one //$('#v-nav>div.tab-content').hide().eq(items.index($(this))).show(); //$('#v-nav>div.tab-content').hide().eq(items.index($(this))).fadeIn(100); $('#v-nav>div.tab-content').hide().eq(items.index($(this))).slideToggle(); window.location.hash = $(this).attr('tab'); }); }); if (location.hash) { showTab(location.hash); } else { showTab("tab1"); } function showTab(tab) { $("#v-nav ul li:[tab*=" + tab + "]").click(); } // Bind the event hashchange, using jquery-hashchange-plugin $(window).hashchange(function () { showTab(location.hash.replace("#", "")); }) // Trigger the event hashchange on page load, using jquery-hashchange-plugin $(window).hashchange(); });

    Read the article

  • Controller Action Methods with different signatures

    - by Narsil
    I am trying to get my URLs in files/id format. I am guessing I should have two Index methods in my controller, one with a parameter and one with not. But I get this error message in browser below. Anyway here is my controller methods: public ActionResult Index() { return Content("Index "); } // // GET: /Files/5 public ActionResult Index(int id) { File file = fileRepository.GetFile(id); if (file == null) return Content("Not Found"); else return Content(file.FileID.ToString()); } Error: Server Error in '/' Application. The current request for action 'Index' on controller type 'FilesController' is ambiguous between the following action methods: System.Web.Mvc.ActionResult Index() on type FileHosting.Controllers.FilesController System.Web.Mvc.ActionResult Index(Int32) on type FileHosting.Controllers.FilesController Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Reflection.AmbiguousMatchException: The current request for action 'Index' on controller type 'FilesController' is ambiguous between the following action methods: System.Web.Mvc.ActionResult Index() on type FileHosting.Controllers.FilesController System.Web.Mvc.ActionResult Index(Int32) on type FileHosting.Controllers.FilesController Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [AmbiguousMatchException: The current request for action 'Index' on controller type 'FilesController' is ambiguous between the following action methods: System.Web.Mvc.ActionResult Index() on type FileHosting.Controllers.FilesController System.Web.Mvc.ActionResult Index(Int32) on type FileHosting.Controllers.FilesController] System.Web.Mvc.ActionMethodSelector.FindActionMethod(ControllerContext controllerContext, String actionName) +396292 System.Web.Mvc.ReflectedControllerDescriptor.FindAction(ControllerContext controllerContext, String actionName) +62 System.Web.Mvc.ControllerActionInvoker.FindAction(ControllerContext controllerContext, ControllerDescriptor controllerDescriptor, String actionName) +13 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +99 System.Web.Mvc.Controller.ExecuteCore() +105 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.<c_DisplayClass8.b_4() +34 System.Web.Mvc.Async.<c_DisplayClass1.b_0() +21 System.Web.Mvc.Async.<c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult1.End() +59 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8677678 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 Updated Code: public ActionResult Index(int? id) { if (id.HasValue) { File file = fileRepository.GetFile(id.Value); if (file == null) return Content("Not Found"); else return Content(file.FileID.ToString()); } else return Content("Index"); } It's still not the thing I want. URLs have to be in files?id=3 format. I want files/3 routes from global.asax routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); //files/3 //it's the one I wrote routes.MapRoute("Files", "{controller}/{id}", new { controller = "Files", action = "Index", id = UrlParameter.Optional} ); I tried adding a new route after reading Jeff's post but I can't get it working. It still works with files?id=2 though.

    Read the article

  • Doubt about adopting CI (Hudson) into an existing automated Build Process (phing, svn)

    - by maraspin
    OUR CURRENT BUILD PROCESS We're a small team of developers (2 to 4 people depending on project) who currently use Phing to deploy code to a staging environment, before going live. We keep our code in a SVN repo, where the trunk holds current active development and, at certain times, we do make branches that we test and then (if successful), tag and export to the staging env. If everything goes well there too, we finally deploy'em in production servers. Actions are highly automated, but always triggered by human intervention. THE DOUBT We'd now like to introduce Continuous Integration (with Hudson) in the process; unfortunately we have a few doubts about activity syncing, since we're afraid that CI could somewhat interfere with our build process and cause certain problems. Considering that an automated CI cycle has a certain frequency of automatically executed actions, we in fact only see 2 possible cases for "integration", each with its own problems: Case A: each CI cycle produces a new branch with its own name; we do use such a name to manually (through phing as it happens now) export the code from the SVN to the staging env. The problem I see here is that (unless specific countermeasures are taken) the number of branches we have can grow out of control (let's suppose we commit often, so that we have a fresh new build/branch every N minutes). Case B: each CI cycle creates a new branch named 'current', for instance, which is tagged with a unique name only when we manually decide to export it to staging; the current branch, at any case is then deleted, as soon as the next CI cycle starts up. The problem we see here is that a new cycle could kick in while someone is tagging/exporting the 'current' branch to staging thus creating an inconsistent build (but maybe here I'm just too pessimist, since I confess I don't know whether SVN offers some built-in protection against this). With all this being said, I was wondering if anyone with similar experiences could be so kind to give us some hints on the subject, since none of the approaches depicted above looks completely satisfing to us. Is there something important we just completely left off in the overall picture? Thanks for your attention &, in advance, for your help!

    Read the article

  • Resizing an image using mouse dragging (C#)

    - by Gaax
    Hi all. I'm having some trouble resizing an image just by dragging the mouse. I found an average resize method and now am trying to modify it to use the mouse instead of given values. The way I'm doing it makes sense to me but maybe you guys can give me some better ideas. I'm basically using the distance between the current location of the mouse and the previous location of the mouse as the scaling factor. If the distance between the current mouse location and the center of of the image is less than the distance between previous mouse location and the center of the image then the image gets smaller, and vice-versa. With the code below I'm getting an Argument Exception (invalid parameter) when creating the new bitmap with the new height and width and I really don't understand why... any ideas? private static Image resizeImage(Image imgToResize, System.Drawing.Point prevMouseLoc, System.Drawing.Point currentMouseLoc) { int sourceWidth = imgToResize.Width; int sourceHeight = imgToResize.Height; float dCurrCent = 0; //Distance between current mouse location and the center of the image float dPrevCent = 0; //Distance between previous mouse location and the center of the image float dCurrPrev = 0; //Distance between current mouse location and the previous mouse location int sign = 1; System.Drawing.Point imgCenter = new System.Drawing.Point(); float nPercent = 0; imgCenter.X = imgToResize.Width / 2; imgCenter.Y = imgToResize.Height / 2; // Calculating the distance between the current mouse location and the center of the image dCurrCent = (float)Math.Sqrt(Math.Pow(currentMouseLoc.X - imgCenter.X, 2) + Math.Pow(currentMouseLoc.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.XimgCenter.X,2) + Math.Pow(prevMouseLoc.Y - imgCenter.Y, 2)); // Calculating the sign value if (dCurrCent >= dPrevCent) { sign = 1; } else { sign = -1; } nPercent = sign * (float)Math.Sqrt(Math.Pow(currentMouseLoc.X - prevMouseLoc.X, 2) + Math.Pow(currentMouseLoc.Y - prevMouseLoc.Y, 2)); int destWidth = (int)(sourceWidth * nPercent); int destHeight = (int)(sourceHeight * nPercent); Bitmap b = new Bitmap(destWidth, destHeight); // exception thrown here Graphics g = Graphics.FromImage((Image)b); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(imgToResize, 0, 0, destWidth, destHeight); g.Dispose(); return (Image)b; }

    Read the article

  • How to actually use Swing Application Framework?

    - by Joonas Pulakka
    Hello, I'd like to learn how to effectively use Swing Application Framework. Most of the the examples I've found are blog entries that just explain how to great it is to extend SingleFrameApplication and override its startup method, but that's about it. Sun's article is almost two years old, as is the project's own introduction, and there has apparently been some evolution since then. Are there any recent and thorough tutorials/HOWTOs available anywhere? There is JavaDoc of course, but it's hard to get the big picture from there. Any pointers are appreciated. Update: I realized that there's a mailing list archive at the project's site. While somewhat clumsy (compared to StackOverflow ;) it seems to be quite active. Still it's a pity that there are no real tutorials anywhere. The information is scattered here and there. Update 2: Let me clarify - I'm not having trouble using Swing (the widget toolkit) itself, I'm talking about its Application Framework, which is supposed to ease things like application lifecycle (startup, exit and whatever happens between them), action management etc. - that is, things that most Swing applications will need. It's cool to get such framework to be standard part of Java. The only problem is to learn how it's intended to be used. Update 3: For the interested, there was just some discussion at the project's forum regarding the current state and future of JSR 296. Shortly: the current version 1.03 is considered to be quite usable, but the API is not stable and it will change to the final version in Java 7. The package name will also change so Java 7 will not break current applications made on SAF. Update 4: Karsten Lentzsch stated at the above mentioned forum: "I doubt that it can be included in Java 7; and I'll vote against it.". I would rather not question the sincerity of this great guru, and it's certainly wise not to let anything flawed to slip into the core JDK, but frankly it's a strange situation - he is the author of JGoodies Swing Suite which is partly a commercial competitor of JSR 296, and he is sitting in the committee that will decide whether this JSR will be included to standard Java. It was the same thing with JSR 295 Beans Binding which I wrote about earlier. Given the current state of SAF, I think the best solution is to wrap the current implementation into a "homebrew" framework, which can then accommodate possible changes to the existing API.

    Read the article

  • ELMAH - Using custom error pages to collecting user feedback

    - by vdh_ant
    Hey guys I'm looking at using ELMAH for the first time but have a requirement that needs to be met that I'm not sure how to go about achieving... Basically, I am going to configure ELMAH to work under asp.net MVC and get it to log errors to the database when they occur. On top of this I be using customErrors to direct the user to a friendly message page when an error occurs. Fairly standard stuff... The requirement is that on this custom error page I have a form which enables to user to provide extra information if they wish. Now the problem arises due to the fact that at this point the error is already logged and I need to associate the loged error with the users feedback. Normally, if I was using my own custom implementation, after I log the error I would pass through the ID of the error to the custom error page so that an association can be made. But because of the way that ELMAH works, I don't think the same is quite possible. Hence I was wondering how people thought that one might go about doing this.... Cheers UPDATE: My solution to the problem is as follows: public class UserCurrentConextUsingWebContext : IUserCurrentConext { private const string _StoredExceptionName = "System.StoredException."; private const string _StoredExceptionIdName = "System.StoredExceptionId."; public virtual string UniqueAddress { get { return HttpContext.Current.Request.UserHostAddress; } } public Exception StoredException { get { return HttpContext.Current.Application[_StoredExceptionName + this.UniqueAddress] as Exception; } set { HttpContext.Current.Application[_StoredExceptionName + this.UniqueAddress] = value; } } public string StoredExceptionId { get { return HttpContext.Current.Application[_StoredExceptionIdName + this.UniqueAddress] as string; } set { HttpContext.Current.Application[_StoredExceptionIdName + this.UniqueAddress] = value; } } } Then when the error occurs, I have something like this in my Global.asax: public void ErrorLog_Logged(object sender, ErrorLoggedEventArgs args) { var item = new UserCurrentConextUsingWebContext(); item.StoredException = args.Entry.Error.Exception; item.StoredExceptionId = args.Entry.Id; } Then where ever you are later you can pull out the details by var item = new UserCurrentConextUsingWebContext(); var error = item.StoredException; var errorId = item.StoredExceptionId; item.StoredException = null; item.StoredExceptionId = null; Note this isn't 100% perfect as its possible for the same IP to have multiple requests to have errors at the same time. But the likely hood of that happening is remote. And this solution is independent of the session, which in our case is important, also some errors can cause sessions to be terminated, etc. Hence why this approach has worked nicely for us.

    Read the article

  • How do you delete rows from UITableView?

    - by James
    This has been bugging me for hours now and i have not been able to figure it out. I am importing data into a tableview using core data and NSMutableArray. As shown below. CORE DATA ARRAY NSMutableArray *mutableFetchResults = [CoreDataHelper getObjectsFromContext:@"Spot" :@"Name" :YES :managedObjectContext]; self.entityArray = mutableFetchResults; TABLE VIEW - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSManagedObject *object = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row]; NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } NSString *lat1 = [object valueForKey:@"Email"]; //NSLog(@"Current Spot Latitude:%@",lat1); float lat2 = [lat1 floatValue]; //NSLog(@"Current Spot Latitude Float:%g", lat2); NSString *long1 = [object valueForKey:@"Description"]; //NSLog(@"Current Spot Longitude:%@",long1); float long2 = [long1 floatValue]; //NSLog(@"Current Spot Longitude Float:%g", long2); //Getting current location from NSDictionary CoreDataTestAppDelegate *appDelegate = (CoreDataTestAppDelegate *) [[UIApplication sharedApplication] delegate]; NSString *locLat = [NSString stringWithFormat:appDelegate.latitude]; float locLat2 = [locLat floatValue]; //NSLog(@"Lat: %g",locLat2); NSString *locLong = [NSString stringWithFormat:appDelegate.longitude]; float locLong2 = [locLong floatValue]; //NSLog(@"Long: %g",locLong2); //Distance Shizzle //Prime's Location CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; //Home Location CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:locLat2 longitude:locLong2]; double distance = [loc1 getDistanceFrom: loc2] / 1000; int myInt = (int)(distance + (distance>0 ? 0.5 : -0.5)); //NSLog(@"INT VAL :%i", myInt); NSMutableString* converted = [NSMutableString stringWithFormat:@"%.1f", distance]; [converted appendString: @" Km"]; //NSLog(@"Distance between Prime and home = %g", converted); if (myInt < 11) { cell.textLabel.text = [object valueForKey:@"Name"]; cell.detailTextLabel.text = [NSString stringWithFormat:converted]; } else { } // Configure the cell... return cell; } I am trying to get the table only to display results that are within a certain distance. This method here works apart from the fact that the results over a certain distance are still in the table, they are just not graphically visible. I am led to believe that i have to carry out the filtering process before the formatting the table but i can not seem to do this. Please help. My xcode skills are not brilliant so code suggestions would be helpfull.

    Read the article

  • NewBie Question, jQuery: How can we implement if...else logic and call function

    - by Rachel
    I am new to jQuery and so don't mind this question if it sounds stupid but here is something that I am trying to do : I have 3 functions like: AddToCart Function which adds item to the shopping cart: //offer_id is the offer which we are trying to add to cart. addToCart: function(offer_id) { this.submit({action: 'add', 'offer_id': offer_id}, {'app_server_url': this.app_server_url}); }, RemoveFromCart which removes data from the cart //target is link clicked and event is the click event. removeFromCart: function(target, event) { this.uniqueElmt('cart_table').find('.sb_item_remove').unbind('click'); var offer_id = $(target).parent().find('.offer_id').html(); this.submit({action: 'remove', 'offer_id': offer_id, 'next_action': this.config.current_action}, {'app_server_url': this.app_server_url}); }, Get the current state of the cart //return string which represents current state of cart. getCartItems: function() { return this.contents; } Now I am trying to do 3 things: if there is no content in cart and addToCart is called than some action, so basically here we need to check the current state of cart and that is obtained by calling getCartItems and if it is Null and than if addToCart is called than we perform some action if there is content in the cart and addToCart is called than some action,so basically here we need to check the current state of cart and that is obtained by calling getCartItems and check if it is Null or not and than if addToCart is called than we perform some action if we had some content in the cart. if there is content in the cart and removeFromCart is called some action, so basically here we need to check the current state of cart and that is obtained by calling getCartItems and if it is not Null and if removeFromCart is called than we perform some action Pseudocode of what I am trying to do: if there is no content in cart and addToCart is called than $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events', 'linkTrackEvents' : 'scAdd,scOpen', 'linkType' : 'o', 'linkName' : 'Cart : First Product Added' // could be blank, but can include event name as added feature 'svalues' : { 'products' : ';OFFERID1[,;OFFERID2]', 'events' : 'scAdd,scOpen', }, } 'defer' : '0' } ); if there is content in the cart and addToCart is called than $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events', 'linkTrackEvents' : 'scAdd', 'linkType' : 'o', 'linkName' : 'Cart : Product Added' // could be blank, but can include event name as added feature 'svalues' : { 'products' : ';OFFERID1[,;OFFERID2]', 'events' : 'scAdd', }, }, 'defer' : '0' } ); if there is content in the cart and removeFromCart is called $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events', 'linkTrackEvents' : 'scRemove', 'linkType' : 'o', 'linkName' : 'Cart : Product Removed' // could be blank, but can include event name as added feature 'svalues' : { 'products' : ';OFFERID1[,;OFFERID2]', 'events' : 'scRemove', }, } 'defer' : '0' } ); My basic concern is that am complete newbie to jQuery and JavaScript and so am not sure how can I implement if...else logic and how can I call a funtion using jQuery/JavaScript.

    Read the article

  • How to Sync CI (Hudson) Activity into an existing automated Build Process (phing, svn)?

    - by maraspin
    OUR CURRENT BUILD PROCESS We're a small team of developers (2 to 4 people depending on project) who currently use Phing to deploy code to a staging environment, before going live. We keep our code in a SVN repo, where the trunk holds current active development and, at certain times, we do make branches that we test and then (if successful), tag and export to the staging env. If everything goes well there too, we finally deploy'em in production servers. Actions are highly automated, but always triggered by human intervention. THE DOUBT We'd now like to introduce Continuous Integration (with Hudson) in the process; unfortunately we have a few doubts about activity syncing, since we're afraid that CI could somewhat interfere with our build process and cause certain problems. Considering that an automated CI cycle has a certain frequency of automatically executed actions, we see 2 possible cases for "integration", each with its own problems: Case A: each CI cycle produces a new branch with its own name; we do use such a name to manually (through phing as it happens now) export the code from the SVN to the staging env. The problem I see here is that (unless specific countermeasures are taken - IE deletion) the number of branches we have can easily grow out of control (let's suppose we commit often, so that we have a fresh new build/branch every N minutes). Case B: each CI cycle creates a new branch named 'current', which is then tagged with a unique name only when we manually decide to export it to staging; the current branch, at any case is then deleted, as soon as the next CI cycle starts up. The problem we see here is that a new cycle could kick in while someone is tagging/exporting the 'current' branch to staging thus creating an inconsistent build (but maybe here I'm just too pessimist, since I confess I don't know whether SVN offers some built-in protection against this). With all this being said, I was wondering if anyone with similar experiences could be so kind to give us some hints on the subject, since none of the approaches depicted above looks completely satisfing to us. Is there something important we just completely left off in the overall picture? Thanks for your attention & (in advance) for your help!

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >