Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
19th January 2006, 01:12 | #1341 | Link |
developer wannabe
Join Date: Nov 2001
Location: Brooklyn, NY
Posts: 1,211
|
I wouldn't take any of these rules too far. Exceptions and return values are just tools; good programmers simply choose the best one for the job. Worrying that you'll trigger an exception often enough that someone might call it "normal" is premature optimization, which we know is the root of all evil.
In this case, forcing the immediate caller of IJobProcessor.Setup to always test the return value works ok with our design, so no exception necessary. If IJobProcessor.Setup had dozens of possible entry points, using an exception would be better because it guarantees that someone in the call stack will do something about it. |
19th January 2006, 12:57 | #1342 | Link | ||
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
2 Doom9, Richard Berg, Mutant_Fruit
Quote:
Does and you know how does woking FileMapping/VirtualMemory/PageFile mechanism? Whe you trying to addreess to non-existing page in RAM processor will generate hardware interrupt (exception). Windows catch this interrupt, look for this page in PageFile, load it to the memory. So exceptions (sometimes) is a really fine to be used in normal program flow... Another sample - for ASP.NET programmers. When You invoke Response.End exception is trown, really, try this code Code:
try { Response.End(); } catch(Exception e) { Response.Write(e.ToString()); } </offtopic> But my sample IS NOT A NORMAL PROGRAM FLOW. If JobProcessor can't setup it mean:
Quote:
Code:
public interface IJobProcessor { void Setup(Job job); } public class JobProcessorAdapter { private IJobProcessor _proc; public JobProcessorAdapter(IJobProcessor p) { _proc = p; } public bool setup(Job job, out string error) { try { _proc.Setup(job); return true; } catch(Exception e) { error = e.Message; return false; } } } 2 All developers I have found another ugly code: Code:
MyForm f = new MyForm(); if(f.ShowDialog()==DialogResult.OK) { // Do something } Code:
using(MyForm f = new MyForm()) { if(f.ShowDialog(this)==DialogResult.OK) { // Do something } }
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
||
19th January 2006, 13:30 | #1343 | Link | |
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
Quote:
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
19th January 2006, 14:14 | #1344 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
Really, garbage collecter will be called only @ deficit memory. But you object can hold window handler or other handles, SqlConnections e.t.c. Read this: http://msdn.microsoft.com/library/de...ASP?frame=true http://msdn.microsoft.com/library/de...ASP?frame=true http://msdn.microsoft.com/library/de...asp?frame=true http://msdn.microsoft.com/library/de...classtopic.asp http://msdn.microsoft.com/library/de...pc10192000.asp
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS Last edited by dimzon; 19th January 2006 at 14:20. |
|
19th January 2006, 14:33 | #1345 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
DGDecode.dll problem
Dear Doom9.
MeGUI invokes DGDecode.dll direcly. It causes such problem: DgDecode.dll must be im MeGUI folder or be avaluable @ PATH enviroment string. In other hand DGDecode.dll MUST be @ avisynth\plugins folder in order to be able open scripts. So I want to propose solution - let's open d2v files via AviSynth temporaly script file.
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
19th January 2006, 15:00 | #1346 | Link | |
Registered User
Join Date: Apr 2004
Posts: 287
|
Quote:
But in this example assume the string "str_value" usually contains an integer, but could occasionally be null.... Code:
try { int result = Convert.ToInt32(str_value); } catch { int result = -1; //the string was null or contained invalid data } Code:
try { if(str_value != null) int result = Convert.ToInt32(str_value); } catch { int result = -1; //string contained invalid data }
__________________
Nothing to see here... |
|
19th January 2006, 15:06 | #1347 | Link | ||
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
@Mutant_Fruit
Quote:
Quote:
Code:
try { int result = Convert.ToInt32(str_value); } catch { int result = -1; //the string was null or contained invalid data } Code:
* You trying to setup JobProcessor for unsupported job * Job configuration is invalid * JobProcessor configuration is invalid * Another shit happens You MUST provide valid job You MUST provide valid configuaration So using exceptions in that case is good, is'nt it?
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
||
19th January 2006, 15:15 | #1348 | Link | ||||
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
Quote:
Quote:
Quote:
Quote:
The only thing that can go wrong in the setup is that the encoder cannot be found.. other than that, nothing can go wrong. It is the job of a jobdispatcher to send jobs to where they belong (yeah I know you hate the "is" type checks.. but they ensure this never ever happens). Similarly, it must not be possible to create invalid jobs.. it's the job of the jobcreator to make sure it returns a valid job, or nothing at all.. incidentally it's done that way.. jobs that would be invalid are not returned, instead you get a null value and it's not added to the queue.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
||||
19th January 2006, 15:20 | #1349 | Link | ||||
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
Quote:
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
||||
19th January 2006, 19:36 | #1350 | Link | |
Registered User
Join Date: Apr 2004
Posts: 287
|
Quote:
In your example, you are relying on an int being contained in the string (str_value MUST contain an int). Since the int MUST be there, an exception should be thrown if an int is not there (i.e. the string is null or contains text). In my example, if the string was null i could return a value indicating a fail result, but i wouldn't use an exception to let the program know that the string was null. Code:
bool ParseOutMyInt(string str_value) try { if(str_Value != null) result = Convert.ToInt32(str_value); else return false; // str_value is null, therefore not parsable //do rest of code and return true for success } catch { return false; // it failed somewhere in the code. }
__________________
Nothing to see here... |
|
19th January 2006, 20:21 | #1352 | Link | |||
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
Quote:
Where native resources are used, they should be properly cleaned up (but obviously nobody's perfect and I might have missed something.. but for instance the avi reader implements additional cleanup stuff because it goes native). Quote:
Since the risk is rather high that I'll do considerable parts of the refactoring in the future as well.. it really shouldn't be a cause to step on the brakes (which is what I feel you're doing.. everybody else here has commited some code for the current "broken" architecture). A major architectural overhaul is bound to take weeks if not months and I'm not the one to put development on hold just because things aren't very pretty right now.. they still work after all. Quote:
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|||
19th January 2006, 20:24 | #1353 | Link | |
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
Quote:
It's similar for the interfaces.. if I'm going to change them.. I'll have to change all classes implementing them because a CVS commit must not break compilation.. so it's my problem in the end and I can live with that.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
19th January 2006, 20:35 | #1354 | Link |
Registered User
Join Date: Apr 2004
Posts: 287
|
Just put the new version of the ContextHelp.xml file (written by LiFe) up on SF. Also made a few changes to the contexthelp code to account for the fact that linebreaks are picked up from the XML correctly.
And i moved some checkboxes slightly as there was a bit of overlap.
__________________
Nothing to see here... |
19th January 2006, 20:46 | #1355 | Link |
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
by the way, how would you like that I feed the cutlist to the avisynth based audio encoder? In the video world it's probably an array with two ints per line, a start and end frame. I figure just before encoding I open the AviSynth script, and put a trim line at the end of the script.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
19th January 2006, 22:25 | #1356 | Link | |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
Quote:
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
|
20th January 2006, 09:41 | #1357 | Link | |||||||||
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
Really IDisposable.Dispose performs cleanup(line finalizer) + remove futher finalizer invokation via GC.SuppressFinalize(). Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
And how about DllHell (one version @ AviSynth plugin folder, another @ DGIndex folder, third @ MeGUI folder). Using AVS-way you are ensure - AviSynth plugin folder version are used!
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|||||||||
20th January 2006, 09:44 | #1358 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
20th January 2006, 09:59 | #1359 | Link | |
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
Quote:
It is a bad idea to take an existing project and change everything to your coding style.. what if the person whose style it corresponds leaves in midstream? What if you don't see it through? Don't answer that.. I've run a site for almost 6 years now and there's been only one other person I've been able to completely rely on.. all others have come and gone.. so that's what I expect will happen with MeGUI.. it's the open source approach.. people come and go.. but I know I'll stick around. Making changes just because they fit somebody's coding style better are useless changes for a project.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
20th January 2006, 10:09 | #1360 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
Code:
private void mnuToolsSettings_Click(object sender, System.EventArgs e) { #if FULL SettingsForm sform = new SettingsForm(this.videoProfiles, this.audioProfiles, this.videoProfile.SelectedIndex, this.audioProfile.SelectedIndex); #else SettingsForm sform = new SettingsForm(); #endif sform.Settings = this.settings; if (sform.ShowDialog() == DialogResult.OK) { this.settings = sform.Settings; this.shutdownCheckBox.Checked = this.settings.Shutdown; this.saveSettings(); // this is here to prevent output extension mismatches when the x264 encoder is changed videoOutput.Text = changeVideoOutputExtention(videoOutput.Text); } }
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
Tags |
development, megui, not a help thread |
|
|