Search Results

Search found 1303 results on 53 pages for 'dr gewa'.

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

  • Is it possible to have a mysql table accept a null value for a primary_key column referencing a diff

    - by Dr.Dredel
    I have a table that has a column which holds the id of a row in another table. However, when table A is being populated, table B may or may not have a row ready for table A. My question is, is it possible to have mysql prevent an invalid value from being entered but be ok with a NULL? or does a foreign key necessitate a valid related value? So... what I'm looking for (in pseudo code) is this: Table "person" id | name Table "people" id | group_name | person_id (foreign key id from table person) insert into person (1, 'joe'); insert into people (1, 'foo', 1)//kosher insert into people (1, 'foo', NULL)//also kosher insert into people(1, 'foo', 7)// should fail since there is no id 7 in the person table. The reason I need this is that I'm having a chicken and egg issue where it makes perfect sense for the rows in the people table to be created before hand (in this example, I'm creating the groups and would like them to pre-exist the people who join them). And I realize that THIS example is silly and I would just put the group id in the person table rather than vice-versa, but in my real-world problem that is not workable. Just curious if I need to allow any and all values in order to make this work, or if there's some way to allow for null.

    Read the article

  • Should '#include' and 'using' statements be repeated in both header and implementation files (C++)?

    - by Dr. Monkey
    I'm fairly new to C++, but my understanding is that a #include statement will essentially just dump the contents of the #included file into the location of that statement. This means that if I have a number of '#include' and 'using' statements in my header file, my implementation file can just #include the header file, and the compiler won't mind if I don't repeat the other statements. What about people though? My main concern is that if I don't repeat the '#include', 'using', and also 'typedef' (now that I think of it) statements, it takes that information away from the file in which it's used, which could lead to confusion. I am just working on small projects at the moment where it won't really cause any issues, but I can imagine that in larger projects with more people working on them it could become a significant issue. An example follows: //Unit.h #include <string> #include <ostream> #include "StringSet.h" using std::string; using std::ostream; class Unit { public: //public members private: //private members //unrelated side-question: should private members //even be included in the header file? } ; //Unit.cpp #include "Unit.h" //The following are all redundant from a compiler perspective: #include <string> #include <ostream> #include "StringSet.h" using std::string; using std::ostream; //implementation goes here

    Read the article

  • Using Linq, how to separate a list in to grouped objects by name?

    - by Dr. Zim
    I have a table where a record looks like this varchar(255) Name varchar(255) Text varchar(255) Value Name is the DDL name, Text is what is displayed, and Value is returned upon selection. There are between one and twenty options for each Name. Without iterating though each option like a cursor, is there any way to pull out a list of objects, one for each unique DDL Name, using Linq and C#? A sample of the data: Beds '4 (10)' 4 Beds '5 (1)' 5 Beds '7 (1)' 7 Baths 'NA (13)' NULL Baths '0 (1)' 0 Baths '1 (13)' 1 I was thinking about doing an outer select to get the unique Names, then an inner select to get the list of options for it, then return the set as a List of a set of Lists.

    Read the article

  • What VS 2010 Template to Chose?

    - by Dr Hydralisk
    I am just getting started with C++ and wanted to know does it really matter what template you chose in Visual Studio 2010 (for creating executables)? Like if I was creating a console application there is CLR Console Application, Win32 Console Application, and Win32 Project (description says it can be an application or a dll), what would I chose (or could i select Empty Project)?

    Read the article

  • Good or Bad experiences with CryptoLicensing?

    - by dr. evil
    I'm planning to buy CryptoLicensing but before buying it I'd like to get some feedbacks if anyone tried it before. Also it'd be interesting if anyone cracked it or spotted an easy hack against it. I've seen some other SO questions regarding the choosing a .NET licensing component but if you currently happy with another component it'd be nice to hear your experience. It's just quite hard to nail this without going through a long trial.

    Read the article

  • Will this only allow certain extensions?

    - by Dr Hydralisk
    I found this snippet that says will only allow certain file types. Will it work and could someone bypass it to upload what ever file type they want? And could someone explain the substr part, i don't get how it works.. <?php function CheckExt($filename, $ext) { $name = strtolower($filename); if(substr($name, strlen($name) -3, 3) == $ext) return true; else return false; } ?>

    Read the article

  • is there a way to designate the line token delimiter in Perl's file reader?

    - by Dr.Dredel
    I'm reading a text file via CGI in, in perl, and noticing that when the file is saved in mac's textEdit the line separator is recognized, but when I upload a CSV that is exported straight from excel, they are not. I'm guessing it's a \n vs. \r issue, but it got me thinking that I don't know how to specify what I would like the line terminator token to be, if I didn't want the one it's looking for by default.

    Read the article

  • C# 4: how to in-line detect for nulls?

    - by Dr. Zim
    In C# 4, wasn't there a short cut for checking for null values like so: if( myobject?.myproperty?.myotherproperty?.value != null ) The value would return null and not throw an exception. Anyone have a link to how to use it or at least the syntax?

    Read the article

  • best method for background uploader in Android

    - by Dr.Dredel
    Problem: I want to write a process that will allow a user to take photos with the device and for those photos to then be uploaded to some listener in the cloud. The user should not have to do anything to initiate the upload, a background listener would just watch the folder and as long as it finds files in it it would upload them and delete them. Two problems: 1) how to keep the program running in the background even after the user is no longer taking pictures (and if they reboot the device for it to wake up and finish the uploads, if any remain) 2) assuming the connection is spotty (as it always is) how to verify that a given image has completed its upload, and if not, to resubmit it. I don't need any code examples, I just would like opinions on the best strategy to get this implemented. I was going to use Apache commons and just do an upload to a PHP, but am not sure what sort of error checking exists to take into account a connection drop mid file. TIA.

    Read the article

  • funny looking comments - c++

    - by Dr Deo
    when i read through source files of opensource projects i often come across some weird phrases in the comments /* @brief ...... @usage..... @remarks.... @par.... */ questions 1.What are they?(were not mentioned when i was learning c++) 2.Do they have any documentation(where)

    Read the article

  • Detecting if a file is binary or plain text?

    - by dr. evil
    How can I detect if a file is binary or a plain text? Basically my .NET app is processing batch files and extracting data however I don't want to process binary files. As a solution I'm thinking about analysing first X bytes of the file and if there are more unprintable characters than printable characters it should be binary. Is this the right way to do it? Is there nay better implementation for this task?

    Read the article

  • C++ performance when accessing class members

    - by Dr. Acula
    I'm writing something performance-critical and wanted to know if it could make a difference if I use: int test( int a, int b, int c ) { // Do millions of calculations with a, b, c } or class myStorage { public: int a, b, c; }; int test( myStorage values ) { // Do millions of calculations with values.a, values.b, values.c } Does this basically result in similar code? Is there an extra overhead of accessing the class members? I'm sure that this is clear to an expert in C++ so I won't try and write an unrealistic benchmark for it right now

    Read the article

  • In an iPhone app, is it beneficial to tile a background image that has a pattern in it?

    - by Dr Dork
    Here's an example of the type of background image I'm talking about, the iPhone Notes app... Clearly, there's a pattern in it. My question is, if this were an iPad app and the background image was twice the size, would there be any significant benefits to taking advantage of this pattern by tiling the image? Or would it really make no difference in terms of performance and just be easier to load the entire image into a UIImageView? Thanks in advance for all your wisdom!

    Read the article

  • How can I obtain the IP address of my server program?

    - by Dr Dork
    Hello! This question is related to another question I just posted. I'm prepping for a simple work project and am trying to familiarize myself with the basics of socket programming in a Unix dev environment. At this point, I have some basic server side code and client side code setup to communicate. Currently, my client code successfully connects to the server code and the server code sends it a test message, then both quit out. Perfect! That's exactly what I wanted to accomplish. Now I'm playing around with the functions used to obtain info about the two environments (server and client). I'd like to obtain my server program's IP address. Here's the code I currently have to do this, but it's not working... int sockfd; unsigned int len; socklen_t sin_size; char msg[]="test message"; char buf[MAXLEN]; int st, rv; struct addrinfo hints, *serverinfo, *p; struct sockaddr_storage client; char s[INET6_ADDRSTRLEN]; char ip[INET6_ADDRSTRLEN]; //zero struct memset(&hints,0,sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; //get the server info if((rv = getaddrinfo(NULL, SERVERPORT, &hints, &serverinfo ) != 0)){ perror("getaddrinfo"); exit(-1); } // loop through all the results and bind to the first we can for( p = serverinfo; p != NULL; p = p->ai_next) { //Setup the socket if( (sockfd = socket( p->ai_family, p->ai_socktype, p->ai_protocol )) == -1 ) { perror("socket"); continue; } //Associate a socket id with an address to which other processes can connect if(bind(sockfd, p->ai_addr, p->ai_addrlen) == -1){ close(sockfd); perror("bind"); continue; } break; } if( p == NULL ){ perror("Fail to bind"); } inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s, sizeof(s)); printf("Server has TCP Port %s and IP Address %s\n", SERVERPORT, s); and the output for the IP is always empty... server has TCP Port 21412 and IP Address :: any ideas for what I'm missing? thanks in advance for your help! this stuff is really complicated at first.

    Read the article

  • is const (c++) optional?

    - by Dr Deo
    according to some tutorials i read a while back, the "const" declaration makes a variable "constant" ie it cannot change later. But i find this const declaration abit inconveniencing since the compiler sometimes gives errors like "cannot convert const int to int" or something like that. and i find myself cheating by removing it anyway. question: assuming that i am careful about not changing a variable in my source code, can i happily forget about this const stuff? Thanks in advance

    Read the article

  • SQL Server 2005: Why would a delete from a temp table hang forever?

    - by Dr. Zim
    DELETE FROM #tItem_ID WHERE #tItem_ID.Item_ID NOT IN (SELECT DISTINCT Item_ID FROM Item_Keyword JOIN Keyword ON Item_Keyword.Keyword_ID = Keyword.Record_ID WHERE Keyword LIKE @tmpKW) The Keyword is %macaroni%. Both temp tables are 3300 items long. The inner select executes in under a second. All strings are nvarchar(249). All IDs are int. Any ideas? I executed it (it's in a stored proc) for over 12 minutes without it finishing.

    Read the article

  • C#: Object having two constructors: how to limit which properties are set together?

    - by Dr. Zim
    Say you have a Price object that accepts either an (int quantity, decimal price) or a string containing "4/$3.99". Is there a way to limit which properties can be set together? Feel free to correct me in my logic below. The Test: A and B are equal to each other, but the C example should not be allowed. Thus the question How to enforce that all three parameters are not invoked as in the C example? AdPrice A = new AdPrice { priceText = "4/$3.99"}; // Valid AdPrice B = new AdPrice { qty = 4, price = 3.99m}; // Valid AdPrice C = new AdPrice { qty = 4, priceText = "2/$1.99", price = 3.99m};// Not The class: public class AdPrice { private int _qty; private decimal _price; private string _priceText; The constructors: public AdPrice () : this( qty: 0, price: 0.0m) {} // Default Constructor public AdPrice (int qty = 0, decimal price = 0.0m) { // Numbers only this.qty = qty; this.price = price; } public AdPrice (string priceText = "0/$0.00") { // String only this.priceText = priceText; } The Methods: private void SetPriceValues() { var matches = Regex.Match(_priceText, @"^\s?((?<qty>\d+)\s?/)?\s?[$]?\s?(?<price>[0-9]?\.?[0-9]?[0-9]?)"); if( matches.Success) { if (!Decimal.TryParse(matches.Groups["price"].Value, out this._price)) this._price = 0.0m; if (!Int32.TryParse(matches.Groups["qty"].Value, out this._qty)) this._qty = (this._price > 0 ? 1 : 0); else if (this._price > 0 && this._qty == 0) this._qty = 1; } } private void SetPriceString() { this._priceText = (this._qty > 1 ? this._qty.ToString() + '/' : "") + String.Format("{0:C}",this.price); } The Accessors: public int qty { get { return this._qty; } set { this._qty = value; this.SetPriceString(); } } public decimal price { get { return this._price; } set { this._price = value; this.SetPriceString(); } } public string priceText { get { return this._priceText; } set { this._priceText = value; this.SetPriceValues(); } } }

    Read the article

  • Performance when accessing class members

    - by Dr. Acula
    I'm writing something performance-critical and wanted to know if it could make a difference if I use: int test( int a, int b, int c ) { // Do millions of calculations with a, b, c } or class myStorage { public: int a, b, c; }; int test( myStorage values ) { // Do millions of calculations with values.a, values.b, values.c } Does this basically result in similar code? Is there an extra overhead of accessing the class members? I'm sure that this is clear to an expert in C++ so I won't try and write an unrealistic benchmark for it right now

    Read the article

  • Why can’t I create a database in an empty ASP MVC 2 project using Project->Add->New Item->SQL Server

    - by Dr Dork
    I'm diving head first into ASP MVC and am playing around with creating and manipulating a database. I did a search and found this tutorial for creating a database, however when I follow it, I get this error right at the start when trying to add a new database to my fresh, empty ASP MVC 2 project... A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) The only requirement the tutorial mentioned was SQL Server Express, but when I went to download it, it said it was already installed. I'm assuming it was part of the VS 2010 RC I installed and am running. So I don't know what else I need if I am missing something. This is all new to me, so I'm sure I'm missing something obvious here and after I'm done posting this question, I plan to do some more research into the topic of databases and how they work with ASP MVC. In the meantime, I was you could help me answer a couple high level questions... What am I missing/forgetting to do that is causing this error? Any suggestions for good resources/tutorials that focus on using databases with ASP MVC? I've done a lot of database programming in the past, so I'm familiar with the concepts of relational databases and the SQL language. I wish I could find a good resource for learning how to work with them in an ASP dev environment, as well as a good breakdown of all the related technologies used for working with them (i.e. LINQ to SQL). Thanks so much in advance for all your help! I'm going to start researching these questions right now.

    Read the article

  • Starting a new Xcode project from a template vs. a blank project

    - by Dr Dork
    I sometimes find it's easier to create a new project from scratch in other IDEs simply because its often more difficult to understand and tweak the generated template code than it is to write the code you need from scratch. Do seasoned iPhone developers still use templates when creating new projects? How difficult is it to add functionality to a template project that isn't initially included in the template? For example, if I don't check the "Use Core Data" option when creating a new project, how difficult does that make it to use Core Data later on if I changed my mind?

    Read the article

  • How can I create a sample SQLLite DB for my iPhone app?

    - by Dr Dork
    I'm diving in to iPhone development and I'm building an iPhone app that uses the Core Data framework and my first task will be to get the model setup with a few that will display it. Thus far, I have the model defined and my Managed Object Files created, but I don't have a database with any sample data. What's a quick way to create a DB that conforms to my schema? Are there any tools that can generate a sample DB using my schemas? Is there a good tool I can use to directly manipulate the data in DB for testing purposes? Thanks in advance for your help! I'm going to continue researching this question right now.

    Read the article

  • Using XSLT, how can I produce a table with elements at the position of the the node's attributes?

    - by Dr. Sbaitso
    Given the following XML: <items> <item> <name>A</name> <address>0</address> <start>0</start> <size>2</size> </item> <item> <name>B</name> <address>1</address> <start>2</start> <size>4</size> </item> <item> <name>C</name> <address>2</address> <start>5</start> <size>2</size> </item> </items> I want to generate the following output including colspan's +---------+------+------+------+------+------+------+------+------+ | Address | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---------+------+------+------+------+------+------+------+------+ | 0 | | | | | | | A | +---------+------+------+------+------+------+------+------+------+ | 1 | | | B | | | +---------+------+------+------+------+------+------+------+------+ | 2 | | C | | | | | | +---------+------+------+------+------+------+------+------+------+ | 3 | | | | | | | | | +---------+------+------+------+------+------+------+------+------+ I think I would be able to accomplish this with a mutable xslt variable, but alas, there's no such thing. Is it even possible? How?

    Read the article

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