Daily Archives

Articles indexed Monday March 29 2010

Page 10/123 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • What would be the time complexity of counting the number of all structurally different binary trees?

    - by ktslwy
    Using the method presented here: http://cslibrary.stanford.edu/110/BinaryTrees.html#java 12. countTrees() Solution (Java) /** For the key values 1...numKeys, how many structurally unique binary search trees are possible that store those keys? Strategy: consider that each value could be the root. Recursively find the size of the left and right subtrees. */ public static int countTrees(int numKeys) { if (numKeys <=1) { return(1); } else { // there will be one value at the root, with whatever remains // on the left and right each forming their own subtrees. // Iterate through all the values that could be the root... int sum = 0; int left, right, root; for (root=1; root<=numKeys; root++) { left = countTrees(root-1); right = countTrees(numKeys - root); // number of possible trees with this root == left*right sum += left*right; } return(sum); } } I have a sense that it might be n(n-1)(n-2)...1, i.e. n!

    Read the article

  • Configuring SMB shares in OS X

    - by Craig Walker
    I'm at my wit's end trying to control SMB file sharing on my Mac. (OS X 10.5 Leopard). I want to do something fairly simple: share a particular (non-home, non-Public) folder over my my SMB/Windows network with two users (accounts are local to my Mac), and share no other folders with anyone. The instructions on the internet are fairly straightforward: add the folders to be shared to the File Sharing panel of the Sharing System Preferences pane: ..and ensure that I'm sharing through SMB: However, when I actually try to connect via a SMB client (Windows XP in this case), the share does not appear. I see my home directory, "Macintosh HD", and my printers, but not the folder I just shared. I ensured that the underlying directory had the proper permissions (since this seems to affect share visibility) and that the "Shared Folder" checkbox was checked: ...but this didn't have any effect. I checked /etc/smb.conf but there was nothing obviously out of place there. I've also restarted smbd and rebooted. What else should I be looking for?

    Read the article

  • does the condition after && always get evaluated

    - by brett
    I have this if statement that tests for the 2 conditions below. The second one is a function `goodToGo() so I want to call it unless the first condition is already true $value = 2239; if ($value < 2000 && goodToGo($value)){ //do stuff } function goodToGo($value){ $ret = //some processing of the value return $ret; } My question is about the 2 if conditions $value < 2000 && goodToGo($value). Do they both get evaluated or does the second one only get evaluated when the first one is true? In other words, are the following 2 blocks the same? if($value < 2000 && goodToGo($value)) { //stuff to do } if($value < 2000) { if (goodToGo($value)){ //stuff to do } }

    Read the article

  • Sending the contents of a file to a client

    - by Zerobu
    Hello, I am writing a C++ server side application called quote of the day. I am using the winsock2 library. I want to send the contents of a file back to the client, including newlines by using the send function. The way i tried it doesn't work. How would i go about doing this?

    Read the article

  • Can I add extra Parameters to AccessTokenEndpoint

    - by Tobi
    I'm trying to add the Hyves API with DotNetOpenAuth. It requires me to add a method name and some other stuff when accessing RequestTokenEndpoint and AccessTokenEndpoint. (http://trac.hyves-api.nl/wiki/APIUserAuthorization) RequestTokenEndpoint is no problem with "PrepareRequestUserAuthorization(Uri, requestParameters, null)" However I can't find a way to do this with AccessTokenEndpoint. Is there an easy way or can I intercept "ProcessUserAuthorization()" in a way? I tried to manual build a request but no luck yet.

    Read the article

  • Activity in Android

    - by leduchuy89vn
    Normally, a Java p'rogram starts from an object, then that object will create some GUI objects (window) and call the "Show" method So, is there any way to do the same thing in Android, since, by default in Android, a program runs from an object created by a class which extended from Activity class?

    Read the article

  • Grid View as demoed in iPad

    - by Sean Clark Hess
    I'm trying to develop a grid-like application for the iPad. Has anyone seen a control that displays info in a grid? In the demos they use a grid-like layout in both the iBooks store and the pictures application. Specifically in pictures, they are displaying a dynamic list of data in a grid. I can work around it, of course, but I'd rather use a control if one exists. Thanks!

    Read the article

  • How do I minimize the number of changes between revisions with new doxygen output?

    - by Dirk Eddelbuettel
    A subversion repository contains the html, latex and man directories that doxygen generates from the source code. Even for small source code changes, new files are being generated with random names which makes for large changes in the version control system. Is there are way around this? How can I minimize the changesets between revisions while still including doxygen-generated documentation? Alternatively, how could I find which of the doxygen-genrated files are no longer being used and should be removed?

    Read the article

  • php warning mysql_fetch_assoc

    - by death the kid
    I am trying to access some information from mysql, but am getting the warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource for the second line of code below, any help would be much appreciated. $musicfiles=getmusicfiles($records['m_id']); $mus=mysql_fetch_assoc($musicfiles); for($j=0;$j<2;$j++) { if(file_exists($mus['musicpath'])) { echo '<a href="'.$mus['musicpath'].'">'.$mus['musicname'].'</a>'; } else { echo 'Hello world'; } } function getmusicfiles($m_id) { $music="select * from music WHERE itemid=".$s_id; $result=getQuery($music,$l); return $result; }

    Read the article

  • Need an encrypted online source code backup service.

    - by camelCase
    Please note this is not a question about online/hosted SVN services. I am working on a home based, solo developer, project that now has commercial significance and it is time to think about remote source code backup. There is no need for file level check in/out, all I need is once a day or once a week directory level snapshot to remote storage. Automatic encryption would be a bonus to protect my IP. What I have in mind is some sort of GUI interface app that will squirt a source code snapshot off to an Amazon S3 bucket on an automatic schedule. (My development PC runs on MS Windows.)

    Read the article

  • Office 2007 and Office 2010 installed side by side

    - by BlueDevil
    I have Office 2007 and Office 2010 installed side-by-side. How do I stop the setup / configuration window from appearing each time I open a different version? If I open 2007, it will go through the configuration process, then I can use 2007 without issue until I open a 2010 application. Then, when I open any 2010 Office application it will go through the configuration process.

    Read the article

  • Which SCM/VCS cope well with moving text between files?

    - by pfctdayelise
    We are having havoc with our project at work, because our VCS is doing some awful merging when we move information across files. The scenario is thus: You have lots of files that, say, contain information about terms from a dictionary, so you have a file for each letter of the alphabet. Users entering terms blindly follow the dictionary order, so they will put an entry like "kick the bucket" under B if that is where the dictionary happened to list it (or it might have been listed under both B, bucket and K, kick). Later, other users move the terms to their correct files. Lots of work is being done on the dictionary terms all the time. e.g. User A may have taken the B file and elaborated on the "kick the bucket" entry. User B took the B and K files, and moved the "kick the bucket" entry to the K file. Whichever order they end up getting committed in, the VCS will probably lose entries and not "figure out" that an entry has been moved. (These entries are later automatically converted to an SQL database. But they are kept in a "human friendly" form for working on them, with lots of comments, examples etc. So it is not acceptable to say "make your users enter SQL directly".) It is so bad that we have taken to almost manually merging these kinds of files now, because we can't trust our VCS. :( So what is the solution? I would love to hear that there is a VCS that could cope with this. Or a better merge algorithm? Or otherwise, maybe someone can suggest a better workflow or file arrangement to try and avoid this problem?

    Read the article

  • Grid view in iPhone SDK

    - by Jack
    Hi, I would like to create a grid view in my iPhone app similar to that shown in the iPad photos app. I know that the iPhone 3.2 SDK is under NDA, but is there a library or framework available for adding this kind of functionality (non-SDK). Ideally I would like to eventually develop an iPad version of the app, where the grid would be 3 items wide in portrait and 4 in landscape, however for the time being I would like 2 items wide in portrait and 3 wide in landscape. The only way I can think of doing this is by subclassing UITableView and having a custom cell that creates the 2 or 3 items. This however seems messy and I am sure that there is a better way. A typical item will have a picture, label and button - nothing too complicated. Thanks

    Read the article

  • SQL SERVER Introduction to Extended Events Finding Long Running Queries

    The job of an SQL Consultant is very interesting as always. The month before, I was busy doing query optimization and performance tuning projects for our clients, and this month, I am busy delivering my performance in Microsoft SQL Server 2005/2008 Query Optimization and & Performance Tuning Course. I recently read white paper about Extended [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Jquery - putting variables in :contains()

    - by Pete B
    I am trying to write a simple piece of Jquery in which the script will check whether a table cell contains a range of numbers. I'm unsure how to do this, because if you were to do something like this: var num_range = ">1"; $("td:contains(" + num_range + ")").css('background-color', '#000'); ...the script only detects if the td contains the exact text "1", rather than what I'm after, it detecting whether any tds contain any numbers greater than 1. (Any then styling the background) Thanks for any help, I'm a Javascript/Jquery novice!

    Read the article

  • Nhibernate: Don't fetch when accessing a child objects primary key

    - by thermal7
    Hi, Is there a way in NHibernate to get the foreign key of a child object, without fetching the child object? EG. I have User and UserRole. Can I access User.UserRole.UserRoleId without causing another hit on the database to retrieve UserRole? I realize I can set fetch mode to eager and this will stop it from hitting the database again, but theoretically this shouldn't be needed, as the User table has UserRoldId in it. Thanks in advance.

    Read the article

  • JAXB Customizations and List<Object>

    - by DaUltimateTrooper
    Hi everybody. I used JAXB to create some classes from an XSD. The result was not quite what I expected and most probably it can be customized. It created a generic list instead of 3 different lists. Can this be corrected somehow? @XmlElements({ @XmlElement(name = "M1", type = M1_Type.class), @XmlElement(name = "M2", type = M2_Type.class), @XmlElement(name = "M3", type = M3_Type.class) }) protected List<Object> m1Orm2OrM3; Is there a customization to fix this?

    Read the article

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