Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

itsnotabug itsnotabug
  • Should Node.js replace Web API?

    , RealBboy360 wrote

    *snip*

    Yes, but that goes back to my initial point.  If Node.js can't do it, then Web API probably can't so use WCF.

    MVC has some nice things that adds to HTML5/Javascript, but MVC is still just HTML5/Javascript.  For somethings, it might take a little longer to code, but everything can be done and plug-ins can be added.

    If you're going for speed to develop a LOB application, nothing beats ASP.NET with something like Telerik controls.  Also, I'd see the MVC crowd abandoning MVC for something new before the webforms people.

    As for ORMs, who cares, you're passing back json anyway.   Well I'm an ORM hater anyway.  I like to actually write my queries in sql to see what's going on and make sure i don't get an surprises.

    ...well there is that whole decade + worth of mature .Net code you'd have access to ;)

    i kinda get what you're saying about writing raw sql. i don't like too much magic either. check out some of the micro-orms like petapoco or dapper. with the use of t4 templates, they give you the rich statically typed experience of an orm with the ability to extend your entities (using partial classes). Zero magic.

    I'd rather write something like DB.Save<MyNicelyTypedClass>(MyNicelyTpedObject) than the dozens of lines to figure out upsert logic from your primary keys.

  • Should Node.js replace Web API?

    wcf is much bigger than the web. you can do .net remoting, com interop, lot's of different types of endpoints with rich meta-descriptions of interfaces so clients can easily get what they need to know about a service. i think mvc was a reaction to the rapid rest-like development that was hot with ruby on rails at the time, so they bolted a framework onto existing asp.net/iis. i think webapi represents a ground-up approach on how ms SHOULD do rest-like development. whether you like it or not, node.js is hot right now, so the decision to go with it for azure is likely a marketing thing. if you're already bought into the ms stack, chances are you're going to use azure anyway if you needed cloud, so the marketing right now is focused on getting those other guys who wouldn't otherwise be considering azure. if i had the luxury to start a brand new project with my choice of tech, i would go mvc/iis (webapi is just too different for me to learn it all right now), but enterprise developers rarely have that luxury. i might even go with wcf data services. you get odata and other nice rest-like features, but it's still on the back on the familiar asp.net iis stack.

  • Xbox One/Windows 8.1 Project Spark Game Development

    wow, where did this come from? there are some impressive looking demos people have created with it already out there. i know the visual programming paradigm is always an inch deep, mile wide, but i really like the ui they've created for the object "brain". if they open up some real scripting abilities, something like this could be really cool to prototype on.

  • ASP.NET Create Word.Docx file?

    a cheap way to go about it is to use a simple find/replace pattern with well-defined {MERGE} fields embedded in the regular docx instead of using real mail merge (literally just type unique "{FIELDTOREPLACE}")

    you can use the openxml sdk 2.0 to work with the xml based file instead of the real mail merge functionality in the word application. do not try automating the word application on the server.

    i think you'd need windowsbase and openxmlpackaging referenced at the very least for this to work, something like...

     

    public string MergeDoc(string wordTemplatePath, string wordOutputPath, List<KeyValuePair<string, string>> MergeFields)
    {
    try
    {
    
    //Create instance of our template in the output location
    File.Copy(wordTemplatePath, wordOutputPath, true); //overwrite = true
    
    using (WordprocessingDocument wordOutputDoc = WordprocessingDocument.Open(wordOutputPath, true))
    {
    string docText = null;
    using (StreamReader sr = new StreamReader(wordOutputDoc.MainDocumentPart.GetStream()))
    {
    docText = sr.ReadToEnd();
    }
    
    foreach (var kv in MergeFields)
    {
    //Swap the text out, key is something like {PLACEHOLDER}, value is "My new text" 
    docText = docText.Replace(kv.Key, kv.Value);
    }
    
    using (StreamWriter sw = new StreamWriter(wordOutputDoc.MainDocumentPart.GetStream(FileMode.Create)))
    {
    sw.Write(docText);
    }
    
    
    }
    
    return wordOutputPath;
    }
    catch (Exception ex)
    {
    
    // logit
    return "";
    }
    }

    then you can test for the returned merged path and serve it up in the response stream ala...

    var MyNewlyMergedFile = MergeDoc(Path.Combine(TemplateFolderName, filename), Path.Combine(OutputFolderName, filename), MergeFields);
    
    byte[] byteArray = File.ReadAllBytes(MyNewlyMergedFile);
    
    Response.Clear();
    
    Response.ContentType = "Application/msword";
    Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", filename));
    Response.BinaryWrite(byteArray);
    Response.Flush();
    Response.Close();
    Response.End();

    this works with formatted text too. the only quirky thing is line breaks in address blocks if you don't need Address2. Environment.NewLine doesn't work so you'd need to add the literal xml tags that define a line break if you want to replace the merge field with a block that contains a line break ("<w:br />")

     

    **** edit **** it just occurred to me that docx files are just zip files containing xml. if you change the docx extension to zip, then drill down to \word\document.xml, you can probably get away with just replacing your merge fields in there. you probably don't even need to use openxml sdk or windowsbase for that. i'm too lazy to test for performance differences between using the sdk or manually unzipping, but i'd bet the sdk is faster. just an option if you feel you cannot use the sdk or other 3rd party libraries.

  • multi-​channel sample step ​sequencer/t​racker in c#

    you sir, are awesome. thanks a bunch. proper plugin delay compensation isn't even implemented in ableton yet! lol @ petproject. you're doing cooler things for fun than most of the devs i've worked with professionally. i'll be sure to mention you if anything comes out of this.

  • multi-​channel sample step ​sequencer/t​racker in c#

    seeing the midi and audio driver wrappers would be nice, but i think naudio might do some of that + i'd probably want to release anything novel i come up with for free. the host and vst integration seem like such cool projects to keep under wraps. are you planning on a commercial release/licensing agreement? codeplex/github and the c# music community would greatly benefit from opening those up. i had a quick look at the pitch tracker. awesome "divide and conquer" optimizations on the autocorrelation algorithm.

  • multi-​channel sample step ​sequencer/t​racker in c#

    the non-realtime spec was more of a realistic limiting factor on the time i can spend on it (and my own dsp math deficiencies). it doesn't need to respond to realtime midi input... i'm thinking more like a standalone redrum step-sequencer in propellerheads reason, not a full featured daw with sample accurate time precision.

    if naudio or other library already has some basic effects baked into i think i could certainly transform a wav buffer before mixing it down or sending it to the sound device, but i'd be out of my league if i wanted to write my own. heck i'd even be okay with doing some p/invoke to use any el cheapo "system" reverbs/delays that may be exposed through win32. i basically have some compositional aids and interface ideas i'd like to play around with.

    i do remember reading all your interesting posts on the subject and i'm glad you chimed in. are you sharing the source on your project and/or do you have a project page? the high level modelling is what i'm kind of interested in at this point.

    edit * heh... sounds like your SortedList is a lot like how i do it with 2d points. i thought there would have to be a better way if basing it off midi, but i can see the benefit of having that layer of abstraction between on/off events in the file and the in-memory sequence if you edit the sequence after starting playback but before the "Playhead" gets to the event.

  • multi-​channel sample step ​sequencer/t​racker in c#

    i couldn't find any open source projects in this area. i'm interested in building a simple (think fl studio v1) pattern based sample playback sequencer in c#. i have built 2 very crappy implementations using my own naive assumptions about how a sequencer should work but they're hacks at best (no midi, using 2d array of points for events, no true "mixer", just direct-x sample playback).

    i'd like to maybe see how someone else would model it. at a minimum, the sequencer portion should use midi as its internal eventing system with the ability to chain patterns together into a song... maybe even be able to export/import patterns. a true mixer would be excellent as you could implement an effects bus. naudio looks perfect for this and i see pluralsite has a course (by none other than naudio's creator).

    anyone have any experience in building a non-realtime pattern based sequencer?

  • How long does it take to produce a great song?

    heh oops... corrected.

  • How long does it take to produce a great song?

    capturing the magic of a happy accident is more associated with an organic, expressive performance. scoring for a video game or film is a different beast alltogether, usually involving several layers of go-betweens and consensus. chances are , if you're scoring specifically for certain scenes, you have a good budget vs licensing a handful of premade tracks to serve as background music on a level.

    look at the score for portal 2. in my opinion, it's one of the best scores in video games because subtle interactive elements bring layers up in the mix (in key mind you!), but you'd barely notice it unless you were paying attention. that level of involvement as a sound-design/scoring composer can command much more money, but i agree, as a non-touring, bedroom producer it's hard to make any money. so much great music is available royalty free if you look in the right places.

    I think the democratization of music tech is both the best and worst thing to happen to musicians. For the price of a cheap laptop and soundcard, anyone can have more power in their hands than the beatles ever did, but there are very few beatles amongst us.