Daily Archives

Articles indexed Sunday January 16 2011

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

  • LINQ timed out while the same query works great in SQL

    - by oshafran
    Hi I am getting Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. When I run the SAME query in the SQL query program I get result within seconds, and in LINQ it takes forever and fails. What can cause this??? Thanks!

    Read the article

  • Internet Explorer not loading stylesheet.

    - by Antarr Byrd
    I have a page that uses css. I works fine in firefox but when I open in IE there appears to be no styling. <!DOCTYPE html> <html> <head> <title>MySite</title> <%= stylesheet_link_tag :all %> <%= javascript_include_tag :defaults %> <%= csrf_meta_tag %> </head> <body> <p> <nav> <ul> <li> <a href="#">Login</a> </li> <li> <a href="#">Blog</a> </li> <li> <a href="#">Contact Us </a> </li> <li> <a href="#">Help</a> </li> <li> <a href="#">Trends</a> </li> <li> <a href="#">Your Privacy!</a> </li> <li> <a href="#">Terms of Use</a> </li> <li> <a href="#">mySite.com</a> </li> </ul> </nav> </p> <%= yield %> </body> <aside style ="float:right; font-size:x-small;background:#ffffff;"> <center> Local Areas </center> <% @states.each do |state| %> <ul> <a href= "/states"> <li> <%= state.name %> </li> </a> </ul> <% end %> </aside> <footer> </footer> </html>

    Read the article

  • Python 3.1 - Memory Error during sampling of a large list

    - by jimy
    The input list can be more than 1 million numbers. When I run the following code with smaller 'repeats', its fine; def sample(x): length = 1000000 new_array = random.sample((list(x)),length) return (new_array) def repeat_sample(x): i = 0 repeats = 100 list_of_samples = [] for i in range(repeats): list_of_samples.append(sample(x)) return(list_of_samples) repeat_sample(large_array) However, using high repeats such as the 100 above, results in MemoryError. Traceback is as follows; Traceback (most recent call last): File "C:\Python31\rnd.py", line 221, in <module> STORED_REPEAT_SAMPLE = repeat_sample(STORED_ARRAY) File "C:\Python31\rnd.py", line 129, in repeat_sample list_of_samples.append(sample(x)) File "C:\Python31\rnd.py", line 121, in sample new_array = random.sample((list(x)),length) File "C:\Python31\lib\random.py", line 309, in sample result = [None] * k MemoryError I am assuming I'm running out of memory. I do not know how to get around this problem. Thank you for your time!

    Read the article

  • mySQL convert varchar to date

    - by Jeff V
    I need to convert a varchar value of 1/9/2011 to a date in mySQL and I want only the month and year. So that I can then use the PERIOD_DIFF function (so I would need the above to be converted to 201101). I've tried various ways using the STR_TO_DATE function: SELECT STR_TO_DATE(CYOApp_oilChangedDate, '%m/%Y') FROM CYO_AppInfo But I get weird results... (for example: 2009-01-00) What am I doing incorrectly?

    Read the article

  • How to distinguish between new and returning anonymous Drupal users?

    - by Matt V.
    Is there an easy way (or a module) in Drupal to distinguish between anonymous users who have never created an account versus those who are returning but are not currently logged in? For non-returning (ie, completely new) users, I'd like to have a front page that is very streamlined and focused on registration as the call-to-action. However, if someone is a returning user but not currently logged in, I'd like to present a lot more information on the front page and have login as the main call-to-action. I realize both pages would still need to have both login and register options available, I just want to make the focus significantly different between the two.

    Read the article

  • python __getattr__ help

    - by Stefanos Tux Zacharakis
    Reading a Book, i came across this code... # module person.py class Person: def __init__(self, name, job=None, pay=0): self.name = name self.job = job self.pay = pay def lastName(self): return self.name.split()[-1] def giveRaise(self, percent): self.pay = int(self.pay *(1 + percent)) def __str__(self): return "[Person: %s, %s]" % (self.name,self.pay) class Manager(): def __init__(self, name, pay): self.person = Person(name, "mgr", pay) def giveRaise(self, percent, bonus=.10): self.person.giveRaise(percent + bonus) def __getattr__(self, attr): return getattr(self.person, attr) def __str__(self): return str(self.person) It does what I want it to do, but i do not understand the __getattr__ function in the Manager class. I know that it Delegates all other attributes from Person class. but I do not understand the way it works. for example why from Person class? as I do not explicitly tell it to. person(module is different than Person(class) Any help is highly appreciated :)

    Read the article

  • Check value existance while performing a UPDATE query

    - by nimo
    Hi, I need to perform a simple update query where the update should only be done, if there is no value with updating value (item_name). For example, DB table [item_types] item_id(PK) | item_name Assuming there exist item_id with 6, My attempt is UPDATE item_types as k SET k.item_name = 'item_1' WHERE NOT EXISTS (SELECT * FROM item_types as a WHERE a.item_name = 'item_1') AND k.item_id = '6' But this gives me error "You can't specify target table 'k' for update in FROM clause" Could you please explain the error here and how can I achieve this ? Thank you

    Read the article

  • obj-c, how do I create a property and synthesize an NSUInteger ?

    - by Jules
    I'm having some trouble using an NSUInteger, I've tried various things and googled, but not found the answer ? I have... I also tried ... nonatomic, retain @property (readwrite, assign) NSUInteger *anAmount; @synthesize anAmount; error: type of property 'anAmount' does not match type of ivar 'anAmount' Also when I release it in dealloc I get a warning.. warning: invalid receiver type 'NSUInteger'

    Read the article

  • the News Feed technique

    - by Rawhi
    I have been read a lot of articles to make a good design for my database so I can get the most recent updates for every single user by executing a - kind of - complex query then I send the data using ajax as a JSON to JS file that makes an appropriate edits for the records. It seems fast but I don't know if it will be as much as fast if the site has a large number of users . so iv'e started looking for an alternatives . and I found something called NodeJS , I really didn't understand what it is stand for and hope that you can help me with that. from another hand if the facebook doesn't use a normal db to do whatever he does , then I think there is no way to do it . helpful link : What's the best manner of implementing a social activity stream? waiting for your comments. best regards

    Read the article

  • PHP & Regular expression: keyword just occurs once

    - by lauthiamkok
    Hi, how can I make sure a certain keyword just occurs once in the input with regular expression? I think there is some mistakes in the expression below as I can repeat the same keywords, if (!preg_match('/\b(.php?){1}\b/', $cfg_path)) { $error = true; echo '<error elementid="cfg_path" message="PATH - make sure you have a \'.php?\' in the path."/>'; } I just want this to be true, form.php?category=something or form.php? but not this, form.php?.php?category=something or form.php?.php? please let me know how to fix it. thanks.

    Read the article

  • Need some explanation about MS Ajax using PageMethods

    - by Ahmed Said
    I have a project that uses PageMethods to call functions on the server. The server functions (written in C#) return the values as array of strings, without doing any kind of serialization and in the client side (from Js) the accessing of the return values is by using static variable called arguments. I found that sometimes for some users (cases are not repro) sometimes an exception occured "WebServiceFailedException the server method 'Foo' returned invalid data. the 'd' property is missing from JSON." Some searching on google I found that people are serializing the return values using DataContractJsonSerializer class and in js accessing the return value using one of the callback function Example: function OnRequestComplete(result, userContext, methodName) { var Person = eval('(' + result + ')'); alert(Person.Forename); alert(Person.Surname); } So is the first technique is correct? or what?

    Read the article

  • PHP Force Download Causing 0 Byte Files

    - by Alex
    Hey, I'm trying to force download files from my web server using PHP. I'm not a pro in PHP but I just can't seem to get around the problem of files downloading in 0 bytes in size. CODE: $filename = "FILENAME..."; header("Content-type: $type"); header("Content-Disposition: attachment;filename=$filename"); header("Content-Transfer-Encoding: binary"); header('Pragma: no-cache'); header('Expires: 0'); set_time_limit(0); readfile($file); Can anybody help? Thanks.

    Read the article

  • AVFoundation buffer comparison to a saved image

    - by user577552
    Hi, I am a long time reader, first time poster on StackOverflow, and must say it has been a great source of knowledge for me. I am trying to get to know the AVFoundation framework. What I want to do is save what the camera sees and then detect when something changes. Here is the part where I save the image to a UIImage : if (shouldSetBackgroundImage) { CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); // Create a bitmap graphics context with the sample buffer data CGContextRef context = CGBitmapContextCreate(rowBase, bufferWidth, bufferHeight, 8, bytesPerRow, colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst); // Create a Quartz image from the pixel data in the bitmap graphics context CGImageRef quartzImage = CGBitmapContextCreateImage(context); // Free up the context and color space CGContextRelease(context); CGColorSpaceRelease(colorSpace); // Create an image object from the Quartz image UIImage * image = [UIImage imageWithCGImage:quartzImage]; [self setBackgroundImage:image]; NSLog(@"reference image actually set"); // Release the Quartz image CGImageRelease(quartzImage); //Signal that the image has been saved shouldSetBackgroundImage = NO; } and here is the part where I check if there is any change in the image seen by the camera : else { CGImageRef cgImage = [backgroundImage CGImage]; CGDataProviderRef provider = CGImageGetDataProvider(cgImage); CFDataRef bitmapData = CGDataProviderCopyData(provider); char* data = CFDataGetBytePtr(bitmapData); if (data != NULL) { int64_t numDiffer = 0, pixelCount = 0; NSMutableArray * pointsMutable = [NSMutableArray array]; for( int row = 0; row < bufferHeight; row += 8 ) { for( int column = 0; column < bufferWidth; column += 8 ) { //we get one pixel from each source (buffer and saved image) unsigned char *pixel = rowBase + (row * bytesPerRow) + (column * BYTES_PER_PIXEL); unsigned char *referencePixel = data + (row * bytesPerRow) + (column * BYTES_PER_PIXEL); pixelCount++; if ( !match(pixel, referencePixel, matchThreshold) ) { numDiffer++; [pointsMutable addObject:[NSValue valueWithCGPoint:CGPointMake(SCREEN_WIDTH - (column/ (float) bufferHeight)* SCREEN_WIDTH - 4.0, (row/ (float) bufferWidth)* SCREEN_HEIGHT- 4.0)]]; } } } numberOfPixelsThatDiffer = numDiffer; points = [pointsMutable copy]; } For some reason, this doesn't work, meaning that the iPhone detects almost everything as being different from the saved image, even though I set a very low threshold for detection in the match function... Do you have any idea of what I am doing wrong?

    Read the article

  • java singleton instantiation

    - by jurchiks
    I've found three ways of instantiating a Singleton, but I have doubts as to whether any of them is the best there is. I'm using them in a multi-threaded environment and prefer lazy instantiation. Sample 1: private static final ClassName INSTANCE = new ClassName(); public static ClassName getInstance() { return INSTANCE; } Sample 2: private static class SingletonHolder { public static final ClassName INSTANCE = new ClassName(); } public static ClassName getInstance() { return SingletonHolder.INSTANCE; } Sample 3: private static ClassName INSTANCE; public static synchronized ClassName getInstance() { if (INSTANCE == null) INSTANCE = new ClassName(); return INSTANCE; } The project I'm using ATM uses Sample 2 everywhere, but I kind of like Sample 3 more. There is also the Enum version, but I just don't get it. The question here is - in which cases I should/shouldn't use any of these variations? I'm not looking for lengthy explanations though (there's plenty of other topics about that, but they all eventually turn into arguing IMO), I'd like it to be understandable with few words.

    Read the article

  • What does my blog says about me?

    - by subodhnpushpak
    Somebody said that “a person is as good as he/she THINKS”. Recently, over conversation, one of my close “blog friend” remarked that a blog post revealed so much about the person who has written it; and though we never met physically / or even talked over phone… (we have only exchanged technical talks over chats and blogs); this friend of mine correctly predicted my personality and even my habits!! I also came across with this site http://www.typealyzer.com/?lang=en. Just put a blog address and it will predict the bloggers mindset!! Here is what I get when I put across my blog ..   very flattering… I must say. Why don’t you discover yours?? Do share the results with me.. BTW.. now a days I am working on Windows Phone 7 and am loving it. Have lots of gotchas to blog but simply no time (only 14 hrs a day )

    Read the article

  • Samba on OS X 10.6.4

    - by Niklas Saers
    I just updated from 10.6.3 to 10.6.4, and now my Samba shares won't mount and won't allow access into the directories. In the logs, I've started to get the following errors, any idea what might have gone wrong? 2010/06/25 15:54:27, 0, pid=13848] /SourceCache/samba/samba-235.4/samba/source/passdb/secrets.c:secrets_fetch_domain_sid(150) secrets_fetch_domain_sid:opendirectory_query_domain_sid gave -14136 [eDSRecordNotFound] [2010/06/25 15:54:27, 0, pid=13850] /SourceCache/samba/samba-235.4/samba/source/lib/opendirectory.c:get_opendirectory_authenticator(247) failed to read DomainAdmin credentials, err=67 fd=19 errno=34 [2010/06/25 15:54:27, 1, pid=13850] /SourceCache/samba/samba-235.4/samba/source/smbd/service.c:make_connection_snum(1092) winsrv (10.0.0.8) connect to service Dates initially as user johnd (uid=1028, gid=20) (pid 13850) [2010/06/25 15:54:42, 1, pid=13850] /SourceCache/samba/samba-235.4/samba/source/smbd/service.c:close_cnum(1289) winsrv (10.0.0.8) closed connection to service Dates [2010/06/25 15:54:44, 0, pid=13850] /SourceCache/samba/samba-235.4/samba/source/passdb/pdb_odsam.c:odssam_getsampwnam(1576) opendirectory_sam_searchname gave -14136 [eDSRecordNotFound]: no dsRecTypeStandard:Users record for account 'Administrator' [2010/06/25 15:54:48, 0, pid=13850] /SourceCache/samba/samba-235.4/samba/source/lib/opendirectory.c:get_opendirectory_authenticator(247) failed to read DomainAdmin credentials, err=67 fd=28 errno=34 [2010/06/25 15:54:48, 1, pid=13850] /SourceCache/samba/samba-235.4/samba/source/smbd/service.c:make_connection_snum(1092) winsrv (10.0.0.8) connect to service Dates initially as user johnd (uid=1028, gid=20) (pid 13850) Cheers Nik

    Read the article

  • Why does iChat Server keep connecting to proxy.eu.jabber.org?

    - by Tom Hamming
    I have OS X Server 10.6.5 running on a new Mac Mini (server model), serving several functions among which is iChat Server (iChat and Pidgin on Windows as clients). In the iChat log in Server Admin, I kept seeing entries about connecting to proxy.eu.jabber.org. It's for our office network and I wasn't excited about external access to it, so I disabled server-to-server XMPP federation and now the connections just time out. But why is it doing that in the first place? Sample log entry: (datetime) (servername)jabberd/resolver[portnum]: [xmpp-server._tcp.proxy.eu.jabber.org resolved to 208.68.163.220:5269 (300 seconds to live) then: sending dialback auth request for route '(full server hostname)/proxy.eu.jabber.org' A couple minutes later, it comes back with: dialback for outgoing route '(full server hostname)/proxy.eu.jabber.org' timed out

    Read the article

  • Bind dns server in Solaris 10 and win xp clients

    - by stevecomptech
    Hi, Added this in zone db file, I am running solaris 10 _ldap._tcp.mydomain.com. SRV 0 0 389 dc.mydomain.com. _kerberos._tcp.mydomain.com. SRV 0 0 88 dc.mydomain.com. _ldap._tcp.dc._msdcs.mydomain.com. SRV 0 0 389 dc.mydomain.com. _kerberos._tcp.dc._msdcs.mydomain.com. SRV 0 0 88 host.mydomain.com. Now I get this error when I try to join win xp to the domain The query was for the SRV record for _ldap._tcp.dc._msdcs.mydomain.com The following domain controllers were identified by the query: host.mydomain.com Common causes of this error include: Host (A) records that map the name of the domain controller to its IP addresses are missing or contain incorrect addresses. Domain controllers registered in DNS are not connected to the network or are not running. What do I need to change in order my win xp join the domain

    Read the article

  • VPN server on Windows Server 2008 for a small office

    - by cmbrnt
    I'm going to refurbish the IT-infrastructure for a small organization with one single office, and I'm not sure what VPN server to use. In your opinion, would the built-in Windows Server 2008 VPN server suffice or are there any specific problems with it as opposed to, for example, OpenVPN? I'd rather run a Windows native VPN server, but if there are few (preferably free) good alternatives, I could install VMware ESXi and virtualize both Windows and an OpenVPN-server. By the way, because of a low budget this office runs a solution with only one physical server. Any advice would be great to help me grasp this field of which I'm quite a novice. Thank you!

    Read the article

  • File corruption (bad checksums) in large files copied to VMware guest

    - by AllanA
    In setting up a development lab, I've got a desktop system running ESXi 4.1.0 (free license) on SATA RAID 0 (already purchased and configured when I started this job; I'm open to hardware input as it pertains to my problem.) Its guests so far include two Win2008 Server R2 64-bit VMs and on Ubuntu 10.04 64-bit VM. I'm installing onto the Windows servers. We've been copying off some fairly large files (over a gigabyte) for an installation, hoping to install more quickly from a (virtual) hard drive than from the network for from BD-ROM. The problem is that they keep coming up with different checksums from the originals. The file sizes are the same, but md5sum reports different numbers (and so does the installer, as it refuses to continue when the checksums don't match.) I've tried copying directly from the BD-ROM (attaching the OS drive to the host system's physical drive). I've tried copying the large files onto a co-worker's Windows machine from his Blu-Ray drive; when I do that, the checksums match. But when I copy from his machine to the VM guest over a network share, the checksums no longer match. Thinking this meant a corrupt destination drive, I deleted it in vSphere and added another freshly created drive. The problem persists. I'm not sure what to try next.

    Read the article

  • Windows 7 System Image Backup - Exclude a partition

    - by Ctroy
    When I choose the "Create System Image" option in Windows Backup & Restore, it says that it will take system image of my C:\ and V:\ partitions. My Windows 7 is installed on V: and I use C:\ for taking backups. Now, my question is, is it possible to ignore taking backup of C:\ partition? I only want to get a copy of system image of V: By the way, I used to have Vista on my C:\ partition sometime ago and I formatted it recently to use the partition for taking backups.

    Read the article

  • Firefox - built in search engine toolbar broken

    - by Victor78
    When I change the order of the search engines (Toolbar - Manage Search Engines - Move up / down - Ok) it changes the order, until I close and reopen the browser. I can't imagine that's the way it's supposed to work. I want it to stay in the order I select. I have no add-ons installed that have anything to do with search engines, nor that add any toolbars. I am not using a customized theme. Apparently this problem is rare, as Googling [ "manage search engine list" ("order reverts" OR "order changes") ] return 0 results. Firefox 3.6.12; Windows XP Pro SP3.

    Read the article

  • Coordinates from 3DS Max to XNA 3.5

    - by David Conde
    Hello My problem is this. I have a simple box made in 3DS Max 2009, the Box is 10x10x10. I've tried to load it on XNA and traslate the camera for 15 units, but I can seem to find the values needed to see the box properly. Can anyone point me to a good resource where I can find some good introduction to XNA coordinate system and how is a simple box made in 3DS Max imported properly Best regards, David

    Read the article

  • EF4 (CPT5) ForeignKeyAttribute in base class - Assert Failure entityType != null

    - by Anthony Johnston
    Getting an error when trying to set a ForeignKeyAttribute in a base class class User{} abstract class FruitBase{ [ForeignKey("CreateById")] public User CreateBy{ get; set; } public int CreateById{ get; set; } } class Banana{} class DataContext : DbContext{ DbSet<Banana> Bananas{ get; set; } } If I move the FruitBase code into the banana, all is well, but I don't want to, as there will be many many fruit and I want to remain relatively DRY if I can Is this a know issue that will be fixed by March? Does anyone know a work around?

    Read the article

  • Some math and animation

    - by Ockonal
    Hello, I have a grass texture: I use it in my 2d-game. I want to animate it by code, without any predefined animations. The grass should interact with wind. So when the wind is stronger, the grass should stoop into need side more. First version of animation I made using sinusoid function, but such animation is a bit ugly, because the base of the grass moves left/right like all another part of picture. And with sinusoid I'm not able to regulate stoop of the image. Any advices?

    Read the article

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