Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

 

Αρχική σελίδα Ιστολόγια Συζητήσεις Εκθέσεις Φωτογραφιών Αρχειοθήκες

dotNETZone.gr Weblogs

  • Hilarious HPC video

    http://highscalability.com/blog/2010/9/5/hilarious-video-relational-database-vs-nosql-fanbois.html...
    19-09-2010, 01:03 από το μέλος napoleon στο count zero
    Δημοσίευση στην κατηγορία:
  • Monadic Memoization in F# (The Continuation)

    Συνεχίζοντας τις περιπέτειες μου στον χώρο του monadic memoization, αποφάσισα να εμπλουτίσω την προηγουμενη προσπάθειά μου με το Continuation Monad, έτσι ώστε να έχω tail calls και να αποφύγω "περίεργα" stack overflows. Η ιδέα είναι να συνδυάσω το State Monad με το Continuation Monad (StateT Monad Transformer) και ως "δια μαγείας" όλα να δουλέψουν. type StateContMonad<'s, 'a, 'r> = StateContMonad of ('s -> ('s -> 'a -> 'r) -> 'r) type StateContBuilder() = member self.Return value = StateContMonad (fun state k -> k state value) member self.Bind(StateContMonad contStateMonad, f) = StateContMonad (fun state k -> contStateMonad state (fun state' value -> let (StateContMonad contMonad') = f value in contMonad' state' k)) member self.Delay( f : unit -> StateContMonad<'s, 'a, 'r> ) = StateContMonad (fun state k -> let (StateContMonad contStateMonad) = f () in contStateMonad state k) let memo = new StateContBuilder() // val Y : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b...
    05-09-2010, 21:13 από το μέλος PALLADIN στο Thoughts and Code
  • Monadic Memoization in F#

    Πρόσφατα χρειάστηκε να χρησιμοποιήσω μια memoization συνάρτηση για ένα πρόβλημα δυναμικού προγραμματισμού. Υλοποιώντας την κλασσική τεχνική χρειαζόμαστε μια συνάρτηση σαν την παρακάτω: let memoize f = let cache = new Dictionary<_, _>() (fun x -> match cache.TryGetValue(x) with | true , y -> y | _ -> let v = f(x) cache.Add(x, v) v) Το πρόβλημα με την παραπάνω συνάρτηση είναι ότι χρειαζόμαστε "κριμένα" side effects. Μετά από μελέτη κατέληξα ότι η pure functional λύση θα περιελάμβανε τον Y combinator και το State Monad. Η κεντρική ιδέα είναι να μετατρέψουμε μια συνάρτηση από a -> b σε a -> m b, plus ότι χρειαζόμαστε να κάνουμε abstract και τις αναδρομικές κλήσεις για να εισάγουμε τους ελεγχους στα arguments. My F# solution: type StateMonad<'a, 's> = StateMonad of ('s -> ('a * 's)) type StateBuilder() = member self.Return value = StateMonad (fun state -> (value, state)) member self.Bind (StateMonad stateMonad, f) = StateMonad (fun state -> let value, state' = stateMonad state in...
    16-08-2010, 22:38 από το μέλος PALLADIN στο Thoughts and Code
  • IsNull in F#

    A simple isNull for string functionality with Active Patterns 1 2 3 4 5 6 7 8 9 10 11 12 13 14 open System let (|Empty|Null|String|) (s: string ) = if s = null then Null elif s.Trim() |> String.IsNullOrEmpty then Empty else String (s.Trim()) let public IsNull (rep: string ) (s: string ) = match s with | Empty | Null -> rep. ToString() | String _ -> s If someone knows why the underlined ToString() is needed I would appreciate it...
    29-07-2010, 14:49 από το μέλος napoleon στο count zero
    Δημοσίευση στην κατηγορία:
  • Making Internals visible

    A very interesting entry to AssemblyInfo that I found is InternalsVisibleTo. If added to a project makes visible internal classes & members to a calling assembly [ assembly : InternalsVisibleTo ( "MyProject.Tests.Unit" )]...
    24-07-2010, 17:46 από το μέλος napoleon στο count zero
    Δημοσίευση στην κατηγορία:
  • F# Sources

    First, I would like to thank N.Palladinos for his various help on F#. F# is a new language officially hosted in VS 2010. Worth mentioning is that even if someone does not choose to write in that language, the knowledge may make him a better programmer. Very good sources for F# are: Don Syme's blog founder of F# Phillip Trelford's blog Luke Hoban's blog Jon Harrop's blog Fsharp.net the official site Most people recommend Chris Smith's Programming F# for a book. I have read Don Syme's Expert F# which is very good but requires some experience in the first place....
    24-07-2010, 15:17 από το μέλος napoleon στο count zero
    Δημοσίευση στην κατηγορία: ,
  • Clojure's Atoms in F#

    Μελετώντας την Clojure , την προσοχή μου τράβηξε ένα απλό αλλά πολύ χρήσιμο construct, το Atom . Το Atom φαίνεται να είναι το πάντρεμα των ref cells της ML με lock free CAS concurrency semantics. Επειδή τέτοια constructs είναι πολύ χρήσιμα στην F#, σκέφτηκα να υλοποιήσω κάτι ανάλογο. My attempt: type Atom<'a when 'a : not struct >(value : 'a) = let refCell = ref value let rec swap f = let currentValue = !refCell let result = Interlocked.CompareExchange<'a>(refCell, f currentValue, currentValue) if obj.ReferenceEquals(result, currentValue) then () else Thread.SpinWait 20; swap f member self.Value with get() = !refCell member self.Swap (f : 'a -> 'a) = swap f let atom value = new Atom<_>(value) let (!) (atom : Atom<_>) = atom.Value let swap (atom : Atom<_>) (f : _ -> _) = atom.Swap f Και ως παράδειγμα χρήσης, σκέφτηκα έναν απλό multithreaded counter. (Σημείωση: βάζω το int μέσα στο lambda επειδή πρέπει να δώσω στο Atom ένα reference type) let counter = atom (fun () -> 0) let...
    11-07-2010, 19:49 από το μέλος PALLADIN στο Thoughts and Code
  • Asyncrhonous programming in .NET Made Simple: From Delegates to the Task Parallel Library

    A few people have been asking lately for samples of using asynchronous programming using Sockets or Pipes so I decided to put together some samples of the various asynchronous programming models using .NET. The scenario used in all the examples is the same: A server pipe is created and starts waiting for connections A client pipe is created and connects to the server pipe The server starts listening for data The client sends a UTF8 formatted number to the server asynchronously and waits for a response The server responds with “You sent x” to the client asynchronously The client reads the response and writes the response to the console. The asynchronous version of a function (e.g. BeginRead, BeginWrite, BeginWaitForConnection) is used whenever one is available. All samples implement a simple interface to make running the samples easier: public interface IAsyncBase { void StartServer(); void StartClient(); } … IAsyncBase sample= new TaskSockets (); sample.StartServer(); sample.StartClient(); .NET 1.0 – Delegates...
    02-07-2010, 10:13 από το μέλος Παναγιώτης Καναβός στο Panagiotis Kanavos' Weblog
  • Windows Azure&ndash;Custom persistence service for WF 4 saving information on Windows Azure Blob

    Recently, I’ve been looking a way to persist the status of an idling Workflow on WF4. There is a way to use SQL Azure to achieve this, after modifying the scripts because they contain unsupported T-SQL commands, but it’s totally an overkill to use it just to persist WF information, if you’re not using the RDBMS for another reason. I decided to modify the FilePersistence.cs of the Custom Persistence Service sample in WF 4 Samples Library and make it work with Windows Azure Blob storage. I’ve created two new methods to Serialize and Deserialize information to/from Blob storage. Here is some code: 1: private void SerialiazeToAzureStorage( byte [] workflowBytes, Guid id) 2: { 3: var account = CloudStorageAccount.FromConfigurationSetting( "DataConnectionString" ); 4: var container = account.CreateCloudBlobClient().GetContainerReference( "workflow_persistence" ); 5: 6: var blob = container.GetBlobReference(id.ToString()); 7: 8: blob.Properties.ContentType = "application/octet-stream" ; 9: using (var stream = new MemoryStream())...
    01-07-2010, 00:22 από The PK site στο The PK blog
    Δημοσίευση στην κατηγορία: , ,
  • How not to get a month's name

    I've had a genuine TheDailyWTF moment earlier today, when I found the C# equivalent of this VB6 code that returns a three letter month name: DateTime time = DateTime.Now; string foldername = time.Year.ToString() + "_" + GetMonthName(time.Month); private static string GetMonthName( int month) { switch (month) { case 1: return "Jan" ; case 2: return "Feb" ; case 3: return "Mar" ; case 4: return "Apr" ; case 5: return "May" ; case 6: return "Jun" ; case 7: return "Jul" ; case 8: return "Aug" ; case 9: return "Sep" ; case 10: return "Oct" ; case 11: return "Nov" ; case 12: return "Dec" ; } return month.ToString(); } This code runs on a server with non-English regional settings. My guess is the coder wanted to ensure that (s)he would get back the english month name even if the thread run using non-English regional settings. The .NET Framework has already solved this problem by accepting an provider parameter in the String.Format and DateTime.ToString() methods. The provider parameter can accept any CultureInfo object...
    22-06-2010, 16:38 από το μέλος Παναγιώτης Καναβός στο Panagiotis Kanavos' Weblog
    Δημοσίευση στην κατηγορία:
  • My great experience with Windows Azure customer support

    Once again, Microsoft proved that it values its customers, either big enterprise or small startups. We’re a small private-held business and I personally have a major role in it as I’m one of the founders. Recently, I’ve been giving some pretty nice presentations and a bunch of sessions for Microsoft Hellas about Windows Azure and Cloud computing in general. I was using my CTP account(s) I have since PDC 08 and I had a lot of services running there from times to times all for demo purposes. But with the 2nd commercial launch wave, Greece was included and I had to upgrade my subscription and start paying for it. I was ok with that, because MSDN Premium subscription has 750 hours included/month, SQL Azure databases and other stuff included for free. I went through the upgrade process from CTP to Paid, everything went smoothly and there I was waiting for my CTP account to switch on read-only mode and eventually “fade away”. So, during that process, I did a small mistake. I miscalculated my instances running. I actually...
    18-06-2010, 22:49 από The PK site στο The PK blog
    Δημοσίευση στην κατηγορία: , ,
  • Totally wrong way to filter a combo box

    From the same legacy code as this post comes this code that loads a combo box with ListItems and then removes unwanted items in a way that is guaranteed to cause an exception when the indexer reaches the middle of the list, which now has only half the initial items: ddlItems.Items.Clear(); // Re-load so we can filter the required UIHelper.FillListBoxFromSharePointList(ddlItems, Microsoft.SharePoint.SPContext.Current.Web, "Items" ); #region Remove all items from list that are not allowed for selection by the current user int listCount = ddlItems.Items.Count; for ( int i = 0; i < listCount; i++) { try { ListItem item = ddlItems.Items[ i]; string roleId = item.Value; if (roleId.Length > 0) { roleId = string .Concat( ";" , roleId, ";" ); if (!allowedRolesStringList.Contains(roleId)) { ddlItems.Items.Remove(item); i = i - 1; // Skip back 1 index - since we deleted one. } } } catch { ; } } #endregion Obviously the coder noticed the problem and instead of fixing it, he covered it under the catch{;} carpet. The...
    14-06-2010, 16:52 από το μέλος Παναγιώτης Καναβός στο Panagiotis Kanavos' Weblog
    Δημοσίευση στην κατηγορία: , , ,
  • F# is out there

    Εδώ και πολλά χρονια ονειρευόμουν την μέρα που κάποια απόγονος της ML θα καταφέρει να σπάσει τα ακαδημαϊκά δεσμά της και να αποκτήσει μια ευρύτερη πιο γενική αντιμετώπιση. Το όνειρο αυτό έγινε πραγματικότητα (υπό μια έννοια)!!! Η F# είναι πλέον γεγονός και βρίσκεται εγκατεστημένη με κάθε VS 2010. Ήδη στην εταιρία μου, κλείνουμε μια εβδομάδα λειτουργίας ενός απαιτητικού production server που τρέχει mission critical components γραμμένα σε F#. Όσοι φίλοι αισθάνονται ότι πρέπει να υπάρχει κάτι περισσότερο από τα συνηθισμένα "{};++", τότε μπορούν να δώσουν μια ευκαιρία σε κάτι διαφορετικό. Μετά από ένα σημείο θα αρχίσουν να βλέπουν τον κώδικα με άλλα μάτια... Σαν τον Neo στο τέλος του πρώτου Matrix . Resources: Use case: http://www.microsoft.com/casestudies/case_study_detail.aspx?casestudyid=4000005226 Lectures: (Όσοι φίλοι παρακολουθήσουν τα μαθήματα και έχουν ερωτήσεις - απορίες, μπορούν να μου στείλουν ένα μήνυμα και θα είναι πραγματικά χαρά μου να βοηθήσω) http://channel9.msdn.com/shows/Going+Deep/C9-Lectures-Dr-Don-Syme-Introduction-to-F-1-of-3/...
    13-06-2010, 18:59 από το μέλος PALLADIN στο Thoughts and Code
  • Install AdventureWorks sample DB

    Useful with some update in source. More...
    12-06-2010, 18:45 από το μέλος napoleon στο count zero
    Δημοσίευση στην κατηγορία: ,
  • First impression on VS 2010

    I have started working on VS 2010 recently. I have created a website and I found the working environment is very clear and helpful. The new font family and some black vs color scheme , with the default indicators of the environment and default project templates are time-saving. The responsiveness is significantly faster. I encourage to install any power tools available....
    12-06-2010, 15:52 από το μέλος napoleon στο count zero
    Δημοσίευση στην κατηγορία:
  • Totally wrong way to use SPSite, SPWeb

    Almost all Sharepoint developers know that you should dispose SPSite and SPWeb object you create in code. Doing so is not hard, you just enclose your objects in a using statement. I found the following piece of code in dozens of places in some legacy Sharepoint code created by people who should have known better: SPSite site = null ; SPWeb web = null ; try { SPSecurity.RunWithElevatedPrivileges( delegate () { site = new SPSite(Microsoft.SharePoint.SPContext.Current.Web.Url); web = site.OpenWeb(); //Blah Blah Blah }); } catch (Exception MyMethodException) { WriteErrorMessage( string .Format( "MyMethodExceptionException : {0}" , MyMethodExceptionException.Message)); } finally { web.Dispose(); site.Dispose(); } Looks like whoever wrote this code never heard of the using statement, in .NET since v1. It's not just that this code is more verbose than it needs to be. It also broadens the scope of the site and web variables and exposes them to abuse. This can be a serious problem if the code contains large methods, and...
    11-06-2010, 12:15 από το μέλος Παναγιώτης Καναβός στο Panagiotis Kanavos' Weblog
    Δημοσίευση στην κατηγορία: , , ,
  • Α programming puzzle: My solution

    Η λύση που έστειλα είναι η Solution2 του darklynx... public class Thunk<T> { private Func<T> func; public T Value { get { return func(); } } public Thunk(Func<T> computeFunc) { this .func = () => { func = ((Func<T, Func<T>>)(value => () => value))(computeFunc()); return func(); }; } } Η τεχνική αυτή μοιάζει λίγο με Jit thunks . Happy hacking....
    07-06-2010, 12:45 από το μέλος PALLADIN στο Thoughts and Code
  • Α programming puzzle

    Πριν από λίγες μέρες, ένας φίλος μου έστειλε ένα programming puzzle που του τέθηκε κατά την διάρκεια ενός job interview. Το σκέφτηκα για λίγο και του έστειλα μια πρόχειρη λύση. Με το που είδε τον κώδικα που του έστειλα, μου απάντησε ότι αποκλείεται να είχαν κάτι τέτοιο στο μυαλό τους. Επειδή είμαι περίεργος να δω και άλλες ιδέες για το πρόβλημα, όσοι φίλοι θέλουν, μπορούν να αφήσουν ένα comment με τις ιδέες τους. Σε επόμενο blog post, θα δώσω την λύση που του έστειλα. Το puzzle: Δώστε μια εναλλακτική υλοποίηση της παρακάτω class χωρίς να χρησιμοποιηθεί κανενός είδους conditional logic construct (if, switch, ()?). public class Thunk<T> { private T value; private bool flag = false ; private Func<T> func; public T Value { get { if (!flag) { value = func(); flag = true ; } return value; } } public Thunk(Func<T> func) { this .func = func; } }...
    06-06-2010, 18:30 από το μέλος PALLADIN στο Thoughts and Code
  • Windows Azure &ndash; Is Thread spawning from Worker Roles the paspartu?

    Paspartu is French for “one size fits all”. Recently I’ve been coming across posts explaining and “promoting” the idea of spawning threads inside a worker role each one of them with a unique work to be done. All are sharing the same idea and all of them are describing the same thing. The idea You have some work to do, but you want to do it with the most efficient way, without having underutilized resources, which is one of the benefits of cloud computing anyway. The implementation You have a worker process (Worker Role on Windows Azure) which processes some data. Certainly that’s a good implementation but it’s not a best practice. Most of the time, your instance will be underutilized, unless your doing some CPU and memory intensive work and you have a continuous flow of data to be processed. In another implementation, we created a Master-Slave pattern. A master distributes work to other slave worker roles, roles are picking up their work, do their stuff, return result and start over again. Still, in some cases...
    18-05-2010, 01:53 από The PK site στο The PK blog
    Δημοσίευση στην κατηγορία: , ,
  • Cloud computing &ndash; Most common concerns and my thoughts

    Every single time something new emerges in the IT market, there are three distinct categories of people: Early adopters, Late majority, Skeptics. Each one of them has its own reasons and its own concerns about when, why and if they are going to adapt to this new technology, either completely or in a hybrid mode. All of them have some things in common. They share the same concerns about security, billing, taxes, availability, latency and probably some others. Concerns and my thoughts. Billing is something that can easily be solved and explained by clever and good marketing. Unfortunately, there is no such thing as local billing. Cloud computing services are truly global and the same billing model, the same prices, the same billing methods have to be used to provide a fair and consistent service to every customer. This has to change. For some markets, a service can be really cheap, but for some others can be really expensive. Increasing the price in some countries and decreasing in some others can make the service...
    17-05-2010, 01:26 από The PK site στο The PK blog
    Δημοσίευση στην κατηγορία: ,
  • Windows Azure Table Storage &ndash; Is backup necessary?

    Yes, it is. Table storage has multiple replicas and guarantees uptime and availability, but for business continuity reasons you have to be protected from possible failures on your application. Business logic errors can harm the integrity of your data and all Windows Azure Storage replicas will be harmed too. You have to be protected from those scenarios and having a backup plan is necessary. There is a really nice project available on Codeplex for this purpose: http://tablestoragebackup.codeplex.com/ PK....
    16-05-2010, 23:31 από The PK site στο The PK blog
    Δημοσίευση στην κατηγορία: ,
  • Οδηγός για την ασφάλεια στο Silverlight 4

    Συνήθως αποφεύγω να αναπαράγω ειδήσεις από blogs άλλων, ωστόσο σε θέματα όπως αυτό της ασφάλειας αυτό που έχει σημασία είναι να διαχυθεί η πληροφόρηση όσον το δυνατόν περισσότερο. Είναι λοιπόν διαθέσιμο για να κατεβάσετε το Silverlight Security Overview ( http://download.microsoft.com/download/A/1/A/A1A80A28-907C-4C6A-8036-782E3792A408/Silverlight Security Overview.docx ) , ένας οδηγός που περιγράφει τόσο το πώς το Silverlight προστατεύει τον τελικό χρήστη όσο και το πώς μπορεί κανείς να κάνει τις Silverlight εφαρμογές που γράφει πιο ασφαλείς. Μέσα σε αυτόν το οδηγό θα βρείτε ανάμεσα στα άλλα πληροφορίες για το sandbox, τον out of browser τρόπο λειτουργίας, την προστασία των xap αρχείων, το validation του input των χρηστών αλλά ακόμα το τι σημαίνει η εκτέλεση σε trusted mode ή το πώς προστατεύουμε τα data που αποθηκεύουμε στο isolated storage. Καλό διάβασμα!...
    07-05-2010, 09:53 από το μέλος KelMan στο Manos Kelaiditis' Weblog
    Δημοσίευση στην κατηγορία: ,
  • Launch PARTY για το Visual Studio 2010

    Αυτή τη φορά το Launch του Visual Studio δεν θα είναι ημερίδα με ομιλίες αλλά ... πάρτυ Παρασκευή βράδυ με πίτσα και μπύρες! Γραφτείτε όσο προλαβαίνετε!...
    06-05-2010, 08:39 από το μέλος Παναγιώτης Καναβός στο Panagiotis Kanavos' Weblog
  • Let’s party on Visual Studio 2010 launch!

    Ίσως το ξέρετε ότι την Παρασκευή 14 Μαϊου γίνεται η μεγάλη εκδήλωση της επίσημης παρουσίασης του Visual Studio 2010, του SQL Server 2008 R2 και των Windows Azure στο Κέντρο Πολιτισμού "Ελληνικός Κόσμός". Αυτό που ενδεχομένως να μην ξέρετε είναι ότι αυτή η παρουσίαση δεν θα είναι σαν τις συνηθισμένες (ξεκινά στις 7.30μμ) όπου κάποιοι ομιλητές απλά θα σας παρουσιάσουν τα προϊόντα. Δεν θέλω να σας αποκαλύψω όλες τις λεπτομέρειες, αρκεί να σας δώσω μερικά keywords: Heineken, rock, community, Coca-Cola, Domino's pizza, XBox. Τι άλλο να θέλει ένας developer?!?! E, οι τεχνικές παρουσιάσεις δεν θα λείψουν, αλλά όχι στο στυλ που έχουμε όλοι συνηθίσει. Από την μεριά μου θα σας δείξω τα νέα χαρακτηριστικά του Silverlight 4. Τα λέμε εκεί!...
    03-05-2010, 18:56 από το μέλος KelMan στο Manos Kelaiditis' Weblog
    Δημοσίευση στην κατηγορία: , ,
  • Έτσι βγαίνουν τα λεφτά

    Γενικά το blog είναι κατά 99% geekish τεχνολογικό, ωστόσο αυτά που διάβασα πριν από λίγο μου φαίνονται απίστευτα! 17 εκ € έχει κοστίσει στα δύο χρόνια λειτουργίας του το σύστημα της SingularLogic “Ήφαιστος”, το οποίο παρακολουθεί τις συναλλαγές του πετρελαίου θέρμανσης στο Υπ. Οικονομικών. Σε γλαφυρή αντιπαράθεση ο Βγενόπουλος με τον Διομήδη Σπινέλλη ο οποίος δεν θέλει να ανανεώσει για έναν ακόμα χρόνο τη σύμβαση με την εταιρεία για τη λειτουργία του (κόστος 6 εκ €) αλλά ζήτησε να παραδοθεί το σύστημα και να εκπαιδευτει προσωπικό (κόστος 1.2 εκ €) για τη λειτουργία και συντήρησή του. Με απευθείας αναθέσεις όλα αυτά μέχρι σήμερα… Αν τα παρπάνω είναι αλήθεια τότε μόνο ένα έχω να πω: That ain't workin' that's the way you do it Get your money for nothin' get your chicks for free http://www.paron.gr/v3/new.php?id=50892&colid=&catid=27&dt=2010-02-21%200:0:0 http://www.sofokleous10.gr/portal2/toprotothema/toprotothema/l------r-2010030920814/...
    21-04-2010, 21:58 από το μέλος KelMan στο Manos Kelaiditis' Weblog
Περισσότερες Δημοσιεύσεις « Προηγούμενη - Επόμενη »
Με χρήση του Community Server (Commercial Edition), από την Telligent Systems