Search Results

Search found 1517 results on 61 pages for 'ben tew'.

Page 40/61 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Common one-to-many table for multiple entities

    - by Ben V
    Suppose I have two tables, Customer and Vendor. I want to have a common address table for customer and vendor addresses. Customers and Vendors can both have one to many addresses. Option 1 Add columns for the AddressID to the Customer and Vendor tables. This just doesn't seem like a clean solution to me. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID AddressID1 AddressID1 Street AddressID2 AddressID2 City... Option 2 Move the foreign key to the Address table. For a Customer, Address.CustomerID will be populated. For a Vendor, Address.VendorID will be populated. I don't like this either - I shouldn't need to modify the address table every time I want to use it for another entity. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID CustomerID VendorID Option 3 I've also seen this - only 1 foreign key column on the Address table with another column to identify which foreign key table the address belongs to. I don't like this one because it requires all the foreign key tables to have the same type of ID. It also seems messy once you start coding against it. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID FKTable FKID So, am I just too picky, or is there something I haven't thought of?

    Read the article

  • Perl throws an error message about syntax

    - by Ben Dauphinee
    So, building off a question about string matching (this thread), I am working on implementing that info in solution 3 into a working solution to the problem I am working on. However, I am getting errors, specifically about this line of the below function: next if @$args->{search_in} !~ /@$cur[1]/; syntax error at ./db_index.pl line 16, near "next " My question as a perl newbie is what am I doing wrong here? sub search_for_key { my ($args) = @_; foreach $row(@{$args->{search_ary}}){ print "@$row[0] : @$row[1]\n"; } my $thiskey = NULL; foreach $cur (@{$args->{search_ary}}){ print "\n" . @$cur[1] . "\n" next if @$args->{search_in} !~ /@$cur[1]/; $thiskey = @$cur[0]; last; } return $thiskey; }

    Read the article

  • Some questions about setting up Amazon S3 with Ruby on Rails

    - by ben
    I'm trying to setup Amazon S3 hosting with my Ruby on Rails 3 app, which is hosted on Heroku. After reading these instructions in the Heroku docs, I'm trying to use the aws-s3 gem. The instructions say to put the S3 account details in config/amazon_s3.yml, but the aws-s3 Github page says you create a connection like this: AWS::S3::Base.establish_connection!( :access_key_id => 'abc', :secret_access_key => '123' ) Why is the connection created by providing the details if they're already provided in the config file? Is that not the correct way to establish a connection? Do I have to establish a connection for each user everytime an upload is about to occur, or is a connection established for the application as a whole? Thanks for reading.

    Read the article

  • SharePoint 2010 Search not working.

    - by Ben
    I have installed and configured SharePoint 2010 to run on the same box as the SQL Server its running from in Windows Server 2008 R2. Everything is working fine except the search. I have uploaded several documents and tagged several items (documents, tasks, announcements etc), however whenever I search the site using the defaul search, i get nothing returned no matter what i search on, I simply get "We did not find any results for [search term]". I know there is setup needed if you wish to use "FAST search", but do I have to do anything to get the standard default search to work?

    Read the article

  • Ordering recursive result set in SQL Server

    - by Ben
    I am having extreme difficulty constructing a query which returns an XML style hierarchy. We have a database table which contains a hierarchy of URLs for our website. The table contains the columns: ID, URL, DisplayName, ParentID, ItemOrder The parent ID forms a recursive relationship between the current item and it's parent. The item should site below it's parent in the hierarchy and it should also be ordered using the item order against items at the same level in the hierarchy. I have managed to get a recursive query working so it drills down the hierarchy sequentially but I cannot order this by the item order as well. My current query is below: WITH Parents AS ( SELECT MenuItemId, URL, ParentItemId, ItemOrder FROM CambsMenu UNION ALL SELECT si.MenuItemId, si.URL, si.ParentItemId, si.ItemOrder FROM CambsMenu si INNER JOIN Parents p ON si.ParentItemId = p.MenuItemId ) SELECT DISTINCT * FROM Parents

    Read the article

  • XSLT: How do I trigger a template when there is no input file?

    - by Ben Blank
    I'm creating a template which produces output based on a single string, passed via parameter, and does not use an input XML document. xsltproc seems to happily run with a single parameter specifying the stylesheet, but I don't see a way to trigger a template without an input file (no parameter to xsltproc to run a named template, for example). I'd like to be able to run: xsltproc --stringparam bar baz foo.xsl But I'm currently having to run, with the "main" template matching "/": echo '<xml/>' | xsltproc --stringparam bar baz foo.xsl - How can I get this to work? I'm sure I've seen other templates in the past which were meant to be run without an input document, but I don't remember how they worked or where to find them again. :-)

    Read the article

  • Android - How to set the wallpaper image?

    - by asdf.BEN
    What i'm trying to do is, set the wallpaper using an image URI (no cropping) I'm a noob at dev on Android and dev in general. The internet has failed me... on providing code to set the wallpaper. yes the dev resource site says public void setStream (InputStream data) but i don't understand it, some sample code would greatly help me.

    Read the article

  • Strange behaviour when posting CGEvent to PSN

    - by Ben Packard
    If I set up a loop that posts some keyboard events to a PSN, I find that it works fine except for when first launched. The event only seems to post when i do something with the mouse manually - even just moving it slightly. Here's the details, if they help. An external application has a list box of text lines, which I am reading by posting copy commands (and checking the pasteboard). Unfortunately this is my only way to get this text. Sometimes, the application pulls focus away from the list, which I can detect. When this happens, the most reliable way to return focus is by sending a mouse event to click on a text field directly above the list, then send a 'tab' keyboard event to shift the focus onto the list. So at launch, the loop runs fine, scrolling down the list and copying the text. When focus is shifted away, its is detected fine, and the events are sent to move focus back to the list. But nothing seems to happen. The loop continues detecting that focus has changed, but the events only work once I move the mouse. Or even just use the scroll wheel. Strange. Once this has happened the first time, it works fine - each time focus moves, the PSN events switch it back without me having to do anything at all. Here's the code that runs in the loop - verified as working: //copy to pasteboard - CMD-V e3 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)8, true); CGEventSetFlags(e3, kCGEventFlagMaskCommand); CGEventPostToPSN(&psn, e3); CFRelease(e3); e4 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)8, false); CGEventPostToPSN(&psn, e4); CFRelease(e4); //move cursor down e1 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)125, true); CGEventPostToPSN(&psn, e1); CFRelease(e1); e2 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)125, false); CGEventPostToPSN(&psn, e2); CFRelease(e2); And here's where I switch focus, also working (except when first required): //click in text input box - point is derived earlier e6 = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, point, 0); CGEventPostToPSN(&psn, e6); CFRelease(e6); e7 = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseUp, point, 0); CGEventPostToPSN(&psn, e7); CFRelease(e7); //press tab key to move to chat log table CGEventRef e = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)48, true); //CGEventPost(kCGSessionEventTap, e); CGEventPostToPSN(&psn, e); CFRelease(e); CGEventRef e11 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)48, false); CGEventPostToPSN(&psn, e11); CFRelease(e11);

    Read the article

  • Why do some Flask session values disappear from the session after closing the browser window, but then reappear later without me adding them?

    - by Ben
    So my understanding of Flask sessions is that I can use it like a dictionary and add values to a session by doing: session['key name'] = 'some value here' And that works fine. On a route I have the client call using AJAX post, I assign a value to the session. And it works fine. I can click on various pages of my site and the value stays in the session. If I close the browser window however, and then go back to my site, the session value I had in there is gone. So that's weird and you would think the problem is the session isn't permanent. I also implemented Flask-Openid and that uses the session to store information and that does persist if I close the browser window and open it back up again. I also checked the cookie after closing the browser window, but before going back to my site, and the cookie is indeed still there. Another odd piece of behaviour (which may be related) is that some values I have written to the session for testing purposes will go away when I access the AJAX post route and assign the correct value. So that is odd, but what is truly weird is that when I then close the browser window and open it up again, and have thus lost the value I was trying to retain, the ones that I lost previously actually return! They aren't being reassigned because there's no code in my Python files to reassign those values. Here is some outputs to helper make it clearer. They are all outputed from a route for a real page, and not the AJAX post route I mentioned above. This is the output after I have assigned the value I want to store in the session. The value key is 'userid' - all the other values are dummy ones I have added in trying to solve this problem. 'userid': 8 will stay in the session as long as I don't close the browser window. I can access other routes and the value will stay there just like it should. ['session.=', <SecureCookieSession {'userid': 8, 'test_variable_num': 102, 'adding using before request': 'hi', '_permanent': True, 'test_variable_text': 'hi!'}>] If I do close the browser window, and go back into the site, but without redoing the AJAX post request, I get this output: ['session.=', <SecureCookieSession {'adding using before request': 'hi', '_permanent': True, 'yo': 'yo'}>] The 'yo' value was not in the first first output. I don't know where it came from. I searched my code for 'yo' and there is no instances of me assigning that value anywhere. I think I may have added it to the session days ago. So it seems like it is persisting, but being hidden when the other values are written. And this last one is me accessing the AJAX post route again, and then going to the page that prints out the keys using debug. Same output as the first output I pasted above, which you would expect, and the 'yo' value is gone again (but it will come back if I close the browser window) ['session.=', <SecureCookieSession {'userid': 8, 'test_variable_num': 102, 'adding using before request': 'hi', '_permanent': True, 'test_variable_text': 'hi!'}>] I tested this in both Chrome and Firefox. So I find this all weird and I am guessing it stems from a misunderstanding of how sessions work. I think they're dictionaries and I can write dictionary values into them and retrieve them days later as long as I set the session to permanent and the cookie doesn't get deleted. Any ideas why this weird behaviour is happening?

    Read the article

  • [C] Signed Hexadecimal string to long int function

    - by Ben
    I am trying to convert a 24bit Hexadecimal string (6 characters) signed in two's complement to a long int in C. This is the function I have come up with: long int hex2li (char string[]) { char *pEnd; long int result = strtol (string, &pEnd, 16); if (strcmp (pEnd, "") == 0) { if (toupper (string[0]) == 'F') { return result - 16777216; } else { return result; } } return LONG_MIN; } Is it valid? Is there a better way of doing this?

    Read the article

  • Finding the most common values from given data

    - by Ben Shelock
    I have some data that looks something like this... +----------+----------+----------+ | Column 1 | Column 2 | Column 3 | +----------+----------+----------+ | Red | Blue | Green | | Yellow | Blue | Pink | | Black | Grey | Blue | +--------------------------------+ I need to go through this data and find the 3 most common colours. The raw data is in CSV and there's likely to be thousands more rows. (link) What's the best way of doing this?

    Read the article

  • Membership levels PHP

    - by Ben
    I want to make someone able to register on my site (or upgrade their current account) with one of 3 membership levels. When someone selects the membership level (or upgrades their current account) and registers, they will register under that membership level and payment will be started from there. My real question being how do I make someone able to sign up (or upgrade) an account upon registration (for new accounts) and upgrade for existing accounts and have this happen automatically so I dont have to do them all by hand? Thanks! Benjamin

    Read the article

  • Codeigniter Form validation problem

    - by ben robinson
    Please please please can someone help me $this-load-library('form_validation'); $this-load-helper('cookie'); $data = array(); if($_POST) { // Set validation rules including additional validation for uniqueness $this-form_validation-set_rules('yourname', 'Your Name', 'trim|required'); $this-form_validation-set_rules('youremail', 'Your Email', 'trim|required|valid_email'); $this-form_validation-set_rules('friendname', 'Friends Name', 'trim|required'); $this-form_validation-set_rules('friendemail', 'Friends Email', 'trim|required|valid_email'); // Run the validation and take action if($this-form_validation-run()) { echo 'valid; } } else{ echo 'problem'; } Form validation is coming back with no errors can cany one see why?

    Read the article

  • Queuing methods to be run on an object by different threads in Python

    - by Ben
    Let's say I have an object who's class definition looks like: class Command: foo = 5 def run(self, bar): time.sleep(1) self.foo = bar return self.foo If this class is instantiated once, but different threads are hitting its run method (via an HTTP request, handled separately) passing in different args, what is the best method to queue them? Can this be done in the class definition itself?

    Read the article

  • Counting viable sublist lengths from an array.

    - by Ben B.
    This is for a genetic algorithm fitness function, so it is important I can do this as efficiently as possible, as it will be repeated over and over. Lets say there is a function foo(int[] array) that returns true if the array is a "good" array and false if the array is a "bad" array. What makes it good or bad does not matter here. Given the full array [1,6,8,9,5,11,45,16,9], lets say that subarray [1,6,8] is a "good" array and [9,5,11,45] is a "good" array. Furthermore [5,11,45,16,9] is a "good" array, and also the longest "good" subarray. Notice that while [9,5,11,45] is a "good" array, and [5,11,45,16,9] is a "good" array, [9,5,11,45,16,9] is a "bad" array. We wants the length counts of all "good" arrays, but not subarrays of "good" arrays. Furthermore, as described above, a "good" array might begin in the middle of another "good" array, but the combination of the two might be a "bad" array.

    Read the article

  • rich:editor ruins html?

    - by Ben
    Hi, Strange behaviour. I use rich:editor with these attributes: (Irrelevant data removed) HtmlEditor editor = new HtmlEditor(); editor.setValueExpression("value", ve); editor.setTheme("advanced"); editor.setValueExpression("viewMode", viewModeValueExpression); panel.getChildren().add(editor); Now my problem is that whenever I load a ready-made html text such as this (In source mode): <html lang="en" xml:lang="en"> <head> <title>Done</title> </head> <body style="direction: ltr; font-size: medium; color: #0000FF;"> <p>When the menu loads, navigate to and open Image Editor.</p> </body> </html> Change to VisualMode and then back to SourceMode, I see that the editor removed all of my html data and now the source mode is this: <p>When the menu loads, navigate to and open Chul Muzal.</p> Anyone knows why this happens? Thanks!!

    Read the article

  • F# Inline Function Specialization

    - by Ben
    Hi, My current project involves lexing and parsing script code, and as such I'm using fslex and fsyacc. Fslex LexBuffers can come in either LexBuffer<char> and LexBuffer<byte> varieties, and I'd like to have the option to use both. In order to user both, I need a lexeme function of type ^buf - string. Thus far, my attempts at specialization have looked like: let inline lexeme (lexbuf: ^buf) : ^buf -> string where ^buf : (member Lexeme: char array) = new System.String(lexbuf.Lexeme) let inline lexeme (lexbuf: ^buf) : ^buf -> string where ^buf : (member Lexeme: byte array) = System.Text.Encoding.UTF8.GetString(lexbuf.Lexeme) I'm getting a type error stating that the function body should be of type ^buf -> string, but the inferred type is just string. Clearly, I'm doing something (majorly?) wrong. Is what I'm attempting even possible in F#? If so, can someone point me to the proper path? Thanks!

    Read the article

  • Do I need to force the GAC to reload an assembly? Is this possible?

    - by Ben McCormack
    I've added types to my .NET classes that I'm using for COM interop. To get it to work with my VB6 application, I unregistered the DLL and re-registered it (using regasm). I then uninstalled and reinstalled it to the GAC (using gacutil). The types are showing up in the VB6 object explorer, but when I run the application in the VB6 IDE, it breaks on the line that instantiates the new types with the error: Automation Errror - The System cannot find the file specified. I thought this odd since I had already updated the GAC, so I uninstalled the dll from the GAC and got the exact same error, which seems to indicate that the older version of the dll is already in memory and needs to be "reloaded" so that the newer DLL is in memory. Is this possible, and if so, what do I need to do?

    Read the article

  • Does Android AsyncTaskQueue or similar exist?

    - by Ben L.
    I read somewhere (and have observed) that starting threads is slow. I always assumed that AsyncTask created and reused a single thread because it required being started inside the UI thread. The following (anonymized) code is called from a ListAdapter's getView method to load images asynchronously. It works well until the user moves the list quickly, and then it becomes "janky". final File imageFile = new File(getCacheDir().getPath() + "/img/" + p.image); image.setVisibility(View.GONE); view.findViewById(R.id.imageLoading).setVisibility(View.VISIBLE); (new AsyncTask<Void, Void, Bitmap>() { @Override protected Bitmap doInBackground(Void... params) { try { Bitmap image; if (!imageFile.exists() || imageFile.length() == 0) { image = BitmapFactory.decodeStream(new URL( "http://example.com/images/" + p.image).openStream()); image.compress(Bitmap.CompressFormat.JPEG, 85, new FileOutputStream(imageFile)); image.recycle(); } image = BitmapFactory.decodeFile(imageFile.getPath(), bitmapOptions); return image; } catch (MalformedURLException ex) { // TODO Auto-generated catch block ex.printStackTrace(); return null; } catch (IOException ex) { // TODO Auto-generated catch block ex.printStackTrace(); return null; } } @Override protected void onPostExecute(Bitmap image) { if (view.getTag() != p) // The view was recycled. return; view.findViewById(R.id.imageLoading).setVisibility( View.GONE); view.findViewById(R.id.image) .setVisibility(View.VISIBLE); ((ImageView) view.findViewById(R.id.image)) .setImageBitmap(image); } }).execute(); I'm thinking that a queue-based method would work better, but I'm wondering if there is one or if I should attempt to create my own implementation.

    Read the article

  • Enhanced Podcasts and MPMoviePlayerViewController

    - by Ben Robinson
    Hi, This is a bit of an odd/specific one - possibly a bug? I'm using MPMoviePlayerViewController to play a variety of files, including Enhanced Podcasts - these are audio files, but with a slideshow of images, often created using GarageBand. Until (i think) iOS 3.2 they weren't supported at all, now they are and play fine in the iPod app, but in my app the slideshow doesn't start, the full screen movie player opens, and the audio begins, but all I see is the QuickTime logo. If I scrub the track the pictures appear - and will continue to play correctly - but I see nothing if I don't scrub! Any ideas?? On a related note, these files also include a small rectangluar button containing an (i) button on the right hand side - anybody know what it is or should do?! It does nothing for me!

    Read the article

  • Symfony Rewrite rules on Zeus webserver

    - by Ben
    I would like to run a symfony project on a zeus webserver, however i cannot get the rewrite rules to work. Has anyone done this successfully The symfony .htaccess is as follows: Options +FollowSymLinks +ExecCGI <IfModule mod_rewrite.c> RewriteEngine On # uncomment the following line, if you are having trouble # getting no_script_name to work #RewriteBase / # we skip all files with .something #RewriteCond %{REQUEST_URI} \..+$ #RewriteCond %{REQUEST_URI} !\.html$ #RewriteRule .* - [L] # we check if the .html version is here (caching) RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f # no, so we redirect to our front web controller RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> From what I can tell the following should work on zeus: match URL into $ with (^(.*)$) if matched then set URL = index.php But it doesn't... I can only load the home page from / all other pages just 404. Thanks..

    Read the article

  • merging arrays of hashes

    - by Ben
    I have two arrays of hashes. Array1 => [{attribute_1 = A, attribute_2 = B}, {attribute_1 = A, attribute_2 = B}] Array2 => [{attribute_3 = C, attribute_2 = D}, {attribute_3 = C, attribute_4 = D}] Each hash in the array is holding attributes for an object. In the above example, there are two objects that I'm working with. There are two attributes in each array for each object How do I merge the two arrays? I am trying to get a single array (there is no way to get a single array from the start because I have to make two different API calls to get these attributes). DesiredArray => [{attribute_1 = A, attribute_2 = B, attribute_3 = C, attribute_2 = D}, {attribute_1 = A, attribute_2 = B, attribute_3 = C, attribute_2 = D}] I've tried a couple things, including the iteration methods and the merge method, but I've been unable to get the array I need.

    Read the article

  • How do I work with constructs in PHPUnit?

    - by Ben Dauphinee
    I am new into PHPUnit, and just digging through the manual. I cannot find a decent example of how to build a complete test from end to end though, and so, am left with questions. One of these is how can I prep my environment to properly test my code? I am trying to figure out how to properly pass various configuration values needed for both the test setup/teardown methods, and the configs for the class itself. // How can I set these variables on testing start? protected $_db = null; protected $_config = null; // So that this function runs properly? public function setUp(){ $this->_acl = new acl( $this->_db, // The database connection for the class passed // from whatever test construct $this->_config // Config values passed in from construct ); } // Can I just drop in a construct like this, and have it work properly? // And if so, how can I set the construct call properly? public function __construct( Zend_Db_Adapter_Abstract $db, $config = array(), $baselinedatabase = NULL, $databaseteardown = NULL ){ $this->_db = $db; $this->_config = $config; $this->_baselinedatabase = $baselinedatabase; $this->_databaseteardown = $databaseteardown; } // Or is the wrong idea to be pursuing?

    Read the article

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