Search Results

Search found 1804 results on 73 pages for 'koenig lookup'.

Page 33/73 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Which style of return is "better" for a method that might return None?

    - by Daenyth
    I have a method that will either return an object or None if the lookup fails. Which style of the following is better? def get_foo(needle): haystack = object_dict() if needle not in haystack: return None return haystack[needle] or, def get_foo(needle): haystack = object_dict() try: return haystack[needle] except KeyError: # Needle not found return None I'm undecided as to which is more more desirable myself. Another choice would be return haystack[needle] if needle in haystack else None, but I'm not sure that's any better.

    Read the article

  • Redirect Large Number of URLs (HTML Files) to Wordpress

    - by Chetan
    Hi, I have over 2000 HTML files that are now in Wordpress blog. I have the URL Map of Old_file.html and new wordpress URL. I want 301 redirect but don't want to add 2000 lines to htaccess. Can you please suggest how to accomplish this using PHP so that when there is a request for old url, the php script should lookup into the database and redirect(301) to the new URL ? Thanks.

    Read the article

  • Multihomed Windows server and DNS resolution

    - by Mike K.
    I have a Windows 2008 server with two IP addresses assigned to a single NIC. The DNS settings are setup to register the connections's addresses on the DNS server. nslookup shows both IP addresses for the server name. How is name resolution done in this case, i.e. which IP address does the DNS server return for a host lookup? Or does it return both, and the client selects one of the addresses?

    Read the article

  • Django filter by hour

    - by DJPy
    I've found that link: http://code.djangoproject.com/attachment/ticket/8424/time_filters.diff and changed my django 1.2 files by adding taht what you can see there. But now, when I'm trying to write Entry.objects.filter(pub_date__hour = x) - the result is following error: Field has invalid lookup: hour What should I do else, to make it work? (sorry for my english)

    Read the article

  • How to obtain JNDI data source for JPA/JTA DAO integration test?

    - by HDave
    I have a JPA application that has specified JTA transactions in persistence.xml. For whatever reason, I have found that when using JTA, you MUST specify a JNDI data source within persistence.xml as well. This is fine, unless you are trying to go integration testing outside a container and JNDI is not available. My questions are: a) is there anyway to inject a jdbc datasource into my JTA transaction manager? b) if not, how do a handle a JNDI lookup during integration testing?

    Read the article

  • Determine week number based on starting date

    - by kreetiv
    I need help to create a function to determine the week number based on these 2 parameters: Starting date Specified date For example, if I specify April 7, 2010 as the starting date & passed April 20, 2010 as the date to lookup, I would like the function to return WEEK 2. Another example, if I set March 6, 2010 as starting date and looked up April 5, 2010 then it should return WEEK 6. I appreciate your time and help.

    Read the article

  • Android Assets - Unable to access

    - by BahaiResearch.com
    Using this code it should return a list of the assets. But it crashes, with a "Source not found, Edit Source Lookup Path..." message in the debugger when I call the list method: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AssetManager assets = this.getAssets(); try { //error happens on this next line String[] l = assets.list(null); } catch (IOException e) { } }

    Read the article

  • Passing DataSource object from a servlet to a JavaBean

    - by Slavko
    I like the ease of using @Resource annotation to get a DataSource, but as far as I know, it's not possible to use it in a regular JavaBean. Would it be considered a bad practice if I pass the DataSource object from a servlet to a bean along with the other data to avoid having that lookup code in the bean?

    Read the article

  • faster strlen ?

    - by Jack
    Typical strlen() traverse from first character till it finds \0. This requires you to traverse each and every character. In algorithm sense, its O(N). Is there any faster way to do this where input is vaguely defined. Like: length would be less than 50, or length would be around 200 characters. I thought of lookup blocks and all but didn't get any optimization.

    Read the article

  • Jquery Autocomplete after space press

    - by Limpep
    I am having an issue with my auto-complete feature such as when a user presses the space button the auto-complete doesn't show up again. Here is my code script type="text/javascript"> function lookup(inputString) { if(inputString.length == 0) { // Hide the suggestion box. $('#suggestions').hide(); } else { $.post("autocomplete.php", { queryString: ""+inputString+"" }, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } }); } } // lookup function fill(thisValue) { $('#tag').val(thisValue); setTimeout("$('#suggestions').hide();", 200); } here my php code <?php require_once('config.php'); $db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD,DB_DATABASE); if(!$db) { // Show error if we cannot connect. echo 'ERROR: Could not connect to the database.'; } else { // Is there a posted query string? if(isset($_POST['queryString'])) { $queryString = $db->real_escape_string($_POST['queryString']); // Is the string length greater than 0? if(strlen($queryString) >0) { // Run the query: We use LIKE '$queryString%' // The percentage sign is a wild-card, in my example of countries it works like this... // $queryString = 'Uni'; // Returned data = 'United States, United Kindom'; $query = $db->query("SELECT name FROM tag WHERE name LIKE '$queryString%' ORDER BY name LIMIT 10"); if($query) { // While there are results loop through them - fetching an Object (i like PHP5 btw!). while ($result = $query ->fetch_object()) { // Format the results, im using <li> for the list, you can change it. // The onClick function fills the textbox with the result. echo '<li onClick="fill(\''.$result->name.'\');">'.$result->name.'</li>'; } } else { echo 'ERROR: There was a problem with the query.'; } } else { // Dont do anything. } // There is a queryString. } else { echo 'There should be no direct access to this script!'; } } ? Any help would be great, thanks.

    Read the article

  • SharePoint (2010): Field for (multi) currency...?

    - by TomTom
    Hello, old problem now getting new. Anyone has a good idea for storing currency values in a sharepoint list? Problem is - there is a currency field, but it is not multi-currency enabled. I could obviously store the value in two fields (currency lookup from a list, value in second field), but I take it as wondering whether there is a more viable approach that.

    Read the article

  • Jquery multiple events to trigger the same function

    - by dweebsonduty
    Is there a way to have keyup, keypress, blur, and change events call the same function in one line or do I have to do them separately? The problem I have is that I need to validate some data with a db lookup and would like to make sure that there is no way that the validation is missed weather it is typed or pasted into the box.

    Read the article

  • How to parse a date from an SSIS Excel filename

    - by user327045
    I want to use the foreach container to iterate through a folder matching something like: "Filename_MMYYYY.xls". That's easy enough to do; but I can't seem to find a way to parse the MMYYYY from the filename and add it to a variable (or something) that i can use as a lookup field for my DimDate table. It seems possible with a flat file data source, but not an excel connection. I'm using Visual Studio 2005. Please help!

    Read the article

  • C++ include statement required if defining a map in a headerfile.

    - by Justin
    I was doing a project for computer course on programming concepts. This project was to be completed in C++ using Object Oriented designs we learned throughout the course. Anyhow, I have two files symboltable.h and symboltable.cpp. I want to use a map as the data structure so I define it in the private section of the header file. I #include <map> in the cpp file before I #include "symboltable.h". I get several errors from the compiler (MS VS 2008 Pro) when I go to debug/run the program the first of which is: Error 1 error C2146: syntax error : missing ';' before identifier 'table' c:\users\jsmith\documents\visual studio 2008\projects\project2\project2\symboltable.h 22 Project2 To fix this I had to #include <map> in the header file, which to me seems strange. Here are the relevant code files: // symboltable.h #include <map> class SymbolTable { public: SymbolTable() {} void insert(string variable, double value); double lookUp(string variable); void init(); // Added as part of the spec given in the conference area. private: map<string, double> table; // Our container for variables and their values. }; and // symboltable.cpp #include <map> #include <string> #include <iostream> using namespace std; #include "symboltable.h" void SymbolTable::insert(string variable, double value) { table[variable] = value; // Creates a new map entry, if variable name already exist it overwrites last value. } double SymbolTable::lookUp(string variable) { if(table.find(variable) == table.end()) // Search for the variable, find() returns a position, if thats the end then we didnt find it. throw exception("Error: Uninitialized variable"); else return table[variable]; } void SymbolTable::init() { table.clear(); // Clears the map, removes all elements. }

    Read the article

  • Win2k3 password Authentication using LDAP in VC++

    - by user001
    Hi, I need to implement the Win2k3 password validation policy. As my application resides on Win2k3 cane we validate the password directly with windows domain password by using LDAP. This is because application design does not want to store 8/more password entry into DB and validate new password against that. As Windows already does same thing and using LDAP we can lookup into windows server. Can any one please let me know LDAP API to fulfill above requirement in VC++.

    Read the article

  • How to store currently logged on user in DB?

    - by stacker
    Using Seam 2.1.2 and JSF 1.2 I wonder how to store the users login name in the database. In plain JSF I would simply lookup FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();in a backing bean and set the value into a persistent object. How can I achieve that the users name will be stored in the DB?

    Read the article

  • SEO Friendly URLs where the phrase used may change in Rails

    - by Newy
    Say I have http://www.mysite.com/I-Like-Cheeseburgers and I want that to point to Item with id 3. Sometime later, I change the name of the item, and now its http://www.mysite.com/I-Like-Hamburgers (and perhaps many more times). I want all these URLs to remain pointing to Item 3. Is it efficient to simply keep a table of [strings,item_ids] and do a lookup on this? Is there a better way?

    Read the article

  • How do you create domain.com/?stringhere without a .php extension

    - by matt
    I want to create a link like the following: http://www.myurl.com/?IDHERE What i want to be able to do is be able to goto the above link, and then pull whats after the ? (in this case IDHERE) and be able to use that information to perform a MySQL lookup and return a page. Can anyone point me into the right direction? please know this is using PHP not ASP

    Read the article

  • How do you create domain.com/?stringhere without a .php extention

    - by matt
    I want to create a link like the following: http://www.myurl.com/?IDHERE What i want to be able to do is be able to goto the above link, and then pull whats after the ? (in this case IDHERE) and be able to use that information to perform a MySQL lookup and return a page. Can anyone point me into the right direction? please know this is using PHP not ASP

    Read the article

  • SQL Delete Query

    - by jerle78
    I need to write an SQL script that selects one record in table1, then does a lookup in the remaining tables in the database. If it doesn't find the record, I need delete the record from table1. Anyone provide some sample script?

    Read the article

  • Intger encoding and decoding problem

    - by aASDASD
    I have a long list of integers, and i need to reduce this down to a single integer. The integer list can be anywhere from 0 to 300 ints long (about). I need to be able to encode/decode. Is there a better option than a lookup table?

    Read the article

  • Any way to detect SMS to E-Mail Gateways?

    - by Paul
    I want to create a PHP app that can send text messages. There are different gateways for different email carriers. Is there any library I could use that would be able to lookup or detect which gateway to use just by passing the phone number into it? This way I can take whatever email address I get out and use PHP's email functions to send a message. Thanks in advance!

    Read the article

  • C# equivalent of typeof for fields

    - by rwallace
    With reflection, you can look up a class from a string at run time, but you can also say typeof(Foo) and get compile time type checking, auto completion etc. If what you want is a field not a class, you can look it up from a string at runtime, but if you want compile time type checking etc., is there anyway to say something like fieldof(Foo.Bar)? I know the name of both the class and the field in advance, and I want to be able to refer to the field at compile time rather than with a run-time string lookup.

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >