IoT Zone is brought to you in partnership with:
DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
  • submit to reddit
Greg Duncan07/09/14
444 views
0 replies

Sign up for the "Windows Developer Program for IoT"

"Build a smart coffee mug, build a talking bear, build a robot, or build something else entirely." So I guess we'll see...

static void ExtractInlineAttachments()
  {
        MapiMessage message = MapiMessage.fromFile("Test.msg");
    MapiAttachmentCollection attachments = message.getAttachments();
    for (Object untypedAttachment : attachments)
    {
          MapiAttachment attachment = (MapiAttachment) untypedAttachment;
          if(IsAttachmentInline(attachment))
          {
                try
                {
                      SaveAttachment(attachment, UUID.randomUUID().toString());
                }
                catch (IOException | FileNotFoundException e)
                {
                      // TODO Auto-generated catch block
                          e.printStackTrace();
                    }
              }
        }
  }
  static boolean IsAttachmentInline(MapiAttachment attachment)
  {
        MapiObjectProperty objectData = attachment.getObjectData();
        if (objectData == null)
              return false;

        for (Object prop : attachment.getObjectData().getProperties().getValues())
        {
              MapiProperty property = (MapiProperty)prop;
              if ("\u0003ObjInfo".equals(property.getName()))
              {
                    byte[] data = property.getData();
                    int odtPersist1 = data[1] << 8 | data[0];
                    return (odtPersist1 & 0x40) == 0;
              }
        }
        return false;
  }
  static void SaveAttachment(MapiAttachment attachment, String fileName) throws IOException, FileNotFoundException
  {
        for (Object prop : attachment.getObjectData().getProperties().getValues())
        {
              MapiProperty property = (MapiProperty)prop;
              if ("Package".equals(property.getName()))
          {
                FileOutputStream fs;
                try
                {
                      fs = new FileOutputStream(fileName);
                      fs.write(property.getData(), 0, property.getData().length);
                }
                catch (java.io.IOException e)
                {
                      // TODO Auto-generated catch block
                          e.printStackTrace();
                    }
              }
        }
  }
Alec Noller07/09/14
5107 views
0 replies

Dev of the Week: James Betteley

Every week here and in our newsletter, we feature a new developer/blogger from the DZone community to catch up and find out what he or she is working on now and what's coming next. This week we're talking to James Betteley, London-based build and release engineer, rugby player, and cyclist.

Alec Noller07/09/14
7122 views
0 replies

The Best of DZone: July 1 - 8

If you missed anything on DZone this week, now's your chance to catch up! This week's best include dynamic CSS classes with SASS, deploying a RabbitMQ cluster on Google Compute Engine, why you should stop unit testing database code, what makes a good programmer, and more.

Graeme Bodys07/09/14
2103 views
0 replies

Transparency

What I am going to say is radical – this will put you outside your comfort zone and challenge your thinking. I will share the how, the why and the benefits.

Lorna Mitchell07/09/14
2964 views
0 replies

View Only Headers with Curl

When working with curl, it can give lots of excellent and detailed information, but sometimes it is too much! Today I'm fiddling with the caching headers on a client's application, so I'm only interested in seeing the headers and not the body of the response.

Mike Bushong07/09/14
1407 views
0 replies

Is the Enterprise Datacenter a Dying Breed?

There is no question that many of our applications will move to the cloud. Pure economics will drive that. But at the same time there will continue to be resistance for a long time to come to move certain applications and data into the cloud.

Alexander Beletsky07/09/14
948 views
0 replies

Lessons Learned Working on a Startup

One of the most significant books on startups, defines startup as temporary organization aims to find sustainable business idea. It’s not about coding, testing or anything related to development. It’s all about the search.

John Sonmez07/08/14
2404 views
5 replies

Do Software Developers Really Need Degrees?

Just because you have a college degree doesn’t mean you have learned anything. That is the main problem I have with most traditional education programs today. School has become much more about getting a degree—a piece of paper—than it has about actually learning something of value.

Abby Fichtner07/08/14
4029 views
0 replies

Why "Hacker?"

As a self-taught programmer, the most inspirational book for me in my early years, what really made me want to be a coder and never look back, was Steven Levy’s Hackers: Heroes of the Computer Revolution.

Jens Schauder07/08/14
5034 views
1 replies

Scaling Agile Beyond Your Project- What Can We Do?

But for me as a developer there seems to be a wall around our team. Behind this wall the management dragons roam. Sometimes balls of flame fly over the wall in our direction, setting our little project on fire, by dictating rules that just don’t make sense, and we can do nothing but putting out the flames, or can we?

Mike Bushong07/08/14
3069 views
0 replies

Explicitly-defined failure domains in the datacenter

While the bulk of the networking industry’s focus is on CapEx and automation, the two major trends driving changes in these areas will have a potentially greater impact on that which matters most: availability.

Ariya Hidayat07/08/14
5468 views
0 replies

Extracting Parts of Git Repository and Keeping the History

For maintenance purposes, it is often beneficial to separate projects into their own projects. Furthermore, the commit history for the extracted project should not be lost. With Git, this can be achieved using git-subtree.

Vijay Narayanan07/08/14
626 views
0 replies

Don’t Implement Reusable Assets Unless Necessary

Resisting the temptation to implement a story is very hard for a dev team – it is all too easy to get carried away in introducing a new idea as a reusable asset.

<style type="text/css">
@media screen and (-webkit-min-device-pixel-ratio:0) {
    H5 { color:red; }
    P { margin-left:20px; }
    /* other special styles for Chrome here */
}
</style>
// source: http://www.apphp.com/index.php?snippet=css-targeting-chrome-only
Erich Styger07/07/14
2382 views
0 replies

Snake Game on the FRDM-KL25Z with Nokia 5110 Display

So I have another nice usage for my boards and the joystick shields :-). I need to admit that I’m not very good at the game. My daughter reached level 4 in the first attempt, while my max level is 2, maybe it is just the age ;-)

Steve Smith07/07/14
5102 views
0 replies

Continuous Delivery Pipeline Pattern: Analysis Stage

The entry point of a Continuous Delivery pipeline is its Commit Stage, and as such manages the compilation, unit testing, analysis, and packaging of source code whenever a change is committed to version control.

Bojan Tomic07/07/14
4238 views
0 replies

Spring Security Run-As example using annotations and namespace configuration

Two examples of Spring Security's authentication replacement feature, often referred to as Run-As, that can replace the current user's authentication (and thus permissions) during a single secured object invocation.

Jeremy Likness07/07/14
4465 views
0 replies

Video: Quick Tip for Debugging AngularJS Applications

In this video I'll show you how to quickly determine where the source code bound to a function in the UI is so you can set a breakpoint to step into the code directly.

Mike Bushong07/07/14
1018 views
0 replies

Network cost and complexity: As simple as changing the y-intercept?

Architects and operators should ask this question to see what kinds of answers come back. An honest answer should lead to follow-on questions.