Search Results

Search found 1234 results on 50 pages for 'enum'.

Page 35/50 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • How to find all clusters of forest on map?

    - by Damir
    How to find all clusters of forest on map ? I have simple class cell like (Type is enum {RIVER, FOREST,GRASS,HILL} class Cell{ public: Type type; int x; int y }; and map like vector<Cell> grid. Can anyone suggest me algorithm to create list<list<Cell>> clusters where list contains FOREST cells in same cluster (cluster are set of connected cells - connection can be in eight direction:up,down,left,right,up_right,up_left,down_left,down_right)? I need to find all clusters of forest on map and put every single cluster in list<Cell>.

    Read the article

  • Looking for a good explanation of the table generation macro idiom

    - by detly
    I want to make this clear up front : I know how this trick works, what I want is a link to a clear explanation to share with others. One of the answers to a C macro question talks about the "X macro" or "not yet defined macro" idiom. This involves defining something like: #define MAGIC_LIST \ X(name_1, default_1) \ X(name_2, default_2) \ ... Then to create, say, an array of values with named indices you do: typedef enum { #define X(name, val) name, MAGIC_LIST #undef X } NamedDefaults; You can repeat the procedure with a different #define for X() to create an array of values, and maybe debugging strings, etc. I'd like a link to a clear explanation of how this works, pitched at someone who is passably familiar with C. I have no idea what everyone usually calls this pattern, though, so my attempts to search the web for it have failed thus far. (If there is such an explanation on SO, that'd be fine...)

    Read the article

  • Can't get Javac to work on Mac OS X

    - by elguapo-85
    I am trying to compile with javac on Snow Leopard through the command line. I have Xcode installed. I am just using a simple Hello World file, it works in Eclipse but I can't get it to work using javac. javac -version returns javac 1.6.0_17 HelloWorld.java public class HelloWorld { public static void main(String[] args) { String message = "Welcome to Java!"; System.out.println(message); } } I type: javac HelloWorld.java and get the following error. HelloWorld.java:1: class, interface, or enum expected public class HelloWorld ^ 1 error and... javac -cp . HelloWorld.java returns the same. echo $CLASSPATH just returns blank. Thanks for the help.

    Read the article

  • Equivalent of Switch Statement in MySql 5

    - by Robert Gowland
    Using MySql 5, I have a task where I need to update one table based on the contents of another table. For example, I need to add 'A1' to table 'A' if table 'B' contains 'B1'. I need to add 'A2a' and 'A2b' to table 'A' if table 'B' contains 'B2', etc.. In our case, the value in table 'B' we're interested is an enum. Right now I have a stored procedure containing a series of statements like: INSERT INTO A SELECT 'A1' FROM B WHERE B.Value = 'B1'; --Repeat for 'B2' -> 'A2a', 'A2b'; 'B3' -> 'A3', etc... Is there a nicer more DRY way of accomplishing this?

    Read the article

  • Enumeration classes in Java

    - by Crystal
    I have one class that declares an enumeration type as: public enum HOME_LOAN_TERMS {FIFTEEN_YEAR, THIRTY_YEAR}; Is this type usable in another class? I'm basically trying to complete a homework assignment where we have two types of loans, and one loanManager class. When I try to use the HOME_LOAN_TERMS.THIRTY_YEAR in my loanManager class that does not extend or implement the loan class, I get an error saying it 'cannot find symbol HOME_LOAN_TERMS.' So I did not know if my loanManager class needed to implement the two different loan classes. Thanks.

    Read the article

  • Using switch and enumerations as substitute for named methods

    - by MatthewMartin
    This pattern pops up a lot. It looks like a very verbose way to move what would otherwise be separate named methods into a single method and then distinguished by a parameter. Is there any good reason to have this pattern over just having two methods Method1() and Method2() ? The real kicker is that this pattern tends to be invoked only with constants at runtime-- i.e. the arguments are all known before compiling is done. public enum Commands { Method1, Method2 } public void ClientCode() { //Always invoked with constants! Never user input. RunCommands(Commands.Method1); RunCommands(Commands.Method2); } public void RunCommands(Commands currentCommand) { switch (currentCommand) { case Commands.Method1: // Stuff happens break; case Commands.Method2: // Other stuff happens break; default: throw new ArgumentOutOfRangeException("currentCommand"); } }

    Read the article

  • In Python, how to use a C++ function which returns an allocated array of structs via a ** parameter?

    - by Jon-Eric
    I'd like to use some existing C++ code, NvTriStrip, in a Python tool. SWIG easily handles the functions with simple parameters, but the main function, GenerateStrips, is much more complicated. What do I need to put in the SWIG interface file to indicate that primGroups is really an output parameter and that it must be cleaned up with delete[]? /////////////////////////////////////////////////////////////////////////// // GenerateStrips() // // in_indices: input index list, the indices you would use to render // in_numIndices: number of entries in in_indices // primGroups: array of optimized/stripified PrimitiveGroups // numGroups: number of groups returned // // Be sure to call delete[] on the returned primGroups to avoid leaking mem // bool GenerateStrips( const unsigned short* in_indices, const unsigned int in_numIndices, PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false ); FYI, here is the PrimitiveGroup declaration: enum PrimType { PT_LIST, PT_STRIP, PT_FAN }; struct PrimitiveGroup { PrimType type; unsigned int numIndices; unsigned short* indices; PrimitiveGroup() : type(PT_STRIP), numIndices(0), indices(NULL) {} ~PrimitiveGroup() { if(indices) delete[] indices; indices = NULL; } };

    Read the article

  • How can I refactor that code ? (state pattern ?)

    - by alex
    Hello guys, How can I refactor that code ? public enum enum1 { value1 = 0x01, value2 = 0x02, value3 = 0x03, value4 = 0x04, value5 = 0x05, UNKNOWN = 0xFF } class class1 { private const string STR_VALUE1 = "some text description of value1"; private const string STR_VALUE2 = "some text description of value2"; private const string STR_VALUE3 = "some text description of value3"; private const string STR_VALUE4 = "some text description of value4"; private const string STR_VALUE5 = "some text description of value5"; private const string STR_VALUE6 = "some text description of unknown type"; public static string GetStringByTypeCode(enum1 type) { switch(type) { case enum1.value1: return STR_VALUE1; case enum1.value2: return STR_VALUE2; case enum1.value3: return STR_VALUE3; case enum1.value4: return STR_VALUE4; case enum1.value5: return STR_VALUE5; default: return STR_VALUE6; } } } PS: there are many enum1...enumX and GetStringByTypeCode(enum1) ... GetStringByTypeCode(enumX) methods.

    Read the article

  • How to export data which are mapped to enumerations

    - by Joshua
    I have a set of data which needs to be imported from a excel sheet, lets take the simplest example. Note: the data might eventually support uploading any locale. e.g. assuming one of the fields denoting a user is gender mapped to an enumeration and stored in the database as 0 for male and 1 for female. 0 and 1 being short values. If I have to import the values I cannot expect the user to punch in numbers (since they are not intuitive and is cumbersome when the enumerations are bigger), what would be the correct way to map to enumerations. Should we ask them to provide a string value in these cases (e.g. male or female) and provide the transformation to a enum in our code by wring a method public static Gender Gender.fromString(String value)

    Read the article

  • NullReferenceException makes me want to shoot myself

    - by rockinthesixstring
    Ok, so once upon a time, my code worked. Since then I did some refactoring (basic stuff so I thought) but now I'm getting a null reference exception, and I can't bloody well figure out why. Here's where it starts. note, this is the logout method, but all of my ActivityLogs sections are throwing this error Function LogOut(ByVal go As String) As ActionResult ActivityLogService.AddActivity(AuthenticationHelper.RetrieveAuthUser.ID, _ IActivityLogService.LogType.UserLogout, _ HttpContext.Request.UserHostAddress) ActivityLogService.SubmitChanges() ''# more stuff happens after this End Function The service is pretty straight forward (notice the ERROR THROWN HERE) Public Sub AddActivity(ByVal userid As Integer, ByVal activity As Integer, ByVal ip As String) Implements IActivityLogService.AddActivity Dim _activity As ActivityLog = New ActivityLog With {.Activity = activity, .UserID = userid, .UserIP = ip.IPAddressToNumber, .ActivityDate = DateTime.UtcNow} ActivityLogRepository.Create(_activity) ''#ERROR THROWN HERE End Sub And the Interface that the Service uses looks like this Public Interface IActivityLogService Sub AddActivity(ByVal userid As Integer, ByVal activity As Integer, ByVal ip As String) Function GetUsersLastActivity(ByVal UserID As Integer) As ActivityLog Sub SubmitChanges() ''' <summary> ''' The type of activity done by the user ''' </summary> ''' <remarks>Each int refers to an activity. ''' There can be no duplicates or modifications ''' after this application goes live</remarks> Enum LogType As Integer ''' <summary> ''' A new session started ''' </summary> SessionStarted = 1 ''' <summary> ''' A new user is Added/Created ''' </summary> UserAdded = 2 ''' <summary> ''' User has updated their profile ''' </summary> UserUpdated = 3 ''' <summary> ''' User has logged into they system ''' </summary> UserLogin = 4 ''' <summary> ''' User has logged out of the system ''' </summary> UserLogout = 5 ''' <summary> ''' A new event has been added ''' </summary> EventAdded = 6 ''' <summary> ''' An event has been updated ''' </summary> EventUpdated = 7 ''' <summary> ''' An event has been deleted ''' </summary> EventDeleted = 8 ''' <summary> ''' An event has received a Up/Down vote ''' </summary> EventVoted = 9 ''' <summary> ''' An event has been closed ''' </summary> EventCloseVoted = 10 ''' <summary> ''' A comment has been added to an event ''' </summary> CommentAdded = 11 ''' <summary> ''' A comment has been updated ''' </summary> CommentUpdated = 12 ''' <summary> ''' A comment has been deleted ''' </summary> CommentDeleted = 13 ''' <summary> ''' An event or comment has been reported as spam ''' </summary> SpamReported = 14 End Enum End Interface And the repository is equally straight forward Public Sub Create(ByVal activity As ActivityLog) Implements IActivityLogRepository.Create dc.ActivityLogs.InsertOnSubmit(activity) End Sub The stack trace is as follows [NullReferenceException: Object reference not set to an instance of an object.] MyApp.Core.Domain.ActivityLogService.AddActivity(Int32 userid, Int32 activity, String ip) in E:\Projects\MyApp\MyApp.Core\Domain\Services\ActivityLogService.vb:49 MyApp.Core.Controllers.UsersController.Authenticate(String go) in E:\Projects\MyApp\MyApp.Core\Controllers\UsersController.vb:258 lambda_method(Closure , ControllerBase , Object[] ) +163 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +51 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +409 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +52 System.Web.Mvc.<c_DisplayClass15.b_12() +127 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +436 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +61 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +305 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830 System.Web.Mvc.Controller.ExecuteCore() +136 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +232 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +68 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +44 System.Web.Mvc.Async.<>c__DisplayClass81.b__7(IAsyncResult ) +42 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +141 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.<c_DisplayClasse.b_d() +61 System.Web.Mvc.SecurityUtil.b_0(Action f) +31 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +56 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +110 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +690 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +194 here's an image of the error when attached to the debugger. And here's an image of the DB schema in question Can anyone shed some light on what I might be missing here?

    Read the article

  • Creating a file upload template in Doctrine ORM

    - by balupton
    Hey all. I'm using Doctrine 1.2 as my ORM for a Zend Framework Project. I have defined the following Model for a File. File: columns: id: primary: true type: integer(4) unsigned: true code: type: string(255) unique: true notblank: true path: type: string(255) notblank: true size: type: integer(4) type: type: enum values: [file,document,image,video,audio,web,application,archive] default: unknown notnull: true mimetype: type: string(20) notnull: true width: type: integer(2) unsigned: true height: type: integer(2) unsigned: true Now here is the File Model php class (just skim through for now): <?php /** * File * * This class has been auto-generated by the Doctrine ORM Framework * * @package ##PACKAGE## * @subpackage ##SUBPACKAGE## * @author ##NAME## <##EMAIL##> * @version SVN: $Id: Builder.php 6365 2009-09-15 18:22:38Z jwage $ */ class File extends BaseFile { public function setUp ( ) { $this->hasMutator('file', 'setFile'); parent::setUp(); } public function setFile ( $file ) { global $Application; // Configuration $config = array(); $config['bal'] = $Application->getOption('bal'); // Check the file if ( !empty($file['error']) ) { $error = $file['error']; switch ( $file['error'] ) { case UPLOAD_ERR_INI_SIZE : $error = 'ini_size'; break; case UPLOAD_ERR_FORM_SIZE : $error = 'form_size'; break; case UPLOAD_ERR_PARTIAL : $error = 'partial'; break; case UPLOAD_ERR_NO_FILE : $error = 'no_file'; break; case UPLOAD_ERR_NO_TMP_DIR : $error = 'no_tmp_dir'; break; case UPLOAD_ERR_CANT_WRITE : $error = 'cant_write'; break; default : $error = 'unknown'; break; } throw new Doctrine_Exception('error-application-file-' . $error); return false; } if ( empty($file['tmp_name']) || !is_uploaded_file($file['tmp_name']) ) { throw new Doctrine_Exception('error-application-file-invalid'); return false; } // Prepare config $file_upload_path = realpath($config['bal']['files']['upload_path']) . DIRECTORY_SEPARATOR; // Prepare file $filename = $file['name']; $file_old_path = $file['tmp_name']; $file_new_path = $file_upload_path . $filename; $exist_attempt = 0; while ( file_exists($file_new_path) ) { // File already exists // Pump exist attempts ++$exist_attempt; // Add the attempt to the end of the file $file_new_path = $file_upload_path . get_filename($filename,false) . $exist_attempt . get_extension($filename); } // Move file $success = move_uploaded_file($file_old_path, $file_new_path); if ( !$success ) { throw new Doctrine_Exception('Unable to upload the file.'); return false; } // Secure $file_path = realpath($file_new_path); $file_size = filesize($file_path); $file_mimetype = get_mime_type($file_path); $file_type = get_filetype($file_path); // Apply $this->path = $file_path; $this->size = $file_size; $this->mimetype = $file_mimetype; $this->type = $file_type; // Apply: Image if ( $file_type === 'image' ) { $image_dimensions = image_dimensions($file_path); if ( !empty($image_dimensions) ) { // It is not a image we can modify $this->width = 0; $this->height = 0; } else { $this->width = $image_dimensions['width']; $this->height = $image_dimensions['height']; } } // Done return true; } /** * Download the File * @return */ public function download ( ) { global $Application; // File path $file_upload_path = realpath($config['bal']['files']['upload_path']) . DIRECTORY_SEPARATOR; $file_path = $file_upload_path . $this->file_path; // Output result and download become_file_download($file_path, null, null); die(); } public function postDelete ( $Event ) { global $Application; // Prepare $Invoker = $Event->getInvoker(); // Configuration $config = array(); $config['bal'] = $Application->getOption('bal'); // File path $file_upload_path = realpath($config['bal']['files']['upload_path']) . DIRECTORY_SEPARATOR; $file_path = $file_upload_path . $this->file_path; // Delete the file unlink($file_path); // Done return true; } } What I am hoping to accomplish is so that the above custom functionality within my model file can be turned into a validator, template, or something along the lines. So hopefully I can do something like: File: actAs: BalFile: columns: id: primary: true type: integer(4) unsigned: true code: type: string(255) unique: true notblank: true path: type: string(255) notblank: true size: type: integer(4) type: type: enum values: [file,document,image,video,audio,web,application,archive] default: unknown notnull: true mimetype: type: string(20) notnull: true width: type: integer(2) unsigned: true height: type: integer(2) unsigned: true I'm hoping for a validator so that say if I do $File->setFile($_FILE['uploaded_file']); It will provide a validation error, except in all the doctrine documentation it has little on custom validators, especially in the contect of "virtual" fields. So in summary, my question is: How earth can I go about making a template/extension to porting this functionality? I have tried before with templates but always gave up after a day :/ If you could take the time to port the above I would greatly appreciate it.

    Read the article

  • immediate=true is set on a jsf command button but still seeing validation

    - by Zack Macomber
    I have the following command button set up in a facelet: <h:commandButton action="#{addressAction.deletePreviousAddress}" value="#{bundle['button.deleteAddress']}" styleClass="deg-form-button" immediate="true"> <f:setPropertyActionListener target="#{addressAction.addressActionForm.previousAddress}" value="#{address}"> </f:setPropertyActionListener> </h:commandButton> In AddressAction, the following code gets run to delete a previous address on the form: public Enum<NavigationConstants> deletePreviousAddress() { addressActionForm.getPreviousAddresses().remove(addressActionForm.getPreviousAddress()); return NavigationConstants.addresses; } Before I made the address input components "required=true", this code worked fine and removed the previous address from the jsf form successfully. Right now, I can't successfully delete a previous address because validation is occurring and stating that the input components need to be filled in on the previous address record on the form. How can I bypass this validation? I thought the "immediate=true" attribute on the command button would have accomplished it but that's not cutting it in my case...

    Read the article

  • Error handling and polymorphism

    - by Neeraj
    I have an application with some bunch of code like this: errCode = callMainSystem(); switch (errCode){ case FailErr: error("Err corresponding to val1\n"); case IgnoreErr: error("Err corresponding to val2\n"); ... ... default: error("Unknown error\n"); } The values are enum constants. Will it make some sense to have something like: // Error* callMainSystem() ... Some code return FaileErr(); // or some other error // handling code Error* err = callMainSystem(); err->toString(); The Error class may be made singleton as it only has to print error messages. What are the pros and cons of above methods,size is an important criteria as the application needs to be supported on embedded devices as well. P.S: I don't want to use exception handling because of portability issues and associated overheads.

    Read the article

  • Set Page Output Cache VaryByCustom value programmatically

    - by Chris Marisic
    I want to use an Enum value for the types of VaryByCustom parameters I will support, is it possible to do this? I tried setting it in the page itself <%@ OutputCache Duration="600" VaryByParam="none" VaryByCustom='<%=VaryByCustomType.IsAuthenticated.ToString(); %>' %> But this returned the entire literal string "<%=VaryByCustomType.IsAuthenticated.ToString(); %>" inside my global.asax is there any way to do this either on the page itself or from the codebehind? Or is this just something I have to accept is purely magic strings and nothing I can do to add type safety to it?

    Read the article

  • C# Windows CE 5.0 error: Can't find entry point ExitWindowsEx in PInvoke DLL coredll

    - by JackN
    I need to programatically shutdown a Windows CE 5.0 tablet using Microsoft.NET SDK CompactFramework v2.0. I tried using the solution here but got the error message Can't find entry point ExitWindowsEx in PInvoke DLL coredll Is there a way to add ExitWindowsEx to my build? Do I need a different coredll? [Flags] public enum ExitFlags { Reboot = 0x02, PowerOff = 0x08 } [DllImport("coredll")] public static extern int ExitWindowsEx(ExitFlags flags, int reserved); private static void buttonShutdown_Click(object sender, EventArgs e) { ExitWindowsEx(ExitFlags.PowerOff, 0); } private static void buttonRestart_Click(object sender, EventArgs e) { ExitWindowsEx(ExitFlags.Reboot, 0); }

    Read the article

  • Inheritance vs specific types in Financial Modelling for cashflows

    - by BlueTrin
    Hello, I have to program some financial applications where I have to represent a schedule of flows. The flows can be of 3 types: - fee flow (just a lump payment at some date) - floating rate flow (the flow is dependant of an interest rate to be determined at a later date) - fixed rate flow (the flow is dependant of an interest rate determined when the deal is done) I need to keep the whole information and I need to represent a schedule of these flows. Originally I wanted to use inheritance and create three classes FeeFlow, FloatingFlow, FixedFlow all inheriting from ICashFlow and implement some method GetFlowType() returning an enum then I could dynamic_cast the object to the correct type. That would allow me to have only one vector to represent my schedule. What do you think of this design, should I rather use three vectors vector, vector and vector to avoid the dynamic casts ?

    Read the article

  • Using enums or a set of classes when I know I have a finite set of different options?

    - by devoured elysium
    Let's say I have defined the following class: public abstract class Event { public DateTime Time { get; protected set; } protected Event(DateTime time) { Time = time; } } What would you prefer between this: public class AsleepEvent : Event { public AsleepEvent(DateTime time) : base(time) { } } public class AwakeEvent : Event { public AwakeEvent(DateTime time) : base(time) { } } and this: public enum StateEventType { NowAwake, NowAsleep } public class StateEvent : Event { protected StateEventType stateType; public MealEvent(DateTime time, StateEventType stateType) : base(time) { stateType = stateType; } } and why? I am generally more inclined to the first option, but I can't explain why. Is it totally the same or are any advantages in using one instead of the other? Maybe with the first method its easier to add more "states", altough in this case I am 100% sure I will only want two states: now awake, and now asleep (they signal the moments when one awakes and one falls asleep).

    Read the article

  • Limit scope of #define

    - by Ujjwal Singh
    What is the correct strategy to limit the scope of #define and avoid unwarrented token collisions. In the following configuration: Main.c # include "Utility_1.h" # include "Utility_2.h" VOID Utility() // Was written without knowing of: Utility_1 & Utility_2 { const UINT ZERO = 0; } VOID Main() { ... } // Collision; for Line:5 Compiler does not indicate what replaced Utility_1.h # define ZERO "Zero" # define ONE "One" BOOL Utility_1(); Utility_2.h # define ZERO '0' # define ONE '1' BOOL Utility_2(); Utility_2.c # include "Utility_2.h" BOOL Utility_2() { // Using: ZERO & ONE } //Collision: Character Literal replaced with String {Edit} Note: This is supposed to be a generic quesition so do not limit yourself to enum or other defined types. i.e. What to do when: I MUST USE #define Please comment on my proposed solution below.. _

    Read the article

  • How can I make a UIPickerView like a UIDatePicker?

    - by iamthepiguy
    I have a custom UIViewController subclass which acts as Datasource and Delegate for a UIPickerView which I would like to serve two different purposes, as each are simple enough, and don't really warrant separate files. One operation must be as a custom picker, and this works fine. However, for the other operation, I want it to act just like a UIDatePicker. The problem is, UIDatePicker is a subclass of UIControl, not UIPickerView. Is there any sort of enum value I can set in a method (or other way) that will set the UIPickerView to act as a date picker? Or do I have to make two completely different classes and use them differently (pain in the ass)?

    Read the article

  • SQL Syntax Error 1064

    - by 01010011
    Hi, I keep getting the following error message ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right systax to use near ''isbn10','isbn13','title','edition','author_f_name','author_m_name','author_l_na' at line 1 when trying to populate my MySQL database from the command line with the following command: source C:\myFilePath\myFileName.sql Here is an excerpt from my mysqldump (showing the table structure for book). Where did I go wrong? Any assistance will be appreciated: -- -- Table structure for table book DROP TABLE IF EXISTS book; /*!40101 SET @saved_cs_client = @@character_set_client /; /!40101 SET character_set_client = utf8 */; CREATE TABLE book ( book_id int(11) NOT NULL AUTO_INCREMENT, isbn10 char(20) DEFAULT NULL, isbn13 char(20) DEFAULT NULL, title char(20) DEFAULT NULL, edition char(20) DEFAULT NULL, author_f_name char(20) DEFAULT NULL, author_m_name char(20) DEFAULT NULL, author_l_name char(20) DEFAULT NULL, cond enum('as new','very good','good','fair','poor') DEFAULT NULL, price decimal(8,2) DEFAULT NULL, genre char(20) DEFAULT NULL, PRIMARY KEY (book_id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table book

    Read the article

  • Enums With Default Throw Clause?

    - by Tom Tresansky
    I noticed the following in the Java Language spec in the section on enumerations here: link switch(this) { case PLUS: return x + y; case MINUS: return x - y; case TIMES: return x * y; case DIVIDE: return x / y; } throw new AssertionError("Unknown op: " + this); However, looking at the switch statement definition section, I didn't notice this particular syntax (the associated throw statement) anywhere. Can I use this sort of "default case is throw an exception" syntactic sugar outside of enum definitions? Does it have any special name? Is this considered a good/bad practice for short-cutting this behavior of "anything not in the list throws an exception"?

    Read the article

  • C#: Oracle Data Type Equivalence with OracleDbType

    - by Partial
    Situation: I am creating an app in C# that uses Oracle.DataAccess.Client (11g) to do certain operations on a Oracle database with stored procedures. I am aware that there is a certain enum (OracleDbType) that contains the Oracle data types, but I am not sure which one to use for certain types. Questions: What is the equivalent Oracle PL/SQL data type for each enumerated type in the OracleDbType enumeration? There are three types of integer (Int16, Int32, Int64) in the OracleDbType... how to know which one to use or are they all suppose to work?

    Read the article

  • Reliably converting C preprocessor macros to python code

    - by manual-manuel
    Hi, I have a bunch of C macros the operation of which I need to simulate in python. I saw some pointers to pygccxml or ctypeslib etc. Are these the ways to go ? Or is there something out there that is better ? The C macros if and when they change, I would like the python implementation to be auto generated rather than having to make manual modifications. Hence the question. <my_c_header.h> /* #defines type 1 */ #ifdef OS #define NUM_FLAGS (uint16_t)(3) #define NUM_BITS (uint16_t)(8) #else #define NUM_FLAGS (uint16_t)(6) #define NUM_BITS (uint16_t)(16) #endif #define MAKE_SUB_FLAGS (uint16_t)((1<<NUMFLAGS) -1) #define MAKE_TOTAL_FLAGS(x) (uint16_t)((x & MAKE_SUB_FLAGS) >> NUM_BITS) /* #defines type 2 */ #ifdef OS #DO_SOMETHING(X) os_specifc_process(x) #else #DO_SOMETHING(x) #endif /* #defines type 3 */ enum { CASE0, CASE1, CASE2 } #define MY_CASE_0 ((uint16_t)CASE0) #define MY_CASE_1 ((uint16_t)CASE1) #define MY_CASE_2 ((uint16_t)CASE2) #define /*End of file <my_c_header.h> */ Thanks M

    Read the article

  • What is the best way to store categorical references in SQL tables?

    - by jlafay
    I'm wanting to store a wide array of categorical data in MySQL database tables. Let's say that for instance I want to to information on "widgets" and want to categorize attributes in certain ways, i.e. shape category. For instance, the widgets could be classified as: round, square, triangular, spherical, etc. Should these categories be stored within a table to reference them best from an application? Another possibility, I would imagine, would be to add a column to widgets that contained a shape column that contained a tiny int. That way my application could search shapes by that and then use a coordinating enum type that would map the shape int meanings. Which would be best? Or is there another solution that I'm not thinking of yet?

    Read the article

  • How to convert an arbitrary object to String with EL? (calling toString())

    - by hstoerr
    Is there any way to call toString() on an object with the EL? (I need the String representation of an enum as index in a map in a JSP EL expression.) I hoped something like ${''+object} would work like in java, but EL isn't that nice, and there does not seem to be any function that does it. Clarification: I have a variable somemap that maps Strings to Strings, and I have a variable someenum that is an enumeration. I'd like to do something like ${somemap[someenum.toString()]}. (Of course .toString() does not work, but what does?)

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >