Search Results

Search found 4685 results on 188 pages for 'proper'.

Page 20/188 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • What should be proper location for sqlit3 database file?

    - by Elliot Chen
    Hi, Everyone: I'm using a sqlite3 database to store app's data. Instead of building a database within program, I introduced an existing db file: 'abc.sqlite' into my project and put it under my 'Resources' folder. So, I think this db file should be inside of 'bundle', so at my init function, I used following statement to read it out: NSString *path = [[NSBundle mainBundle] pathForResource:@"abc" ofType:"sqlite"]; if(sqlite3_open([path UTF8String], &database) != SQLITE_OK) ... It's ok that this db can be opened and data can be retrieved from it. BUT, someone told me that it's better to copy this db file into user folder: such as 'Document'. So, my question is: is it ok to use this db from main bundle directly or copy it to user folder then use that copy. Which is better? Thank you very much!

    Read the article

  • What's the proper way to use sqlite at xCode?

    - by Elliot Chen
    Hi, Experts: Can you please give some suggestions on sqlite using at xcode? Within my application, I use a sqlite DB to store all local data. Two methods can be used to retrieve those data during running time. 1, Load all the data into memory at initialization stage. (More memory used, less DB open/close operation needed) 2, Read corresponding records when necessary, free the occupied memory after using. (Good habit for memory using, but much DB open/close operations needs). I prefer to use method 2, but not sure whether too many DB opening/closing operations could affect app's efficiency. Or do you think I can 'upgrade' method 2 by opening DB when app launches and closing DB when app quits? Thanks for your suggestions very much!

    Read the article

  • What is the best / proper idiom in django for modifying a field during a .save() where you need to o

    - by MDBGuy
    Hi, say I've got: class LogModel(models.Model): message = models.CharField(max_length=512) class Assignment(models.Model): someperson = models.ForeignKey(SomeOtherModel) def save(self, *args, **kwargs): super(Assignment, self).save() old_person = #????? LogModel(message="%s is no longer assigned to %s"%(old_person, self).save() LogModel(message="%s is now assigned to %s"%(self.someperson, self).save() My goal is to save to LogModel some messages about who Assignment was assigned to. Notice that I need to know the old, presave value of this field. I have seen code that suggests, before super().save(), retrieve the instance from the database via primary key and grab the old value from there. This could work, but is a bit messy. In addition, I plan to eventually split this code out of the .save() method via signals - namely pre_save() and post_save(). Trying to use the above logic (Retrieve from the db in pre_save, make the log entry in post_save) seemingly fails here, as pre_save and post_save are two seperate methods. Perhaps in pre_save I can retrieve the old value and stick it on the model as an attribute? I was wondering if there was a common idiom for this. Thanks.

    Read the article

  • Proper QUuid usage in Qt ? (7-Zip DLL usage problems (QLibrary, QUuid GUID conversion, interfaces))

    - by whipsnap
    Hi, I'm trying to write a program that would use 7-Zip DLL for reading files from inside archive files (7z, zip etc). Here's where I'm so far: #include QtCore/QCoreApplication #include QLibrary #include QUuid #include iostream using namespace std; #include "7z910/CPP/7zip/Archive/IArchive.h" #include "7z910/CPP/7zip/IStream.h" #include "MyCom.h" // {23170F69-40C1-278A-1000-000110070000} QUuid CLSID_CFormat7z(0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00); typedef int (*CreateObjectFunc)( const GUID *clsID, const GUID *interfaceID, void **outObject); void readFileInArchive() { QLibrary myLib("7z.dll"); CreateObjectFunc myFunction = (CreateObjectFunc)myLib.resolve("CreateObject"); if (myFunction == 0) { cout outArchive; myFunction(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive); } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); readFileInArchive(); return a.exec(); } Trying to build that in Qt Creator will lead to following error: cannot convert 'QUuid*' to 'const GUID*' in argument passing How should QUuid be correctly used in this context? Also, being a C++ and Qt newbie I haven't yet quite grasped templates or interfaces, so overall I'm having trouble getting through these first steps. If someone could give tips or even example code on how for example an image file could be extracted from ZIP file (to be shown in Qt GUI later on*), I would highly appreciate that. My main goal at the moment is to write a program with GUI for selecting archive files containing image files (PNG, JPG etc) and displaying those files one at a time in the GUI. A Qt based CDisplayEx in short.

    Read the article

  • How to check whether given file is in PROPER word file format?

    - by shekhar
    Hi, I am developing one application using C# for processing MSWord files. My application gets hang when I pass invalid .doc file as an input. For example, if I have one foo.pdf file and I pass it to my application after changing its extension (foo.doc). Is it possible to check whether file is valid doc file before trying to open it? Please enlighten !!!! Thanks in advance

    Read the article

  • What's the proper workaround for creating a div with a table in it with images in the table?

    - by Noor
    I want this: <div id="display"> <div id="slideshow1"> <table cellspacing=0><tr><td style="height:200px;padding:0;vertical-align:middle"> <img ... /> </td></tr></table> </div> </div> And I'm using this: var thelistt = localStorage.getItem('thelist') var trt = document.createElement("div"); trt.setAttribute("Id","slideshow1"); trt.className="pics"; $('#display').append(trt); var tble = document.createElement("table"); tble.setAttribute("cellspacing","0"); tble.innerHTML = "<tr><td style='height:200px;padding:0;vertical-align:middle'>"; $('#slideshow1').append(tble); trt.innerHTML += thelistt; This creates a div, then a table, closes the table, then images, then closes div.. Isn't there a smoother way to not do all this, if someone'd take a look at my current code i''m sure you'd get a good laugh : http://hem.bredband.net/noor/bildspelet3.html (you need to click on edit and put in two or more urls directly to images)

    Read the article

  • What's the "proper" way to retrieve a reference to a ribbon object?

    - by Nick
    For a VSTO workbook project, is there a best practice for retrieving a reference to the Ribbon object from the ThisWorkbook class? Here's what I'm doing: In my Ribbon class, I created a public method called InvalidateControl(string controlID). I need to call that method from the ThisWorkbook class based on when a certain workbook level event fires. But the only way I can see to "get" a reference to that Ribbon object is to do this... // This is all in the ThisWorkbook class Ribbon ribbon; protected override IRibbonExtensibility CreateRibbonExtensibilityObject() { this.ribbon = new Ribbon(); return this.ribbon; } ...which seems a little smelly. I mean, I have to override CreateRibbonExtensibilityObject() regardless; all I'm doing beyond that is maintaining a local reference to the ribbon so I can call methods against it. But it doesn't feel right. Is there another, better way to get that reference in the ThisWorkbook class? Or is this pretty acceptable? Thanks!

    Read the article

  • iPhone keeps going into dim/sleep mode even with the proper API calls.

    - by Kyle
    I call: [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ] on the applicationDidFinishLaunching event.. I set a breakpoint on it, which fires so I know it's getting called.. I've also called this function in other places as well.. Basically, a 3G iPhone will still go into sleep mode, but my 3GS won't. Has anyone seen this behavior before? Both are running the latest OS versions. Thanks for reading!

    Read the article

  • Can't fill a column of NULLs with actual values by making an association to the proper values in the

    - by UkraineTrain
    I have a table with separate columns for months, days and a varchar column for 6 hour increments for each day ('12AM', '6AM', '12PM', '6PM'). There's also a column that's supposed to have calculated numeric values for each of those 6 hour increments. These calculated values come from some reference table. This reference table contains values for each day for several months broken down by hour where each hour has its own column. So, basically, I have to add the values for each 6 hour increment. I have no idea how to associate the correct values in the reference table to those 6 hour increments. I will really appreciate any help on this.

    Read the article

  • C - What is the proper format to allow a function to show an error was encountered?

    - by BrainSteel
    I have a question about what a function should do if the arguments to said function don't line up quite right, through no fault of the function call. Since that sentence doesn't make much sense, I'll offer my current issue. To keep it simple, here is the most relevant and basic function I have. float getYValueAt(float x, PHYS_Line line, unsigned short* error) *error = 0; if(x < line.start.x || x > line.end.x){ *error = 1; return -1; } if(line.slope.value != 0){ //line's equation: y - line.start.y = line.slope.value(x - line.start.x) return line.slope.value * (x - line.start.x) + line.start.y; } else if(line.slope.denom == 0){ if(line.start.x == x) return line.start.y; else{ *error = 1; return -1; } } else if(line.slope.num == 0){ return line.start.y; } } The function attempts to find the point on a line, given a certain x value. However, under some circumstances, this may not be possible. For example, on the line x = 3, if 5 is passed as a value, we would have a problem. Another problem arises if the chosen x value is not within the interval the line is on. For this, I included the error pointer. Given this format, a function call could work as follows: void foo(PHYS_Line some_line){ unsigned short error = 0; float y = getYValueAt(5, some_line, &error); if(error) fooey(); else do_something_with_y(y); } My question pertains to the error. Note that the value returned is allowed to be negative. Returning -1 does not ensure that an error has occurred. I know that it is sometimes preferred to use the following method to track an error: float* getYValueAt(float x, PHYS_Line line); and then return NULL if an error occurs, but I believe this requires dynamic memory allocation, which seems even less sightly than the solution I was using. So, what is standard practice for an error occurring?

    Read the article

  • Proper Install Order For Visual Studio 2010 with SQL Server 2008 and Office 2007?

    - by Optimal Solutions
    I want to create a Windows 7 64-bit (Ultimate) virtual machine with: Visual Studio 2010 (Ultimate) Office 2007 Enterprise (with Visio 2007) SQL Server 2008 (with SSIS and SSRS) but I am not sure if there is a correct order to install those items such that there will not be a loss of "awareness" of one application from another on that list? For example, I want to make sure Visual Studio knows that Office exists but also that Visual Studio knows that SQL Server exists but if I install SQL Server before Office will that wipe out any data access drivers that are needed by VS 2010 if Office is installed after SQL Server? There are a lot of components and I never gave it a thought that install order would matter but I have a feeling it does. Ultimately I want to create a VM that I can save and use a base development VM from which to create additional VMs from.

    Read the article

  • Node.js A Good authentication module ? or whats the proper way to authenticate users?

    - by Mohamed Ahmed
    I'm learning Node.js and looking forward to create a simple web application which will be based on Express and I was thinking of something like creating user groups and each group has its own users and each group has its own permissions (Just like ACL in Cakephp) So can anyone recommend a good module or whatever to do so ? Also I'm a little curious about security and how these passwords are going to be saved and what type of encryption the passwords will be encrypted in. Thanks :)

    Read the article

  • What's the proper approach for writing multi-path "story" flows?

    - by Basiclife
    Hi, I wonder if you can help me. I'm writing a game (2d) which allows players to take multiple routes, some of which branch/merge - perhaps even loop. Each section of the game will decide which section is loaded next. I'm calling each section an IStoryElement - And I'm wondering how best to link these elements up in a way that is easily changed/configured and at the same time, graphable I'm going to have an engine/factory assembly which will load the appropriate StoryElement(s) based on various config options. I initially planned to give each StoryElement a NextElement() As IStoryElement property and a Completed() event. When the vent fires, the engine reads the NextElement property to find the next StoryElement. The downside to this is that if I ever wanted to graph all the routes through the game, I would be unable to - I couldn't determine all possible targets for each StoryElement. I considered a couple of other solutions but they all feel a little clunky - eg Do I need an additional layer of abstraction? ie StoryElementPlayers or similar - Each one would be responsible for stringing together multiple StoryElement perhaps a Series and a ChoicePlayer with each responsible for graphing its own StoryElement - But this will just move the problem up a layer. In short, I need some way of emulating a simple but dynamic workflow (but I'd rather not actually use WWF). Is there a pattern for something this simple? All the ones I've managed to find relate to more advanced control flow (parallel processing, etc.)

    Read the article

  • In an AVL tree, at what condition the balancing is to be done? proper code in c languge

    - by bachchan
    Binary search follows Divide and Conquer method where as linear Search doesn't follw.The time complexity of Binary Search in O(log n) but incase of linear search the time complexity is O(n). Thats way Binary search is having bettr prior than linear search. But it is true when the list of items is large incase of smaller list linear is best(i.e.- it is only when the Best Case concern)

    Read the article

  • Is there a proper and wrong way to format CSS?

    - by DavidR
    When I first started writing CSS, I was writing it in an expanded form div.class { margin: 10px 5px 3px; border: 1px solid #333; font-weight: bold; } .class .subclass { text-align:right; } but now I find myself writing css like this: (Example from code I'm actually writing now) .object1 {} .scrollButton{width:44px;height:135px;} .scrollButton img {padding:51px 0 0 23px;} .object2 {width:165px;height:94px;margin:15px 0 0 23px;padding:15px 0 0 10px;background:#fff;} .featuredObject .symbol{line-height:30px; padding-top:6px;} .featuredObject .value {width:90px;} .featuredObject .valueChange {padding:5px 0 0 0;} .featuredObject img {position:absolute;margin:32px 0 0 107px;} and I'm beginning to worry because a lot of the time I see the first form done in examples online, while I find the second form a lot easier for me to work with. It has a lower vertical height, so I can see all the classes at a glance with less scrolling, the tabulation of the hierarchy seems more apparent, and it looks more like code I'd write with javascript or html. Is this a valid way of doing code, or to keep with standards when putting it online should I use the vertical form instead?

    Read the article

  • What is the proper syntax for getting a Makefile to print the output directory of one of its output zip files?

    - by 9exceptionThrower9
    I'm trying to edit an Android Makefile in the hopes of getting it to print out the directory (path) location of one the ZIP files it creates. Ideally, since the build process is long and does many things, I would like for it print out the pathway to the ZIP file to a text file in a different directory I can access later: Pseudo-code idea: # print the desired pathway to output file print(getDirectoryOf(variable-name.zip)) > ~/Desktop/location_of_file.txt The Makefile snippet where I would like to insert this new bit of code is shown below. I am interested in finding the directory of $(name).zip (that is specific file I want to locate): # ----------------------------------------------------------------- # A zip of the directories that map to the target filesystem. # This zip can be used to create an OTA package or filesystem image # as a post-build step. # name := $(TARGET_PRODUCT) ifeq ($(TARGET_BUILD_TYPE),debug) name := $(name)_debug endif name := $(name)-target_files-$(FILE_NAME_TAG) intermediates := $(call intermediates-dir-for,PACKAGING,target_files) BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip $(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates) $(BUILT_TARGET_FILES_PACKAGE): \ zip_root := $(intermediates)/$(name) # $(1): Directory to copy # $(2): Location to copy it to # The "ls -A" is to prevent "acp s/* d" from failing if s is empty. define package_files-copy-root if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \ mkdir -p $(2) && \ $(ACP) -rd $(strip $(1))/* $(2); \ fi endef

    Read the article

  • is there a proper way to handle multiple errors/exceptions?

    - by toPeerOrNotToPeer
    in OO programming, is there some conceptual pattern, ideas, about handling multiple errors? for example, i have a method that performs some checks and should return an error message for each error found ['name is too short', 'name contains invalid unicode sequences', 'name is too long'] now, should i use an array of exceptions (not thrown exceptions)? or something like this is better: class MyExceptionList extends Exception{ public Void addException(Exception e){} public Array getExceptions(){} } any theory behind this argument will be appreciated! (this isn't a request about a specific programming language, but a pure theoretical one) thank you in advance

    Read the article

  • What is the proper way to handle a fully qualified domain in a GET request?

    - by Mark P Neyer
    I'm writing a proxy server. When I use curl to fetch a page, say http://www.foo.com/pants, curl makes the following request: GET /pants HTTP/1.1 When I have curl send that request through my local proxy, curl changes the GET request to: GET http://www.foo.com/pants HTTP/1.1 This change causes the foo.com server return a 404. Is foo.com broken? Or is the fully qualified domain name only meaningful to proxy servers? Should I always strip http://domain from the requests I send out? Thanks!

    Read the article

  • Most proper way to use inherited classes with shared scopes in Mongo?

    - by Trip
    I have the TestVisual class that is inherited by the Game class : class TestVisual < Game include MongoMapper::Document end class Game include MongoMapper::Document belongs_to :maestra key :incorrect, Integer key :correct, Integer key :time_to_complete, Integer key :maestra_id, ObjectId timestamps! end As you can see it belongs to Maestra. So I can do Maestra.first.games But I can not to Maestra.first.test_visuals Since I'm working specifically with TestVisuals, that is ideally what I would like to pull. Is this possible with Mongo. If it isn't or if it isn't necessary, is there any other better way to reach the TestVisual object from Maestra and still have it inherit Game ?

    Read the article

  • VB6 ActiveX exe - what is the proper registration sequence?

    - by Timbuck
    I have recently updated a Visual Basic 6 application that is an ActiveX exe, running on Windows XP. I have a couple of testers for this application who have received a copy of the exe and are attempting to run it. However, they are getting an error message "Unexpected error;quitting" when trying to do so. A key difference between their testing and my testing is that on the machines I tested on, I have admin rights and was able to register the application using the appname.exe /regserver command line. Reading the details at MS Support about file registration appears unclear: Visual Basic ActiveX EXE files register themselves the first time you run the EXE. However, you cannot use the EXE as a COM server until it is registered. So does this mean that after the first time the users run the exe that the application should be correctly registered, and the error I am receiving is sign of something other than an incorrectly registered application? Or does this mean that the application will not work properly until such time as the file is explicitly registered using the appname.exe /regserver command line? nb - during a production distribution, the software would be sent out to client PCs using Systems Management Server, which isn't an option for this testing.

    Read the article

  • How to overwrite a convenience constructor the proper way?

    - by mystify
    For example I want to overwrite from UIButton: + (id)buttonWithType:(UIButtonType)buttonType So I would do: + (id)buttonWithType:(UIButtonType)buttonType { UIButton *button = [UIButton buttonWithType:buttonType]; if (button != nil) { // do own config stuff ... } return button; } is that the right way? Or did I miss something? (yeah, I have been overwriting thousands of instance methods, but never class methods ;) )

    Read the article

  • Proper way to handle issue when porting 32 to 64 bit. Conversion from DT1 to DT2 of greater size

    - by grobartn
    So I am trying to port 32 bit to 64 bit. I have turned on the VS2008 flag for detecting problems with 64 bit. I am trying following: char * pList = (char *)uiTmp); warning C4312: 'type cast' : conversion from 'unsigned int' to 'char *' of greater size Disregard the code itself. This is also true for any pointer, because 64 bit pointer is greater than 32 bit unsigned int or int for that purpose. Given that you have to cast smaller type to greater how would you go about doing it so it correctly on both 32/64 bit systems

    Read the article

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