Daily Archives

Articles indexed Thursday April 15 2010

Page 10/127 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • static function in an abstract class

    - by Alexander
    How to implement a static function in an abstract class?? Where do I implement this? class Item{ public: // // Enable (or disable) debug descriptions. When enabled, the String produced // by descrip() includes the minimum width and maximum weight of the Item. // Initially, debugging is disabled. static enableDebug(bool); };

    Read the article

  • Advanced Django query with subselects and custom JOINS

    - by Bryan Ward
    I have been investigating this number theoretic function (found in the Height model) and I need to query for things based on the prime factorization of the primary key, or id. I have created a model for Factors of the id which maintains all of the prime factors. class Height(models.Model): b = models.IntegerField(null=True, blank=True) c = models.IntegerField(null=True, blank=True) d = models.FloatField(null=True, blank=True) class Factors(models.Model): height = models.ForeignKey(Height, null=True, blank=True) factor = models.IntegerField(null=True, blank=True) degree = models.IntegerField(null=True, blank=True) prime_id = models.IntegerField(null=True, blank=True) For example, if id=24, then the associated entries in the factors table would be height_id=24,factor=2,degree=3,prime_id=0 height_id=24,factor=3,degree=1,prime_id=1 the prime_id keep track of the relative order of the primes. Now let p < q < r < s all be prime numbers and a,b,c,d be positive integers. Then I want to be able to query for all Heights of the form id=(p**a)*(q**b)*(r**c)*(s**d). Now this is simple in the case that all of p,q,r,s,a,b,c,d are known in that I can just run Height.objects.get(id=(p**a)*(q**b)*(r**c)*(s**d)) But I need to be able to query for something like (2**a)*(3**2)*(r**c)*(s**d) where r,s,a,d are unknown and all Heights of such form will be returned. Furthermore, not all of the rows in Height will have exactly four prime factors, so I need to make sure that I am not matching rows of the form id=(p**a)*(q**b)*(r**c)*(s**d)*(t**e)... From what I can tell, the following MySQL query accomplishes this, but I would like to do it through the Django ORM. I also don't know if this MySQL query is the proper way to go about doing things. SELECT h.*,count(f.height_id) AS factorsCount FROM height AS h LEFT JOIN factors AS f ON ( f.height_id = h.id AND f.height_id IN (SELECT height_id FROM factors where prime_id=1 AND factor=2 AND degree=1) AND f.height_id IN (SELECT height_id FROM factors where prime_id=2 AND factor=3 AND degree=2) AND f.height_id IN (SELECT height_id FROM factors where prime_id=3 AND factor=5 AND degree=1) AND f.height_id IN (SELECT height_id FROM factors where prime_id=4 AND factor=7 ANd degree=1) ) GROUP BY h.id HAVING factorsCount=4 ORDER BY h.id; Any ideas or suggestions for things to try?

    Read the article

  • Using (void)awakeFromNib

    - by MN
    I am trying to run an action when the application starts. The action checkAtStart is supposed to display an alert if there is no text in field1 and hide startView if there is text in field1. checkAtStart works fine if assigned to a button, but when I try to run it using (void)awakeFromNib, the alert will display no matter what and startView will never hide. Its probably something really simple that I'm forgetting. Any help is appreciated! Here is my code: - (void)awakeFromNib { [self checkAtStart:self]; } - (IBAction)checkAtStart:(id)sender { if (field1.text == nil || [field1.text isEqualToString:@""]) { NSString *msg = nil; msg = nil; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Message" message:@"Test Message" delegate:self cancelButtonTitle:@"Close" otherButtonTitles: nil]; [alert show]; [alert release]; [msg release]; } else { startView.hidden = YES; } }

    Read the article

  • Sharepoint how to get a list of Sharepoint specific fields/columns

    - by BeraCim
    Hi all: I have a list of fields/columns that comprises of Sharepoint specific fields/columns, my own custom fields/columns, and a bunch of custom fields/columns created by someone else (which I dont know what they are yet). My goal is to get the list of the fields/columnns created by that someone else. My first hurdle lies in how to tell which ones are from Sharepoint. So I was wondering is there any way to programmatically retrieve a list of Sharepoint Specific fields/columns? Thanks.

    Read the article

  • PHP app with cookie less session does not work

    - by iama
    I am trying to use PHP session without using cookies. I have enabled session.use_trans_sid and disabled session.use_cookies in my php.ini file. I have also disabled cookies in my firefox browser. Now, when I browse my home page, I do not see the HTTP set cookie header in the server response to my page request (using Live HTTP headers). My understanding is that PHP will append session IDs to my request URL when cookies are disabled. Am I doing something wrong? BTW, I am aware using session IDs is not a recommended approach.

    Read the article

  • WPF Binding to DataRow Columns

    - by Trindaz
    Hi, I've taken some sample code from http://sweux.com/blogs/smoura/index.php/wpf/2009/06/15/wpf-toolkit-datagrid-part-iv-templatecolumns-and-row-grouping/ that provides grouping of data in a WPF DataGrid. I'm modifying the example to use a DataTable instead of a Collection of entities. My problem is in translating a binding declaration {Binding Parent.IsExpanded}, which works fine where Parent is a reference to an entity that has the IsExpanded attribute, to something that will work for my weakly typed DataTable, where Parent is the name of a column and references another DataRow in the same DataTable. I've tried declarations like {Binding Parent.Items[IsExpanded]} and {Binding Parent("IsExpanded")} but none of these seem to work. How can I create a binding to the IsExpanded column of the DataRow Parent in my DataTable? Thanks in advance, Dave

    Read the article

  • Problem building PyGTK on CentOS

    - by Marcelo Cantos
    I am trying to build PyGTK on CentOS for a non-standard Python (2.6, vs the out-of-the-box 2.4). It requires that I first build pygobject. pygobject-2.18.0 fails at the configure step. The error messages is as follows: checking for GLIB - version >= 2.14.0... no *** Could not run GLIB test program, checking why... *** The test program failed to compile or link. See the file config.log for the *** exact error that occured. This usually means GLIB is incorrectly installed. configure: error: maybe you want the pygobject-2-4 branch? I have downloaded, built and successfully installed glib. The config.log file contains the following output: configure:6893: gcc -E conftest.c conftest.c:13:28: error: ac_nonexistent.h: No such file or directory What am I doing wrong?

    Read the article

  • How do I create lines while dragging a menu item on a WinForm? C#

    - by Bryan
    I want to mimic the functionality of Google Chrome/FireFox for example, when rearranging your bookmarks, when you are dragging the menu item, it creates a line at the proposed drop point. I've already implemented the Drag/Drop functionality to rearrange the menu, but I would like to add these separator lines as an additional feature. Is there a way to do this within the .NET Framework (3.5) or shall I have to resort to Win32 api calls? Just wanted to ask before I went down that path.

    Read the article

  • Different location of assemblies stoped the type casting.

    - by smwikipedia
    I am writing a custom Control class in C# for my main project. There're 2 projects, one for my Control and one for my main project. These 2 projects are in the same solution. I add a reference from my main project to my Control project. I notice that the first time after I drag my Control from the Tool Panel onto my main winform, an assembly folder was generated at the C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies, and the folder name is something like "jlebh-py01". The first build is always OK, but after I rebuild my Control class or whole solution, a new assembly folder will be generated at C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies, and then problem arises, my Control fails to behave well because Visual Studio says that the two types "originates from different location". The error message is as below: [A]MyControl.TypeXXX cannot be cast to [B]MyControl.TypeXXX. Type A orginates from assemblyXXX at location 'C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies\jlebh-py01\MyControl.dll' Type B originats from assemblyXXX at location 'C:\Users\XXX\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies\ue4i-z3j01\MyControl.dll' If I reference the Control DLL directly instead of through project reference, or never rebuild the Control project after use my Control in the main project, things seem to be OK. Does anyone knows why? Is it the proper way to develop a control and a main project within the same solution? Many thanks...

    Read the article

  • How to handle User Authentication for program in client’s local machine?

    - by Daniel
    Which user authentication scheme could be used at following scenario? 1.Application A developed by my company is installed at user's local computer. 2.Users login at my company's website. 3.If login is successful, access to the application A in user's local machine is granted. The development environment is .NET. Is there a secure way to authenticate the user to access the application? I've thought about encrypting the login information entered at the website, and then sending that information to the program at user's local machine for authentication. but I think as long as the client program has the decrypting ability, it is vulnerabe to decompiling,etc. Thanks in advance!

    Read the article

  • nfs (netapp) question: how to map the device shown in sar -d to the data volume?

    - by Daniel
    Using sar I can see device nfss24 is very busy, but how to know which data volume (file system) the device is for? sar -d 1 10|egrep "busy|nfs" SunOS phxdbnfs11 5.10 Generic_141414-07 sun4v 04/14/2010 19:03:27 device %busy avque r+w/s blks/s avwait avserv 19:03:28 nfs23 0 0.0 0 0 0.0 0.0 nfs24 100 1484053.4 504 32123 2944300.0 47.5 nfs25 0 0.0 0 0 0.0 0.0 nfs26 0 0.0 0 0 0.0 0.0 nfs27 107 1.1 0 0 0.0 0.0 nfs28 107 17.0 0 0 0.0 0.0 nfs29 100 13109.5 460 29435 28451.7 52.0 nfs30 0 0.0 0 0 0.0 0.0 nfs31 107 9.6 0 0 0.0 0.0 nfs32 0 0.0 0 0 0.0 0.0 nfs33 107 1.1 0 0 0.0 0.0 19:03:29 nfs23 0 0.0 0 0 0.0 0.0 nfs24 100 1483762.8 530 33709 2797054.5 45.1 nfs25 0 0.0 0 0 0.0 0.0 nfs26 0 0.0 0 0 0.0 0.0 nfs27 107 1.1 0 0 0.0 0.0 nfs28 107 17.0 0 0 0.0 0.0 nfs29 100 12800.8 511 32732 25016.0 46.8 nfs30 0 0.0 0 0 0.0 0.0 nfs31 107 9.6 0 0 0.0 0.0 nfs32 0 0.0 0 0 0.0 0.0 nfs33 107 1.1 0 0 0.0 0.0 19:03:30 nfs23 0 0.0 0 0 0.0 0.0 nfs24 100 1483080.4 761 48162 1950073.8 31.4 nfs25 0 0.0 0 0 0.0 0.0 nfs26 0 0.0 0 0 0.0 0.0 nfs27 107 1.1 0 0 0.0 0.0 nfs28 107 17.0 0 0 0.0 0.0 nfs29 100 12406.7 737 46855 16800.7 32.4 nfs30 0 0.0 0 0 0.0 0.0 nfs31 107 9.6 0 0 0.0 0.0 nfs32 0 0.0 0 0 0.0 0.0 nfs33 107 1.1 0 0 0.0 0.0

    Read the article

  • Upgraded from VS 2008 -> VS 2010. Can't Connect to SQL Server in Staging Environment

    - by Bob Kaufman
    I have a test application written in C#/ASP.NET that I've developed using Visual Studio 2008 Professional/.NET 3.5 which connects to a local SQL Server 2008 Express instance. I upgraded the development machine to Visual Studio 2010 Professional maintaining .NET 3.5 and everything in the development environment continues to work correctly. Upon deployment of the new app to an internal staging machine, that app cannot connect to its local SQL Server 2008 Express database. I get the customary "server not found" error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible... Does something need to be upgraded on the staging machine to be able to host a Visual Studio 2010/.NET 3.5 application?

    Read the article

  • How to customize Windows 7 HAL library during installation (BSOD STOP: 0x000000A5)?

    - by koldovsky
    While trying to install Windows 7 x86 Ultimate on Samsung M40 laptop (Pentium M 1.7 Dothan, 2 GB RAM/ 100 GB HDD) i receive BSOD STOP: 0x000000A5: The bios in this system is not fully ACPI compliant. Please contact your system vendor for an updated bios. The bios on the system is updated to latest version. If ACPI is the real source of the issue it means that I possibly could use another HAL library. In Windows XP it is possible to install system with generic HAL library pressing F7 when installer asks to supply drivers, but on Windows 7 I can't find such option. Ironically, Vista installs and works nice, even if they said that Windows 7 is less demanding for hardware. Windows 7 Advisor also tells nothing suspicious. Can anybody tell me how to customize Windows 7 installer to use generic HAL library (if it is possible, of course) or point me to another solution?

    Read the article

  • How to make emacs properly indent if-then-else construct in elisp

    - by Mad Wombat
    When I indent if-then-else construct in emacs lisp, the else block doesn't indent properly. What I get is: (defun swank-clojure-decygwinify (path) "Convert path from CYGWIN UNIX style to Windows style" (if (swank-clojure-cygwin) (replace-regexp-in-string "\n" "" (shell-command-to-string (concat "cygpath -w " path))) (path))) where else form is not indented at the same level as the then form. Is there an obvious way to fix this?

    Read the article

  • Brackets around Stored Procedure in ADODB Command Text

    - by KennerL90
    Help me understand why this is happening! I use the ADODB.Command object. The Command Text is set to the Stored Procedure Name. Sometimes, if I DON'T add brackets around the stored procedure name, I get a Syntax Error or Access Violation error. Sometimes, if I DO add brackets around the stored procedure name, I get a Syntax Error or Access Violation error.

    Read the article

  • OpenFileDialog directing to a file 2 directories back

    - by steve
    I'm having problems in visual basic programming. Currently I open a file using an open file dialog window and navigating to a file to open it. I want to be able to write a simple line saying ( and this is the best way I can describe it), Open this file "....\users.text". Please can someone help?

    Read the article

  • Ruby Rails Mongrel Sever failing to serve OXS1.6

    - by Mark V
    Hi there I'm fairly new to Rails and the Mac, and doing my first deploy... I'm trying to set up my rails app on a brand new Apple mini-server running OXS1.6 (Snow Leopard). It is currently running fine on my new iMac i7 (same OS). I start mongrel with this command: mongrel_rails start -e production -p 3000 -d -a 127.0.0.1 --debug And it starts giving this output in the log/mongrel.log ** Daemonized, any open files are closed. Look at log/mongrel.pid and log/mongrel.log for info. ** Starting Mongrel listening at 127.0.0.1:3000 ** Installing debugging prefixed filters. Look in log/mongrel_debug for the files. ** Starting Rails with production environment... /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement /Users/danadmin/ServiceApp/ServiceApp/app/helpers/input_grid_manager.rb:9: warning: already initialized constant ID_PREFIX /Users/danadmin/ServiceApp/ServiceApp/app/helpers/input_grid_manager.rb:10: warning: already initialized constant ADD_ID ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.5 available at 127.0.0.1:3000 ** Writing PID file to log/mongrel.pid The output is the same on my dev iMac (including the warnings). The difference is that accessing http://127.0.0.1:3000 on my iMac serves up the app's login page. Where as on the mac mini-server accessing the same results in this error 500 text from mongrel: "We're sorry, but something went wrong." It's as if rails is not working. I'm pretty good at figuring things out if I have some log file messages to direct me, but mongrel.log has no error message (the output remains the same as above), and the log/production.log is empty (which makes me think rails has not started?). My gems are all the same versions between machines and so is the app code; and there are no clues I can see in any of the mongrel_debug logs, except that rails.log on the mac mini-server and the iMac are different. After a start and single access, first is the rails.log from the mac mini-server: D, [2010-04-15T13:45:34.870406 #6914] DEBUG -- : TRACING ON Thu Apr 15 13:45:34 +1200 2010 Thu Apr 15 13:46:08 +1200 2010 REQUEST / --- !map:Mongrel::HttpParams SERVER_NAME: 127.0.0.1 HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 HTTP_CACHE_CONTROL: max-age=0 HTTP_HOST: 127.0.0.1:3000 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_0; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2 REQUEST_PATH: / SERVER_PROTOCOL: HTTP/1.1 HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8 REMOTE_ADDR: 127.0.0.1 PATH_INFO: / SERVER_SOFTWARE: Mongrel 1.1.5 SCRIPT_NAME: / HTTP_VERSION: HTTP/1.1 REQUEST_URI: / SERVER_PORT: "3000" HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3 REQUEST_METHOD: GET GATEWAY_INTERFACE: CGI/1.2 HTTP_ACCEPT_ENCODING: gzip,deflate,sdch HTTP_CONNECTION: keep-alive While on my iMac it seems the same except for the addition of the HTTP_COOKIE and the HTTP_IF_NONE_MATCH, here is rails.log from my iMac # Logfile created on Thu Apr 15 13:41:42 +1200 2010 by logger.rb/22285 D, [2010-04-15T13:41:42.934088 #2070] DEBUG -- : TRACING ON Thu Apr 15 13:41:42 +1200 2010 Thu Apr 15 13:42:05 +1200 2010 REQUEST / --- !map:Mongrel::HttpParams SERVER_NAME: 127.0.0.1 HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 HTTP_HOST: 127.0.0.1:3000 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2 REQUEST_PATH: / SERVER_PROTOCOL: HTTP/1.1 HTTP_IF_NONE_MATCH: "\"216cc63ce3c1f286ef8dd4f18f354f6e\"" HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8 REMOTE_ADDR: 127.0.0.1 PATH_INFO: / SERVER_SOFTWARE: Mongrel 1.1.5 SCRIPT_NAME: / HTTP_COOKIE: _ServiceApp_session=BAh7DDonY3VzdG9tZXJfbGlzdF9maWx0ZXJfam9iX3N0YXR1c19pZGn6Og9zZXNzaW9uX2lkIiU0ZTk1ZWZjMmViMGU3NjE2YzA0NDc2YTkxYzJlNDZiOToaY3VycmVudF9jdXN0b21lcl9uYW1lIilUSEUgQ1VTVE9NRVIgTkFNRSBORUVEUyBUTyBCRSBMT0FERUQ6EF9jc3JmX3Rva2VuIjFuT1JMUWk0NlZrWlM3c2lUN3BaWCs5NkhRajhxYnFwRnhzVHVTWXEvUWY0PToZam9iX2xpc3RfZmlsdGVyX3RleHQiADogam9iX2xpc3RfZmlsdGVyX2VtcGxveWVlX2lkafo6HmN1c3RvbWVyX2xpc3RfZmlsdGVyX3RleHQiAA%3D%3D--d01bc5d0b457ad524d16cb3402b5dfed9afce83d HTTP_VERSION: HTTP/1.1 REQUEST_URI: / SERVER_PORT: "3000" HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3 REQUEST_METHOD: GET GATEWAY_INTERFACE: CGI/1.2 HTTP_ACCEPT_ENCODING: gzip,deflate,sdch HTTP_CONNECTION: keep-alive Any direction or ideas would be greatly appreciated. Thanks.

    Read the article

  • Parse Formulae in .NET

    - by Cool
    I am trying to parse formula in C# language like "5*3 + 2" "(3*4 - 2)/5" Is it possible to do in C# or scripts like VBScript, JavaScript (which will be called in c# program).

    Read the article

  • How do I create drop lines while dragging a menu item on a WinForm?

    - by Bryan
    I want to mimic the functionality of Google Chrome/FireFox for example, when rearranging your bookmarks, when you are dragging the menu item, it creates a black line at the proposed drop point, like this: I've already implemented the Drag/Drop functionality to rearrange the menu, but I would like to add these separator lines as an additional feature. Is there a way to do this within the .NET Framework (3.5) or shall I have to resort to Win32 api calls? Just wanted to ask before I went down that path.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >