Daily Archives

Articles indexed Monday May 24 2010

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

  • Comparing structs in C++

    - by kamziro
    So in C++ There's a lot of times where you need to make an "index" class. For example: class GameID{ public: string name; int regionid; int gameid; bool operator<(const GameID& rhs) const; } Now, if we were to represent GameID as pair , the operator comparison just comes with it. Is there any other way to get that automatic operator comparison without having to use std::pair< ?

    Read the article

  • What is the best credit card processing service?

    - by JerSchneid
    We're looking to add credit card payments to our system (and it needs to be fairly custom, handling variable "per use" charges each month). We would like the integration to be simple and secure (i.e. no storing of credit card data on our system). What, in your opinion, is the best credit card processing provider to offer this kind of security and flexibility. List only one provider per answer to let the voting system do it's thing.

    Read the article

  • Dispatcher Timer Problem

    - by will
    I am trying to make a game in silverlight that also has widgets in it. To do this I am using a dispatcher timer running a game loop that updates graphics etc. In this I have a variable that has to be accessed by both by the constantly running game loop and UI event code. At first look it seemed that the gameloop had its own local copy of currentUnit (the variable), despite the variable being declared globally. I am trying to update currentUnit with an event by the widget part of the app, but the timer's version of the variable is not being updated. What can I do get the currentUnit in the gameloop loop to be updated whenever I update currentUnit via a click event? Here is the code for setting currentUnit as part of a click event DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Unit)); currentUnit = serializer.ReadObject(e.Result) as Unit; txtName.Text = currentUnit.name; Canvas.SetLeft(txtName, 100 - (int)Math.Ceiling(txtName.ActualWidth) / 2); txtX.Text = "" + currentUnit.x; txtY.Text = "" + currentUnit.y; txtX.Text = "" + currentUnit.owner; txtY.Text = "" + currentUnit.moved; txtName.Text = "" + currentUnit.GetHashCode(); And here is a snippet from the gameLoop loop //deal with phase changes and showing stuff if (txtPhase.Text == "Move" && movementPanel.Visibility == Visibility.Collapsed) { if (currentUnit != null) { if (currentUnit.owner) { if (currentUnit.moved) { txtMoved.Text = "This Unit has Already Moved!"; movementPanel.Visibility = Visibility.Collapsed; } else { txtMoved.Text = "" + currentUnit.GetHashCode(); movementPanel.Visibility = Visibility.Visible; } } else { txtMoved.Text = "bam"; movementPanel.Visibility = Visibility.Collapsed; } } else { txtMoved.Text = "slam"; movementPanel.Visibility = Visibility.Collapsed; } //loadUnitList(); } Here is the code for my unit class. using System; public class Unit { public int id { get; set; } public string name { get; set; } public string image { get; set; } public int x { get; set; } public int y { get; set; } public bool owner { get; set; } public int rotation { get; set; } public double movement { get; set; } public string type { get; set; } public bool moved { get; set; } public bool fired { get; set; } } Overall, any simple types, like a double is being 'updated' correctly, yet a complex of my own type (Unit) seems to be holding a local copy. Please help, I've asked other places and no one has had an answer for me!

    Read the article

  • recursive program

    - by wilson88
    I am trying to make a recursive program that calculates interest per year.It prompts the user for the startup amount (1000), the interest rate (10%)and number of years(1).(in brackets are samples) Manually I realised that the interest comes from the formula YT(1 + R)----- interest for the first year which is 1100. 2nd year YT(1 + R/2 + R2/2) //R squared 2nd year YT(1 + R/3 + R2/3 + 3R3/) // R cubed How do I write a recursive program that will calculate the interest? Below is the function which I tried double calculateInterest(double startUp, double rate, double duration) { double cpdInterest = (duration*startUp)*(1 + rate); if (duration == 0) { return cpdInterest; } else if (duration < 0) { cout << "Please enter a valid year"; } else { calculateInterest(cpdInterest,rate,duration); } return cpdInterest; }

    Read the article

  • Adding Street View controls (the two icons just above the +) to a Google Map (v3)

    - by AlexV
    It's probably something really simple, but I can't find it in the docs and I can't find a map with it to check it's source... I use version 3 of the API. I guess it's an something to add in myOptions? var latlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); Currently I only have dragging controls and the zoom pane controls. I would like to have the two Street View controls icons too. If you want full source, I'm using this example as a base (how would you add Street View controls to this example?).

    Read the article

  • How to structure class to support imported 3d model ?

    - by brainydexter
    Hello, I've written a C++ library that reads in this 3d model file (collada DAE). uptil now, I would output a list of triangles and handle each at rendering stage. But now, I need to attach some Bounding sphere information with the imported model. I need some advice on how should I organize this in code. Here are some specs of the 3D file format: - 3D model is represented as a Tree consisting of nodes - each node can contain other nodes, geometry information, transformation etc My requirements: - a bounding sphere associated with each node, thereby yielding a tree of bounding sphere hierarchy for the model itself. - actual vertex information What would be the recommended way to deal with this situation? Thanks

    Read the article

  • Required Working Precision for the BBP Algorithm?

    - by brainfsck
    Hello, I'm looking to compute the nth digit of Pi in a low-memory environment. As I don't have decimals available to me, this integer-only BBP algorithm in Python has been a great starting point. I only need to calculate one digit of Pi at a time. How can I determine the lowest I can set D, the "number of digits of working precision"? D=4 gives me many correct digits, but a few digits will be off by one. For example, computing digit 393 with precision of 4 gives me 0xafda, from which I extract the digit 0xa. However, the correct digit is 0xb. No matter how high I set D, it seems that testing a sufficient number of digits finds an one where the formula returns an incorrect value. I've tried upping the precision when the digit is "close" to another, e.g. 0x3fff or 0x1000, but cannot find any good definition of "close"; for instance, calculating at digit 9798 gives me 0xcde6 , which is not very close to 0xd000, but the correct digit is 0xd. Can anyone help me figure out how much working precision is needed to calculate a given digit using this algorithm? Thank you,

    Read the article

  • How to Route URL from one domain to another..

    - by Magic
    Hello, I am an C# ASP.NET developer. I am trying to route URL from one domain to another using Godaddy IIS Virtual dedicated server or Dedicated server. For example I have a website application called A_Application in my server. An example URL: www.myserver.com/A_Application/product/bear/?productid=1 or using pretty URL www.myserver.com/A_Application/product/bear/1 I would like to setup for my client to point to A_Application using his/her domain. My Client example URL will be: www.hisserver.com/product/bear/?productid=1 or using pretty URL www.hisserver.com/product/bear/1 Thanks!

    Read the article

  • Scala Map conversion

    - by Benjamin Metz
    I'm a Scala newbie I'm afraid: I'm trying to convert a Map to a new Map based on some simple logic: val postVals = Map("test" - "testing1", "test2" - "testing2", "test3" - "testing3") I want to test for value "testing1" and change the value (while creating a new Map) def modMap(postVals: Map[String, String]): Map[String, String] = { postVals foreach {case(k, v) => if(v=="testing1") postVals.update(k, "new value")} }

    Read the article

  • imported function name is not visible in entities context

    - by ali moharrami
    hi I am working on silverlight application which uses EF. I am able to retrieve the data. But I want to execute a stored procedure which returns no value. I tried using Import function. and the function is created in DataModel.Designer.cs : public int ClearWorkflow(Nullable<global::System.Guid> processId) { ObjectParameter processIdParameter; if (processId.HasValue) { processIdParameter = new ObjectParameter("ProcessId", processId); } else { processIdParameter = new ObjectParameter("ProcessId",typeof(global::System.Guid)); } return base.ExecuteFunction("ClearWorkflow", processIdParameter); } But the function name is not visible in entities context while accessing in silverlight.

    Read the article

  • How to setup NS for a subdomain

    - by DK M
    Hello, I have a DomainA.com use : ns1.mydomain.com ns2.mydomain.com I want create subdomain myname.domainA.com and use NS of other Server ns1.godaddy.com ns2.godaddy.com for that sub, please help, how to config in my NS ? I use Blind.

    Read the article

  • Custom DHCP Server on home network

    - by DanSpd
    Hello I have a computer network at my house which consists of two computers and one server. I have a software on dedicated server which requires direct connection to internet (port forwarding doesn't work for this). So I plan to setup network in following way. link text Please let me know if this will work. How good or bad could this be? Internet Connection: Verizon Fios 25/25

    Read the article

  • Linq 2 SQL Store inherited classes - not mapped to tables in the database

    - by user348672
    Hi. I'm trying to introduce the Linq2SQL technique into the project and have encountered the following issue: I've created ORM classes based on the Northwind database. In some other application I create several classes derived from the Linq2SQL classes. I'm able to add such a class to EntitySet but the application fails to submit changes. Is there any way around this? Sample code(MyClass is derived from the Order): DataClasses1DataContext northwind = new DataClasses1DataContext(); Product chai = northwind.Products.Single(p => p.ProductName == "Chai"); Product tofu = northwind.Products.Single(p => p.ProductName == "Tofu"); Order myOrder = new Order(); myOrder.OrderDate = DateTime.Now; myOrder.RequiredDate = DateTime.Now.AddDays(1); myOrder.Freight = 34; Order_Detail myItem1 = new Order_Detail(); myItem1.Product = chai; myItem1.Quantity = 12345; Order_Detail myItem2 = new Order_Detail(); myItem2.Product = tofu; myItem2.Quantity = 3; myOrder.Order_Details.Add(myItem1); myOrder.Order_Details.Add(myItem2); Customer myCustomer = northwind.Customers.Single(c => c.CompanyName == "B's Beverages"); MyClass newOrder = new MyClass(); newOrder.OrderDate = DateTime.Now; newOrder.RequiredDate = DateTime.Now.AddDays(31); newOrder.Freight = 35; Order_Detail myItem3 = new Order_Detail(); myItem3.Product = tofu; myItem3.Quantity = 3; newOrder.Order_Details.Add(myItem3); myCustomer.Orders.Add(myOrder); myCustomer.Orders.Add(newOrder); As I said I'm able to add the newOrder object but unable to submit into the database.

    Read the article

  • XMl Data Structure

    - by metdos
    Which one of two XML structures below do you prefer? Why? Any other suggestion is welcome :) <Parameters> <Parameter id=username>metdos</Parameter> <Parameter id=password>123</Parameter> </Parameters> or <Parameters> <username>metdos</username> <password>123</password> </Parameters>

    Read the article

  • Linq for two tables

    - by Diana
    I need to do something like this, My two tables have the same signature, but different class so It suppose to work but it is not working. var myTable; if (booleanVariable == true) { myTable = table1; } else { myTable = table2; } var myLinq1 = from p in myTable join r in myOtherTable select p; In this case, I have to initialize myTable I have tried also, var myTablev= table2; if (booleanVariable == true) { myTable = table1; } var myLinq1 = from p in myTable join r in myOtherTable select p; then var is type table2, then it can't be changed to table1 type. I need help, I don't want to make a copy paste of all the code. the linq query is huge, and it s nested with 5 or 6 queries. also I have to do this on 12 different methods. Thanks a lot for your help.

    Read the article

  • gcc-4.2 failed with exit code 1 iphone

    - by SKayser
    Hi, I've seen this error with different variations on discussion forums but being a non programmer I'm not sure how to progress this. Basically I have code which I found to help me with changing the background colors of cells on a grouped uitableview. The code introduced a line as such: CGContextAddArcToPoint(c, minx, miny, midx, miny, ROUND_SIZE); This gave an error indicated that it wasn't declared, so I added to my .h file the following under import uikit: #import <UIKit/UIKit.h> #define ROUND_SIZE 10 Now it shows that I have an error: Command/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 iphone Some discussions talk about libraries but because I don't have a programming background I don't understand what to do. I also see that some people show a log output but I'm not sure where that comes from as I don't get any debug windows because I'm guessing it doesn't get that far. I simply click 'Build and Go' and I get this error in the Message window. Any thoughts?

    Read the article

  • Regex: markdown-style link matching

    - by The.Anti.9
    I want to parse markdown style links, but I'm having some trouble matching the reference style ones. Like this one: [id]: http://example.com/ "Optional Title Here" My regex gets the id and the url, but not the title. Heres what I have: /\[([a-zA-Z0-9_-]+)\]: (\S+)\s?("".*?"")?/ I go through and add the references to a hashtable. the id as the key and the value is an instance of a class I made called LinkReference that just contains the url and the title. In case the problem is not my regex, and my code adding the matches to the hash table, Heres my code for that too: Regex rx = new Regex(@"\[([a-zA-Z0-9_-]+)\]: (\S+)\s?("".*?"")?"); MatchCollection matches = rx.Matches(InputText); foreach (Match match in matches) { GroupCollection groups = match.Groups; string title = null; try { title = groups[3].Value; } catch (Exception) { // keep title null } LinkReferences.Add(groups[1].Value, new LinkReference(groups[2].Value, title)); }

    Read the article

  • Problems compiling peazip on OSX

    - by Yansky
    I'm having some problems with compiling Peazip on OSX (10.6). I emailed the Peazip developer and he said he probably couldn't help me too much as the error seems to be OSX specific and he doesn't have access to an OSX machine any more. The compiler I'm using is Lazarus as the source is in Pascal. The actual compile process seems to go ok, but when I run the peazip.app program launcher, I get the following error: http://img.photobucket.com/albums/v215/thegooddale/Screen-shot-2010-05-22-at-71907-PM.png Here is the app launcher that the compile made: http://forboden.com/coding/peazip.app.zip - you can use an unzip program to look at the files inside (i.e. unzip it twice). I also tried just running the peazip unix file executable that was produced after the compile from the terminal and I got this: http://img.photobucket.com/albums/v215/thegooddale/Screen-shot-2010-05-22-at-72148-PM.png Here are the messages from the compile log from Lazarus while compiling Peazip: http://pastebin.com/qK4bdncL (I asked on the Lazarus forums and they said I can just ignore those "ld: warning: unknown stabs type" warnings). Here is the info from the project_peach.compiled file: <?xml version="1.0"?> <CONFIG> <Compiler Value="/usr/local/bin/ppc386" Date="1238949773"/> <Params Value=" -MObjFPC -Sgi -O1 -gl -k-framework -kCarbon -k-framework -kOpenGL -k'-dylib_file' -k'/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib' -WG -vewnhi -l -Fu/Users/yansky/Desktop/peazip-3.1.src/res/themes/crystalc/ -Fu/Developer/lazarus/components/synedit/units/i386-darwin/ -Fu/Developer/lazarus/ideintf/units/i386-darwin/ -Fu/Developer/lazarus/lcl/units/i386-darwin/ -Fu/Developer/lazarus/lcl/units/i386-darwin/carbon/ -Fu/Developer/lazarus/packager/units/i386-darwin/ -Fu/Users/yansky/Desktop/peazip-3.1.src/ -Fu. -opeazip -dLCL -dLCLcarbon project_peach.lpr"/> </CONFIG> I guess there's little chance that anyone here has experience with Pascal and Lazarus since it's not that popular a language and the compiler is still in beta, but I thought I would post here in the hopes that someone might point me in the right general direction about where/how the peazip.app launcher is breaking.

    Read the article

  • Creating a CLR UDF with variable number of parameters

    - by josephj1989
    Hi I wanted a function to find the greatest of a list of String values passed in. I want to invoke it as Select greatest('Abcd','Efgh','Zxy','EAD') from sql server. It should return Zxy. The number of parameters is variable.Incidentally it is very similar to oracle GREATEST function. So I wrote a very simple CLR function (Vs2008) and tried to deploy it. See below public partial class UserDefinedFunctions { [Microsoft.SqlServer.Server.SqlFunction] public static SqlString Greatest(params SqlString[] p) { SqlString max=p[0]; foreach (string s in p) max = s.CompareTo(max) > 0 ? s : max; return max; } }; But when I try to compile or deploy it I get the following error Cannot find data type SqlString[]. Is it possible to satisfy my requirement using SQL CLR ?

    Read the article

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