Search Results

Search found 1711 results on 69 pages for 'andrew rice'.

Page 36/69 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • SQL Joins Excluding Data

    - by Andrew
    Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce Store A (Table 2 - 2 columns: Fruit for sale => Price) ------------------------- Apple => 1.00 Orange => 1.50 Pear => 2.00 Produce Store B (Table 3 - 2 columns: Fruit for sale => Price) ------------------------ Apple => 1.10 Pear => 2.50 Banana => 1.00 If I would like to write a query with Column 1: the set of fruit offered at Produce Store A UNION Produce Store B, Column 2: Price of the fruit at Produce Store A (or null if that fruit is not offered), Column 3: Price of the fruit at Produce Store B (or null if that fruit is not offered), how would I go about joining the tables? I am facing a similar problem (with more complex tables), and no matter what I try, if the "fruit" is not at "produce store a" but is at "produce store b", it is excluded (since I am joining produce store a first). I have even written a subquery to generate a full list of fruits, then left join Produce Store A, but it is still eliminating the fruits not offered at A. Any Ideas?

    Read the article

  • .net Globalization and ResourceManager

    - by Andrew Bullock
    I've got a console app and i need to globalize some of the hardcoded message strings. I've got two assemblies: MyProgram.Console (Console app) MyProgram.Core (class lib) In MyProgram.Core I've made a Language.en-GB.resx and set it as an Embedded Resource. In the resource I've created a key/value pair: "SomeKey" : "SomeValue" When I build my application I get: bin/MyProgram.Console.exe bin/MyProgram.Core.dll bin/en-BG/MyProgram.Core.resources.dll How do I address these resource key/values? Currently I'm trying this from a class within MyProgram.Core: var mgr = new ResourceManager(GetType().Assembly.GetName().Name, Assembly.GetExecutingAssembly()); mgr.GetString("SomeKey", new Culture("en-GB")); But I keep getting: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MyProgram.Core.resources" was correctly embedded or linked into assembly "MyProgram.Core" at compile time, or that all the satellite assemblies required are loadable and fully signed. What am I doing wrong? I've tried every combination I can think of for the baseName argument to the ResourceManagers ctor. Thanks

    Read the article

  • How do I use jQueryUI's ui-states with JSF2's h:messages?

    - by Andrew
    It seems like it should be very simple to specify that the h:messages generated by JSF should be styled using jQueryUI's nice ui-states. But sadly I can't make it fit. It seems that the jQueryUI states require several elements (div,div,p,span) in order to make it work. So taking inspiration directly from the jQueryUI theme demo page: <!-- Highlight / Error --> <h2 class="demoHeaders">Highlight / Error</h2> <div class="ui-widget"> <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span> <strong>Hey!</strong> Sample ui-state-highlight style.</p> </div> </div> <br/> <div class="ui-widget"> <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong>Alert:</strong> Sample ui-state-error style.</p> </div> </div> and trying to jam the css class details into my h:message as best I can: <div class="ui-widget"> <h:messages globalOnly="true" errorClass="ui-state-error ui-corner-all ui-icon-alert" infoClass="ui-state-highlight ui-corner-all ui-icon-info"/> </div> I don't get the icon or sufficient padding etc but the colours make it through. So, the styles are being applied but they aren't working as intended. Any idea how I can make this work?

    Read the article

  • Rails: translations for table's column.

    - by Andrew
    In rails application I have two models: Food and Drink. Both food and drink have a name, which has to be stored in two languages. How do I better realize translations for theese tables? First solution I realized was to replace name column with name_en and name_ru. Another solution is to encode with YAML hash like { :en => 'eng', :ru => 'rus' } and store yaml as a name. What would you recommend, assuming content is not static? Maybe there's good article?

    Read the article

  • jquery ajax type GET question

    - by Andrew Jackson
    Hi all! I hava a simple question. I have a server running which take actions according to parameters in the url. Example: if I type in browser: http://localhost:8081/Edit?action=renameModule&newName=Module2 This works correctly. I would like to know the equivalent jquery ajax method to perform the same thing I have tried $.ajax({ url: 'http://localhost:8081/Edit', type: 'GET', data:'action=renameModule&newName=Module2 }); It is not working. I would be very grateful for any help. Thanks

    Read the article

  • how do i filter my lucene search results?

    - by Andrew Bullock
    Say my requirement is "search for all users by name, who are over 18" If i were using SQL, i might write something like: Select * from [Users] Where ([firstname] like '%' + @searchTerm + '%' OR [lastname] like '%' + @searchTerm + '%') AND [age] >= 18 However, im having difficulty translating this into lucene.net. This is what i have so far: var parser = new MultiFieldQueryParser({ "firstname", "lastname"}, new StandardAnalyser()); var luceneQuery = parser.Parse(searchterm) var query = FullTextSession.CreateFullTextQuery(luceneQuery, typeof(User)); var results = query.List<User>(); How do i add in the "where age = 18" bit? I've heard about .SetFilter(), but this only accepts LuceneQueries, and not IQueries. If SetFilter is the right thing to use, how do I make the appropriate filter? If not, what do I use and how do i do it? Thanks! P.S. This is a vastly simplified version of what I'm trying to do for clarity, my WHERE clause is actually a lot more complicated than shown here. In reality i need to check if ids exist in subqueries and check a number of unindexed properties. Any solutions given need to support this. Thanks

    Read the article

  • possible to have a background color transition from color A to color B without repeating a pixel sti

    - by Andrew Heath
    For things like menubars and headers, a background color is nice. But a background color that gracefully transitions from say Blue to White is even nicer. I know this can be done by making a 1-pixel wide, X-pixel tall image file containing the desired fade and repeating it across the div, but does CSS have native support to just define colors and be done with it? Can any other language handle this?

    Read the article

  • Marshal a list of objects from VB6 to C#

    - by Andrew
    I have a development which requires the passing of objects between a VB6 application and a C# class library. The objects are defined in the C# class library and are used as parameters for methods exposed by other classes in the same library. The objects all contain simple string/numeric properties and so marshaling has been relatively painless. We now have a requirement to pass an object which contains a list of other objects. If I was coding this in VB6 I might have a class containing a collection as a member variable. In C# I might have a class with a List member variable. Is it possible to construct a C# class in such a way that the VB6 application could populate this inner list and marshal it successfully? I don't have a lot of experience here but I would guess Id have to use an array of Object types.

    Read the article

  • How to display an HTML email for preview on a webpage?

    - by Andrew
    I am trying to display a "preview" of an HTML email. I have the HTML in my database and now I need to render it in an iframe, or popup window or something. I am trying to inject the html into a div tag on the page, but it won't display anything. Here is the problem I am running into (I have nested HTML tags): <html> <body> <h1>My page</h1> <div id="email-body"> <html> <body> <p>email</p> </body> </html> </div> </body> </html>

    Read the article

  • Trouble with detecting gestures over ListView

    - by Andrew
    I have an Activity that contains a ViewFlipper. The ViewFlipper includes 2 layouts, both of which are essentially just ListViews. So the idea here is that I have two lists and to navigate from one to the other I would use a horizontal swipe. I have that working. However, what ever list item your finger is on when the swipe begins executing, that item will also be long-clicked. Here is the relevant code I have: public class MyActivity extends Activity implements OnItemClickListener, OnClickListener { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 250; private static final int SWIPE_THRESHOLD_VELOCITY = 200; private GestureDetector mGestureDetector; View.OnTouchListener mGestureListener; class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) return false; // right to left swipe if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { if (mCurrentScreen != SCREEN_SECONDLIST) { mCurrentScreen = SCREEN_SECONDLIST; mFlipper.setInAnimation(inFromRightAnimation()); mFlipper.setOutAnimation(outToLeftAnimation()); mFlipper.showNext(); updateNavigationBar(); } } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { if (mCurrentScreen != SCREEN_FIRSTLIST) { mCurrentScreen = SCREEN_FIRSTLIST; mFlipper.setInAnimation(inFromLeftAnimation()); mFlipper.setOutAnimation(outToRightAnimation()); mFlipper.showPrevious(); updateNavigationBar(); } } } catch (Exception e) { // nothing } return true; } } @Override public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)) return true; else return false; } ViewFlipper mFlipper; private int mCurrentScreen = SCREEN_FIRSTLIST; private ListView mList1; private ListView mList2; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_flipper); mFlipper = (ViewFlipper) findViewById(R.id.flipper); mGestureDetector = new GestureDetector(new MyGestureDetector()); mGestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (mGestureDetector.onTouchEvent(event)) { return true; } return false; } }; // set up List1 screen mList1List = (ListView)findViewById(R.id.list1); mList1List.setOnItemClickListener(this); mList1List.setOnTouchListener(mGestureListener); // set up List2 screen mList2List = (ListView)findViewById(R.id.list2); mList2List.setOnItemClickListener(this); mList2List.setOnTouchListener(mGestureListener); } … } If I change the "return true;" statement from the GestureDetector to "return false;", I do not get long-clicks. Unfortunately, I get regular clicks. Does anyone know how I can get around this?

    Read the article

  • How to detect Java agents, JVMTI, etc...

    - by Andrew Westberg
    How does one secure the Java environment when running on a machine you don't control? What is to stop someone from creating a java agent or native JVMTI agent and dumping bytecode or re-writing classes to bypass licensing and/or other security checks? Is there any way to detect if any agents are running from Java code? From JNI? From a JVMTI agent?

    Read the article

  • Delaying emails in PHP to avoid exceeding server limit

    - by Andrew P.
    Okay, so here's my problem: I have a list of members on a website, and periodically one of the admins my site (who are not very web or tech savvy) will send a newsletter to the memberlist. My current memberlist is well over 800 individuals long. So, I wrote an email script that sends the email to the full memberlist, with the members listed in the Bcc header. However, I've discovered that my host server has a limit of 300 emails per hour, which I apparently exceed even though the members are listed in the Bcc field. (I wasn't previously aware that the behaviour of Bcc was to send separate emails for each name on the list...) After some thought, I've come to the conclusion that my only solution is to have my script send only the email to only the first 300 emails, wait an hour, and send a second email to the next three hundred, wait another hour, and so on until I've sent the email to the whole member list. Looking around on the internet, I've seen some other solutions people have come up with for delaying emails in PHP. Sleep() is obviously not an option, because I can't just leave the script open and running for 3 or four hours. I've seen some people suggest cron jobs, but I'm not sure how feasible it would be to create three new cron jobs every time I send an email, use them once, and then delete them afterward. The final (and what I think is the smartest) solution I've seen, is to have a table in my database to temporarily store the emails to be delayed and sent later, and then create a cron job that checks this sql table every hour or so, compares the timestamp of the row to the current timestamp, and then sends the email if an hour has passed. So I'm asking you all which method you would recommend. Is there an easier solution that I've completely looked over (aside from getting a different hosting plan. ha!), or is there a cleaner way to do it than the database / cron job approach? tl;dr: I have 800 emails to send in an hour on a server that limits me to 300/hr. Using PHP, find a way to get around this problem in a way that the person sending the email needs only to click "send."

    Read the article

  • Dependency Injection for objects that require parameters

    - by Andrew
    All of our reports are created from object graphs that are translated from our domain objects. To enable this, we have a Translator class for each report, and have been using Dependency Injection for passing in dependencies. This worked great, and would yield nice classes structured like this: public class CheckTranslator : ICheckTranslator { public CheckTranslator (IEmployeeService empSvc , IPaycheckService paySvc) { _empSvc = empSvc; _paySvc = paySvc; } public Check CreateCheck() { //do the translation... } } However, in some cases the mapping has many different grouping options. As a result, the c-tor would turn into a mix of class dependencies and parameters. public class CheckTranslator : ICheckTranslator { public CheckTranslator (IEmployeeService empSvc , IPaycheckService paySvc , bool doTranslateStubData , bool doAttachLogo) { _empSvc = empSvc; _paySvc = paySvc; _doTranslateStubData = doTranslateStubData; _doAttachLogo = doAttachLogo; } public Check CreateCheck() { //do the translation... } } Now, we can still test it, but it no longer really works with an IoC container, at least in a clean fashion. Plus, we can no longer call the CreateCheck twice if the settings are different for each check. While I recognize it's a problem, I don't necessarily see the right solution. It seems kind of strange to create a Factory for each class ... or is this the best way?

    Read the article

  • Random Pairings that don't Repeat

    - by Andrew Robinson
    This little project / problem came out of left field for me. Hoping someone can help me here. I have some rough ideas but I am sure (or at least I hope) a simple, fairly efficient solution exists. Thanks in advance.... pseudo code is fine. I generally work in .NET / C# if that sheds any light on your solution. Given: A pool of n individuals that will be meeting on a regular basis. I need to form pairs that have not previously meet. The pool of individuals will slowly change over time. For the purposes of pairing, (A & B) and (B & A) constitute the same pair. The history of previous pairings is maintained. For the purpose of the problem, assume an even number of individuals. For each meeting (collection of pairs) and individual will only pair up once. Is there an algorithm that will allow us to form these pairs? Ideally something better than just ordering the pairs in a random order, generating pairings and then checking against the history of previous pairings. In general, randomness within the pairing is ok.

    Read the article

  • Display/hide menu items depending on logged on user

    - by Andrew
    In my web app, I would like to show an "Admin" menu link only to users who have been added to the database as an administrator. What would be the best way to do this in ASP.NET MVC 2? At the moment, I am doing it by checking whether the user exists in the Admin database table for every page. Obviously, there must be a better way to do this. If it helps, I am using Windows Auth.

    Read the article

  • Converter problem with XmlDataProvider

    - by Andrew
    Sorry for this, I've just started programming with wpf. I can't seem to figure out why the following xaml displays "System.Xml.XmlElement" instead of the actual xml node content. This is displayed 5 times in the listbox whenever I run it. Not sure where I'm going wrong... <Window x:Class="TestBinding.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <XmlDataProvider x:Key="myXmlSource" XPath="/root"> <x:XData> <root xmlns=""> <name>Steve</name> <name>Arthur</name> <name>Sidney</name> <name>Billy</name> <name>Steven</name> </root> </x:XData> </XmlDataProvider> <DataTemplate x:Key="shmooga"> <TextBlock Text="{Binding}"/> </DataTemplate> </Window.Resources> <Grid> <ListBox ItemTemplate="{StaticResource shmooga}" ItemsSource="{Binding Source={StaticResource myXmlSource}, XPath=name}"> </ListBox> </Grid> </Window> Any help would be very much appreciated. Thanks!

    Read the article

  • How do you link to an action that takes an array as a parameter (RedirectToAction and/or ActionLink)

    - by Andrew
    I have an action defined like so: public ActionResult Foo(int[] bar) { ... } Url's like this will work as expected: .../Controller/Foo?bar=1&bar=3&bar=5 I have another action that does some work and then redirects to the Foo action above for some computed values of bar. Is there a simple way of specifying the route values with RedirectToAction or ActionLink so that the url's get generated like the above example? These don't seem to work: return RedirectToAction("Foo", new { bar = new[] { 1, 3, 5 } }); return RedirectToAction("Foo", new[] { 1, 3, 5 }); <%= Html.ActionLink("Foo", "Foo", new { bar = new[] { 1, 3, 5 } }) %> <%= Html.ActionLink("Foo", "Foo", new[] { 1, 3, 5 }) %> However, for a single item in the array, these do work: return RedirectToAction("Foo", new { bar = 1 }); <%= Html.ActionLink("Foo", "Foo", new { bar = 1 }) %> When setting bar to an array, it redirects to the following: .../Controller/Foo?a=System.Int32[] Finally, this is with ASP.NET MVC 2 RC. Thanks.

    Read the article

  • Why is this the output of this python program?

    - by Andrew Moffat
    Someone from #python suggested that it's searching for module "herpaderp" and finding all the ones listed as its searching. If this is the case, why doesn't it list every module on my system before raising ImportError? Can someone shed some light on what's happening here? import sys class TempLoader(object): def __init__(self, path_entry): if path_entry == 'test': return raise ImportError def find_module(self, fullname, path=None): print fullname, path return None sys.path.insert(0, 'test') sys.path_hooks.append(TempLoader) import herpaderp output: 16:00:55 $> python wtf.py herpaderp None apport None subprocess None traceback None pickle None struct None re None sre_compile None sre_parse None sre_constants None org None tempfile None random None __future__ None urllib None string None socket None _ssl None urlparse None collections None keyword None ssl None textwrap None base64 None fnmatch None glob None atexit None xml None _xmlplus None copy None org None pyexpat None problem_report None gzip None email None quopri None uu None unittest None ConfigParser None shutil None apt None apt_pkg None gettext None locale None functools None httplib None mimetools None rfc822 None urllib2 None hashlib None _hashlib None bisect None Traceback (most recent call last): File "wtf.py", line 14, in <module> import herpaderp ImportError: No module named herpaderp

    Read the article

  • Positioning DIV's with Javascript

    - by Andrew P.
    I have two divs that I need to position horizontally dependent on the width of the user's screen. I've styled their vertical position in CSS, and I am trying to position them horizontally using Javascript. My divs: <div id="tl"> blah blah </div> <div id="bl"> blah blah </div> My CSS: #tl { position: absolute; top: -14px; right: 0; } #bl { position: absolute; bottom: 1px; right: 0; } My Javascript: var tl = document.getElementById('tl'); var bl = document.getElementById('bl'); var wide = parseInt(screen.width); var nudge = wide*.86; nudge = nudge+21; tl = tl.style; tl.right = ( parseInt(tl.right) + nudge ); bl = bl.style; bl.right = ( parseInt(bl.right) + nudge ); However... nothing happens. No errors, and definitely no movement from my divs. What am I doing wrong? Can anyone help?

    Read the article

  • ASP.NET custom routes for simple requirements management tool

    - by Andrew
    I am implementing a very simple requirements management tool. I want the URLs to look like this: Shows home page for "Project One": http://projectmanager/Project/Project%20One Shows a list of requirements being worked on for "Project One" http://projectmanager/Project/Project%20One/Requirements Shows requirement 1 for "Project One" http://projectmanager/Project/Project%20One/Requirement/1 How could I set up routes so that http://projectmanager/Project/Project%20One is handled by the project controller http://projectmanager/Project/Project%20One/Requirements and http://projectmanager/Project/Project%20One/Requirements/1 is handled by the requirements controller. Is it even possible?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >