Search Results

Search found 838 results on 34 pages for 'sake'.

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

  • Returning a static array without using a class field

    - by Bart Friederichs
    I have the following base and derived (partial, for sake of brevity) classes: class Base { public abstract int[] someArray { get; } } class Derived : Base { private readonly static int[] _someArray = new int[] { 1,2,3,4 }; public override int[] someArray { get { return _someArray; } } } What I would like now, is put the new int[] { 1,2,3,4 } in the return part of the getter. But, that would create a new array every time the getter is called. Is it possible to directly return some kind of object, which stays the same for all objects of class Derived ? Something along the lines of (I know this is invalid C#): get { return (int[]) { 1, 2, 3, 4 }; }

    Read the article

  • In Python, are there builtin functions for elementwise boolean operators over boolean lists?

    - by bshanks
    For example, if you have n lists of bools of the same length, then elementwise boolean AND should return another list of that length that has True in those positions where all the input lists have True, and False everywhere else. It's pretty easy to write, i just would prefer to use a builtin if one exists (for the sake of standardization/readability). Here's an implementation of elementwise AND: def eAnd(*args): return [all(tuple) for tuple in zip(*args)] example usage: >>> eAnd([True, False, True, False, True], [True, True, False, False, True], [True, True, False, False, True]) [True, False, False, False, True] thx

    Read the article

  • fstream stopping math.h from working

    - by CaptainProg
    I am creating a program in C++ in which I need to read a text file in. I have included the fstream header file, which allows me to open the file, but having added the include, I now receive countless errors relating to math.h functions. Examples: 1>c:\program files\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf' 1>c:\program files\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';' Is there any way I can include the text file reading functions of fstream without compromising the math.h functions? And why does this conflict occur anyway? /Edit/ It seems the errors are in the cmath standard header file. It is nothing I have access to, but for the sake of completion, here is the code that is causing the errors: using _CSTD acosf; using _CSTD asinf; using _CSTD atanf; using _CSTD atan2f; using _CSTD ceilf; (etcetera)

    Read the article

  • How does exactly Qt works?

    - by Somebody still uses you MS-DOS
    I have seen that you can write your application in Qt, and it can be run in different operating systems. And - correct me if I'm wrong - you don't need to have Qt already installed in all of these platforms. How exactly this approach works? Does Qt compiles to the desired platform, does it bundle some "dlls" (libs), how does it do it? Is different from programming a Java application for the sake of cross-platform? If you use Python to write a Qt application with Python bindings, does the final user needs to have Python installed?

    Read the article

  • How SEO friendly is this URL ?

    - by The_AlienCoder
    I have this products catalog site.For the sake of SEO, I would have wanted my 'view details' link to look some thing like this ~/products/26-productname or ~/products/26/productname On my machine I'm using a url re-writing module and it works well. Unfortunately My host(shared) does not support url re-writing modules or Aspnet 4.0 for now. So I came up with a workaround that attempts to be SEO friendly Instead of this : ~/Products/details.aspx?id=26 I decided to simply append the product name in the url and i.e ~/Products/details.aspx?product=26-Toshiba Qosmio Notebook So my question is how SEO friendly is such a URL and is my attempt worth anything at all?

    Read the article

  • Binding Data Template element to property on sub-class

    - by TerrorAustralis
    Hi guys, I have a class, for experiment sake call it foo() and another class, call it bar() I have a data template for class foo() defined in my xaml, but one of foo()'s properties is a bar() object such that foo() { Public string Name {get; set;} Public int ID {get; set;} Public bar barProp {get; set;} } and bar() { Public string Description{get; set;} } I want my data template of foo to display the Description property of bar. I have tried the simple <textblock Text="{Binding Path=barProp.Description}" /> and variants to no avail Seeking wisdom, DJ

    Read the article

  • Logging out of Facebook invalidates offline_access token

    - by Mike Pateras
    I'm getting an offline access token like this: https://graph.facebook.com/oauth/access_token?scope=offline_access&client_id=MYCLIENTID&redirect_uri=MYREDIRECTURI&client_secret=MYSECRET&code=MYCODE obviously the MYCLIENTID and stuff have been changed for the sake of this post. Anyway, as soon as the user logs out of facebook, the key seems to no longer be valid. Am I not requesting offline_access properly (there's still an "expires" value on it, should there be if it is actually getting offline access), or is that just how it works? If it's the latter, how can I get a key that will persist, regardless of if the user logs out of facebook? I'm sure this is possible, because Tweetdeck can still write to Facebook, even though I'm currently logged out.

    Read the article

  • Why cant I specify the width and height of a cell in an html table?

    - by Phil
    I am using CSS but for the sake of quick testing i am just using a style tag. This is the code I am trying to implement: echo "<td style='height=10px; width=10px;'>"; it makes sure that the max width of the cell is 10px however the height overflows with the text so becomes very large (high). what I am trying to achieve is any information that is in that cell more than 30 charcters I want to hide so you cant see it. (I know 30 charaters is more than 10px but I am just playing to see if it worked!) Thanks guys.

    Read the article

  • Java - understanding servlets

    - by Trup
    I am working on a homework project that should implement a board game between 2 clients over an HttpServlet. I have couple of questions: 1) I read that HttpServlets must be stateless, however, for the sake of the game, I have to keep a lot of state(whose turn it is, the state of the board, etc). Do I have to keep this in the clients? Does the HttpServlet indeed have to be stateless, i.e. have no fields that track state? 2) I know that the clients will talk to the servlet via the doGet/doPost methods, but how can the servlet talk to the clients(for example, if player 1 just made a move and sent it to the servlet, the servlet has to tell client 2 what the move was). Thank you Also, if you can point me to a useful, simple example of a similar code online, I would be very grateful

    Read the article

  • Structuremap and creating objects with initial state

    - by Simon
    I have an object which needs a dependency injected into it public class FootballLadder { public FootballLadder(IMatchRepository matchRepository, int round) { // set initial state this.matchRepo = matchRepository; this.round = round; } public IEnumerable<LadderEntry> GetLadderEntries() { // calculate the ladder based on matches retrieved from the match repository // return the calculated ladder } private IMatchRepository matchRepo; private int round; } For arguments sake, lets assume that I can't pass the round parameter into the GetLadderEntries call itself. Using StructureMap, how can I inject the dependency on the IMatchRepository and set the initial state? Or is this one of those cases where struggling against the framework is a sign the code should be refactored?

    Read the article

  • Is it possible with dynamic TSQL query ?

    - by eugeneK
    I have very long select query which i need to filter based on some params, i'm trying to avoid having different stored procedures or if statements inside of single stored procedure by using partly dynamic TSQL... I will avoid long select just for example sake select a from b where c=@c or d=@d @c and @d are filter params, only one can filter at the same time but also both filters could be disabled. 0 for each of these means param is disables so i can create nvarchar with where statement in it... How do i integrate in here dynamic query so 'where' can be added to normal query. I cannot add all the query as big nvarchar because there is too many things in it which will require changes ( ie. when's, subqueries, joins)

    Read the article

  • How can I store a useful value in my ASP.NET MVC site's URL and make it propagate?

    - by joshjs
    Let's say I have a simple ASP.NET MVC site with two views. The views use the following routes: /Foo and /Foo/Bar. Now let's say I want to use the URL to specify (just for the sake of example) the background color of the site. I want my routes to be, for instance, /Blue/Foo or /Green/Foo/Bar. Also, if I call Html.ActionLink from a view, I want the Blue or Green value to propagate. So, e.g., if I call Html.ActionLink("Bar", "Foo") from /Blue/Foo, I want /Blue/Foo/Bar to come back. How best can I do this? (Forgive me if I'm missing an existing post. This is hard for me to articulate concisely, so I'm not quite sure what to search for.)

    Read the article

  • Using the windows api and C++, how could I load an exe from the hard drive and run it in its own thread?

    - by returneax
    For the sake of learning I'm trying to do what the OS does when launching a program ie. parsing a PE file and giving it a thread of execution. If I have two exe's one called foo.exe and the other bar.exe, how could I have foo.exe load the contents of bar.exe into memory then have it execute from there in its own thread? I know how to get it into memory using MapViewOfFile or by simple loading the contents on the hard drive into a buffer. I'm assuming simply copying the contents of bar.exe on disk into its own suspended thread and running it wouldn't work. I am semi-familiar with PE file internals. All help is very much appreciated, of course :)

    Read the article

  • MySQL Query involving column names containing math operators

    - by devil_fingers
    I'm a MySQL scrub, and I have asked around and checked around the internet for what I'm sure will turn out to be something obvious, but I'm very frustrated with what I thought would be a very, very simple query not working. So here goes. Please be gentle. Basically, in a large database, some of the column names contain mathematical operators like "/" and "+." (Don't ask, it's not my database, I can't do anything about it). Here is the "essence" of my query (I took out the irrelevant stuff for the sake of this question): SELECT PlayerId, Season, WPA/LI AS WPALI FROM tht.stats_batting_master WHERE Season = "2010" AND teamid > 0 AND PA >= 502 GROUP BY playerid ORDER BY WPALI DESC When I run this, it returns "Unknown column 'LI' in 'field list'," I assume because it sees the "/" in WPA/LI as a division sign. Like I said, I'm sure this is easy enough to work around (it must be given how much this database is used), but I haven't' been able to figure out how. Thanks in advance for any help.

    Read the article

  • Development life-cycle for making an application?

    - by Mohit Deshpande
    I have an idea that I want to make into an application (I have a C/C++, C#, and Java programming background so I will be developing in QT Creator for cross-compilation's sake). So now I am asking you senior developers, what should I do next? I know that all good programs come from an idea. Then what should I do? Prototype the UI? Then develop the code? Is there like a circle of the development of an application? I DO NOT MEAN FOR THIS QUESTION TO BE SUBJECTIVE OR ARGUMENTATIVE

    Read the article

  • conceptually different entities with a few similar properties should be stored in one table or more?

    - by Haghpanah
    Assume A and B are conceptually different entities that have a few similar properties and of course their own specific properties. In database design, should I put those two entities in one big aggregated table or two respectively designed tables. For instance, I have two types of payment; Online-payment and Manual-payment with following definition, TABLE [OnlinePayments] ( [ID] [uniqueidentifier], [UserID] [uniqueidentifier], [TrackingCode] [nvarchar](32), [ReferingCode] [nvarchar](32), [BankingAccID] [uniqueidentifier], [Status] [int], [Amount] [money], [Comments] [nvarchar](768), [CreatedAt] [datetime], [ShopingCartID] [uniqueidentifier], ) And TABLE [ManualPayments] ( [ID] [uniqueidentifier], [UserID] [uniqueidentifier], [BankingAccID] [uniqueidentifier], [BankingOrgID] [uniqueidentifier], [BranchName] [nvarchar](64), [BranchCode] [nvarchar](16), [Amount] [money], [SlipNumber] [nvarchar](64), [SlipImage] [image], [PaidAt] [datetime], [Comments] [nvarchar](768), [CreatedAt] [datetime], [IsApproved] [bit], [ApprovedByID] [uniqueidentifier], ) One of my friends told me that creating two distinct tables for such similar entities is not a well design method and they should be put in one single table for the sake of performance and ease of data manipulations. I’m now wondering what to do? What is the best practice in such a case?

    Read the article

  • Safely dereferencing FirstOrDefault call in Linq c#

    - by samy
    For brevity's sake in my code, i'd like to be able to do the following: having a collection, find the first element matching a lambda expression; if it exists, return the value of a property or function. If it doesn't exist, return null. var stuff = {"I", "am", "many", "strings", "obviously"}; var UpperValueOfAString = stuff.FirstOrDefault(s => s.contains("bvi")).ToUpper(); // would return "OBVIOUSLY" var UpperValueOfAStringWannabe = stuff.FirstOrDefault(s => s.contains("unknown token")).ToUpper(); // would return null Is it possible with some linq-syntax-fu or do i have to check explicitly for the return value before proceeding?

    Read the article

  • SSAS OLAP MDX and relationships

    - by Sonic Soul
    I new to OLAP, and still not sure how to create a relationship between 2 or more entities. I am basing my cube on views. For simplicity sake let's call them like this: viewParent (ParentID PK) viewChild (ChildID PK, ParentID FK) these views have more fields, but they're not important for this question. in my data source, i defined a relationship between viewParent and viewChild using ParentID for the link. As for measures, i was forced to create separate measures for Parent and Child. in my MDX query however, the relationship does not seem to be enforced. If i select record count for parent, child, and add some filters for the parent, the child count is not reflecting it.. SELECT { [Measures].[ParentCount],[Measures].[ChildCount] } ON COLUMNS FROM [Cube] WHERE { ( {[Time].[Month].&[2011-06-01T00:00:00]} ,{[SomeDimension].&[Foo]} ) } the selected ParentCount is correct, but ChildCount is not affected by any of the filters (because they are parent filters). However, since i defined a relationship, how can i take advantage of that to filter children by parent filter?

    Read the article

  • Localizing a plist with grouped data

    - by Robert Altman
    Is there a way to localize a plist that contain hierarchical or grouped data? For instance, if the plist contains: Book 1 (dictionary) Key (string) Name (string) Description (localizable string) Book 2 (dictionary) Key (string) Name (string) Description (localizable string) (etcetera...) For the sake of the example, the Key and Name should not be translated (and preferably should not be duplicated in multiple localized property lists). Is there a mechanism for providing localizations for the localizable Description field without localizing the entire property list? The only other strategy that came to my mind is to store a lookup key in the description field and than use that to retrieve the localized text via NSLocalizedString(...) Thanks.

    Read the article

  • TFS 2008 and Common libraries folder structure.

    - by Doerr
    TFS 2008 and Common Libraries I have created a Team Project called "Common Library" that will host code used in numerous different Team Projects throughout TFS. For sake of argument, lets say we have 2 distinct Librarys under the "Common Library" Team Projects, MailProject and LoggingProject. Other projects throughout TFS will be using the binary representation of these projects via branching and not the actual source code. What is the best way to set up the folder structure for this Team Project? Do I add the project to the "Common Library" and simply "include" the bin/release folder as part of the project? I have seen some examples of people creating a seperate "Deploy" folder. I assume this is synonamous with the bin/release folder?

    Read the article

  • What is the best way to write faster on Vim using a non-english keyboard?

    - by Martín Fixman
    I usually use Vim, and its great for the ability to do faster some actions than other editors. However, since I live in Argentina I have a Latin American keyboard, that makes everything in Vim pretty slower (to write / to search, I must press Shift+7). Since I don't want to be changing Keyboard layouts all the time (and its pretty difficult to get used to pressing symbols as in an English keyboard), I was wondering if there was a vim plugin (of .vimrc file) that may be useful for international users. Just for the sake of it, here's how the Latin American keyboard is laid out: By the way, I would love to go and buy an English keyboard, but unfortunately I use a Laptop.

    Read the article

  • How can I apply indexer to Dictionary VALUES (C#3.0)

    - by Newbie
    I have done a program string[] arrExposureValues = stock.ExposureCollection[dt] .Values.ToArray(); for(int i=0;i<arrExposureValues .length;i++) Console.WriteLine(arrExposureValues[i]); Nothing wrong and works fine. But is it possible to do something like the below for(int i=0;i<stock.ExposureCollection[dt].Count;i++) Console.WriteLine(stock.ExposureCollection[dt].Values[i]); This is just for my sake of knowledge (Basically trying to accomplish the same in one line). Note: ExposureCollection is a dictionary object Dictionary<DateTime, Dictionary<string, string>> First of all I have the doubt if it is at all possible! I am using C#3.0. Thanks.

    Read the article

  • Real world examples of Ecmascript functions returning a Reference?

    - by Bergi
    Read the EcmaScript specification, section 8.7 The Reference Specification Type: The Reference type is used to explain the behaviour of such operators as delete, typeof, and the assignment operators. […] A Reference is a resolved name binding. Function calls are permitted to return references. This possibility is admitted purely for the sake of host objects. No built-in ECMAScript function defined by this specification returns a reference and there is no provision for a user-defined function to return a reference. Those last two sentences impressed me. With this, you could do things like coolHostFn() = value (valid syntax, btw). So my question is: Are there any EcmaScript implementations that define host function objects which result in Reference values?

    Read the article

  • Using xval with fields containing periods

    - by JP
    Hello, I have been using xVal with success for a while but this evening ran into an issue where a field containing a period would not be validated (client or server-side). I am using ASP.NET MVC2 and need to use the period syntax in cases where I am model binding to a list. In the below example I am using a textbox for the sake of simplicity: xVal.AttachValidator(null, { "Fields": [{ "FieldName": "entry[622592].Value", "FieldRules": [{ "RuleName": "Required", "RuleParameters": {}}]}] }, {}) <input type="text" class="text" name="entry[622592].Value"/> If I replace both instances of "entry[622592].Value" to something trivial like "test" then the validation works successfully, but if i leave it this way the validation never appears to fire... Has anyone run into this issue? Thanks in advance!

    Read the article

  • Assign TableView column binding to a specific core-data object in to-many related entity based on se

    - by snown27
    How would I assign a column of a TableView to be a specific entry in a Core Data entity that is linked to the NSArrayController via a to-many relationship? For example Entity: MovieEntity Attributes: title(NSString), releaseDate(NSDate) Relationship: posters<-->> PosterEntity Entity:PosterEntity Attributes: imageLocation(NSURL), default(BOOL) Relationships: movie<<--> MovieEntity So I have a three column table that I want to display the Poster, Title, and Release Date attributes in, but as one movie could potentially have several different style's of posters how do I get the poster column to only show the one that's marked default? Since the rest of the table is defined in Interface Builder I would prefer to keep it that way for the sake of keeping the code as clean as possible, but if this can only be done programmatically then I'm all ears. I just wanted to give preference in case there's more than one way to skin a cat, so to speak.

    Read the article

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