Daily Archives

Articles indexed Sunday April 25 2010

Page 8/72 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Read DataTable by RowState

    - by RBrattas
    I am reading my DataTable as follow: foreach ( DataRow o_DataRow in vco_DataTable.Rows ) { //Insert More Here } It crash; because I insert more records. How can I read my DataTable without reading the new records? Can I read by RowState? Thanks

    Read the article

  • How to set default permissions for automounted FAT drives in Ubuntu

    - by piman
    I've got many FAT32 drives that I'd like to mount in Ubuntu such that they have permission mode 700 for directories and 600 for all other files. By default, they have 755 for all files, which is not particularly useful since almost no non-directories should be executable, and it screws up version control repos hosted on the drives. "Back in the day" I would have had the drives listed in /etc/fstab with the umask/dmask I want and there was no such thing as a default. These days, drives automount under their volume names. Which is great, except now I have no idea how to set the default. I have tried changing the /system/storage/default_options/vfat/mount_options gconf key with no apparently effect. It was 077 initially but the mounted drive reflected a default of 022; changing it and re-inserting the drives resulted in the files still having permission bits of 755.

    Read the article

  • How to create an array of buttons in C++

    - by mangoman13
    Hi, I'm using C++ in VS2005 and have an 8x8 grid of buttons on a form. I want to have these buttons in an array, so when I click on any of them it will open the same event handler (I think that is what they are called), but I will know the index of which one was clicked on. I know how to do this in VB and C#, but I can't seem to figure it out with C++ Right now I have all my buttons labelled by their location, i.e. b00, b10, b21, etc. So I think what I am looking for is a way to do something like this: Button b[8][8]; //this causes me errors (error C2728: 'System::Windows::Forms::Button' : a native array cannot contain this managed type) and (error C2227: left of '->{ctor}' must point to class/struct/union/generic type) void Assignment(){ b[0][0] = b00; b[1][0] = b10; ... } and then in form1.h: private: System::Void b_Click(System::Object^ sender, System::EventArgs^ e) { //somehow read the coordinates into variables x and y //do something based on these values } Any help would be appreciated. Also let me know if I am going in the complete wrong direction with this. Thanks!

    Read the article

  • Using kEAGLRenderingAPIOpenGLES2 causes bad access in glMatrixMode

    - by hyn
    I am trying to use the ES 2 API in my app but using kEAGLRenderingAPIOpenGLES2 causes bad access at glMatrixMode(). There is a similar question here but doesn't answer my question. If I use kEAGLRenderingAPIOpenGLES1 then everything is fine. I could reproduce the same problem with Apple's sample code. What can I do to make glMatrixMode() work in ES 2?

    Read the article

  • Check my anagram code from a job interview in the past.

    - by Michael Dorgan
    Had the following as an interview question a while ago and choked so bad on basic syntax that I failed to advance (once the adrenalin kicks in, coding goes out the window.) Given a list of string, return a list of sets of strings that are anagrams of the input set. i.e. "dog","god", "foo" should return {"dog","god"}. Afterward, I created the code on my own as a sanity check and it's been around now for a bit. I'd welcome input on it to see if I missed anything or if I could have done it much more efficiently. Take it as a chance to improve myself and learn other techniques: void Anagram::doWork(list input, list &output) { typedef list SortType; SortType sortedInput; // sort each string and pair it with the original for(list<string>::iterator i = input.begin(); i != input.end(); ++i) { string tempString(*i); std::sort(tempString.begin(), tempString.end()); sortedInput.push_back(make_pair(*i, tempString)); } // Now step through the new sorted list for(SortType::iterator i = sortedInput.begin(); i != sortedInput.end();) { set<string> newSet; // Assume (hope) we have a match and pre-add the first. newSet.insert(i->first); // Set the secondary iterator one past the outside to prevent // matching the original SortType::iterator j = i; ++j; while(j != sortedInput.end()) { if(i->second == j->second) { // If the string matches, add it to the set and remove it // so that future searches need not worry about it newSet.insert(j->first); j = sortedInput.erase(j); } else { // else, next element ++j; } } // If size is bigger than our original push, we have a match - save it to the output if(newSet.size() > 1) { output.push_back(newSet); } // erase this element and update the iterator i = sortedInput.erase(i); } }

    Read the article

  • How to name uploaded files in php to prevent them from being overwritten?

    - by user156814
    I'm trying to add user submitted articles to my website, (only for admins). With each article comes an option to upload up to 3 images. My database is set up like this Articles id user_id title body date_added last_edited Photos id (auto_increment) article_id First I save the article in the database, then I upload the photo (temporarily) then I create a new photo record in the database saving the article_id. Then I rename the uploaded photo to be the same as the primary key of the photo record, and to be a png. $filename = $photo->id . '.png'; I figured this would be a good way to prevent files form being overwritten. This seems flawed to me. Any suggestions on how I should save my records and photos? Thanks

    Read the article

  • Why are monitors so poor?

    - by ULTRA_POROV
    72 ppi is nothing. And we have been stuck with this for 20 years. Why do we need to resort to stupid tech like anti-aliasing instead of resolving the core of the issue, more pixels per inch!!! It is really surprising considering all the progress cpu's, video cards, etc. have made.

    Read the article

  • Singular method name for single object argument, plural for a list?

    - by nasufara
    I'm having a problem with naming a method for a database application. In my Database instance, I have a method that can remove an Agreement object from the database. However, I want to be able to remove multiple Agreements at once, to be able to use transactions. The problem is that I also have an overload to remove a single Agreement object. Essentially, my structure is like this: public class Database { // ... public void RemoveAgreement(Agreement a) { // ... } public void RemoveAgreement(IEnumerable<Agreement> agreements) { // ... } } But this can be confusing, as the overload with the list of Agreements has a singular name, despite being inherently plural. My question is, how should I structure this? Should I have two overloads with the name RemoveAgreement(), or RemoveAgreements()? Or should I use two separate methods, instead of overloads? Thanks.

    Read the article

  • 2D Gaming - How to reflect a ball off the bat?

    - by sid
    Hi there I am pretty new to XNA & game dev and am stuck at ball reflection. My ball is reflecting once it hits the bat, but only in one angle, no matter which angle the bat is at. Here's the code: if (BallRect.Intersects(BatRect)) { Vector2 NormBallVelocity = Ball.velocity; NormBallVelocity.Normalize(); NormBallVelocity = Vector2.Reflect(Ball.velocity, NormBallVelocity); Ball.velocity = NormBallVelocity; } The ball is retracting its way back. How do I make it look like the ball is reflecting off the bat? I have seen other posts but they are on 3D front I am too new to translate it to 2D terms... Thanks Sid

    Read the article

  • Problems inserting file data into sqlite database using python

    - by tylerc230
    I'm trying to open an image file in python and add that data to an sqlite table. I created the table using: "CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "description" VARCHAR, "image" BLOB );" I am trying to add the image to the db using: imageFile = open(imageName, 'rb') b = sqlite3.Binary(imageFile.read()) targetCursor.execute("INSERT INTO images (image) values(?)", (b,)) targetCursor.execute("SELECT id from images") for id in targetCursor: imageid= id[0] targetCursor.execute("INSERT INTO %s (questionID,imageID) values(?,?)" % table, (questionId, imageid)) When I print the value of 'b' it looks like binary data but when I call: 'select image from images where id = 1' I get '????' printed to the console. Anyone know what I'm doing wrong?

    Read the article

  • Data mining textbook

    - by lmsasu
    If you followed a DM course, which textbook was used? I know about Data Mining: Practical Machine Learning Tools and Techniques (Second Edition) and this poll. What did you effectively use?

    Read the article

  • Removing UITextField from superview does not make it disappear on screen

    - by moshy
    I have the following code // Breakpoint here [label removeFromSuperview]; [label release]; label = nil; stepping through it with the debugger outputs (gdb) po [self subviews] <NSCFArray 0x476af70>( <UIImageView: 0x47581a0; frame = (0 0; 232 81); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b3d0>>, <UILabel: 0x4758870; frame = (15 11; 202 56); text = 'Test'; clipsToBounds = YES; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b590>> ) (gdb) po label <UILabel: 0x4758870; frame = (15 11; 202 56); text = 'Test'; clipsToBounds = YES; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b590>> (gdb) n (gdb) n (gdb) n (gdb) po [self subviews] <NSCFArray 0x478c4e0>( <UIImageView: 0x47581a0; frame = (0 0; 232 81); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x476b3d0>> ) Yet it is still visible, it does not disappear. Not even if I do [self setNeedsDisplay] immediately after. Has anyone else come across this? Is it a bug in the SDK or am I missing something?

    Read the article

  • Why is my PHP string being converted to 1?

    - by animuson
    Ok, so here's the quick rundown. I have a function to generate the page numbers. This: <?php die($ani->e->tmpl->pages("/archive", 1, 15, 1, true)); ?> will output Single Page like expected. But this: <?php $page_numbers = $ani->e->tmpl->pages("/archive", 1, 15, 1, true); ?> <?= $page_numbers ?> will output a simple 1 to the page. Why is it getting converted to a 1? I would expect it to store the 'Single Page' string to the page_numbers variable and then output it (like an echo) exactly the same. EDIT: Running a var_dump($page_numbers) returns int(1)... Here is the entire function in context: <?php // other functions... function show_list() { global $ani; $page_numbers = $ani->e->tmpl->pages("/archive", 1, 15, 1, true); ob_start(); ?> <!-- content:start --> <?php $archive_result = $ani->e->db->build(array("select" => "*", "from" => "animuson_archive", "orderby" => "0-time", "limit" => 15)); while ($archive = $ani->e->db->fetch($archive_result)) { ?> <h2><a href="/archive/article/<?= $archive['aid'] ?>/<?= $archive['title_nice'] ?>"><?= $archive['title'] ?></a></h2> <!-- breaker --> <?php } ?> <?= var_dump($page_numbers) ?> <!-- content:stop --> <?php $ani->e->tmpl->process("box", ob_get_clean()); } // other functions... ?>

    Read the article

  • How to setup Lucene search for a B2B web app?

    - by Bill Paetzke
    Given: 5000 databases (spread out over 5 servers) 1 database per client (so you can infer there are 1000 clients) 2 to 2000 users per client (let's say avg is 100 users per client) Clients (databases) come and go every day (let's assume most remain for at least one year) Let's stay agnostic of language or sql brand, since Lucene (and Solr) have a breadth of support The Question: How would you setup Lucene search so that each client can only search within its database? How would you setup the index(es)? Would you need to add a filter to all search queries? If a client cancelled, how would you delete their (part of the) index? (this may be trivial--not sure yet) Possible Solutions: Make an index for each client (database) Pro: Search is faster (than one-index-for-all method). Indices are relative to the size of the client's data. Con: I'm not sure what this entails, nor do I know if this is beyond Lucene's scope. Have a single, gigantic index with a database_name field. Always include database_name as a filter. Pro: Not sure. Maybe good for tech support or billing dept to search all databases for info. Con: Search is slower (than index-per-client method). Flawed security if query filter removed. For Example: Joel Spolsky said in Podcast #11 that his hosted web app product, FogBugz On-Demand, uses Lucene. He has thousands of on-demand clients. And each client gets their own database. His situation is quite similar to mine. Although, he didn't elaborate on the setup (particularly indices); hence, the need for this question. One last thing: I would also accept an answer that uses Solr (the extension of Lucene). Perhaps it's better suited for this problem. Not sure.

    Read the article

  • Oracle account locked

    - by Priya
    Hi All, I had a user in my oracle DB with some 'x' password for sometime. Without notifying my team I changed the password to 'y'. But my team members tried to connect to the machine with the old passowrd 'x' and as the limit was set, the user account got locked. I know how to set the resource limit for the login. It would be helpful if anyone can help in finding who and all has tried to connect to the DB. As a administrator I would like to view from where the connection was from. Thanks in advance. Priya.R

    Read the article

  • VB.NET Syntax Coding

    - by Yiu Korochko
    I know many people ask how some of these are done, but I do not understand the context in which to use the answers, so... I'm building a code editor for a subversion of Python language, and I found a very decent way of highlighting keywords in the RichTextBox through this: bluwords.Add(KEYWORDS GO HERE) If scriptt.Text.Length > 0 Then Dim selectStart2 As Integer = scriptt.SelectionStart scriptt.Select(0, scriptt.Text.Length) scriptt.SelectionColor = Color.Black scriptt.DeselectAll() For Each oneWord As String In bluwords Dim pos As Integer = 0 Do While scriptt.Text.ToUpper.IndexOf(oneWord.ToUpper, pos) >= 0 pos = scriptt.Text.ToUpper.IndexOf(oneWord.ToUpper, pos) scriptt.Select(pos, oneWord.Length) scriptt.SelectionColor = Color.Blue pos += 1 Loop Next scriptt.SelectionStart = selectStart2 End If (scriptt is the richtextbox) But when any decent amount of code is typed (or loaded via OpenFileDialog) chunks of the code go missing, the syntax selection falls apart, and it just plain ruins it. I'm looking for a more efficient way of doing this, maybe something more like visual studio itself...because there is NO NEED to highlight all text, set it black, then redo all of the syntaxing, and the text begins to over-right if you go back to insert characters between text. Also, in this version of Python, hash (#) is used for comments on comment only lines and double hash (##) is used for comments on the same line. Now I saw that someone had asked about this exact thing, and the working answer to select to the end of the line was something like: ^\'[^\r\n]+$|''[^\r\n]+$ which I cannot seem to get into practice. I also wanted to select text between quotes and turn it turquoise, such as between the first quotation mark and the second, the text is turquoise, and the same between the 3rd and 4th etcetera... Any help is appreciated!

    Read the article

  • Connection error with heroku db:push with postgresql

    - by Toby Hede
    I have suddenly started seeing this strange error when trying to push my database to heroku. > heroku db:push Auto-detected local database: postgres://infinity:infinity@localhost/infinity_development?encoding=utf8 Failed to connect to database: Sequel::DatabaseConnectionError -> TypeError wrong argument type String (expected Array) My app works fine - the credentials are all set locally.

    Read the article

  • Verilog errors during synthesis

    - by chester.boo
    Here is the code in question: http://pastebin.com/smqUNpdt When I do a syntax check, everything is okay. But when I try to synthesize with XST I get the following errors: ERROR:Xst:870 - "fibonacci.v" line 42: Can not simplify operator DIV. ERROR:Xst:899 - "fibonacci.v" line 29: The logic for <out> does not match a known FF or Latch template. ERROR:Xst:899 - "fibonacci.v" line 30: The logic for <ratio> does not match a known FF or Latch template. ERROR:Xst:899 - "fibonacci.v" line 36: The logic for <nextstate> does not match a known FF or Latch template. ERROR:Xst:899 - "fibonacci.v" line 37: The logic for <previousstate> does not match a known FF or Latch template. ERROR:Xst:899 - "fibonacci.v" line 38: The logic for <presentstate> does not match a known FF or Latch template. ERROR:Xst:899 - "fibonacci.v" line 39: The logic for <fib_number_cnt> does not match a known FF or Latch template.

    Read the article

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