Search Results

Search found 467 results on 19 pages for 'brad'.

Page 12/19 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Factorial Algorithms in different languages

    - by Brad Gilbert
    I want to see all the different ways you can come up with, for a factorial subroutine, or program. The hope is that anyone can come here and see if they might want to learn a new language. Ideas: Procedural Functional Object Oriented One liners Obfuscated Oddball Bad Code Polyglot Basically I want to see an example, of different ways of writing an algorithm, and what they would look like in different languages. Please limit it to one example per entry. I will allow you to have more than one example per answer, if you are trying to highlight a specific style, language, or just a well thought out idea that lends itself to being in one post. The only real requirement is it must find the factorial of a given argument, in all languages represented. Be Creative! Recommended Guideline: # Language Name: Optional Style type - Optional bullet points Code Goes Here Other informational text goes here I will ocasionally go along and edit any answer that does not have decent formatting.

    Read the article

  • need to store values from foreach loop into array

    - by Brad
    Need to store values from foreach loop into an array, need help doing that. Code below does not work, only stores the last value, tried $items .= ..., but that is not doing the trick either, any help will be appreciated. <?php foreach($group_membership as $i => $username) { $items = array($username); } print_r($items); ?>

    Read the article

  • Unit Testing a rails 2.3.5 plugin

    - by brad
    I'm writing a new plugin for a rails 2.3.5 app. I've included an app directory (which makes it an engine) so i can easily load some extra routes. Not sure if that affects anything. Anyway, in the test directory i have two files: test_helper.rb and my_plugin_test.rb These files were generated automatically using script/generate plugin my_plugin When I go to vendor/plugins/my_plugin directory and run rake test they don't seem to run. I get the following console output: (in /Users/me/Repos/my_app/source/trunk/vendor/plugins/my_plugin) /Users/me/.rvm/rubies/jruby-1.4.0/bin/jruby -I"lib:lib:test" "/Users/me/.rvm/gems/jruby-1.4.0/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/my_plugin_test.rb" So it obviously sees my test file, but none of the tests inside get run, I just get back to my console prompt. What am I missing here? I figured the generated code would work out of the box Here are the two files test_helper.rb require 'rubygems' require 'active_support' require 'active_support/test_case' my_plugin_test.rb require 'test_helper' class MyPluginTest < ActiveSupport::TestCase # Replace this with your real tests. test "the truth" do assert true end test "Factories are supported" do assert_not_nil Factory end end File structure vendor - plugins - my_plugin - app - config - routes.rb - generators - my_plugin - some generator files.rb - lib - my_plugin.rb - my_plugin - my_plugin_lib_file.rb - rails - init.rb - Rakefile - tasks - my_plugin_tasks.rake - test - test_helper.rb - my_plugin_test.rb

    Read the article

  • Repeat String - Javascript

    - by brad
    What is the best or most concise method for returning a string repeated an arbitrary amount of times? The following is my best shot so far: function repeat(s, n){ var a = []; while(a.length < n){ a.push(s); } return a.join(''); }

    Read the article

  • What is the best way to convince management that virtualization isn't always appropriate in producti

    - by uncle brad
    I work for a small company with a .NET product that was acquired by a medium sized company with "big iron" products. Recently, the medium-sized part of the company acquired another small company with a similar .NET product and management went to have a look at their technology. They make heavy use of virtualization in their production environment and it's been decided that we will too. Our product was not designed to be run in a virtual environment, but some accommodations can be made. For instance; there are times when we're resource bound due to customer initiated processes. This initiation is "bursty" by nature, but the processing can be made asynchronous and throttled. This is something that would need to be done for scalability anyway. But there is other processing that we do that isn't so easily modified because we're resource bound for extended periods of time. How do I convince management that heavy use of virtualization is probably not appropriate for us?

    Read the article

  • activemodel for rails < 3

    - by brad
    Does anyone know if activemodel works with 2.3.5? I'm looking for this exact functionality (namely, validations for non-AR objects) and I'm trying to find a clean solution for a Rails 2.3.5 app. Or if anyone knows of a good gem/plugin to use that can mimic activerecord like validations for non AR objects, I'm all ears

    Read the article

  • How do I implement graphs and graph algorithms in a functional programming language?

    - by brad
    Basically, I know how to create graph data structures and use Dijkstra's algorithm in programming languages where side effects are allowed. Typically, graph algorithms use a structure to mark certain nodes as 'visited', but this has side effects, which I'm trying to avoid. I can think of one way to implement this in a functional language, but it basically requires passing around large amounts of state to different functions, and I'm wondering if there is a more space-efficient solution.

    Read the article

  • XmlDocument.WriteTo truncates resultant file

    - by Brad Heller
    Trying to serialize an XmlDocument to file. The XmlDocument is rather large; however, in the debugger I can see that the InnerXml property has all of the XML blob in it -- it's not truncated there. Here's the code that writes my XmlDocument object to file: // Write that string to a file. var fileStream = new FileStream("AdditionalData.xml", FileMode.OpenOrCreate, FileAccess.Write); xmlDocument.WriteTo(new XmlTextWriter(fileStream, Encoding.UTF8) {Formatting = Formatting.Indented}); fileStream.Close(); The file that's produced here only writes out to line like 5,760 -- it's actually truncated in the middle of a tag! Anyone have any ideas why this would truncate here?

    Read the article

  • ldap login form works, but need to add active-directory group access

    - by Brad
    I created a form that asks you to log in, then verifies the user/pass against the ldap server/active-directory, if successful, it creates a session, which will be checked on every page. Now I want to check the session, which is the username of the person who is logged in, and do a search for them using ldap_search, so I can check what group they belong to and pass that group thru a function to verify that they can view that page. Each page will accessible to a certain group or groups of users, which those groups are defined within Active Directory. I am unsure on how I can do that using ldap_search, or maybe that is just one piece of the puzzle I am trying to solve. Any help is appreciated - thank you! In the example code below, it is seeing if the user belongs to the student active-directory group (I do not know if this code works, but it should give you an idea of what I want to accomplish). $filter = "CN=StudentCN=Users,dc=domain,dc=control"; $result = ldap_search($ldapconn,$filter,$valid_session_username); if($result == TRUE) { print $valid_session_username.' does have access to this page'; } else { print $valid_session_username.' does NOT have access to this page'; }

    Read the article

  • MySQL: Is it possible to compute MAX( AVG (field) )?

    - by Brad
    My current query reads: SELECT entry_id, user_id, cat_id, AVG( rating ) as avg_rate FROM entry_rate WHERE 1 GROUP BY entry_id cat_id relates to different categories: 1, 2, 3 or 4 Is there a way I can find the maximum average for each user in each category without setting up an additional table? The return could potentially be 4 maximum avg_rate for each user_id Visit the link below for example: http://lh5.ggpht.com/_rvDQuhTddnc/S8Os_77qR9I/AAAAAAAAA2M/IPmzNeYjfCA/s800/table1.jpg

    Read the article

  • need to display info for user within active-directory

    - by Brad
    The following code will search for the user within the domain controller, but I want to display the info of each thing noted within the justthese variable: "displayname","mail","samaccountname","sn","givenname","department","telephonenumber" $dn = "dc=xxx,dc=xxx"; $justthese = array("displayname","mail","samaccountname","sn","givenname","department","telephonenumber"); $sr=ldap_search($ldapconn, $dn,'SAMAccountName=username', $justthese); $info = ldap_get_entries($ldapconn, $sr); echo "<h3>".$info["count"]." entries returned</h3>"; foreach($justthese as $key=>$value){ print '<p><strong>'.$value.'</strong></p>'; } It displays each item within the $justthese array, I want to display the info for that user for each thing noted in $justthese array. Right now it outputs it like this: displayname mail samaccountname sn givenname department telephonenumber I want it to have the actual data to the right of it, which I know I am doing something wrong with the foreach loop, any help is appreciated. So it'd look like this displayname Chuck mail [email protected] samaccountname chucknorris sn chuckisthebest givenname Chuck Norris department Security telephonenumber 555-555-5555

    Read the article

  • RFCOMM Before Android 2.0?

    - by Brad Hein
    I have several apps which I wrote using the standard SDK. They all connect to RFCOMM devices using bluetooth, so at present, I can only support devices which are 2.0 or newer. What options are available for backporting a bluetooth app to pre-2.0 apps while re-writing as little code as possible? Thank you.

    Read the article

  • How do I test how my client program will react to a web server error?

    - by Brad Bruce
    I have a client program based on LibCurl. I have run into a situation where on some occasions a program on the server runs longer than the configured IIS timeout. IIS then terminates the program and returns a 502 error status to the client. I have added code to the client to capture this issue. Now, I need to find a way to prove that the change will work. I haven't been able to reliably reproduce the issue, so don't have a good test case. Any suggestions?

    Read the article

  • Loading an NSArray on iPhone from a dynamic data base url in PHP or ASP

    - by Brad
    I have a database online that I would like to be able to load into an NSArray in my app. I can use arrayWithContentsOfURL with a static file, but I really need to go to a url that generates a plist file from the database and loading it into the array. I can use ASP or PHP. I tried setting the response type to "text/xml", but that doesn't help. Any thoughts?

    Read the article

  • ASP Function that returns result from stored procedures

    - by Brad
    I am working on a project that requires me to hop into to separate DB's. So I have figured that I need to have multiple functions inside of my VB page. The only problem I am having,is I am not to sure how to get this all accomplished. So far I have figured out the overall structure, just need help implementing that structure. Here is my idea: The main Function would call two other functions. We can Call them Sub Function 1 and Sub Function 2. So, the main Function takes the saved sessions information for the E-mail address and dumps in into Sub Function 1. It needs to open up a new connection to the db/stored procedure and RUN the following procedure and then return the result. Here is the stored procedure and what i think is correct. CREATE PROCEDURE WEB_User ( @EMAIL_ADDRESS varchar(80) = [EMAIL_ADDRESS] ) AS SELECT MEMBER_NUMBER FROM WEB_LOGIN WHERE EMAIL_ADDRESS = @EMAIL_ADDRESS So my question is, what is the function suppose to look like? how do I send the session information to the procedure? and finally, how do I return the stored procedure results and push back into the main function so it can be carried into sub function 2? Thank you in advance for your help... I really appreciate it!

    Read the article

  • Are there any PHP Frameworks (e.g. CodeIgniter) that support database connections on a per user acco

    - by Brad G
    I'm looking into developing a multi-tenant SaaS application, and I found several sites that describe a solid way to separate the data using tenantIDs and updateable views. e.g. This blog post It all hinges on the ability to have your user accounts authenticated from a master users table and then having their respective database connections use those user-specific credentials. This way, the views can pull the userid and map it to the tenantID to display that user's view. However, most PHP frameworks tend to be very static when it comes to database connections (stored in text config files). They appear to be at odds. Does anyone know: a) how to make CodeIgniter handle this gracefully? b) a different PHP framework that might?

    Read the article

  • Java - How to force resize JCheckBox to prevent clicking the empty space ?

    - by Brad
    When i create a JCheckBox in my Swing application i leave some extra space after its label, so if the JCheckBox label is for example 100 pixels width, i make the JCheckBox 120 pixels for safety. The problem as at runtime, it's not nice that a user can click on the empty space after the JCheckBox label and it can be actually clicked, like this : I wonder if there is a way to resize the JCheckBox at runtime to exactly fit the text inside it, depending on the font type/size used ? This seems fancy a bit, but i like to make things look perfect :)

    Read the article

  • Get a font filename based on Font Name and Style (Bold/Italic)

    - by Brad
    This has been driving me crazy all day. I need to get a font filename (eg. Arial.ttf) based off of it's name (Arial in this case). The problem is, I am only supplied with the font name (Arial) and weather it's bold, italic or both. Using those pieces of information, I need to find the font file so I can use it for rendering. Some more examples: Calibri, Bold would resolve to calibrib.ttf Calibri, Italic would resolve to calibrii.ttf Any ideas on how I could achieve this in C++ (Win32)

    Read the article

  • How do I start a service which is defined in a different package?

    - by Brad Hein
    I have two apps, one runs in namespace com.gtosoft.voyager and the other is com.gtosoft.dash. From com.gtosoft.dash I would like to start up the service which is defined in com.gtosoft.voyager... I think I need an intent, but what arg(s) would I pass to the intent before kicking it off with startService()? If they were in the same package I could just use Intent svc=new Intent (SettingsActivity.this,VoyagerService.class); startService(svc); Snippet of Manifest which defines the service <application android:icon="@drawable/voyagercarlogo" android:label="@string/app_name" android:debuggable="false"> <provider android:name="com.gtosoft.voyager.VoyagerCProvider" android:authorities="com.gtosoft.voyager"/> <service android:name=".VoyagerService"/> <activity android:name=".SettingsActivity" android:label="Voyager" android:configChanges="keyboardHidden|orientation"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    Read the article

  • How to tell which thread(s) are producing all the garbage?

    - by Brad Hein
    I have an app with about 15 threads. Most do mundane tasks and sleep most of their lives. Others collect information and cache it in hashmaps. The hashmaps grow to a moderate size and level out. The number of keys and size of value remains constant, but the contents of the values changes (at 33 keys per second average). When I start my app, I notice the garbage collection interval goes from minutes to once per second, and the amount of garbage is 700k+ each time. In fact as I was writing this, it caused my phone to reboot with an error "Referencetable Overflow". Here's my question: Are there any tricks to identifying which threads are producing the garbage, or even finding out more about what garbage they are producing?

    Read the article

  • What are the major differences between Windows CE and Windows Mobile for a programmer?

    - by Brad Bruce
    What are the major differences between Windows CE and Windows Mobile for a programmer? I'd love to find a feature table, but haven't been able to find one on the Microsoft web site. I'm starting to work on a project involving industrial handheld terminals. I'm early into the design phase and need to find a comparison of Windows CE and Windows Mobile. Many of the people I'll be talking to jump on the first option that sounds "good enough". I want my first suggestion to be the best based on their needs. We're talking heavy duty hardware with a heavy duty price. I've got to get the programming questions out of the way early. We're currently a MFC6 and .Net 2.0 shop

    Read the article

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