|
Normally, in .NET I create wrapper classes for all of my web methods.
[WebMethod]
public FooBarResult FooBar(FooBarParameters parameters){
FooBarResult result = new FooBarResult();
try{
... do work here
}
catch(Exception e1){
... Perform logic to determine how much of the exception you can return and
... assign that to the result object in a special errors property
}
}
While not perfect in any manner it lets me consistently write web methods and always know how the results are coming back. I do a lot of cross platform WS work which is a real pain because both the Java tools and the .NET tool behave differently. This pattern gives a small semblance of sanity.
|
|
|
|
|
Question doesn't make any sense.
GetOrganisation() will not be invoke unless there is a value for organisationId.
So there is no way to test in that method whether a client called it with a value or not.
If you are asking about client code that calls that method then a much more likely error scenario is a communication fault. Although it is possible to call the server such that it is unable to resolve the method that is unlikely to be a valid scenario and it isn't a scenario that will exist for long. And even then it is a problem with the client code.
|
|
|
|
|
Does anyone knows how can i get properties of an mp3 file? such as artist, album etc.
what class shold i use?
|
|
|
|
|
The best thing is to use a 3rd party library. TagLib#[^] is an open source library from Novell, and id3DotNet[^] is another open source library on SourceForge.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
thanks
I added the TAGLIB library but i cant find the specific class i need.
|
|
|
|
|
This example assumes the MP3 file has at least one artist in the tag.
TagLib.File tagFile = TagLib.File.Create (mp3Filename);
System.Console.WriteLine ("Album = {0}", tagFile.Album);
System.Console.WriteLine ("Artist = {0}", tagFile.AlbumArtists[0]); /ravi
|
|
|
|
|
Search here on CP: there are many projects here, going back to 2002, that demonstrate how to get meta-information from .mp3 files.
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
I want to write 1 extension method,it's purpose is convert 1 IEnumerable<T> to 1 ObservableCollection<T>, but i've error :
Error 5 The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
Here is my code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Data;
namespace BookStore.Helper
{
public static class ExtensionMethods
{
public static ObservableCollection<T> ToObservableCollection(this IEnumerable<T> source)
{
ObservableCollection<T> target = new ObservableCollection<T>();
foreach (T item in source)
target.Add(item);
return target;
}
}
}
|
|
|
|
|
You need to add <T> to the method name. Try this:
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> source)
{
ObservableCollection<T> target = new ObservableCollection<T>();
foreach (T item in source)
target.Add(item);
return target;
}
Hoep this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
|
I thought this could be much simpler: in the extension:
return new ObservableCollection<T>(source); No 'foreach' needed.
Full disclosure: my first several attempts at doing this using variations of 'Select' and 'Cast' led to stack-overflow errors: so I went a-hunting and found this on StackOverFlow[^].
So, vote the SO answerer up, not this 'gofer'
best, Bill
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
iam creatin c#4 wndows application
this appication creat work team meating & then send email to wrok tem members
database is published on internt not local becuase this application 'll be access from differnt people
my problem is when someone creat meating he may say it 'll repeated each week
so what i need too add new row in database for each meet week but the problem is that i can't do that from my application becasue i don't know when application open may be someone open appliction creat meet then close application & didn't open until he want to creat new meet
so i need something that work on pblished server that do that work check if new meet is new near send email to members & add new row in database
how can i do that
any help please
md_refay
|
|
|
|
|
Don't just post the same question everywhere: you waste time and effort.
Since you have posted this in Q&A[^], don't add it here as well.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
You can create a window service which will do whatever you want to do and run on sevrer Or SQL JOB
This service or job will run on server where you have database for this application.
In database you can take a flag for Repeated meetings.This service will check that flag and send the mails.
modified 11-Nov-11 4:04am.
|
|
|
|
|
Maybe it is a silly question. In my WPF application, there is a combobox with some item 0, -1,-2,, -3... It works ok for combobox.Text = "-3". however, if I set combobox.Text = "-1" or Combobox.Text = "-2", it display nothing. why?
I am using VS2008, and Windows 7.
|
|
|
|
|
Post your code. This makes zero sense.
|
|
|
|
|
Don't you really mean -1 sense or -2 sense?
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
thanks for reply. It is a very simple question. In Combobox, there are 10 items from -9 to 0; then I can use Combobox.Text= "-9" to "-3" and "0", however, I can't set it to "-1" or "-2". it always displays nothing. certainly, if I set combobox editable, it can display all numbers.
source code is very simple: comboBox.Text = "-1";
|
|
|
|
|
Did you miss my joke icon? I was having a (rather weak) go at sledge's "zero sense" comment.
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I meant your C# and XAML code. How are you populating the combobox, what kind of properties / styles does it have set, etc?
|
|
|
|
|
thanks all. It is just a test software, and now I use selecedindex instead of text property. and the problem is fixed.
|
|
|
|
|
OP + wit => rating += 5;
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
Have you considered posting this in the WPF[^] forum?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I am trying to launch csript as an administrator (the account logged in has admin rights). setting the startinfo.verb to runas does not work.
ProcessStartInfo p1 = new ProcessStartInfo();
p1.UseShellExecute = true;
p1.Verb = "runas";
p1.FileName = "cscript";
p1.Arguments = "I:\\WPKG\\wpkg.js /synchronize /quiet /nonotify";
Process p = new Process();
p.StartInfo = p1;
p.Start();
The only way I can get it to start with privileges is to manually set the username and password. However I cannot hardcode that information or put it into configurations. Is there any way to have the cmd elevate without the login info?
I have also tried adding using (System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate()) around the above code with no luck either.
|
|
|
|
|
There's a post[^] on the "Hey, Scripting Guy blog" that discusses running an elevated cscript.
Bastard Programmer from Hell
|
|
|
|