Daily Archives

Articles indexed Saturday March 20 2010

Page 1/89 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Ruby - Feedzirra and updates

    - by mplacona
    Hi, trying to get my head around Feedzirra here. I have it all setup and everything, and can even get results and updates, but something odd is going on. I came up with the following code: def initialize(feed_url) @feed_url = feed_url @rssObject = Feedzirra::Feed.fetch_and_parse(@feed_url) end def update_from_feed_continuously() @rssObject = Feedzirra::Feed.update(@rssObject) if @rssObject.updated? puts @rssObject.new_entries.count else puts "nil" end end Right, what I'm doing above, is starting with the big feed, and then only getting updates. I'm sure I must be doing something stupid, as even though I'm able to get the updates, and store them on the same instance variable, after the first time, I'm never able to get those again. Obviously this happens because I'm overwriting my instance variable with only updates, and lose the full feed object. I then thought about changing my code to this: def update_from_feed_continuously() feed = Feedzirra::Feed.update(@rssObject) if feed.updated? puts feed.new_entries.count else puts "nil" end end Well, I'm not overwriting anything and that should be the way to go right? WRONG, this means I'm doomed to always try to get updates to the same static feed object, as although I get the updates on a variable, I'm never actually updating my "static feed object", and newly added items will be appended to my "feed.new_entries" as they in theory are new. I'm sure I;m missing a step here, but I'd really appreciate if someone could shed me a light on it. I've been going through this code for hours, and can't get to grips with it. Obviously it should work fine, if I did something like: if feed.updated? puts feed.new_entries.count @rssObject = initialize(@feed_url) else Because that would reinitialize my instance variable with a brand new feed object, and the updates would come again. But that also means that any new update added on that exact moment would be lost, as well as massive overkill, as I'd have to load the thing again. Thanks in advance!

    Read the article

  • How to make SIMPLE C++ Makefile?

    - by befall
    Hi everyone, For a project, we are required to use a makefile to pull everything together, but our abhorrent professor never showed us how to. I only have ONE file, a3driver.cpp. The driver imports a class from a location "/user/cse232/Examples/example32.sequence.cpp". That's it, everything else is contained with the .cpp. How would I go about making a simple Makefile that creates an executable called "a3a.exe"?

    Read the article

  • complete, monospaced Unicode font?

    - by nachik
    I'm looking for a good programming font that lets me add comments and string literals in Unicode, usually Japanese and Chinese along with some Latin and Cyrillic languages. So far the situation seems to be "complete, monospace, free, pick 2" and Google is failing me with this (maybe because there are no good ones?). The best I found is Arial Unicode but it's not monospace, which is a big nuisance for me and the editors I use. Not to mention Python indentation when I'm coding Python. (Links, edits are welcome)

    Read the article

  • Rotating images + content - jQuery or MooTools?

    - by Lenwood
    I've found a feature on two different websites that I'd like to include on one of my web projects, but I can't figure out how they're doing it. I think they're using either jQuery or mootools, but I'm not sure. http://www.x-plane.com/index_desktop.html I'm new here so I don't have the reputation to post the other link, but if you do a Google search for "Andrews Institute of Orthopaedics" its the top result. I'll see if I can answer a few questions to earn my keep. The thing that I like about these is that the images and text (including links) are all rotated together. I've done a few web searches related to cycle, rotate and slide but it's not coming together for me. Can anyone give me a nudge in the right direction?

    Read the article

  • how to rethrow same exception in sql server

    - by Shantanu Gupta
    I want to rethrow same exception in sql server that has been occured in my try block. I am able to throw same message but i want to throw same error. BEGIN TRANSACTION BEGIN TRY INSERT INTO Tags.tblDomain (DomainName, SubDomainId, DomainCode, Description) VALUES(@DomainName, @SubDomainId, @DomainCode, @Description) COMMIT TRANSACTION END TRY BEGIN CATCH declare @severity int; declare @state int; select @severity=error_severity(), @state=error_state(); RAISERROR(@@Error,@ErrorSeverity,@state); ROLLBACK TRANSACTION END CATCH RAISERROR(@@Error, @ErrorSeverity, @state); This line will show error, but i want functionality something like that. This raises error with error number 50000, but i want erron number to be thrown that i am passing @@error, I want to capture this error no at frontend i.e. catch (SqlException ex) { if ex.number==2627 MessageBox.show("Duplicate value cannot be inserted"); } I want this functionality. which can't be achieved using raiseerror. I dont want to give custom error message at back end.

    Read the article

  • dcommit to SVN in 1 commit after cherry-picking in git

    - by DJ
    I would like to know if there is a clean way to do git-svn dcommit of multiple local commits as 1 commit into subversion. The situation that I have is I am cherry picking some bug fixes changes from our trunk into the maintenance branch. The project preference is to have the bug fixes to be committed as 1 commit in subversion, but I would like to keep the history of changes that I had cherry-picked on my local git for references. Currently what I do is to do all cherry-picking on branch X and then do a squash merge into new branch Y. The dcommit will then be done from branch Y. Is there a better way to do it without using an intermediary branch?

    Read the article

  • Can I override task :environment in test_helper.rb to test rake tasks?

    - by Michael Barton
    I have a series of rake tasks in a Rakefile which I'd like to test as part of my specs etc. Each task is defined in the form: task :do_somthing => :environment do # Do something with the database here end Where the :environment task sets up an ActiveRecord/DataMapper database connection and classes. I'm not using this as part of Rails but I have a series of tests which I like to run as part of BDD. This snippet illustrates how I'm trying to test the rake tasks. def setup @rake = Rake::Application.new Rake.application = @rake load File.dirname(__FILE__) + '/../../tasks/do_something.rake' end should "import data" do @rake["do_something"].invoke assert something_in_the_database end So my request for help - is it possible to over-ride the :environment task in my test_helper.rb file so I my rake testing interacts with the my test database, rather than production? I've tried redefining the task in the helper file, but this doesn't work. Any help for a solution would be great, as I've been stuck on this for the past week.

    Read the article

  • What could be causing my Ghostscript to fail

    - by simplr
    When I run ps2pdf I get the following error messages: norman@host:~$ ps2pdf test.ps test.pdf While reading gs_dbt_e.ps: ERROR: /syntaxerror in -file- Operand stack: (gs_cidfm.ps) 1 --nostringval-- Execution stack: %interp_exit --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- --nostringval-- Dictionary stack: --dict:928/1123(G)-- --dict:0/20(G)-- --dict:74/200(L)-- --dict:928/1123(G)-- --dict:8/8(G)-- --dict:1/1(G)-- Current allocation mode is global Current file position is 4623 norman@host:~$ I have tried re-installing gs and gs-esp without affect. Files test.ps, gs_dbt_e.ps and gs_cidfm.ps all checked against a working system as being good. Regardless of what postscript file I try to convert, the "Current file position is 4623" remains exactly the same. The host is running Ubuntu 7.04. Any suggestions as to what I should re-install will be much appreciated.

    Read the article

  • Synchronizing audio and video using MP4Box / ffmpeg to concatenate files

    - by jdl2003
    I have two H.264 encoded MPEG-4 files that I need to concatenate. I have been using MP4Box for this task by first ensuring the files are encoded identically (even went so far as to compare output from h264_parse on their video tracks) and then concatenating with this command: MP4Box -cat file1.mp4 -cat file2.mp4 output_file.mp4 This works and the output file is playable, but on playback in Quicktime or VLC the second video's audio starts too soon, making the entire second part of the concatenated file out of sync. I have tried reencoding the output through ffmpeg with -vcodec copy and -acodec copy but the sync issue persists. I have also tried converting to MPEG-2 format first, concatenating with a simple cat file1.mpg file2.mpg > output.mpg and reencoding the result with ffmpeg. This was even worse. I know that I can pass commands to MP4Box to adjust the start time of the audio track, but I am trying to do this programmatically for any input video (in the same encoding of course). I am looking for possible solutions that would not require human intervention / manual adjustments. Or, at least, an understanding of what is happening to make the second part of the concatenated video go out of sync.

    Read the article

  • Unusual Restart

    - by Nikit Batale
    I am currently running Windows XP Professional on my computer. My configuration is Intel Dual Core 3.00 GHz, 512 MB RAM, 160 GB HDD. Sometimes, the computer just restarts without any particular reason. After restarting, I get an error report, "Windows has just recovered from a serious error." Such incidents happen once in 5-6 days. I don't face any other problems apart from this. Also, I don't face this problem in Ubuntu Karmic Koala though.

    Read the article

  • PROBLEM WITH FPDF

    - by user297801
    Hello i'm trying to create a report using FPDF from a website using php, see i need to put a signature line at the en of the report, but I don't know how, can you help me??

    Read the article

  • SQLiteQueryBuilder.buildQuery not using selectArgs?

    - by user297468
    Alright, I'm trying to query a sqlite database. I was trying to be good and use the query method of SQLiteDatabase and pass in the values in the selectArgs parameter to ensure everything got properly escaped, but it wouldn't work. I never got any rows returned (no errors, either). I started getting curious about the SQL that this generated so I did some more poking around and found SQLiteQueryBuilder (and apparently Stack Overflow doesn't handle links with parentheses in them well, so I can't link to the anchor for the buildQuery method), which I assume uses the same logic to generate the SQL statement. I did this: SQLiteQueryBuilder builder = new SQLiteQueryBuilder(); builder.setTables(BarcodeDb.Barcodes.TABLE_NAME); String sql = builder.buildQuery(new String[] { BarcodeDb.Barcodes.ID, BarcodeDb.Barcodes.TIMESTAMP, BarcodeDb.Barcodes.TYPE, BarcodeDb.Barcodes.VALUE }, "? = '?' AND ? = '?'", new String[] { BarcodeDb.Barcodes.VALUE, barcode.getValue(), BarcodeDb.Barcodes.TYPE, barcode.getType()}, null, null, null, null); Log.d(tag, "Query is: " + sql); The SQL that gets logged at this point is: SELECT _id, timestamp, type, value FROM barcodes WHERE (? = '?' AND ? = '?') However, here's what the documentation for SQLiteQueryBuilder.buildQuery says about the selectAgs parameter: You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. ...but it isn't working. Any ideas?

    Read the article

  • Best way of storing an "array of records" at design-time

    - by smartins
    I have a set of data that I need to store at design-time to construct the contents of a group of components at run-time. Something like this: type TVulnerabilityData = record Vulnerability: TVulnerability; Name: string; Description: string; ErrorMessage: string; end; What's the best way of storing this data at design-time for later retrieval at run-time? I'll have about 20 records for which I know all the contents of each "record" but I'm stuck on what's the best way of storing the data. The only semi-elegant idea I've come up with is "construct" each record on the unit's initialization like this: var VulnerabilityData: array[Low(TVulnerability)..High(TVulnerability)] of TVulnerabilityData; .... initialization VulnerabilityData[0].Vulnerability := vVulnerability1; VulnerabilityData[0].Name := 'Name of Vulnerability1'; VulnerabilityData[0].Description := 'Description of Vulnerability1'; VulnerabilityData[0].ErrorMessage := 'Error Message of Vulnerability1'; VulnerabilityData[1]...... ..... VulnerabilityData[20]...... Is there a better and/or more elegant solution than this? Thanks for reading.

    Read the article

  • Can I use a class as an object in C# to create instances of that class?

    - by Troy
    I'm writing a fairly uncomplicated program which can "connect" to several different types of data sources including text files and various databases. I've decided to implement each of these connection types as a class inherited from an interface I called iConnection. So, for example, I have TextConnection, MySQLConnection, &c... as classes. In another static class I've got a dictionary with human-readable names for these connections as keys. For the value of each dictionary entry, I want the class itself. That way, I can do things like: newConnection = new dict[connectionTypeString](); Is there a way to do something like this? I'm fairly new to C# so I'd appreciate any help.

    Read the article

  • How to use gnlcomposition to concatenate video files?

    - by Hardy
    Hi All, I am trying to concatenate two video files with the gnonlin components of the gstreamer. The pipeline I am using is gst-launch-0.10 gnlcomposition { gnlfilesource name="s1" location="/home/s1.mp4" start=0 duration=2000000000 media-start=0 media-duration=2000000000 gnlfilesource name="s2" location="/home/s2.mp4" start=2000000000 duration=2000000000 media-start=0 media-duration=2000000000 } ! queue ! videorate ! progressreport name="Merging Progress" ! ffmpegcolorspace ! ffenc_mpeg4 ! ffmux_mp4 ! filesink location="/home/merge.mp4" As a result I am getting only the second file for the duration specified in the parameters. Tried several things and also searched on google but I could not figure out the problem with the above command. Can anyone point what i am doing wrong? Any other way of concatenating multiple files into one based on time is welcome too. Thanks

    Read the article

  • ksh: assigning function output to an array

    - by rcarson
    Why doesn't this work??? #!/bin/ksh # array testfunc() function testfunc { typeset -A env env=( one="motherload" ) print -r $env return 0 } testfunc # returns: ( one=motherload ) typeset -A testvar # segfaults on linux, memfaults on solaris testvar=$(testfunc) # segfaults on linux, memfaults on solaris print -r $testvar I am sure this has been asked before, but I am not sure what to search on and everything I have been trying to use for keywords is not bringing me any answers that relate to my problem.

    Read the article

  • Problem hosting WebBrowser control in an ATL app.

    - by Andrew Bucknell
    I have a legacy atl app that hosts a webbrowser control in an ATL window. I create an instance of the client to host the browser using the following sequence CComPtr<IOleObject> spOleObject; HRESULT hr = CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, ID_IOleObject,(void**)&spOleObject); spOleObject->SetClientSite(this); GetClientRect(&rcClient); hr = spOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, m_hWnd, &rcClient); hr = AtlAdvise(m_spWebBrowser, GetUnknown(), DIID_DWebBrowserEvents2, &m_dwCookie); CComVariant navvar(navurl); m_spWebBrowser->Navigate2(&navvar, NULL, NULL, NULL, NULL); This sequence works fine to create the initial browse window. The call to navigate2 works and if I look at the window via spy++ I have Shell Embedding - Shell DocObject View - Internet Explorer_Server. When a popup occurs (detected through NewWindow3) I launch a new window and execute the same code sequence for the new window. In the popup window the navigate2 doesnt work, and when I look at this new window in spy++ I just have Shell Embedding. I get the same problem even if I instantiate the popup window on startup, so its not related to NewWindow3 at all - it seems the second instance of the web control isnt instantiating even though all the calls return S_OK. This sequence worked fine under IE7 but now I am using IE8 and the popup window isnt working. There is clearly something I am missing but I cant guess what it may be. Any suggestions would be incredibly helpful.

    Read the article

  • Return automatic download JQuery Ajax Call

    - by krio
    I use the Ajax JQuery command to call a PHP script that generates a CSV file and returns a link to that file for the user to download. I would like to make this more user friendly by automatically starting the download so the user sees the browsers "Save or Open" window instead of having to click the download link. I'm guessing I need to somehow change the headers in the Ajax success callback function?? I'm not really sure what I should be titling my searches or even if this is possible. Thanks!

    Read the article

  • Adding C++ Object to Objective-C Class

    - by Winder
    I'm trying to mix C++ and Objective-C, I've made it most of the way but would like to have a single interface class between the Objective-C and C++ code. Therefore I would like to have a persistent C++ object in the ViewController interface. This fails by forbidding the declaration of 'myCppFile' with no type: #import <UIKit/UIKit.h> #import "GLView.h" #import "myCppFile.h" @interface GLViewController : UIViewController <GLViewDelegate> { myCppFile cppobject; } @end However this works just fine in the .mm implementation file (It doesn't work because I want cppobject to persist between calls) #import "myCppFile.h" @implementation GLViewController - (void)drawView:(UIView *)theView { myCppFile cppobject; cppobject.draw(); }

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >