|
I've been playing with the RC on that VM for about a week now. It's really cool to finally get to toy around with Tasks and Parallel. But, truthfully, the custom enumerator I threw together came from toying around with Enumberable.Range. It only uses integer and the results it returns can be no longer than integers. So, I tried throwing a custom Range method that supported Long's together and that's what I adapted to quickly come up with that example. I took his point to be that he was trying to figure out how the PTL worked. So...
I'm very interested in seeing an article on the Prime Sieve you've got. It would be interesting to see if it could be adapted to use or work with PTL.
|
|
|
|
|
It probably will be a few more months before my article on primes gets finished.
I can tell you right now the parallel stuff will not be useful for it, multi-threading hardly helps at all here. The first step in my analysis is proving calculations are so fast (assuming a sieve) the job is bandwidth limited, not compute bound. So I optimized it with banding (locality of reference, cache efficiency), all on a single thread. Only then I set out to figure a way to get extra cores involved, and there hardly is any. IIRC a second thread yields no more than a few percents of extra speed, taking care of some initialization, as running the sieve itself is an inherently sequential operation.
|
|
|
|
|
Hi,
i need to get only title, author and lenght of mp3 file, how i can do this??
please help me!
|
|
|
|
|
You need to read id3 tags from the file.
|
|
|
|
|
|
A little researc using this information[^] should speed you on your way. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
Bangalore, March 11, 2010: Darwin’s reference to biological symbiosis involves two or more species that commit to a relationship and through their combined efforts and mutual collaborative interactions, both stand to gain success. In a similar vein, there can be no doubt that one of the hottest spaces in enterprise software today is collaboration. It’s no surprise collaboration is getting a lot of interest. The old processes for capturing, authoring and sharing information are stale and inefficient. As such, there is lot of room for achieving productivity improvements through improved user experience. This has been true for all software, but especially so in the enterprise software space where collaboration is essential for daily operation, where every ounce of productivity translates into big dollars.
When we refer to collaboration on a business activity, there are generally two buckets for these processes. The first are activities that would fit within the process of innovation. This might include creating new products, models or business processes. In other words, we are talking about the process of creation and innovation by teams. The second bucket includes activities around executing the business processes. Execution includes the hundreds of processes that run each day to operate the business. These are tactical in nature, and traditionally have key performance indicators (KPIs) measuring the success of a given process.
In this day and age, fast is synonymous with instantaneous. Increasingly, there is less time to dial up a fax machine or wait for a file to slowly attach to e-mail (then wait yet again during sending). This is especially true for entrepreneurs, whose small businesses are built on every advantageous edge that makes them competitive with larger corporations as well as one another. For small business, everything must be real-time – not just information anymore, but also changes. Small business needs collaborative tools that can keep up.
Enter web-based collaborative tools, center stage. These business implementations are the only means fast enough to match the high-speed demands of the Internet-age industry. They achieve instantaneous cooperation despite distance, cost, and other past inhibitive considerations. In support of a powerful storage hub, they allow you to securely store your information, make real-time changes to it, share it openly or discretely, and, most importantly, collaborate on it with family, friends, groups, departments, business teams, clients, vendors, or anyone.
Fast isn't the only measure, though. These tools must be easy, with user-friendly interfaces and intuitive commands. Complicated FTP programs are a thing of the past, and e-mail is too limited (and sometimes too flaky) to fully meet a company's diverse needs. Tools must be cheap. The idea is productivity, and expensive software or services prohibit that goal. Web-based tools fill the demands traditionally met by established application suites, but without their hefty price tags attached. Most of all, though, tools must be reliable. Web-based collaboration does not depend on one machine (PC or Mac) or one server, but reliably and securely functions outside of these constraints in the cloud, so to speak. The information your enterprise team works on in the office all day should still be accessible at your home computer (so you can continue work with them at night). And with the extensive controls built in to web-based tools, even the most sensitive materials remain completely confidential despite their availability within user-defined limitations. Simply put, all-in-all web-based tools make collaboration simple.
In the pre-computer age (before 1970), collaboration was a manual process. This was done mainly in face-to-face meetings and phone calls. The technologies used included calculators, blackboards, telephones, postal mail and pencil on paper. While computers might be part of the process, it was mainframe host oriented that offered no interaction by the participants. This was labor intensive with long cycle times for even simple tasks. In this era, teams needed to be in the same location, or endure significant travel.
When the Internet entered the picture (1980s), it provided a basis for the team to communicate, mainly via email. This allowed teams to collaborate while geographically separated, which further improved the efficiency of the process. Since collaboration allowed teams to extend beyond a single location, they could now include more talented people in other geographies. Other technology advances such as overnight mail, video conferencing, faxing and conference calling further improved the process.
Another emerging area of how web collaboration is impacting execution is through business intelligence networks. These are like Facebook or Twitter on steroids. An example of this would be collecting sales and market intelligence through an internal network – very similar to a social network. The key difference is that in these applications the participants are internal communities, and the network has intelligence. Information is assembled and analytics push back conclusions based on all the inputs. This allows the community to respond quickly to new conditions. In other words, the decision latency is reduced closer to the dream of “real time business.”
Clearly, web collaboration has enabled business execution to be better, cheaper and faster than in the past.
Saltmarch Media's annual Great Indian Developer Awards honors software products across 12 categories,based on their productivity, innovation excellence, universal usefulness, simplicity, functionality and most importantly on the ground feedback from India’s software developer ecosystem. In the Collaboration Tools Category, the final shortlist consists of Citrix’s popular GoToMeeting, Microsoft’s Office, WebEx WebOffice, Microsoft’s Office SharePoint server and Microsoft’s Exchange Server. Oracle’s Collaboration Suite was the first collaboration tool to win this award in 2008 followed by Adobe Acrobat Connect Professional in the 2009 chapter of the same awards. Voting is open from http://www.developersummit.com/gida3_llist.
If there is a particular development environment that you personally endorse to your colleagues or you evangelize about them at the first opportunity you get, here is your chance to vote for it (voting closes April 10 2010) and see it win this prestigious award. Visit the 2010 Great Indian Developer Awards website and cast your vote. It counts!
A Saltmarch Media Press Release
E: info@saltmarch.com
Ph: +91 80 4005 1000
|
|
|
|
|
A coworker and I are working on a logging system for unhandled exceptions in our code (screenshots, logging system information, detailed exception info, etc) using the Application.ThreadException handler (our main app is in WinForms). From the exception, I can get the MethodInfo for the method that threw the exception, and from that get the DeclaringType of the class, and from that get all the class member variables and their values. Only one problem...I need to pass an instance of the class to the FieldInfo.GetValue method, but I can't find a way to get access to that instance in the ThreadException event handler. I spent a few hours this evening going over the System.Reflection documentation and put toegether a small console app to test a few theories, but I haven't found anything for getting a reference to a class instance from a MethodInfo , MethodBody , or Module object (and yes, I used the AppDomain.UnhandledException event for the console test app instead of Application.ThreadException ). Knowing the values of the class variables when the exception occurs would be very useful for debugging. Any ideas?
I'm also trying to find a way to get the current values for the function parameters and local variables when the exception occurs. I know, Reflection won't help since these values are all on the stack at runtime, and Reflection works off of compile-time metadata, but there must be some way to get this information. I found this thread[^] that mentions using the Debugging API, but I didn't see anything in that documentation that looked like it would help either. Any suggestions on this one?
I'm using VS2005 SP1 on XP Pro SP3 and Win7 Pro.
Thanks,
DybsThe shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
There's no easy way built-in to do this, but..
As an alternative, there's a Data [^] property on the exception. Perhaps you could put the internal state of the object that's throwing the exception in there?I are Troll
|
|
|
|
|
Eddy,
Thanks for the reply. In my case that won't really work because I need this information in the UnhandledException handler, and by the time I get to this point (the first time I actually have an exception to look at), I no longer have access to the object that threw the exception. I can certainly use this where I can handle an exception more gracefully and still want to log it with more details, but my goal is to get as much info as I can for unhandled exceptions.
Thanks,
DybsThe shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
dybs wrote: my goal is to get as much info as I can for unhandled exceptions
Ditto, and you're right - if the information contained helps with the debugging-proces. There's no easy anwer to your question, once one says that it's technically possible one has to answer whether it's worth the effort.
dybs wrote: In my case that won't really work because I need this information in the UnhandledException handler, and by the time I get to this point (the first time I actually have an exception to look at), I no longer have access to the object that threw the exception.
I have created a small console-application to test with;
class Program
{
static Form myForm = new Form();
static Button myButton = new Button();
[STAThread]
public static void Main(string[] args)
{
myButton.Click += delegate
{
new MyTextCache().DoLoadStuff();
};
myForm.Controls.Add(myButton);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(logEx);
Application.Run(myForm);
}
static void logEx(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = (Exception)e.ExceptionObject;
Console.WriteLine("Exception: " + e.ExceptionObject.GetType().ToString());
if (ex.Data.Count > 0)
{
foreach(var item in ex.Data)
{
var entry = (System.Collections.DictionaryEntry)item;
Console.WriteLine("Parameter: " + entry.Value.ToString());
}
}
}
} Rather simple, just creates a form with a button and logs any exceptions on the console. The key here is looping the Data property. We know that we can fill it when we throw an exception ourselves. Now, imagine that there's an unexpected exception thrown by a .NET class in the MyTextCache.DoLoadStuff method. To add the info, we'd need to catch it, attach the desired information, and rethrow it.
The MyTextCache could be adapted like shown below. There's a local exception-handler that doesn't handle the FileNotFound-exception, but instead adds a reference to the object;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
[Serializable()]
class MyTextCache: ISerializable
{
#region variables that represent Internal State
string _filename;
string _contents;
#endregion
public MyTextCache()
{
_filename = "Q:\\Hello World.txt";
}
public MyTextCache(SerializationInfo info, StreamingContext ctxt)
{
_filename = (String)info.GetValue("filename", typeof(string));
_contents = (String)info.GetValue("contents", typeof(string));
}
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("filename", _filename);
info.AddValue("contents", _contents);
}
public override string ToString()
{
return string.Format("Filename: {0}\nContents: {1}\n",
_filename,
_contents);
}
internal void DoLoadStuff()
{
try
{
_contents = System.IO.File.ReadAllText(_filename);
}
catch(Exception e)
{
e.Data.Add("the object: ", this);
throw e;
}
}
} That would give you access to the _filename and _contents properties of the MyTextCache class. You should see an invalid filename, and an empty contents-property on the console if you attempt this.
There's a second problem; you can log the contents of the class now (or serialize it), but that doesn't give you access to the local variables from the DoLoadStuff method. This can be solved by modifying the calling method, like thus;
internal void DoLoadStuff()
{
int i = 9;
try
{
_contents = System.IO.File.ReadAllText(_filename);
}
catch(Exception e)
{
e.Data.Add("the object: ", this);
e.Data.Add("local i: ", i);
throw e;
}
} As you can see, it would be a lot of work to add "all" local variables for "each" method in the project. Adding a reference to the originating class might be worth the time to modify some of the key-classes.I are Troll
|
|
|
|
|
Thanks for the detailed response! I'm looking more into the data dictionary now and serializing the objects.
One other question. I notices after you throw add the values to the Data dictionary, you use
throw e; Doesn't this "reset" the stack track to the line where you rethrow the exception? Can you just use
throw; instead? Or would a simple throw not include your changes to the dictionary?
Thanks,
DybsThe shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
dybs wrote: Thanks for the detailed response! I'm looking more into the data dictionary now and serializing the objects.
My pleasure. Tracking the items in a dictionary would indeed be a nice alternative
dybs wrote: Doesn't this "reset" the stack track to the line where you rethrow the exception?
It does! That was sloppiness in my example.
dybs wrote: Or would a simple throw not include your changes to the dictionary?
It also includes the change if you omit the exception variable. Just verified it, just to be on the safe side.I are Troll
|
|
|
|
|
Hi Team,
I'm trying to figure out a way to manipulate a bitmap sent to an un-managed cpp DLL by a VB.NET program.
The vb.net loads the image from disk and puts it in memory as a windows.forms.picturebox. I need to send the DLL some characters to tell it what to do, and the image itself. DLL makes the changes to the image, then sends it back to the vb.net to display.
I'm looking at marshaling/interop but its not coming together for me.
Any ideas, previous articles etc are most appreciated!
Thank you in advance for any assistance you could provide.
Musher-AK
|
|
|
|
|
Hi,
you can pass all of the pixels of a Bitmap (not a PictureBox!) to the unmanaged world; all it takes is getting the pointer to it as an IntPtr, and pass that on to a C/C++ char pointer. Look at Bitmap.LockBits and BitmapData.Scan0
Background information on P/Invoke is available here[^] (not completed yet!).
|
|
|
|
|
Thank you very much Luc. This helps.
Can you think of any sample code somewhere that may illustrate this? I'll probably have to alloc/dealloc some memory and other what-nots and not quite sure how to do all this.
The demo app mentioned on the P/Invoke site didn't have a downloadable package.
BTW, the Pinvoke Wiki is awesome.
Again, many thanks for sharing your knowledge.
--Musher rob.
|
|
|
|
|
I don't have an example. I gave you all relevant keywords, so fire up Google and read the documentation on the classes involved. Sorry about the demo app, it isn't ready yet.
|
|
|
|
|
Thank you Luc, I appreciate the feedback! Kudos!
|
|
|
|
|
Hello
Everbody ,i am new in VB.net , i want to serializsed the collection .Please help me to do this
and if it is posible with coding.Hereby i am send the example of coding that i have done but not
working
Public Class colection
Private _objsavecli As New List(Of Cliente)
Public ReadOnly Property objsavecli() As List(Of Cliente)
Get
Return Me._objsavecli
End Get
End Property
Public Sub Addcliente(ByVal Client As Cliente)
Me.objsavecli.Add(Client)
End Sub
End class
<serializable>_
Public Class Cliente
Private _Name As String
Private _surname1 As String
Private _surname2 As Double
Public Property Name() As String
Get
Return Me_Name
End Get
Set(ByVal value As Double)
Me_Name = value
End Set
End Property
Public Property surname1 () As String
Get
Return Me.__surname1
End Get
Set(ByVal value As String)
Me._surname1 = value
End Set
End Property
Public Property surname2() As String
Get
Return Me._surname2
End Get
Set(ByVal value As String)
Me._surname21 = value
End Set
End class cliente
Imports System.Runtime.Serialization.Formatters.Soap
Module Module1
Public save As coleccion
Sub Main()
Dim obj As New SoapFormatter
Dim fs As FileStream
fs = File.Create("D:\all_floders\MCPD\\DatosMultiples")
'obj.Serialize(fs,save.objsavecli )
fs.Close()
End Module1
it could make a file but not write any thing.
|
|
|
|
|
Firstly I recomend you read up on how to Serialize and Deserialize Objects as XML using Generic Types in C# 2.0[^]. This article should answer most of your problems.
Secondly, why repost your original code within three hours of your first post without changing even one line based on the advise you were given? You were already at the top of the forum listing so the only thing you have gained is a reputation for ignoring advice.
Thirdly, Please enclose code snippets in a code block, preferably with the correct language attribute, but anything would be more readable than the sea of blue!
|
|
|
|
|
I send the original messages twice because i thought this problem belongs to VISUAL BASIC not .Net Framwork.Sorry any inconvencies.
|
|
|
|
|
Hello
Everbody ,i am new in VB.net , i want to serializsed the collection .Please help me to do this
and if it is posible with coding.Hereby i am send the example of coding that i have done but not
working
Public Class colection
Private _objsavecli As New List(Of Cliente)
Public ReadOnly Property objsavecli() As List(Of Cliente)
Get
Return Me._objsavecli
End Get
End Property
Public Sub Addcliente(ByVal Client As Cliente)
Me.objsavecli.Add(Client)
End Sub
End class
<serializable()> _
Public Class Cliente
Private _Name As String
Private _surname1 As String
Private _surname2 As Double
Public Property Name() As String
Get
Return Me_Name
End Get
Set(ByVal value As Double)
Me_Name = value
End Set
End Property
Public Property surname1 () As String
Get
Return Me.__surname1
End Get
Set(ByVal value As String)
Me._surname1 = value
End Set
End Property
Public Property surname2() As String
Get
Return Me._surname2
End Get
Set(ByVal value As String)
Me._surname21 = value
End Set
End class cliente
Imports System.Runtime.Serialization.Formatters.Soap
Module Module1
Public save As coleccion
Sub Main()
Dim obj As New SoapFormatter
Dim fs As FileStream
fs = File.Create("D:\all_floders\MCPD\\DatosMultiples")
'obj.Serialize(fs,save.objsavecli )
fs.Close()
End Module1
it could make a file but not write any thing.
|
|
|
|
|
Hi,
you have to mark the class itself as "serializable". So change the first line of your class declaration to this:
<Serializable()> Public Class Cliente
Regards
Sebastian
|
|
|
|
|
yes i have changed it , but working as same.
|
|
|
|
|