Daily Archives

Articles indexed Wednesday May 26 2010

Page 25/118 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • Are Socket AM2/AM2+ Heatsinks Compatible with Socket AM3 Heatsinks?

    - by wag2639
    I bought an Asus Lion Square compatible with a AMD Athlon II X3 435 Socket AM3 processor? I know strictly speaking, the Lion Square specifies AM2 but I'm a little confused since AM2 and AM3 are suppose to be socket compatible (I'm a little confused here as well but I assume it means an AM3 board will support AM2/AM2+ CPUs). However, will there be a problem with chip height and spacing? Or do people have experience asking ASUS for a standoff adapter?

    Read the article

  • When using Query Syntax in C# "Enumeration yielded no results". How to retrieve output

    - by Shantanu Gupta
    I have created this query to fetch some result from database. Here is my table structure. What exaclty is happening. DtMapGuestDepartment as Table 1 DtDepartment as Table 2 Are being used var dept_list= from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID") join dept in DtDepartment.AsEnumerable() on map.Field<Nullable<long>>("DEPARTMENT_ID") equals dept.Field<Nullable<long>>("DEPARTMENT_ID") select dept.Field<string>("DEPARTMENT_ID"); I am performing this query on DataTables and expect it to return me a datatable. Here I want to select distinct department from Table 1 as well which will be my next quest. Please answer to that also if possible.

    Read the article

  • Best practices regarding equals: to overload or not to overload?

    - by polygenelubricants
    Consider the following snippet: import java.util.*; public class EqualsOverload { public static void main(String[] args) { class Thing { final int x; Thing(int x) { this.x = x; } public int hashCode() { return x; } public boolean equals(Thing other) { return this.x == other.x; } } List<Thing> myThings = Arrays.asList(new Thing(42)); System.out.println(myThings.contains(new Thing(42))); // prints "false" } } Note that contains returns false!!! We seems to have lost our things!! The bug, of course, is the fact that we've accidentally overloaded, instead of overridden, Object.equals(Object). If we had written class Thing as follows instead, then contains returns true as expected. class Thing { final int x; Thing(int x) { this.x = x; } public int hashCode() { return x; } @Override public boolean equals(Object o) { return (o instanceof Thing) && (this.x == ((Thing) o).x); } } Effective Java 2nd Edition, Item 36: Consistently use the Override annotation, uses essentially the same argument to recommend that @Override should be used consistently. This advice is good, of course, for if we had tried to declare @Override equals(Thing other) in the first snippet, our friendly little compiler would immediately point out our silly little mistake, since it's an overload, not an override. What the book doesn't specifically cover, however, is whether overloading equals is a good idea to begin with. Essentially, there are 3 situations: Overload only, no override -- ALMOST CERTAINLY WRONG! This is essentially the first snippet above Override only (no overload) -- one way to fix This is essentially the second snippet above Overload and override combo -- another way to fix The 3rd situation is illustrated by the following snippet: class Thing { final int x; Thing(int x) { this.x = x; } public int hashCode() { return x; } public boolean equals(Thing other) { return this.x == other.x; } @Override public boolean equals(Object o) { return (o instanceof Thing) && (this.equals((Thing) o)); } } Here, even though we now have 2 equals method, there is still one equality logic, and it's located in the overload. The @Override simply delegates to the overload. So the questions are: What are the pros and cons of "override only" vs "overload & override combo"? Is there a justification for overloading equals, or is this almost certainly a bad practice?

    Read the article

  • asp.net mvc and portal like functionality

    - by richard-heesbeen
    fHi, I need to build an site with some portal like functionality where an param in the request will indentify the portal. like so http:/domain/controller/action/portal Now my problem is if an portal doesn't exists there must be an redirect to an other site/page and an user can login in to one portal but if the user comes to an other portal the user must be redirected back to the login page for that portal. I have something working now, but i feel like there must be an central place in the pipeline to handle this. My current solution uses an custom action filter which checks the portal param and sees if the portal exists and checks if the user logged on in that portal (the portal the user logged on for is in the authentication cookie). I make my own IIndentiy and IPrincipal in the application_postauthentication event. I have 2 problems with my current approach: 1: It's not really enforced, i have to add the attributes to all controllers and/or actions. 2: The isauthenticated on an user isn't really working, i would like that to work. But for that i need to have access to the params of the route when i create my IPrincipal/IIndenty and i can't seem to find an correct place to do that. Hope someone can give me some pointers, Richard.

    Read the article

  • MySQL> Selecting from more tables (with same columns) without UNION

    - by Petr
    Hi, It is probably pretty simple but I cannot figure it out: Say I have tables A and B both with the same columns. I need to do SELECT * FROM A,B without having results merged into one row. I.e. when each table has 2 rows, I need the result to have 4 rows. EDIT: I know about JOIN but dont know how to join the tables without predicate. I need merge them. Thanks

    Read the article

  • Eliminating inherited overlong MACRO

    - by ExpatEgghead
    I have inherited a very long set of macros from some C algorithm code.They basically call free on a number of structures as the function exits either abnormally or normally. I would like to replace these with something more debuggable and readable. A snippet is shown below #define FREE_ALL_VECS {FREE_VEC_COND(kernel);FREE_VEC_COND(cirradCS); FREE_VEC_COND(pixAccum)..... #define FREE_ALL_2D_MATS {FREE_2D_MAT_COND(circenCS); FREE_2D_MAT_COND(cirradCS_2); } #define FREE_ALL_IMAGES {immFreeImg(&imgC); immFreeImg(&smal..... #define COND_FREE_ALLOC_VARS {FREE_ALL_VECS FREE_ALL_2D_MATS FREE_ALL_IMAGES} What approach would be best? Should I just leave well alone if it works? This macro set is called twelve times in one function. I'm on Linux with gcc.

    Read the article

  • Hard coded contents in SVG Editor is not appearing?

    - by marknt15
    Hi, I'm using this: http://code.google.com/p/svg-edit/ I put a hard coded code inside the svgcanvas div html tag: <div id="svgcanvas"> <svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" id="svgroot" height="480" width="640"><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 640 480" id="svgcontent"><g style="pointer-events: all;"><title style="pointer-events: inherit;">Layer 1</title><ellipse ry="69" rx="90" style="pointer-events: inherit;" stroke-width="5" stroke="#000000" fill="#FF0000" id="svg_1" cy="156.5" cx="286"></ellipse></g></svg><g id="selectorParentGroup"><rect style="pointer-events: none;" display="none" stroke-width="0.5" stroke="#22C" fill-opacity="0.15" fill="#22C" id="selectorRubberBand"></rect></g></svg> </div> My expected output is that it should draw the example svg code in there but it didn't. Even if I reload the page it will still not appear. How can I make it appear? Thanks

    Read the article

  • JavaScript: why `null == 0` is false?

    - by lemonedo
    I had to write a routine that increments the value of a variable by 1 if it is a number, or assigns 0 to the variable if it is not a number. The variable can be incremented by the expression, or be assigned null. No other write access to the variable is allowed. So, the variable can be in three states: it is 0, a positive integer, or null. My first implementation was: v >= 0 ? v += 1 : v = 0 (Yes, I admit that v === null ? v = 0 : v += 1 is the exact solution, but I wanted to be concise then.) It failed since null >= 0 is true. I was confused, since if a value is not a number, an numeric expression involving it must be false always. Then I found that null is like 0, since null + 1 == 1, 1 / null == Infinity, Math.pow(2.718281828, null) == 1, ... Strangely enough, however, null == 0 is evaluated to false. I guess null is the only value that makes the following expression false: (v == 0) === (v >= 0 && v <= 0) So why null is so special in JavaScript?

    Read the article

  • Regex split string but keep separators

    - by rwwilden
    I'd like to do a Regex.Split on some separators but I'd like to keep the separators. To give an example of what I'm trying: "abc[s1]def[s2][s3]ghi" --> "abc", "[s1]", "def", "[s2]", "[s3]", "ghi" The regular expression I've come up with is new Regex("\\[|\\]|\\]\\["). However, this gives me the following: "abc[s1]def[s2][s3]ghi" --> "abc", "s1", "def", "s2", "", "s3", "ghi" The separators have disappeared (which makes sense given my regex). Is there a way to write the regex so that the separators themselves are preserved?

    Read the article

  • Imploding nested arrays

    - by Alex Zylman
    Hey guys, If I have an array structured like this: $array[index]['first_name'] $array[index]['last_name'] Is there an easy way to implode it into something like first_name last_name,first_name last_name, etc. for all the indices? Implode didn't seem to do what I wanted for something like this. Currently I'm just looping over the whole thing, but it's a SIGNIFICANT bottleneck.

    Read the article

  • Querying a Single Column with LINQ

    - by Hossein Margani
    Hi Every one! I want to fetch array of values of a single column in a table, for example, I have a table named Customer(ID,Name), and want to fetch ids of all customers. my query in LINQ is: var ids = db.Customers.Select(c=>c.ID).ToList(); The answer of this query is correct, but I ran SQL Server Profiler, and saw the query which was like this: SELECT [t0].[ID], [t0].[Name] FROM [dbo].[Customer] AS [t0] I understood that LINQ selects all columns and then creates the integer array of ID fields. How can I write a LINQ query which generates this query in SQL Server: SELECT [t0].[ID] FROM [dbo].[Customer] AS [t0] Thank you.

    Read the article

  • Accessing curl executable from Program files?

    - by Kaido
    I have built an application which uses user executable through WScript com object. Now the main program is located in C:\Program files\Myapp Curl executable is located in C:\Curl But it looks like my application is unable to execute curl if main application is in Program files. If i move it to another location it can execute curl nicely. Problem occurs only on Windows Xp on Vista and Win7 it works perfectly. Is there any special permissions i have to give to my app or what?

    Read the article

  • Update/Insert without select

    - by user348731
    I have this very simple class public class ProductAttributeValuePortal { public virtual int ID { get; set; } public virtual Domain.Entity.Portals.ProductPortal Product { get; set; } public virtual Attribute Attribute { get; set; } public virtual string Value { get; set; } } with this very simple map public ProductAttributeValueMap () { Table("DM.dbo.ProductAttributeValues"); Id(x => x.ID, "ProductAttributeValue_id"); References(x => x.Product); References(x => x.Attribute); Map(x => x.Value); } Each time i make a insert NHibernate makes a Select of the attribute like : NHibernate: INSERT INTO MachineData.dbo.ProductAttributeValues (Value, Product_id, Attribute_id) VALUES (@p0, @p1, @p2); select SCOPE_IDENTITY();@p0 = '6745', @p1 = 39, @p2 = 'BSTD' NHibernate: SELECT attribute_.Attribute_id, attribute_.Name as Name21_, attribute_.AttributeType as Attribut3_21_, attribute_.TagName as TagName21_, attribute_.MapTo as MapTo21_ FROM MachineShared.dbo.Attributes attribute_ WHERE attribute_.Attribute_id=@p0;@p0 = 'DLB' What am i doing wrong. And where do i find some really uptodate books about nhibernate/Fluent nhibernate

    Read the article

  • inserting only date in a column in sql server

    - by sam
    hi! Is there a way to insert only date in a datetime column in sql server without the time? for example date (datetime) =============== 12-01-2000 16-02-2000 or i should store this as a varchar and cast it when retriving so that i can convert to whatever form i need.

    Read the article

  • WinAPI C - RunAsUser from REDMON_USER and REDMON_SESSIONID

    - by scriptmaster
    I installed a PostScript printer driver and have setup REDMON (redmonnt.dll) for redirecting postscript output to my program. In my rather simple c program I capture the data from STDIN and I am able to successfully save it into a .ps file. The file looks OK. However, I want to start gsview.exe for viewing the file. If I call ShellExecute it fails in Windows 7 because of permission issues. It seems that my program is called under a different user account (LOCAL SERVICE). So I am looking for a way to run gsview.exe under a specific username (the user who initiated the print job is available to me in a variable as REDMON_USER along with the SESSIONID as well. I am stuck (and my stack is overflowing =) What are the minimum WinAPI call I need to use to launch a program given a username and a sessionid? Any code examples in C/C++, .NET would be very helpful

    Read the article

  • python processs complete list files matched

    - by thomytheyon
    Hi All, I'm trying to get a simple code working, unfortunatly im a python beginner. My script should return a list of files that doesn't match a pattern, more information here : http://stackoverflow.com/questions/2910106/python-grep-reverse-matching/2910288#2910288 My code is running but doesn't process the complete list of files found as it should : import sys,os filefilter = ['.xml','java','.jsp','lass'] path= "/home/patate/code/project" s = "helloworld" for path, subdirs, files in os.walk(path): for name in files: if name[-4:] in filefilter : f = str(os.path.join(path, name)) with open(f) as fp: if s in fp.read(): print "%s has the string" % f else: print "%s doesn't have the string" % f This code return : /home/patate/code/project/blabla/blabla/build.xml doesn't have the string None If i change f = str(os.path.join(path, name)) for print str(os.path.join(path, name)) I can see the whole list being printed. How can i process the whole list as i which to ? :( Thanks again.

    Read the article

  • C# - Pass by value & Pass by Reference

    - by Lijo
    Hi Team, Could you please explain the following behavior of C# Class. I expect the classResult as "Class Lijo"; but actual value is “Changed”. We’re making a copy of the reference. Though the copy is pointing to the same address, the method receiving the argument cannot change original. Still why the value gets changed ? public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Person p = new Person(); p.Name = "Class Lijo"; Utilityclass.TestMethod(p); string classResult = p.Name; Response.Write(classResult); } } public class Utilityclass { public static void TestMethod(Person k) { k.Name = "Changed"; } } public class Person { private string name; public string Name { get { return name; } set { name = value; } } } Thanks Lijo

    Read the article

  • Get Image from Byte Aarray.

    - by Arun Thakkar
    Hello Everyone!! Hope You all are fine and also in one of your best of moods!! Hope You all are Enjoying iPhone development. I herewith one issue that i am not able to solve, may be i don't know the depth concept of iPhone. So Its my humble requet to you to guide me or suggest or share your ideas. I do find an issue with getting an image from Bytes array. I am calling a webservice which returns an image in form of Bytes Array as response. I have Converted this bytes array in to form of NSData, Now i have NSData, But When i Try to get an image from this NSData, It shows nil. I Did lots of R&D and Find one suggestion to use base64 encoder, But unfortunately because of not proper guidance I was not able to Implement that. I was also suggested to use OPenSSL Library for base64 from url http://www.cocoadev.com/index.pl?BaseSixtyFour But again i was not able to include #include #include these two files. as in Newer Version of SDK 3.X family Apple has depreciated those (as i guess). So Now i need help from you guys. kindly help me if you have solution or if you know the steps to solve these. Looking Forwards. Regards, Arun Thakkar

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >