Search Results

Search found 3459 results on 139 pages for 'if modified since'.

Page 38/139 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • Django: How to iterate over formsets and access cleaned data?

    - by Mark
    What if I want to do something with my formset other than immediately saving it? How can I do this? for form in vehicles_formset.forms: listing.id = None listing.vehicle_year = form.cleaned_data['year'] listing.vehicle_make = form.cleaned_data['make'] listing.vehicle_model = form.cleaned_data['model'] listing.vin = form.cleaned_data['vin'] listing.vehicle_runs = form.cleaned_data['runs'] listing.vehicle_convertible = form.cleaned_data['convertible'] listing.vehicle_modified = form.cleaned_data['modified'] listing.save() (Thus creating multiple listings) Apparently cleaned_data does not exist. There's a bunch of stuff in the data dict like form-0-year but it's pretty useless to me like that.

    Read the article

  • How to Add Date Picker To VBA UserForm

    - by user1760110
    I am looking for a control to add to userForm to enable user to pick the date.I a good one at this address Formatting MM/DD/YYYY dates in textbox in VBA from Siddharth Rout which is perfect but it generate invisible sheets which is not nessaccary for my application I tried to stop creating sheets but i couldnt figure it out. Can you please let me know how I can properly modified the Siddharth Rout code or ponit me to another application like that? Thanks for you time

    Read the article

  • GridView Events Clarification

    - by nettguy
    Recently I have been asked an interview question "What are the events order in GridView?". I explained Init() Loading() DataBinding() DataBound() RowCreated .... User interaction events like RowCommand,RowDeleting,RowUpdating PreRender -executes every time when the GridView is modified unload() I would like to check whether my answer is right or not.

    Read the article

  • How do I hook a git pull on the remote?

    - by Danny
    Is there a way to hook when a git pull happens on the remote (similar to a pre-receive or post-receive). Basically I'd like to be able to cause the remote to commit whatever it has when there is a pull. In my situation, whatever is live on the remote is an authoritative source which may get modified without a git commit. I want to make sure when I pull I'm always able to get the latest of whatever is live.

    Read the article

  • Remove gap in wordpress posts in IE

    - by Martin Ingolf
    I'm using a modified version of Modern Clix by Rodrigo Galindez on my website, and I've encountered a problem with gaps on top of every one of my posts in IE. The gap is the size of my left-hand sidebar and doesn't appear in firefox. Ex.: http://martiningolf.dk/?page%5Fid=273 If anyone knows how to solve this problem, It'd make me happy.

    Read the article

  • C++ simple logging class with UTF-8 output [code example]

    - by Andrew
    Hello everyone, I was working on one of my academic projects and for the first time I needed pure C++ without GUI. After googling for a while, I did not find any simple and easy to use implementation for logging and created my own. This is a simple implementation with iostreams that logs messages to screen and to the file simultaneously. I was thinking of using templates but then I realized that I do not expect any changes and removed that. It is modified std::wostream with two added modifiers: 1. TimeStamp - prints time-stamp 2. LogMode(LogModes) - switches output: file only, screen only, file+screen. *Boost::utf8_codecvt_facet* is used for UTF-8 output. // ############################################################################ // # Name: MyLog.h # // # Purpose: Logging Class Header # // # Author: Andrew Drach # // # Modified by: <somebody> # // # Created: 03/21/10 # // # SVN-ID: $Id$ # // # Copyright: (c) 2010 Andrew Drach # // # Licence: <license> # // ############################################################################ #ifndef INCLUDED_MYLOG_H #define INCLUDED_MYLOG_H // headers -------------------------------------------------------------------- #include <string> #include <iostream> #include <fstream> #include <exception> #include <boost/program_options/detail/utf8_codecvt_facet.hpp> using namespace std; // definitions ---------------------------------------------------------------- // ---------------------------------------------------------------------------- // DblBuf class // Splits up output stream into two // Inspired by http://wordaligned.org/articles/cpp-streambufs // ---------------------------------------------------------------------------- class DblBuf : public wstreambuf { private: // private member declarations DblBuf(); wstreambuf *bf1; wstreambuf *bf2; virtual int_type overflow(int_type ch) { int_type eof = traits_type::eof(); int_type not_eof = !eof; if ( traits_type::eq_int_type(ch,eof) ) return not_eof; else { char_type ch1 = traits_type::to_char_type(ch); int_type r1( bf1on ? bf1->sputc(ch1) : not_eof ); int_type r2( bf2on ? bf2->sputc(ch1) : not_eof ); return (traits_type::eq_int_type(r1,eof) || traits_type::eq_int_type(r2,eof) ) ? eof : ch; } } virtual int sync() { int r1( bf1on ? bf1->pubsync() : NULL ); int r2( bf2on ? bf2->pubsync() : NULL ); return (r1 == 0 && r2 == 0) ? 0 : -1; } public: // public member declarations explicit DblBuf(wstreambuf *bf1, wstreambuf *bf2) : bf1(bf1), bf2(bf2) { if (bf1) bf1on = true; else bf1on = false; if (bf2) bf2on = true; else bf2on = false; } bool bf1on; bool bf2on; }; // ---------------------------------------------------------------------------- // logstream class // Wrapper for a standard wostream with access to modified buffer // ---------------------------------------------------------------------------- class logstream : public wostream { private: // private member declarations logstream(); public: // public member declarations DblBuf *buf; explicit logstream(wstreambuf *StrBuf, bool isStd = false) : wostream(StrBuf, isStd), buf((DblBuf*)StrBuf) {} }; // ---------------------------------------------------------------------------- // Logging mode Class // ---------------------------------------------------------------------------- enum LogModes{LogToFile=1, LogToScreen, LogToBoth}; class LogMode { private: // private member declarations LogMode(); short mode; public: // public member declarations LogMode(short mode1) : mode(mode1) {} logstream& operator()(logstream &stream1) { switch(mode) { case LogToFile: stream1.buf->bf1on = true; stream1.buf->bf2on = false; break; case LogToScreen: stream1.buf->bf1on = false; stream1.buf->bf2on = true; break; case LogToBoth: stream1.buf->bf1on = true; stream1.buf->bf2on = true; } return stream1; } }; logstream& operator<<(logstream &out, LogMode mode) { return mode(out); } wostream& TimeStamp1(wostream &out1) { time_t time1; struct tm timeinfo; wchar_t timestr[512]; // Get current time and convert it to a string time(&time1); localtime_s (&timeinfo, &time1); wcsftime(timestr, 512,L"[%Y-%b-%d %H:%M:%S %p] ",&timeinfo); return out1 << timestr; } // ---------------------------------------------------------------------------- // MyLog class // Logs events to both file and screen // ---------------------------------------------------------------------------- class MyLog { private: // private member declarations MyLog(); auto_ptr<DblBuf> buf; string mErrorMsg1; string mErrorMsg2; string mErrorMsg3; string mErrorMsg4; public: // public member declarations explicit MyLog(string FileName1, wostream *ScrLog1, locale utf8locale1); ~MyLog(); void NewEvent(wstring str1, bool TimeStamp = true); string FileName; wostream *ScrLog; wofstream File; auto_ptr<logstream> Log; locale utf8locale; }; // ---------------------------------------------------------------------------- // MyLog constructor // ---------------------------------------------------------------------------- MyLog::MyLog(string FileName1, wostream *ScrLog1, locale utf8locale1) : // ctors mErrorMsg1("Failed to open file for application logging! []"), mErrorMsg2("Failed to write BOM! []"), mErrorMsg3("Failed to write to file! []"), mErrorMsg4("Failed to close file! []"), FileName(FileName1), ScrLog(ScrLog1), utf8locale(utf8locale1), File(FileName1.c_str()) { // Adjust error strings mErrorMsg1.insert(mErrorMsg1.length()-1,FileName1); mErrorMsg2.insert(mErrorMsg2.length()-1,FileName1); mErrorMsg3.insert(mErrorMsg3.length()-1,FileName1); mErrorMsg4.insert(mErrorMsg4.length()-1,FileName1); // check for file open errors if ( !File ) throw ofstream::failure(mErrorMsg1); // write UTF-8 BOM File << wchar_t(0xEF) << wchar_t(0xBB) << wchar_t(0xBF); // switch locale to UTF-8 File.imbue(utf8locale); // check for write errors if ( File.bad() ) throw ofstream::failure(mErrorMsg2); buf.reset( new DblBuf(File.rdbuf(),ScrLog->rdbuf()) ); Log.reset( new logstream(&*buf) ); } // ---------------------------------------------------------------------------- // MyLog destructor // ---------------------------------------------------------------------------- MyLog::~MyLog() { *Log << TimeStamp1 << "Log finished." << endl; // clean up objects Log.reset(); buf.reset(); File.close(); // check for file close errors if ( File.bad() ) throw ofstream::failure(mErrorMsg4); } //--------------------------------------------------------------------------- #endif // INCLUDED_MYLOG_H Tested on MSVC 2008, boost 1.42. I do not know if this is the right place to share it. Hope it helps anybody. Feel free to make it better.

    Read the article

  • Windows Mobile 6.5 Application Data?

    - by Ritu
    Can you tell me where to store application specific data on a Win Mobile phone. Let's say my app is named MyApp and I install it in the program files folder. I have two initial files in My Documents that it uses with no problems. But what is the correct destination on the device? Also, when I do an uninstall, do I leave the modified app data?

    Read the article

  • Does Apple approve a kind of mark-up language for AppStore?

    - by Eonil
    AppStore now rejects applications made with non-Apple like languages. (with modified contract) However, is it allowed using declarative mark-up language formed with XML? (like XHTML, but different schema) The declarative mark-up is a code too, but not a script or logic code. Just a passive, static data, but forms some layout and part of an application logic.

    Read the article

  • How to Load Data from Text File in MySQL?

    - by Taz
    I have this file availableHere Fields are separated by space and newline starts at new line. I am using this command to load data mysql> LOAD DATA LOCAL INFILE 'C:\\Documents and Settings\\Scan\\My Documents\\Downloads\\images_en.nt\\Sample4.txt' INTO TABLE NER.Images FIELDS TERMINATED BY' ' LINES TERMINATED BY '\n';' Only one row is loaded and if I execute again No row is loaded. Where is the problem? Data can be modified to reformat if required.

    Read the article

  • Using arrays with other arrays in Python.

    - by Scott
    Trying to find an efficient way to extract all instances of items in an array out of another. For example array1 = ["abc", "def", "ghi", "jkl"] array2 = ["abc", "ghi", "456", "789"] Array 1 is an array of items that need to be extracted out of array 2. Thus, array 2 should be modified to ["456", "789"] I know how to do this, but no in an efficient manner.

    Read the article

  • PowerShell locking File....

    - by Ben
    I am trying to do something very simple in powershell Reading the contents of a file Manipulation some string Saving the modified test back to the file function Replace { $file = Get-Content C:\Path\File.cs $file | foreach {$_ -replace "document.getElementById", "$"} |out-file -filepath C:\Path\File.cs } I have tried Set-Content as well. I always get unautorized exception. I can see the $file has the file content, error is coming while writing the file. Any help is appreciated. Ben

    Read the article

  • Iterating Collection In Two Threads

    - by ChloeRadshaw
    This question relates both to C# and Java If you have a collection which is not modified and that collection reference is shared between two threads what happens when you iterate on each thread?? ThreadA: Collection.iterator ThreadA: Collection.moveNext ThreadB: Collection.iterator ThreadB: Collection.moveNext Will threadB see the first element? Is the iterator always reset when it is requested? What happens if this is interleaved so movenext and item is interleaved? Is there a danger that you dont process all elements??

    Read the article

  • Why is this OpenGL ES code slow on iPhone?

    - by f3r3nc
    I've slightly modified the iPhone SDK's GLSprite example while learning OpenGL ES and it turns out to be quite slow. Even in the simulator (on the hw worst) so I must be doing something wrong since it's only 400 textured triangles. const GLfloat spriteVertices[] = { 0.0f, 0.0f, 100.0f, 0.0f, 0.0f, 100.0f, 100.0f, 100.0f }; const GLshort spriteTexcoords[] = { 0,0, 1,0, 0,1, 1,1 }; - (void)setupView { glViewport(0, 0, backingWidth, backingHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0.0f, backingWidth, backingHeight,0.0f, -10.0f, 10.0f); glMatrixMode(GL_MODELVIEW); glClearColor(0.3f, 0.0f, 0.0f, 1.0f); glVertexPointer(2, GL_FLOAT, 0, spriteVertices); glEnableClientState(GL_VERTEX_ARRAY); glTexCoordPointer(2, GL_SHORT, 0, spriteTexcoords); glEnableClientState(GL_TEXTURE_COORD_ARRAY); // sprite data is preloaded. 512x512 rgba8888 glGenTextures(1, &spriteTexture); glBindTexture(GL_TEXTURE_2D, spriteTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, spriteData); free(spriteData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); } - (void)drawView { .. glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); glTranslatef(tx-100, ty-100,10); for (int i=0; i<200; i++) { glTranslatef(1, 1, 0); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } .. } drawView is called every time the screen is touched or the finger on the screen is moved and tx,ty are set to the x,y coordinates where that touch happened. I've also tried using GLBuffer, when translation was pre-generated and there was only one DrawArray but gave the same performance (~4 FPS). ===EDIT=== Meanwhile I've modified this so that much smaller quads are used (sized: 34x20) and much less overlapping is done. There are ~400 quads-800 triangles spread on the whole screen. Texture size is 512x512 atlas and RGBA_8888 while the texture coordinates are in float. The code is very ugly in terms of API efficiency: there are two MatrixMode change along with two loads and two translation then a drawarrays for a triangle strip (quad). Now this produces ~45 FPS.

    Read the article

  • NSMutableArray & Multiple Views

    - by Antonio
    I am trying to write an application that has a NSMutableArray that needs to be accessed and modified in a different View. The MainViewController displays a table that gets the information from an NSMutableArray. The SecondaryViewController is used to addObjects into the array. How do I go about this without declaring it as a global variable?

    Read the article

  • JanRain OpenID in PHP SREG?

    - by AFK
    I setup the demo with a modified login I found called open-id selector. the login works fine and the identity url comes back, but the SREG data I ask for is never populated, required or optional. I am logging into my page with a gmail account. Here is the code from my try_auth.php that I edited $sreg_request = Auth_OpenID_SRegRequest::build( // Required array('email'), // Optional array('fullname', 'gender', 'timezone', 'dob', 'country')); what gives?

    Read the article

  • ubuntu gnome short cut keys

    - by benjipete
    Hi, I have done something quite silly and not sure how to fix it. I modified some of the gnome keyboard short cuts and was trying to disable the "Run Application" command. In the process I assigned it to the delete key and every time I hit delete the "Run Application" window comes up. It would not normally be a problem but the "Keyboard Shortcuts" no long has the short cut in the window so I can't disable it. Any help advice would be appreciated. Cheers Ben

    Read the article

  • Overloading framework methods in objective-c, or retaining local changes with framework updates.

    - by Jeff B
    I am using cocos2d to build an iPhone game. It's mostly done, but along the way I came across some things that I would like to handle better. I am fairly new to Objective C, and honestly I do more Perl scripting in my day-to-day job than anything, so my C skills are a little rusty. One of them is the fact that I have modified cocos2d files for some specific cases in my game. However, when I update to a new version, I have to manually pull my changes forward. So, the question is, what is the best way to deal with this? Some options I have thought of: Overload/redefine the cocos2d classes. I was under the impression that I cannot overload existing class functions, so I don't think this will work. Create patches that I re-apply after library updates. I don't think this will work as the new files won't necessarily be the same as the old ones, and if they were, I could just copy the whole file forward. Turn in my changes to Cocos2d. Not an option as my changes are very specific to my application. Am I missing something obvious? UPDATE: I will explain what I am doing to be more clear. Cocos2d has a CCNode object, which can contain children, etc. I added a shadow, which is very similar to a child, but handled a little differently. The shadow has an offset from the parent, and translates with it's parent, rotates around it's own center when the parent rotates, etc. The shadow is not included as a true child, however, so given the correct z-index, the shadows can render under ALL other objects, but still move with the parent. To do this I added addShadow functions to CCNode, and modified the setPosition and setRotate functions to move the shadowSprite: CCNode.m: -(id) init { if ((self=[super init]) ) { ... shadowSprite_ = nil; ... } } ... -(BOOL) addShadow: (CCNode*) child offset: (CGPoint) offset { shadowSprite_ = child; shadowSprite_.position = CGPointMake(position_.x+offset.x, position_.y+offset.y); return YES; } ... -(void) setRotation: (float)newRotation { rotation_ = newRotation; isTransformDirty_ = isInverseDirty_ = YES; if(shadowSprite_) { [shadowSprite_ setRotation: newRotation]; } } There is more, of course, including the prototypes in the .h file, but that is the basics. I don't think I need shadowSprite to be a property, because I don't need to access it after it has been added.

    Read the article

  • Conditional action based on whether any file in a directory has a ctime newer than X

    - by jberryman
    I would like to run a backup job on a directory tree from a bash script if any of the files have been modified in the last 30 minutes. I think I can hack together something using find with the -ctime flag, but I'm sure there is a standard way to examine a directory for changes. I know that I can inspect the ctime of the top level directory to see if files were added, but I need to be able to see changes also. FWIW, I am using duplicity to backup directories to S3.

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >