Daily Archives

Articles indexed Sunday April 25 2010

Page 15/72 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • gcc std=gnu++0x option

    - by Neeraj
    Hi everyone, I need to compile a C++ code that uses std=gnu++0x option to the g++ compiler in the Makefile.am , As this option is compatible only with gcc 4.3 and above, the build crashes on my machine where i have gcc 4.2. What are my alternatives ? I tried removing that option from the Makefile.am but that reports some other error. Do i need to install gcc 4.3 or above? How can I do it in ubuntu hardy through apt-get ? Thanks.

    Read the article

  • Getter/Setter from separate class file in Java

    - by Crystal
    I'm new to Java and for a HW assignment, we had to create a Person class that has a constructor, getter/setter for the attributes of firstName, lastName, phone. That is in a separate file from an old HW assignment (Person.java). Now we have to use that Person class in our new HW assignment (LoanApplication.java). So if one of the attributes is private Person client do I need to create getter/setters or a constructor again? Otherwise, how does each LoanApplicaiton instance know which Person attribute it is to go with? How does the JVM know that it can use the Person.class even though my LoanApplicaiton.class does not extend Person.class? Thanks.

    Read the article

  • WYSIHAT 'resonds_to_parent" undefined method - Ruby on Rails

    - by bgadoci
    I just successfully installed WysiHat in my rails blog. Seems that the 'add a picture' feature is not working. It successfully allows me to find and select a picture from my desktop but upon clicking save, it does nothing. I also have Paperclip successfully installed and can attach images to records outside the WYSIHAT form field. Any ideas? (let me know if I need to post any code). Also, WysiHat-engine uses facebox, not sure if that is relevant. UPDATE: Added Server Log, looks like paperclip is saving it so not sure what else is going wrong. Processing PostsController#update (for 127.0.0.1 at 2010-04-23 16:42:14) [PUT] Parameters: {"commit"=>"Update", "post"=>{"body"=>"<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>", "title"=>"Rails Code for Search"}, "authenticity_token"=>"hndm6pxaPLfgnSMFAmLDGNo86mZG3XnlfJoNOI/P+O8=", "id"=>"105"} Post Load (0.2ms) SELECT * FROM "posts" WHERE ("posts"."id" = 105) Post Update (0.3ms) UPDATE "posts" SET "updated_at" = '2010-04-23 21:42:14', "body" = '<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>' WHERE "id" = 105 [paperclip] Saving attachments. Redirected to http://localhost:3000/posts/105 Completed in 12ms (DB: 0) | 302 Found [http://localhost/posts/105] UPDATE 2 I installed ImageMagic and now I get the following error. Processing WysihatFilesController#index (for 127.0.0.1 at 2010-04-23 23:27:57) [GET] Parameters: {"editor"=>"post_body_editor"} WysihatFile Load (0.3ms) SELECT * FROM "wysihat_files" Rendering wysihat_files/index Rendered wysihat_files/_form (1.9ms) Completed in 4ms (View: 3, DB: 0) | 200 OK [http://localhost/wysihat_files/?editor=post_body_editor] Processing WysihatFilesController#create (for 127.0.0.1 at 2010-04-23 23:28:09) [POST] Parameters: {"commit"=>"Save changes", "wysihat_file"=>{"file"=>#<File:/var/folders/F3/F3ovLEb1EMW4aZ5nsRvRlU+++TI/-Tmp-/RackMultipart20100423-43326-1mzeb3s-0>}, "authenticity_token"=>"IHF9Ghz6gYuAeNOUYhna+O0A4WrDbm4iha4Tsavu97o="} NoMethodError (undefined method `responds_to_parent' for #<WysihatFilesController:0x10352a2c0>): vendor/gems/wysihat-engine-0.1.12/app/controllers/wysihat_files_controller.rb:10:in `create' Rendered rescues/_trace (25.2ms) Rendered rescues/_request_and_response (0.3ms) Rendering rescues/layout (internal_server_error) Update 3 After reading a comment below I am thinking that perhaps I am missing something in my Post model. Here is the code for the model. class Post < ActiveRecord::Base has_attached_file :photo validates_presence_of :body, :title has_many :comments, :dependent => :destroy has_many :tags, :dependent => :destroy has_many :ugtags, :dependent => :destroy has_many :votes, :dependent => :destroy belongs_to :user after_create :self_vote def self_vote # I am assuming you have a user_id field in `posts` and `votes` table. self.votes.create(:user => self.user) end cattr_reader :per_page @@per_page = 10 end

    Read the article

  • nginx-tornado-django request timeout

    - by Xie
    We are using nginx-tornado-django to provide web services. That is, no web page frontend. The nginx server serves as a load-balancer. The server has 8 cores, so we launched 8 tornado-django processes on every server. Memcached is also deployed to gain better performance. The requests per day is about 1 million per server. We use MySQL as backend DB. The code is tested and correct. Our profiling shows that normally every request are processed within 100ms. The problem is, we find that about 10 percent of the requests suffers from time-out issue. Many requests didn't even reach tornado. I really don't have much experience on tuning of nginx/tornado/MySQL. Right now I don't have a clue on what is going wrong. Any advise is appreiciated.

    Read the article

  • ASMX Web Services with SOAP Extension

    - by digitall
    I am in the process of setting up a web service for an external client to connect to my client's application and update some information. I went the ASMX route (the rest of the application runs on WCF) because I knew the external client could be very difficult to deal with and I was trying to keep everything as simple as possible. They also aren't a .Net shop which makes things worse. After getting the service setup for them I provided the ASMX URL for them to see how to format the SOAP headers/message content. They have since come back and told me their tool is unable to send them in the format required by .Net and I can either come up with a different way to accept messages or we have to go with FTP. Based on this I have been researching how to intercept their message, reformat it the way my service requires it (which means adding two lines), and then let it process. This path led me to SOAP Extensions which I have been trying to work with but can't seem to figure out. When I have my sample application call the web service from the generated code Add Web Reference provides everything works great until I add in my extension. All it currently does is override ChainStream setting an internal stream equal to the one being passed in and returning a new stream, like this: private Stream newStream = null; private Stream oldStream = null; public override Stream ChainStream(Stream stream) { this.oldStream = stream; this.newStream = new MemoryStream(); return newStream; } I also override ProcessMessage and in it take the contents of oldStream and set newStream equal to that and then write to a different stream with an XmlWriter. I take that new stream and using a StreamReader read it into a string, with the end goal being manipulating it here and setting newStream (which is being used by ChainStream) equal to the contents of this. Here is that piece: public override void ProcessMessage(SoapMessage message) { switch (message.Stage) { case SoapMessageStage.BeforeDeserialize: this.Process(); break; default: break; } } private void Process() { this.newStream.Position = 0L; XmlTextReader reader = new XmlTextReader(this.oldStream); MemoryStream outStream = new MemoryStream(); using (XmlWriter writer = XmlWriter.Create(outStream)) { do { writer.WriteNode(reader, true); } while (reader.Read()); writer.Flush(); } outStream.Seek(0, SeekOrigin.Begin); StreamReader streamReader = new StreamReader(outStream); string message = streamReader.ReadToEnd(); newStream = outStream; newStream.Seek(0, SeekOrigin.Begin); streamReader.Close(); } By running this, which seems to me like it would be fine, my test application gets a 400 Bad Request back from the service. If I either don't use the extension or I don't do anything in ProcessMessage everything seems fine. Any suggestions to this? As a side note, once I get this working with the generated code from the WSDL I will be moving to a WebRequest to try sending the message to the service. Currently that bombs out with a 415 Unsupported Media Type response. I'm trying to keep this post to one question but if anyone has any tips with using a WebRequest to connect to an ASMX service it would be much appreciated!

    Read the article

  • Ripping a CD to mp3 in C# - third party component or api out there?

    - by Jonathan Williamson
    We're working on a project that requires the ripping of audio tracks from CDs to MP3s (ideally also retrieving the track information from CDDB or similar). More background information: Various music labels send us CDs of music which we then deliver to people via an online delivery system. We're looking at automating the process of converting those CDs into MP3s with full track information where possible. We want to produce a simple desktop application that allows a member of editorial staff to setup the information about the new music we receive. To streamline the process we'd like to include the ripping of the audio and retrieval of the track information.

    Read the article

  • User reactions to WYSIWYM

    - by David
    I am trying to decide between a WYSIWYG editor (e.g. TinyMCE, CKEditor) and a WYSIWYM (What You See Is What You Mean) editor (e.g. WMD) for my web application. There is a thread on stackoverflow that compares the two approaches. I would like to know how users, particularly computer novices, have reacted to WYSIWYM editors in deployed web applications. It could be that computer novices are confused by WYSIWYM editors, preferring the immediacy of WYSIWYG; but is that born out in real-world applications? It's not theory I'm asking about here, but empirical evidence of the acceptance or otherwise of WYSIWYM.

    Read the article

  • COM Exceptions in C#

    - by Yaron Naveh
    I am consuming a cpp COM object from c# code. My c# code looks like this: try { var res = myComServer.GetSomething(); } catch (Exception e) { } However the exception never contains any of the details I set in cpp, in particular my error message. In my cpp side I have followed several examples I have found on the web: ... ICreateErrorInfo *pcerrinfo; IErrorInfo *perrinfo; HRESULT hr; hr = CreateErrorInfo(&pcerrinfo); pcerrinfo->SetDescription(L"C++ Exception"); hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID FAR*) &perrinfo); if (SUCCEEDED(hr)) { SetErrorInfo(0, perrinfo); perrinfo->Release(); } pcerrinfo->Release(); return E_FAIL; // E_FAIL or other appropriate failure code ... Am I missing anything? Is there anything else that could affect this, like marshaling, the interop creation or attributes of the com server itself?

    Read the article

  • Difficulty porting raw PCM output code from Java to Android AudioTrack API.

    - by IndigoParadox
    I'm attempting to port an application that plays chiptunes (NSF, SPC, etc) music files from Java SE to Android. The Android API seems to lack the javax multimedia classes that this application uses to output raw PCM audio. The closest analog I've found in the API is AudioTrack and so I've been wrestling with that. However, when I try to run one of my sample music files through my port-in-progress, all I get back is static. My suspicion is that it's the AudioTrack I've setup which is at fault. I've tried various different constructors but it all just outputs static in the end. The DataLine setup in the original code is something like: AudioFormat audioFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100, 16, 2, 4, 44100, true ); DataLine.Info lineInfo = new DataLine.Info( SourceDataLine.class, audioFormat ); DataLine line = (SourceDataLine)AudioSystem.getLine( lineInfo ); The constructor I'm using right now is: AudioTrack = new AudioTrack( AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT, AudioTrack.getMinBufferSize( 44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT ), AudioTrack.MODE_STREAM ); I've replaced constants and variables in those so they make sense as concisely as possible, but my basic question is if there are any obvious problems in the assumptions I made when going from one format to the other.

    Read the article

  • How to run unittest under pydev for Django?

    - by photon
    I configured properties for my django project under pydev. I can run the django app under pydev or under console window. I can also run unittest for app under console window. But I have problems to run unittest under pydev. I guess it's something related to run configurations of pydev, so I made several trials, but with no success. Once I got messages like this: ImportError: Could not import settings 'D:\django_projects\MyProject' (Is it on sys.path? Does it have syntax errors?): No module named D:\django_projects\MyProject ERROR: Module: MyUnittestFile could not be imported. Another time I got messages like this: ImportError: Could not import settings 'MyProject.settngs' (Is it on sys.path? Does it have syntax errors?): No module named settngs 'ERROR: Module: MyUnittestFile could not be imported. I use pydev 1.5.6 on eclipse and windows xp. Any ideas for this problem?

    Read the article

  • Android Bottombar with two buttons having different backgrounds and a common background for two butt

    - by cppdev
    Hi, I have a linear layout in my main.xml which has a listview. Now I want to create a bottom bar below listview. Bottombar has a background image and two buttons with their individual background images. I want to put these two buttons on common background image. I have read that this can be achieved using FrameLayout. But since I am using LinearLayout as base layout in my main.xml, is there any way to this design using linearlayout ?

    Read the article

  • How to mkdir only if a dir does not already exist?

    - by Spike Williams
    I am writing a script to run under the korn shell on AIX. I'd like to use the mkdir command to create a directory. But the directory may already exist, in which case I don't want to do anything. So I want to either test to see that the directory doesn't exist, or suppress the "File exists" error that mkdir throws when it tries to create an existing directory. Any thoughts on how best to do this?

    Read the article

  • function.array-diff problems!

    - by SKY
    Hi, im currently getting these error on my site: Warning: array_keys() [function.array-keys]: The first argument should be an array on line 43 Warning: Invalid argument supplied for foreach() on line 44 Warning: array_diff() [function.array-diff]: Argument #1 is not an array on line 47 Warning: array_diff() [function.array-diff]: Argument #1 is not an array on line 48 And the source are: 42. $tmp = $this->network->get_user_follows($this->user->id); 43. $tmp = array_keys($tmp->followers); 44. foreach($tmp as &$v) { $v = intval($v); } 45. $tmp2 = array_keys($this->network->get_group_members($g->id)); 46. foreach($tmp2 as &$v) { $v = intval($v); } 47. $tmp = array_diff($tmp, $tmp2); 48. $tmp = array_diff($tmp, array(intval($this->user->id))); I want to know what is the problem and how i fix it. Thanks!

    Read the article

  • what is the wrong with this code"length indicator implementation" ?

    - by cj
    Hello, this is an implementation of length indicator field but it hang and i think stuck at a loop and don't show any thing. // readx22.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream" #include "fstream" #include "stdio.h" using namespace std; class Student { public: string id; size_t id_len; string first_name; size_t first_len; string last_name; size_t last_len; string phone; size_t phone_len; string grade; size_t grade_len; void read(fstream &ven); void print(); }; void Student::read(fstream &ven) { size_t cnt; ven >> cnt; id_len=cnt; id.reserve( cnt ); while ( -- cnt ) { id.push_back( ven.get() ); } ven >> cnt; first_len=cnt; first_name.reserve( cnt ); while ( -- cnt ) { first_name.push_back( ven.get() ); } ven >> cnt; last_len=cnt; last_name.reserve( cnt ); while ( -- cnt ) { last_name.push_back( ven.get() ); } ven >> cnt; phone_len=cnt; phone.reserve( cnt ); while ( -- cnt ) { phone.push_back( ven.get() ); } ven >> cnt; grade_len=cnt; grade.reserve( cnt ); while ( -- cnt ) { grade.push_back( ven.get() ); } } void Student::print() { // string::iterator it; for ( int i=0 ; i<id_len; i++) cout << id[i]; } int main() { fstream in; in.open ("fee.txt", fstream::in); Student x; x.read(in); x.print(); return 0; } thanks

    Read the article

  • objective-c EXC_BAD_ACCESS in my code...

    - by Mark
    I'm new to objective-c and Im trying to write a little sample app that gets some XML from a remote server and outputs it to the console, but when I do it I get a EXC_BAD_ACCESS which I dont understand: NSString *FeedURL = @"MYURLGOESHERE"; NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:FeedURL]]; NSURLResponse *resp = nil; NSError *err = nil; NSData *response = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &resp error: &err]; NSString *theString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; NSLog(@"Response: %@", theString);]; [resp release]; [err release]; When I comment out the [resp release] line I dont get it anymore, can someone please explain this to me :) Thanks

    Read the article

  • How to shutdown local tomcat server when closing browser window?

    - by agez
    Hi, I hava a web app running on a local tomcat server. When the user starts the app (via desktop shortcut) the server starts and the app is opened in a browser window. But when the user just clicks on the close button to stop the application the server is still running in the background - that's annoying. I tried to utilize the "unonload" and "onbeforeunload" events from javascript but unfortunately these events are also fired on some other requests in the app. So I can't use them, except I do a lot of refactoring. Does anyone have an idea for a possible solution? Btw, what I find interesting is the behaviour of Visual Studio when debugging a web application. When I close the browser window Visual Studio also gets a trigger to stop debug mode. So it seems it somehow notices the close event of the browser window, which would be exactly what I need. But I don't know how they do it... Cheers, Helmut

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >