Daily Archives

Articles indexed Tuesday March 30 2010

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

  • Overriding Equals method in Structs

    - by devoured elysium
    I've looked for overriding guidelines for structs, but all I can find is for classes. At first I thought I wouldn't have to check to see if the passed object was null, as structs are value types and can't be null. But now that I come to think of it, as equals signature is public bool Equals(object obj) it seems there is nothing preventing the user of my struct to be trying to compare it with an arbitrary reference type. My second point concerns the casting I (think I) have to make before I compare my private fields in my struct. How am I supposed to cast the object to my struct's type? C#'s as keyword seems only suitable for reference types. Thanks

    Read the article

  • Best way to store 3 pieces of data as a single entry

    - by Matt
    For a game server, I want to record details when a player makes a kill, store this, and then at intervals update to a sql database. The part i'm interested in right now is the best method of storing the kill information. What i'd like to pass to the sql server on update would be {PlayerName, Kills, Deaths}, where the kills and deaths are a sum for the period between updates. So i'm assuming i'd build a list along the lines of {bob, 1, 0} {frank, 0, 1} {tom, 1, 0} {frank, 0, 1} then on update, consolidate the list to {frank, 14, 3}etc Can someone offer some advice please?

    Read the article

  • Doing TDD Silverlight 4 RC using Visual Studio 2010 RC

    - by user133992
    First I am glad to see better TDD support in VS2010. Support for generating code stubs from my tests is ok - not as good as more mature TDD plug-ins but a good start. I am looking for some best Silverlight 4.0 TDD practices. First Question: Anyone have links, recommendations? I know the new Silverlight Unit Test capabilities are much better (Jeff Wilcox's Mix Presentation). What I am focusing on right now is using TDD to develop pure Silverlight 4.0 Class Library projects - projects without a Silverlight UI project. I've been able to get it to work but not as cleanly as it should be. I can create an Empty VS project. Add A Silverlight 4 Class Library Project. Add a TestProject (not a silverlight Unit Test Project but a plain Test Project). Add a simple test in the Test Project such as: namespace Calculator.Test { [TestClass] public class CalculatorTests { [TestMethod] public void CalulatorAddTest() { Calc c = new Calc(); int expected = 10; int actual = c.Add(6, 4); Assert.AreEqual<int>(expected, actual); } } } Using the new Generate Type and Method from Test feature it will generate the following code in the Silverlight Project: namespace Calculator { public class Calc { public int Add(int p, int p_2) { throw new NotImplementedException(); } } } When I run the tests the first time it says the target assembly is Silverlight and not able to run test - Not exact text but the same general idea. When I change the implementation to: namespace Calculator { public class Calc { public int Add(int p, int p_2) { return p + p_2; } } } and re-run the test, it works fine and the test goes green. It also works for all other TDD code I generate after. I also get a warning Mark in the Test Project's reference to the Calculator Silverlight Class Library Assembly. Second Question: Any comments ideas if this just a bug in VS2010 RC or is Silverlight Class Library TDD not really supported. I have not created a Silverlight UI project or changed and build or debug settings so I have no idea what is hosting the silverlight DLL. Finally, some of the Silverlight Class Libraries I need to write will provide functionality that requires elevated Out-Of-Browser rights. Based on the above, it looks like I can use TDD Test Projects against regular Silverlight 4.0 Class Libraries, but I have no idea how I can TDD the elevated OOB functionality without also creating the UI component that gets installed. The UI piece is not really needed for the Library development and gets in the way of what I actually want to TDD. I know I can (and will) mock some of that functionality but at some point I will also need the real thing in my tests. Third Question: Any ideas how to TDD Silverlight 4.0 Class Library project that requires OOB elevated rights? Thanks!

    Read the article

  • Database: relational/not relational/object oriented... What to choose?

    - by Damian
    I'm porting a website that I made for app engine to run on a dedicated server. It is coded in java and I'm looking for a database to replace google datastore. My first thougt was MySql because everybody uses it, but i dont like SQL and I think I would feel more comfortable using OODB or anything else. With google datastore I could modify my models and don't worry about the database definition at all. I know using MySql that isn't possible. And I don't want to miss that. And if I use a OODB, which should I use? What about performance compared to MySql? Well, any idea or tip will really help me since I know nothing about databases.

    Read the article

  • Simple Linq Dynamic Query question

    - by Dr. Zim
    In Linq Dynamic Query, Scott Guthrie shows an example Linq query: var query = db.Customers. Where("City == @0 and Orders.Count >= @1", "London", 10). OrderBy("CompanyName"). Select("new( CompanyName as Name, Phone)"); Notice the projection new( CompanyName as Name, Phone). If I have a class like this: public class CompanyContact { public string Name {get;set;} public string Phone {get;set;} } How could I essentially "cast" his result using the CompanyContact data type without doing a foreach on each record and dumping it in to a different data structure? To my knowledge the only .Select available is the Dymanic Query version which only takes a string and parameter list.

    Read the article

  • What device manufacturers have their own Java ME API's

    - by Andres
    I know that BlackBerry and Nokia provide their own API's that go above and beyond what is specified in MIDP, CLDC, or any of the JSRs for Java ME. I am looking at a few other platforms for Java ME development and needed to know: Do Windows Mobile, LG, Samsung, ZTE, or Huawei provide their own API's for Java ME development?

    Read the article

  • Printing a PDF in .NET

    - by Chris Marasti-Georg
    It's the "printing question guy" again. Looking for a third-party solution to print PDFs, preferable from a service. I have seen some arguments against it, but due to our use case, this really is the preferred solution - the service will be receiving messages from a messaging bus, and there shouldn't be any sort of delay between the receipt of that message and the printing of the report. So far, I've found 1 solution from PDF Tools that seems very nice, and very flexible. The problem is that it's licensed per server. If anyone knows of any third-party solutions that have a seat license (per developer, unlimited runtime distribution), that would be much preferred. EDIT: Clarification, by printing, I mean sending the PDF to a printer.

    Read the article

  • How to handle localization in javascript files?

    - by Arnis L.
    I want javascript to be separated from views. Got requirement to implement localization for simple image button generated by JS: <img src="..." onclick="..." title="Close" /> What's the best technique to localize title of it? P.s. Found a solution by Ayende. This is the right direction. Edit: I got Localization helper class which provides Controller.Resource('foo') extension method. Thinking about to extend it (helper) so it could return all JavaScript resources (from "ClientSideResources" subfolder in App_LocalResources) for specified controller by it's name. Then - call it in BaseController, add it to ViewData and render it in Layout. Would that be a good idea?

    Read the article

  • Work For Hire SEO Services - What to Watch Out For!

    In a world where people continents apart work together for that same cause, and may not even know it, it can be confusing to hire someone when you cannot be familiar with them. Especially in the realm of online services like SEO services. A person who lives in a far away country may be willing to do the job you want them to for a fraction of the pay of hiring someone from your own country, but what redress do you have as a consumer if things do not go as expected? Not much really...

    Read the article

  • I have to select the checkbox two times to check/uncheck in jTable

    - by 117526709403775781607
    I have a jTable code i intend to use, but the problem with it is that when i click on the checkbox once it doesn't select/deselect it, instead i have to click twice. But if i select any other cell in the row except the one containing the checkbox the purpose is solved. HERE IS MY CODE : public class TableSelectionTest extends JFrame implements ListSelectionListener { private final int COLUMN_COUNT = 5; private TblModel model; public TableSelectionTest() { initialize(); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); } private void initialize() { List data = new ArrayList(); for (int i = 0; i < 10; i++) { Object record[] = new Object[COLUMN_COUNT]; record[0] = Boolean.FALSE; for (int j = 1; j < COLUMN_COUNT; j++) { record[j] = new Integer(j); } data.add(record); } model = new TblModel(data); JTable table = new JTable(model); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener (this); JScrollPane scroll = new JScrollPane(table); getContentPane().add(scroll, BorderLayout.CENTER); } public static void main(String[] args) { TableSelectionTest f = new TableSelectionTest(); f.show(); } class TblModel extends AbstractTableModel { private List data; public TblModel(List data) { this.data = data; } public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { if(columnIndex == 0) return true; else return false; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } } public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); int index = lsm.getMinSelectionIndex(); if(model.getRecord(index)[0] == Boolean.FALSE) model.setValueAt(Boolean.TRUE, index, 0); else if(model.getRecord(index)[0] == Boolean.TRUE) model.setValueAt(Boolean.FALSE, index, 0); } } } Please reply soon as it is bugging me a lot Thank you in advance :)

    Read the article

  • Disk Search / Sort Algorithm

    - by AlgoMan
    Given a Range of numbers say 1 to 10,000, Input is in random order. Constraint: At any point only 1000 numbers can be loaded to memory. Assumption: Assuming unique numbers. I propose the following efficient , "When-Required-sort Algorithm". We write the numbers into files which are designated to hold particular range of numbers. For example, File1 will have 0 - 999 , File2 will have 1000 - 1999 and so on in random order. If a particular number which is say "2535" is being searched for then we know that the number is in the file3 (Binary search over range to find the file). Then file3 is loaded to memory and sorted using say Quick sort (which is optimized to add insertion sort when the array size is small ) and then we search the number in this sorted array using Binary search. And when search is done we write back the sorted file. So in long run all the numbers will be sorted. Please comment on this proposal.

    Read the article

  • Microsoft equivalent of Eclipse RCP

    - by Bermo
    I have heard positive things about Eclipse RCP (Rich Client Platform) - does Microsoft has similar plugin UI framework available? I found an article from the Eclipse.org marketing director where he states: "An organization that is 100% Microsoft probably won't/shouldn't consider Eclipse RCP." A colleague pointed out that this article was posted in 2005, so i was wondering if Microsoft has a competing product by now, and if not, why not?

    Read the article

  • Debian: Adding new user?

    - by Marco
    How can I create a new user then SSH into the server under that user? I ran: useradd marco -d /home/marco -p WuUfhRdt4B Then I added to /etc/ssh/sshd_config: AllowUsers root marco Then restarted ssh: /etc/init.d/ssh restart I can't login. What did I miss? ** Running Debian.

    Read the article

  • CakePHP: Missing database table

    - by Justin
    I have a CakePHP application that is running fine locally. I uploaded it to a production server and the first page that uses a database connection gives the "Missing Database Table" error. When I look at the controller dump, it's complaining about the first table. I've tried a variety of things to fix this problem, with no luck: I've confirmed that at the command line I can login with the given MySQL credentials in database.php I've confirmed this table exists I've tried using the MySQL root credentials (temporarily) to see if the problem lies with permissions of the user. The same error appeared. My debug level is currently set to 3 I've deleted the entire contents of /app/tmp/cache I've set 777 permissions on /app/tmp* I've confirmed that I can run DESCRIBE commands at the commant line MySQL when logged in with the MySQL credentials used by by the application I've verified that the CakePHP log file only contains the error I'm setting in the browser window. I've tried all the suggestions I could find in similar postings on SO I've Googled around and didn't find any other ideas I think I've eliminating the obvious problems and my research isn't turning anything up. I feel like I'm missing something obvious. Any ideas?

    Read the article

  • strstr matching first occurrence in c

    - by lex0273
    I was wondering how could I match the string "just" in str1 if str1 contains the strings as: "this is just\2323 a test" // "just" will always be the same I'm trying to match it using strstr but so far it won't match because of the \xxxx Any suggestions on how to match it? Thanks

    Read the article

  • If Possible, How Can One Set Either a Background Color on Cells within a Sizer or Gridlines for the

    - by MetaHyperBolic
    I am flailing about with wxWidgets, in particular, the wx.Sizer in wxPython. I have read the documents, I have a copy of wXPython in Action before me, and have set aside the problem to work on other things a better mental model of sizers hopefully gestated within my skull. None of this has worked. I am not grokking, or even getting to the point where I can bang about usefully, how sizers work. In HTML, I could at least set a background color on some div or td, or call forth borders so I could see how things are laid out. Here, I have a grey expanse and no idea which of the nested static box sizers from which it originates. I am giving static box sizers after making a mess out of the grid bag sizers. Either alternative would let me at least get a handle on how these work.

    Read the article

  • How Can I Deal With Those Dead Links After Revamping My Web Site?

    - by skyflyer
    Couple of months ago, we revamped our web site. We adopted totally new site structure, specifically merged several pages into one. Everything looks charming. However, there are lots of dead links which produce a large number of 404 errors. So how can I do with it? If I leave it alone, could it bite back someday, say eating up my pr? One basic option is using 301 redirect, however it is almost impossible considering the number of it. So is there any workaround? Thanks for your considering!

    Read the article

  • dynamically creating the #temp table and then used to insert the data

    - by praveen
    Hi All, I am importing an intermediate result of query into a temp table for further use, so I used a #temp table to maintain the same schema as select * into # temp from schema.tableName where 1<1; insert into # temp from exec(table) While I am doing this statement as a variable to pass the different tableName its not working SET @TEMPSCHEMA = 'SELECT * INTO #temp FROM ' + @PKSchema + '.dbo.' + @PKTableName + ' WHERE 1<1;' exec(@TEMPSCHEMA) INSERT INTO #temp EXEC ( @SELECTSTATEMENT ) however after exec statement it is not taking the values to the temp table. it is showing the invalid object id #temp

    Read the article

  • dojo datagrid will make the page "jump" when sorting is changed

    - by Select0r
    Hi, I have a Dojo Datagrid in one of my pages (which contains more content) and the following problem occurs: As soon as I click on a column header to change the sorting, the page will jump up as if I clicked on some HTML-anchor. Funny enough, the page jump will make the grid show only the first two rows after it jumped, instead of (e.g.) have the grid start at the top of the page after the jump, which is the expected behaviour if an anchor is used. The problem occurs in different browsers (tested: Firefox 3.6, Opera 10, IE6), so I guess it might be a Dojo-problem/-bug. Any ideas to make this annoying behaviour stop? Greetings, Select0r PS: this seems to describe a similar problem, only for JQuery (and unfortunately without a solution, too)

    Read the article

  • IE8: Disable cleartype?

    - by Daniel
    For IE7, it's possible to add filter: none; to the body css to disable cleartype on fonts through CSS. I don't like the fuzzy look it gives, and it isn't really consistent across browsers. IE; Firefox and IE6 show it differently. IE8 however, seems to ignore the css option, even when forcing the browser into IE7 compatibility mode using: <meta http-equiv="X-UA-Compatible" content="IE=7" /> TL;DR: How do I disable clear-type fonts in IE8 through CSS?

    Read the article

  • How to speed up/slow down application's 'time'

    - by overboming
    I guess I am not saying it right in the title. What I intend to do is to hook to some system api,like a time interrupt happens every amount of time (which is how every application in the operating system interprets time) and make an application's call to this api return some bigger/smaller result. So from the point view of an applicaiton, time has been speed up or slow down. I have found some application on windows doing this, can anyone gives me some pointers on how to implement this on Mac OS X?

    Read the article

  • Do i *have* to use ObservableCollection in Silverlight WCF client?

    - by Simon_Weaver
    When accessing Silverlight in WCF you get proxies generated with ObservableCollection Thats fine when you're databinding, but a little clumsy when you're just calling a method. For instance the following service method : [OperationContract] public SearchOrdersMsgOut SearchOrders(ShippingStatusType[] shippingStatuses, string[] orderId) { } gets generated with ObservableCollection. What! They're just parameters. Why would I ever want to 'observe' them? I'm fine if I have to do this - but it seems like there should be a way to force simple array structures when I know I'm never databinding - especially on input messages. I'd much rather do this : searchCriteria.PaymentStatus = new [] { PaymentStatusType.PaymentFailed, PaymentStatusType.Unpaid }; than this : searchCriteria.PaymentStatus = new ObservableCollection<PaymentStatusType> { PaymentStatusType.PaymentFailed, PaymentStatusType.Unpaid }; Is there a way? PS. I do actually use a SearchCriteria object for my search criteria - but I simplified for this example wondering if parameters were handled differently.

    Read the article

  • AS3 mouseX and mouseY values wrong in Firefox

    - by Gerard
    Hi there, I'm getting some strange behaviour in my Flash movie, only in Firefox for MAC (3.6.2). Basically, the mouseX and mouseY properties of all display objects become massive numbers: < 100000000. This issue only occurs on Firefox, it is not present when the movie is run standalone, nor when it is run on any other browser. The swf requires Flash Player 10, and is written in AS3. It is also embedded via SWFObject, but I tested using the export code supplied with Flash and verified the issue is still present. Has anybody heard of this? Is it a Flash or Firefox bug? Is it a bug at all? Thanks

    Read the article

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