Search Results

Search found 1911 results on 77 pages for 'james howell'.

Page 43/77 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • How do I so a select input for a STI column in a Rails model?

    - by James A. Rosen
    I have a model with single-table inheritance on the type column: class Pet < ActiveRecord::Base TYPES = [Dog, Cat, Hamster] validates_presence_of :name end I want to offer a <select> dropdown on the new and edit pages: <% form_for @model do |f| %> <%= f.label :name %> <%= f.text_input :name %> <%= f.label :type %> <%= f.select :type, Pet::TYPES.map { |t| [t.human_name, t.to_s] } %> <% end %> That gives me the following error: ActionView::TemplateError (wrong argument type String (expected Module)) I read a suggestion to use an alias for the field #type since Ruby considers that a reserved word that's the same as #class. I tried both class Pet < ActiveRecord::Base ... alias_attribute :klass, :type end and class Pet < ActiveRecord::Base ... def klass self.type end def klass=(k) self.type = k end end Neither worked. Any suggestions? Oddly, it works fine on my machine (MRI 1.8.6 on RVM), but fails on the staging server (MRI 1.8.7 not on RVM).

    Read the article

  • Configuration files for C in linux

    - by James
    Hi, I have an executable that run time should take configuration parameters from a script file. This way I dont need to re-compile the code for every configuration change. Right now I have all the configuration values in a .h file. Everytime I change it i need to re-compile. The platform is C, gcc under Linux. What is the best solution for this problem? I looked up on google and so XML, phthon and Lua bindings for C. Is using a separate scripting language the best approach? If so, which one would you recommend for my need? Thanks

    Read the article

  • Downloading a file in ASP.NET (through the server) while streaming it to the user

    - by James Teare
    My ASP.NET website currently downloads a file from a remote server to a local drive, although when users access the site they have to wait for the server to finish downloading the file until they can then download the file from my ASP.NET website. Is it possible to almost stream the download from the remote website - through my ASP.NET website directly to the user (a bit like a proxy) ? My current code is as follows: using (var client = new WebClientEx()) { client.DownloadFile(downloadURL, "outputfile.zip"); } WebClient class: public class WebClientEx : WebClient { public CookieContainer CookieContainer { get; private set; } public WebClientEx() { CookieContainer = new CookieContainer(); } protected override WebRequest GetWebRequest(Uri address) { var request = base.GetWebRequest(address); if (request is HttpWebRequest) { (request as HttpWebRequest).CookieContainer = CookieContainer; } return request; } }

    Read the article

  • Macbook memory upgrade question

    - by James Evans
    I've read some conflicting articles on Macbooks and memory upgrades. Some say you have to buy the "special" Mac memory (bulls$%t), others say manufacturers like Partriot and Ocz will work fine. My Macbook (non-pro) is about 6 mos old with it's 2 GB of memory (SO-DIMM 1066MHz DDR3). Does anyone have any definitive information of what will work? Thanks!

    Read the article

  • Trying to run psexec to remote to server and recycle app pool

    - by James
    If I run this from my command prompt it works fine. psexec \ServerName cscript.exe iisapp.vbs /a AppName /r I'm trying to do the same thing with C# console app. I'm using the below code but most of the time the application hangs and doesn't complete, and the few times it does it throws an error code. Am I doing this wrong? Anyone know where I can look up the error or error code? static void RecycleAppPool(string sServer) { Console.Clear(); ProcessStartInfo p = new ProcessStartInfo("psexec.exe", "\\\\" + sServer + " cscript.exe iisapp.vbs /a <AppName> /r"); p.RedirectStandardInput = true; p.UseShellExecute = false; Process.Start(p); } When it completes with error, looks like this "cscript.exe exited with error code -2147024664"

    Read the article

  • Including FFMPEG with a Java application on Mac

    - by James Skidmore
    I'm writing a Java program that will be used on both Windows and Mac. In the program, I'm using FFMPEG to convert a MOV file to an FLV. On Windows, it's no problem -- simply call the command. But on Mac, I'm not quite sure what to do. Does the user really have to install FFMPEG on their machine, or can it somehow be included in the Java application? Thanks for any help/guidance!

    Read the article

  • vb.net Object Initialiser List(Of T)

    - by Tim B James
    I have been looking at some C# code: List<Employee> Employees = new List<Employee>{ new Employee{firstname="Aamir",lastname="Hasan",age=20}, new Employee{firstname="awais",lastname="Hasan",age=50}, new Employee{firstname="Bill",lastname="Hasan",age=70}, new Employee{firstname="sobia",lastname="khan",age=80}, }; Now when I convert this to vb.net Dim Employees as List(Of Employee) = New List(Of Employee)() With { New Employee() With { _ .firstname = "Aamir", _ .lastname = "Hasan", _ .age = 20 _ }, _ New Employee() With { _ .firstname = "awais", _ .lastname = "Hasan", _ .age = 50 _ }, _ New Employee() With { _ .firstname = "Bill", _ .lastname = "Hasan", _ .age = 70 _ }, _ New Employee() With { _ .firstname = "sobia", _ .lastname = "khan", _ .age = 80 _ } _ } I get the error "Name of field or property being initialized in an object initializer must start with'.'." Now I can get an array of employee using the code: Dim Employees = { New Employee() With { _ .FirstName = "Aamir", _ .LastName = "Hasan", _ .Age = 20}, _ New Employee() With { _ .FirstName = "Awais", _ .LastName = "Hasan", _ .Age = 50}, _ New Employee() With { _ .FirstName = "Bill", _ .LastName = "Hasan", _ .Age = 70 _ } _ } But I would like a List(Of Employee) as it is bugging me as to why this doesnt work in vb.net?

    Read the article

  • Escaping Problem

    - by James Jeffery
    How can escape quotes for use in HTML? My line of code is: <body onload="setTimeout('window.location='http://somepage.com'', 1000)"> As you can see in the current example, there are two ', and a " being used. How can I escape them for the above to work? The onload contents are set dynamically for a system I am working on @ work.

    Read the article

  • Hosting a VST/DX instrument in C#/C++?

    - by James D
    I'm trying to get a read on the effort level involved in building a barebones virtual instrument host in C++ or C# but I haven't been able to get any hard information. Does anybody know any good starter apps, tutorials, helper libraries for this sort of thing? If it matters, the goal would be to a) accept incoming MIDI events and b) dispatch them to the virtual instrument. In C++ or C#, if possible. Thanks!

    Read the article

  • Getting size of a specific byte array from an array of pointers to bytes

    - by Pat James
    In the following example c code, used in an Arduino project, I am looking for the ability to get the size of a specific byte array within an array of pointers to bytes, for example void setup() { Serial.begin(9600); // for debugging byte zero[] = {8, 169, 8, 128, 2,171,145,155,141,177,187,187,2,152,2,8,134,199}; byte one[] = {8, 179, 138, 138, 177 ,2,146, 8, 134, 8, 194,2,1,14,199,7, 145, 8,131, 8,158,8,187,187,191}; byte two[] = {29,7,1,8, 169, 8, 128, 2,171,145,155,141,177,187,187,2,152,2,8,134,199, 2, 2, 8, 179, 138, 138, 177 ,2,146, 8, 134, 8, 194,2,1,14,199,7, 145, 8,131, 8,158,8,187,187,191}; byte* numbers[3] = {zero, one, two }; function(numbers[1], sizeof(numbers[1])/sizeof(byte)); //doesn't work as desired, always passes 2 as the length function(numbers[1], 25); //this works } void loop() { } void function( byte arr[], int len ) { Serial.print("length: "); Serial.println(len); for (int i=0; i<len; i++){ Serial.print("array element "); Serial.print(i); Serial.print(" has value "); Serial.println((int)arr[i]); } } In this code, I understand that sizeof(numbers1)/sizeof(byte)) doesn't work because numbers1 is a pointer and not the byte array value. Is there a way in this example that I can, at runtime, get at the length of a specific (runtime-determined) byte array within an array of pointers to bytes? Understand that I am limited to developing in c (or assembly) for an Arduino environment. Also open to other suggestions rather than the array of pointers to bytes. The overall objective is to organize lists of bytes which can be retrieved, with length, at runtime.

    Read the article

  • Assigning figure size to a figure with a given handle (MATLAB)

    - by James
    Hi, is there a way to assign the outerposition property of a figure to a figure with a given handle? For example, if I wanted to define a figure as say figure 1, I would use: figure(1) imagesc(Arrayname) % I.e. any array I can also change the properties of a figure using the code: figure('Name', 'Name of figure','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]); Is there a propertyname I can use to assign the outerposition property to the figure assigned as figure 1? The reason I am asking this is because I am using a command called save2word (from the MATLAB file exchange) to save some plots from a function I have made to a word file, and I want to limit the number of figures I have open as it does this. The rest of the code I have is: plottedloops = [1, 5:5:100]; % Specifies which loops I want to save GetGeometry = getappdata(0, 'GeometryAtEachLoop') % Obtains a 4D array containing geometry information at each loop NumSections = size(GetGeometry,4); %Defined by the fourth dimension of the 4D array for j = 1:NumSections for i = 1:plottedloops P = GetGeometry(:,:,i,j); TitleSize = 14; Fsize = 8; % Save Geometry scrsz = get(0,'ScreenSize'); %left, bottom, width height figure('Name', 'Geometry at each loop','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]); This specifies the figure name, dims etc., but also means multiple figures are opened as the command runs. % I have tried this, but it doesn't work: % figure(0, 'OuterPosition',[scrsz(1) scrsz(2) 700 700]); imagesc(P), title('Geometry','FontSize', TitleSize), axis([0 100 0 100]); text(20,110,['Loop:',num2str(i)], 'FontSize', TitleSize); % Show loop in figure text(70,110,['Section:',num2str(j)], 'FontSize', TitleSize);% Show Section number in figure save2word('Geometry at each loop'); % Saves figure to a word file end end Thanks

    Read the article

  • Android: Content goes off screen

    - by James
    He is an example of my TextView, which goes off the right side of the screen. I tried setting paddings and stuff, but nothing seemed to work. Any ideas? Here is my hierarchy, ScrollView,TableLayout <TableRow> <TextView android:layout_column="1" android:id="@+id/text_price" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textCapCharacters" android:padding="2dip" android:text="@string/game_price" /> <EditText android:id="@+id/gameprice" android:inputType="textCapCharacters" android:gravity="right" android:minWidth="120dip" /> </TableRow>

    Read the article

  • How do I access a JavaFX 1.3 static class member from Java?

    - by James
    I want to access a static JavaFX class member from Java using the Javafx reflection API. E.g. JavaFX code: var thing; class MyJavaFXClass { } Java code: private Object getThing() { FXClassType classType = FXContext.getInstance().findClass("mypackage.MyJavaFXClass"); // Get static member 'thing' from 'MyJavaFXClass' // <Insert Code Here> return thing; } What Java code do I need to access 'MyJavaFXClass.thing'? Note: I am using JavaFX 1.3 - I'm not sure if the reflection API is different here to earlier JavaFX versions.

    Read the article

  • GCC, functions, and pointer arguments, warning behaviour

    - by James Morris
    I've recently updated to a testing distribution, which is now using GCC 4.4.3. Now I've set everything up, I've returned to coding and have built my project and I get one of these horrible messages: *** glibc detected *** ./boxyseq: free(): invalid pointer: 0x0000000001d873e8 *** I absolutely know what is wrong here, but was rather confused as to when I saw my C code where I call a function which frees a dynamically allocated data structure - I had passed it an incompatible pointer type - a pointer to a completely different data structure. warning: passing argument 1 of 'data_A_free' from incompatible pointer type note: expected 'struct data_A *' but argument is of type 'struct data_B *' I'm confused because I'm sure this would have been an error before and compilation would never have completed. Is this not just going to make life more difficult for C programmers? Can I change it back to an error without making a whole bunch of other warnings errors too? Or am I loosing the plot and it's always been a warning?

    Read the article

  • How to pass data to another droid device when the other device isn't expecting it

    - by James Black
    I am working on an application and one feature that would make it really useful is the ability to share some information, but the other device may not be expecting the data to be sent. For example, if I am reading a really good book, and I realize that a friend may like it, I could use an application to send the data to him, so he could order the book from Amazon. But, since he isn't expecting the data, I would hate for the application to be polling a server every so often, as that will be needlessly draining the battery. Ideally it would be great if there was a way to make a phone call to the target device, send a data packet and end the call. If it could be done and prevent the phone from ringing, then it would be very useful to me. I am curious if there is some way to send data between devices without polling.

    Read the article

  • SH/BASH - Scan a log file until some text occurs, then exit. How??

    - by James
    Current working environment is OSX 10.4.11. My current script: #!/bin/sh tail -f log.txt | while read line do if echo $line | grep -q 'LOL CANDY'; then echo 'LOL MATCH FOUND' exit 0 fi done It works properly the first time, but on the second run and beyond it takes 2 occurrences of 'LOL CANDY' to appear before the script will exit, for whatever reason. And although I'm not sure it is specifically related, there is the problem of the "tail -f" staying open forever. Can someone please give me an example that will work without using tail -f? If you want you can give me a bash script, as OSX can handle sh, bash, and some other shells I think.

    Read the article

  • ASP.NET MVC Paging for a search form

    - by James Alexander
    I've read several different posts on paging w/ in MVC but none describe a scenario where I have something like a search form and then want to display the results of the search criteria (with paging) beneath the form once the user clicks submit. My problem is that, the paging solution I'm using will create <a href="..."> links that will pass the desired page like so: http://mysite.com/search/2/ and while that's all fine and dandy, I don't have the results of the query being sent to the db in memory or anything so I need to query the DB again. If the results are handled by the POST controller action for /Search and the first page of the data is rendered as such, how do I get the same results (based on the form criteria specified by the user) when the user clicks to move to page 2? Some javascript voodoo? Leverage Session State? Make my GET controller action have the same variables expected by the search criteria (but optional), when the GET action is called, instantiate a FormCollection instance, populate it and pass it to the POST action method (there-by satisfying DRY)? Can someone point me in the right direction for this scenario or provide examples that have been implemented in the past? Thanks!

    Read the article

  • Get Auto Increment value with MySQL query

    - by James Simpson
    I currently have a database with over 6 million rows and growing. I currently do SELECT COUNT(id) FROM table; in order to display the number to my users, but the database is getting large and I have no need to store all of those rows except to be able to show the number. Is there a way to select the auto_increment value to display so that I can clear out most of the rows in the database? Using LAST_INSERT_ID() doesn't seem to work.

    Read the article

  • What do the different columns (of letters) mean for the svn merge output?

    - by James
    The output of SVN merge has 4 columns of letters listed before the file name. I understand the meaning of the letters (mostly) but I can't find any information on the meanings of the columns and so only have a vague understanding based on context. Can anyone point me to the documentation on this? Based on context I've been able to infer that column: Is about text changes to a file Seems to be related to use of the svn ignore command on a folder (or maybe it's just properties of the file?) I've never seen a letter in the third column and hence I have no idea what it means. Might be tree conflicts? This is the one I'm mostly worried about because I don't know how to handle it yet.

    Read the article

  • What needs checking in for a Grails app?

    - by Bill James
    What parts of a Grails application need to be stored in source-control? Some obvious parts that are needed: grails-app directory test directory web-app directory Now we reach questions like: If we use a Grails plug-in (like gldapo), do we need to check in that plugin? Do Grails plugins install in the Grails directory, or your project? I'm not looking to start a religious war about .project, so please ignore that, but are there any "hidden" project files I need to worry about, along with the plugin issues? Converted to a community wiki, as new versions of Grails have changed some of these solutions, especially as regards plugins.

    Read the article

  • Regular expressions and matching question marks in URLs

    - by James P.
    I'm having trouble finding a regular expression that matches the following String. Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1 One problem is escaping the question mark. Java's pattern matcher doesn't seem to accept \? as a valid escape sequence but it also fails to work with the tester at myregexp.com. Here's what I have so far: ([a-zA-Z0-9])+;http://([a-zA-Z0-9./-]+);[0-9]+ Any suggestions?

    Read the article

  • BackgroundWorker and WebBrowser Control

    - by James Jeffery
    Is it possible/recommended to use background worker threads with the web browser control? I am creating a bot that searches google for keywords, then checks for sites in the first 10 pages to see if a site is ranked. The user can provide a maximum of 20 sites to check, and can use proxies. So ideally I'd like to have 5 threads working at once. Is it possible? I might have heard somewhere that there are problems with WebBrowser control and threads.

    Read the article

  • SEO: Where do I start?

    - by James
    Hi, I am primarily a software developer however I tend to delve in some web development from time to time. I have recently been asked to have a look at a friends website as they are wanting to improve their position in search engine results i.e. google/yahoo etc. I am aware there is no guarentee that their position will change, however, I do know there are techniques/ways to make your website more visible to search engine spiders and to consequently improve your position in the rankings i.e. performing SEO. Before I started looking at the SEO of the site I did the following prerequsite checks: Ran the website through the W3C Markup Validator and the W3C CSS Validator services. Looked through the markup code manually (check for meta tags etc) Performed a thorough cross browser compatibility test. From those checks, the following was evident: No SEO has been performed on the site before. The website has been developed using a visual editing tool such as dreamweaver (as it failed the validation services miserably and tables where being used everywhere!) The site is fairly cross browser compatibile (only some slight issues with IE8 which are easily resolved). How the site navigation is, isn't very search engine friendly (e.g. index.php?page=home) I can see right away a major improvement for SEO (or I at least think) would be to change the way the website is structured i.e. change from using dynamic pages such as "index.php?page=home" and actually having pages called "home.html". Other area's would be to add meta tags to identify keywords, and then sprinkling these keywords over the pages. As I am a rookie in this department, could anyone give me some advice on how I could perform thorough SEO on this website? Thanks in advance.

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >