Search Results

Search found 310 results on 13 pages for 'joseph garvin'.

Page 6/13 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • migrating simple rails database to mysql

    - by joseph-misiti
    i am interested in creating a rails app with a mysql database. i am new to rails and am just trying to start creating something simple: rails -d mysql MyMoviesSQL cd MyMoviesSQL script/generate scaffold Movies title:string rating:integer rake db:migrate i am seeing the following error: rake aborted! NoMethodError: undefined method `ord' for 0:Fixnum: SET NAMES 'utf8' if i do a trace: ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! NoMethodError: undefined method ord' for 0:Fixnum: SET NAMES 'utf8' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:inlog' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in execute' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:599:inconfigure_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:594:in connect' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:203:ininitialize' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:in new' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:75:inmysql_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in send' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:innew_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in checkout_new_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:incheckout' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in loop' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:incheckout' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:incheckout' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:inretrieve_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in retrieve_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:inconnection' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:435:in initialize' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:innew' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in up' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:inmigrate' /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116 /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:insynchronize' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:inload' /usr/bin/rake:19 here are my versions: rails - 2.3.5 ruby - 1.8.6 gem list * LOCAL GEMS * actionmailer (2.3.5, 1.3.6) actionpack (2.3.5, 1.13.6) actionwebservice (1.2.6) activerecord (2.3.5, 1.15.6) activeresource (2.3.5) activesupport (2.3.5, 1.4.4) acts_as_ferret (0.4.1) capistrano (2.0.0) cgi_multipart_eof_fix (2.5.0) daemons (1.0.9) dbi (0.4.3) deprecated (2.0.1) dnssd (0.6.0) fastthread (1.0.1) fcgi (0.8.7) ferret (0.11.4) gem_plugin (0.2.3) highline (1.2.9) hpricot (0.6) libxml-ruby (0.9.5, 0.3.8.4) mongrel (1.1.4) needle (1.3.0) net-sftp (1.1.0) net-ssh (1.1.2) rack (1.0.1) rails (2.3.5) rake (0.8.7, 0.7.3) RedCloth (3.0.4) ruby-openid (1.1.4) ruby-yadis (0.3.4) rubygems-update (1.3.6) rubynode (0.1.3) sqlite3-ruby (1.2.1) termios (0.9.4) also, if i need to add a patch to FixNum, can someone please tell which file to add the patch to. thanks for your help

    Read the article

  • Uploading multiple images through Tumblr API

    - by Joseph Carrington
    I have about 300 images I want to upload to my new Tumblr account, becuase my old wordpress site got hacked and I no longer wish to use wordpress. I uploaded one image a day for 300 days, and I'd like to be able to take these images and upload them to my tumblr site using the api. The images are currently local, stored in /images/. They all have the date they were uploaded as the first ten characters of the filename, (01-01-2009-filename.png) and I went to send this date parameter along as well. I want to be able to see the progress of the script by outputting the responses from the API to my error_log. Here is what I have so far, based on the tumblr api page. // Authorization info $tumblr_email = '[email protected]'; $tumblr_password = 'password'; // Tumblr script parameters $source_directory = "images/"; // For each file, assign the file to a pointer here's the first stumbling block. How do I get all of the images in the directory and loop through them? Once I have a for or while loop set up I assume this is the next step $post_data = fopen(dir(__FILE__) . $source_directory . $current_image, 'r'); $post_date = substr($current_image, 0, 10); // Data for new record $post_type = 'photo'; // Prepare POST request $request_data = http_build_query( array( 'email' => $tumblr_email, 'password' => $tumblr_password, 'type' => $post_type, 'data' => $post_data, 'date' => $post_date, 'generator' => 'Multi-file uploader' ) ); // Send the POST request (with cURL) $c = curl_init('http://www.tumblr.com/api/write'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($c); $status = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); // Output response to error_log error_log($result); So, I'm stuck on how to use PHP to read a file directory, loop through each of the files, and do things to the name / with the file itself. I also need to know how to set the data parameter, as in choosing multi-part / formdata. I also don't know anything about cURL.

    Read the article

  • rails paperclip and passenger `is not recognized by the 'identify' command`

    - by Joseph Silvashy
    When I upload a photo, my model fails validation, err well even without any validations I'm returned this error: /tmp/stream20100103-13830-ywmerx-0 is not recognized by the 'identify' command. and /tmp/stream20100103-13830-ywmerx-0 is not recognized by the 'identify' command. I'm confident this is not related to ImageMagick because I've removed any image processing from the uploading, also I've tried uploading different mime types, like .txt files and the such. Additionally, I found something that may work. A blog post claims that putting the following in my environment (in this case development.rb) Paperclip.options[:command_path] = "/opt/local/bin"

    Read the article

  • android: How to set a listener that fires when my ViewFlipper shows a new child

    - by Joseph Cheek
    Hi Android gurus, I have a ViewFlipper for which I want a listener to fire when the child displayed is changed. I have set an OnFocusChangeListener to the ViewFlipper but it never fires when I flip from child 0 to child 1 or vice-versa. The ViewFlipper contains two RelativeLayouts and I have tried setting OnFocusChangeListeners for those but I get a ClassCastException when I try to set it. Here's my code: RelativeLayout songsLayout = (RelativeLayout) findViewById(R.id.song_page_layout); songsLayout.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View view, boolean hasFocus) { showPopUp("View " + view.getId() + " now has focus: " + hasFocus); } } ); R.is.song_page_layout is one of my RelativeLayouts and showPopUp() is a function I use to show, well, popups. Does anyone have working code for some sort of trigger that fires when a ViewFlipper changes which child is displayed?

    Read the article

  • SQLSTATE 08001 error

    - by Joseph
    Hi all OUR SQL Server 2008 got freeze.and not able to connect the databse and we restrted the server(windows 2008). Even we were not able to login windows(Restrted via HP ILO). ANybody face this issue?and have a resolution. [165] ODBC Error: 0, Login timeout expired [SQLSTATE HYT00] [298] SQLServer Error: 258, Shared Memory Provider: Timeout error [258]. [SQLSTATE 08001] [382] Logon to server '(local)' failed (ConnUpdateJobActivity_NextScheduledRunDate) the above three error we got this time thanks in advance

    Read the article

  • API Failure Sqlite

    - by Joseph Anderson
    I ran the Windows 8 App Certification Kit on my app and it says it will fail because of Sqllite. Am I referencing code incorrectly or can I ignore this problem? Here is the response: Impact if not fixed: Using an API that is not part of the Windows SDK for Windows Store apps violates the Windows Store certification requirements. API __CppXcptFilter in msvcr110.dll is not supported for this application type. sqlite3.dll calls this API. API __clean_type_info_names_internal in msvcr110.dll is not supported for this application type. sqlite3.dll calls this API. API __crtTerminateProcess in msvcr110.dll is not supported for this application type. sqlite3.dll calls this API. API __crtUnhandledException in msvcr110.dll is not supported for this application type. sqlite3.dll calls this API. I am referencing this file: SQLite for Windows Runtime SQLite.WinRT, Version=3.7.14 C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\SQLite.WinRT\3.7.14\ In my Windows 8 Metro app using XAML.

    Read the article

  • Javascript Post Request like a Form Submit

    - by Joseph Holsten
    I'm trying to direct a browser to a different page. If I wanted a GET request, I might say document.location.href = 'http://example.com/q=a'; But the resource I'm trying to access won't respond properly unless I use a POST request. If this were not dynamically generated, I might use the HTML <form action="http://example.com/" method="POST"> <input type="hidden" name="q" value="a"> </form> Then I would just submit the form from the DOM. But really I would like JavaScript that allows me to say post_to_url('http://example.com/', {'q':'a'}); What's the best cross browser implementation? Edit I'm sorry I was not clear. I need a solution that changes the location of the browser, just like submitting a form. If this is possible with XMLHTTPRequest, it is not obvious. And this should not be asynchronous, nor use XML, so AJAX is not the answer.

    Read the article

  • UpdatePanel doesn't do partial-page update, and IsInAsyncPostBack is always false

    - by Joseph Anderson
    I'm attempting to use an UpdatePanel, but can't get partial-page updates to work. When I look at the ScriptManager's IsInAsyncPostBack property, it's always false. Here's a page that reproduces the issue. It has a ScriptManager, an UpdatePanel, a LinkButton within the update panel, and a Button wired up to the UpdatePanel via the Triggers collection. <%@ Page Language="C#" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString(); if (IsPostBack) Label1.Text += " - Postback!"; if (ScriptManager1.IsInAsyncPostBack) Label1.Text += " - Async!"; } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <ContentTemplate>Panel 1:<asp:Label runat=server ID=Label1 /><br /> <asp:LinkButton runat=server ID="LinkButton1" Text="Update!"></asp:LinkButton></ContentTemplate> <Triggers><asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /></Triggers> </asp:UpdatePanel> <asp:Button ID="Button1" Text="Refresh Panel 1" runat="server" UseSubmitBehavior=false /> </form> </body> </html> If I run this code and click on either of the buttons, I see "Panel 1:2/8/2010 3:38:41 PM - Postback!" I expected that clicking either button would cause a partial-page update for UpdatePanel1, that IsInAsyncPostBack would be true, and that " - Async!" would be appended to Label1. Any idea why IsInAsyncPostBack is always false?

    Read the article

  • C#/WPF: Print a ListView

    - by Joseph Melettukunnel
    Does anyone have an idea how to Print (A4) the Content of a ListView (e.g. with all the ColumnHeaders, fit to the Page-Width and without the Scrollbar)? I've found several old threads about this on stackoverflow, but no complete answer. Thank you. Cheers

    Read the article

  • How to use BeanTreeView?

    - by joseph
    Hello. I have read through whole platform.netbeans.org and I do not find how to add some instance to existing children. I can add static array of diagrams(created in addNotify()), but how to add new Diagram object to the Children? I want to add it from an action that I will create(not included in code). See the code: public class ExploirerTopComponent extends TopComponent implements ExplorerManager.Provider { ... ... ... public ExploirerTopComponent() { ... ... associateLookup (ExplorerUtils.createLookup(mgr, getActionMap())); mgr.setRootContext(new MyProjects());// setDisplayName ("Projects explorer"); } public class MyProjects extends AbstractNode { public MyProjects(MainProject obj) { super (new ProjectsChildren(), Lookups.singleton(obj)); setDisplayName ( obj.getName()); } public MyProjects() { super (new ProjectsChildren()); setDisplayName ("My projects"); } } . public class ProjectsChildren extends Children.Keys{ public ProjectsChildren() { } @Override protected Node[] createNodes(Object o) { MainProject obj = (MainProject) o; return new Node[] { new MyDiagrams() }; } @Override protected void addNotify() { Diagram[] d = new Diagram[3]; for (int i = 0; i < pr.length; i++) { pr[i] = new Diagram("digram"); } setKeys (pr); } }

    Read the article

  • Prevent checkins to SVN

    - by Joseph Mastey
    My team uses SVN for our software platform, and we create tags periodically to help keep module versions straight. Best practice, as I understand it, is not to modify a tag once it has been created. However, it seems that sometimes the temptation is too great and a modification is made to one of the tags. Is there a way to prevent these kinds of checkins, or at least make them a complete pain so that we can discourage them automatically? Thanks, Joe

    Read the article

  • What's the best way to create a Windows Mobile application with multiple screens in C#

    - by Joseph Earl
    I am creating a Windows Mobile Application in C# and Visual Studio 2008. The application will have 5-6 main 'screens'. There will also be bar (/area) with information (e.g. a title, whether the app is busy, etc) above the screens, and a toolbar (or similar control) below the screens with 5-6 buttons (with images) to change the active screen (i.e. the screens will share the top bar and toolbar) What is the best way to implement this? Use multiple forms, and just include the toolbar and top-bar in each Use a single form and something like the Tab control (but customised) to contain the screens Something else? Keeping in mind a) memory usage and b) time to switch screens. Thanks in advance. Any links, pointers etc are much appreciated.

    Read the article

  • cannot evaluate expression because a native frame is on top of the call stack and system.accessviolationexception

    - by Joseph
    I have this code using c#. public partial class MainForm : Form { private CvCapture VideoCapture; private IplImage frame; private IplImage imgMain; public MainForm() { InitializeComponent(); } private void btnVideo_Click(object sender, EventArgs e) { double vidWidth, vidHeight; try { VideoCapture = highgui.CvCreateCameraCapture(0); } catch (Exception except) { MessageBox.Show(except.Message); } if (btnVideo.Text.CompareTo("Start Video") == 0) { if (VideoCapture.ptr == IntPtr.Zero) { MessageBox.Show("badtrip ah!!!"); return; } btnVideo.Text = "Stop Video"; highgui.CvSetCaptureProperty(ref VideoCapture, highgui.CV_CAP_PROP_FRAME_WIDTH, 640); highgui.CvSetCaptureProperty(ref VideoCapture, highgui.CV_CAP_PROP_FRAME_HEIGHT, 480); highgui.CvQueryFrame(ref VideoCapture); vidWidth = highgui.cvGetCaptureProperty(VideoCapture, highgui.CV_CAP_PROP_FRAME_WIDTH); vidHeight = highgui.cvGetCaptureProperty(VideoCapture, highgui.CV_CAP_PROP_FRAME_HEIGHT); picBoxMain.Width = (int)vidWidth; picBoxMain.Height = (int)vidHeight; timerGrab.Enabled = true; timerGrab.Interval = 42; timerGrab.Start(); } else { btnVideo.Text = "Start Video"; timerGrab.Enabled = false; if (VideoCapture.ptr == IntPtr.Zero) { highgui.CvReleaseCapture(ref VideoCapture); VideoCapture.ptr = IntPtr.Zero; } } } private void timerGrab_Tick(object sender, EventArgs e) { try { frame = highgui.CvQueryFrame(ref VideoCapture); if (frame.ptr == IntPtr.Zero) { timerGrab.Stop(); MessageBox.Show("??"); return; } imgMain = cxcore.CvCreateImage(cxcore.CvGetSize(ref frame), 8, 3); picBoxMain.Image = highgui.ToBitmap(imgMain, false); cxcore.CvReleaseImage(ref imgMain); //cxcore.CvReleaseImage(ref frame); } catch (Exception excpt) { MessageBox.Show(excpt.Message); } } } The problem is after i break all and step through the debugger the program stops at a certain code. the code where it stops is here: frame = highgui.CvQueryFrame(ref VideoCapture); the error is that it says that cannot evaluate expression because a native frame is on top of the call stack. and then when i try to shift+F11 it. there is another error saying that system.accessviolationexception. the stack trace says that: at System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length) at CxCore.IplImage.get_ImageDataDb()

    Read the article

  • How to replace all instances of a particular value in a mysql database with another?

    - by Joseph
    I'm looking for a MySQL equivalent of what str_replace is for PHP. I want to replace all instances of one word with another, I want to run a query that will replace all "apples" with "oranges". The reason why: UPDATE fruits SET name='oranges' WHERE name='apples'; isn't going to work for my situation, is because I often times have multiple words in a table row separated by commas like: "apples, pears, pineapples". In this case I want just apples to be replaced by oranges and pear and pineapples to stay in tact. Is there any way to do this?

    Read the article

  • AppFabric Cache errors

    - by Joseph
    The AppFabric Cache in our production crashes almost every day, and is highly unstable. The below errors are logged: Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (Sufficient secondaries not present or they are in throttled state.) Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (The request did not find the primary.) AppFabric Caching service crashed.{Lease with external store expired: Microsoft.Fabric.Federation.ExternalRingStateStoreException: Lease already expired at Microsoft.Fabric.Data.ExternalStoreAuthority.UpdateNode(NodeInfo nodeInfo, TimeSpan timeout) at Microsoft.Fabric.Federation.SiteNode.PerformExternalRingStateStoreOperations(Boolean& canFormRing, Boolean isInsert, Boolean isJoining)} Could someone please provide me some inputs? This is a HA enabled cache environment with 3 cache hosts. All of them are running on Windows Server 2008 Enterprise Edition, and the SQL Server is used for config.

    Read the article

  • WPF TextBox Interceping RoutedUICommands

    - by Joseph Sturtevant
    I am trying to get Undo/Redo keyboard shortcuts working in my WPF application (I have my own custom functionality implemented using the Command Pattern). It seems, however, that the TextBox control is intercepting my "Undo" RoutedUICommand. What is the simplest way to disable this so that I can catch Ctrl+Z at the root of my UI tree? I would like to avoid putting a ton of code/XAML into each TextBox in my application if possible. The following briefly demonstrates the problem: <Window x:Class="InputBindingSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:loc="clr-namespace:InputBindingSample" Title="Window1" Height="300" Width="300"> <Window.CommandBindings> <CommandBinding Command="loc:Window1.MyUndo" Executed="MyUndo_Executed" /> </Window.CommandBindings> <DockPanel LastChildFill="True"> <StackPanel> <Button Content="Ctrl+Z Works If Focus Is Here" /> <TextBox Text="Ctrl+Z Doesn't Work If Focus Is Here" /> </StackPanel> </DockPanel> </Window> using System.Windows; using System.Windows.Input; namespace InputBindingSample { public partial class Window1 { public static readonly RoutedUICommand MyUndo = new RoutedUICommand("MyUndo", "MyUndo", typeof(Window1), new InputGestureCollection(new[] { new KeyGesture(Key.Z, ModifierKeys.Control) })); public Window1() { InitializeComponent(); } private void MyUndo_Executed(object sender, ExecutedRoutedEventArgs e) { MessageBox.Show("MyUndo!"); } } }

    Read the article

  • How to spread changes in oriented graph?

    - by joseph
    Hello. I have oriented graph. Graph can be strongly connected. Every vertix can have a set of anything, for example letters. The set is user editable. Every vertix makes intersection of sets in previous vertices (only one step back). But now, there is problem: When I update set of one vertex, the change should expand to all vertices and uptate their intersection of sets of previous vertices. How to do every vertex have correct intersection after update of any vertex? Restriction: algorithm must avoid to stick in infinity. Any idea how to solve it?

    Read the article

  • Rails Plugin - Install as Plugin or Install As Gem

    - by Joseph Misiti
    Hey guys, I am new to rails and have a question regarding the plugins. It seems there are two approaches you can take when using a third party plugin in a ROR App: 1) install a gem using sudo gem install GEM, and then "require" it in your rails project 2) install the plugin using script/generate plugin install PLUGIN. The plugin in code appears in your vendor directory and then you are good to go (sometimes, i could not get Devise working via this method). Since it appears both of these methods accomplish them same thing, why should I choose one method over the other. Thanks,

    Read the article

  • How to enable OutputCache with an IHttpHandler

    - by Joseph Kingry
    I have an IHttpHandler that I would like to hook into the OutputCache support so I can offload cached data to the IIS kernel. I know MVC must do this somehow, I found this in OutputCacheAttribute: public override void OnResultExecuting(ResultExecutingContext filterContext) { if (filterContext == null) { throw new ArgumentNullException("filterContext"); } // we need to call ProcessRequest() since there's no other way to set the Page.Response intrinsic OutputCachedPage page = new OutputCachedPage(_cacheSettings); page.ProcessRequest(HttpContext.Current); } private sealed class OutputCachedPage : Page { private OutputCacheParameters _cacheSettings; public OutputCachedPage(OutputCacheParameters cacheSettings) { // Tracing requires Page IDs to be unique. ID = Guid.NewGuid().ToString(); _cacheSettings = cacheSettings; } protected override void FrameworkInitialize() { // when you put the <%@ OutputCache %> directive on a page, the generated code calls InitOutputCache() from here base.FrameworkInitialize(); InitOutputCache(_cacheSettings); } } But not sure how to apply this to an IHttpHandler. Tried something like this, but of course this doesn't work: public class CacheTest : IHttpHandler { public void ProcessRequest(HttpContext context) { OutputCacheParameters p = new OutputCacheParameters { Duration = 3600, Enabled = true, VaryByParam = "none", Location = OutputCacheLocation.Server }; OutputCachedPage page = new OutputCachedPage(p); page.ProcessRequest(context); context.Response.ContentType = "text/plain"; context.Response.Write(DateTime.Now.ToString()); context.Response.End(); } public bool IsReusable { get { return true; } } }

    Read the article

  • LINQ to SQL - Tracking New / Dirty Objects

    - by Joseph Sturtevant
    Is there a way to determine if a LINQ object has not yet been inserted in the database (new) or has been changed since the last update (dirty)? I plan on binding my UI to LINQ objects (using WPF) and need it to behave differently depending whether or not the object is already in the database. MyDataContext context = new MyDataContext(); MyObject obj; if (new Random().NextDouble() > .5) obj = new MyObject(); else obj = context.MyObjects.First(); // How can I distinguish these two cases? The only simple solution I can think of is to set the primary key of new records to a negative value (my PKs are an identity field and will therefore be set to a positive integer on INSERT). This will only work for detecting new records. It also requires identity PKs, and requires control of the code creating the new object. Is there a better way to do this? It seems like LINQ must be internally tracking the status of these objects so that it can know what to do on context.SubmitChanges(). Is there some way to access that "object status"? Clarification Apparently my initial question was confusing. I'm not looking for a way to insert or update records. I'm looking for a way, given any LINQ object, to determine if that object has not been inserted (new) or has been changed since its last update (dirty).

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >