Skip to content
Snippets Groups Projects
resetDB.py 21 KiB
Newer Older
Xingchen Zhou's avatar
Xingchen Zhou committed
from blog.models import User, Post, Comment, Rate

def resetDB(db):
	db.drop_all()
	db.create_all()
	db.session.add(User(username='johnsmith',email='john@smith.com',password='123'))
	db.session.commit()
	db.session.add(Post(title='Flutter expands web support in major update',content='Google wants to change the way developers think about building apps with a major release of its UI software development kit. Flutter 2 features the ability to create native apps that target the five top operating systems — iOS, Android, Windows, macOS and Linux — all from the same codebase. <br/><br/>"Flutter allows you to handcraft beautiful experiences where your brand and design comes to the forefront. Flutter is fast, compiling your source to machine code, but thanks to our support for stateful hot reload, you still get the productivity of interpreted environments, allowing you to make changes while your app is running and see the results immediately. And Flutter is open, with thousands of contributors adding to the core framework and extending it with an ecosystem of packages,” the Flutter team wrote in a post.<br/><br/>The team explained that the latest release transforms Flutter from a mobile framework to a portable framework, allowing developers to target new platforms.  <br/><br/>The latest release also features production-quality support for the web, targeting progressive web apps (PWAs), single page apps (SPAs), and the mobile web. "The early foundation of the web was document-centric. But the web platform has evolved to encompass richer platform APIs that enable highly sophisticated apps with hardware-accelerated 2D and 3D graphics and flexible layout and paint APIs. Flutter’s web support builds on these innovations, offering an app-centric framework that takes full advantage of all that the modern web has to offer,” the  team wrote. Other features for the web include test autofill, control over address bar URLs and routing, PWA manifests, interactive scrollbars, keyboard shortcuts, and screen reader support for better accessibility.<br/>Reference:https://sdtimes.com/webdev/flutter-expands-web-support-in-major-update/',author_id=1,date="2020-10-04",image_file="image-1-1024x576.png"))
	db.session.commit()

	db.session.add(Post(title='Securing Microservices: The API gateway, authentication and authorization',content='Recently I was building a thousand-piece puzzle with my girlfriend. Experienced puzzle builders have some techniques to finish the task successfully. They follow what we call in algorithms “Divide and Conquer.”<br/><br/>For example, in the puzzle I built above with my girlfriend, we started by building the frame, then we gathered the pieces of trees, ground, castle and sky separately. We built each block separately, then at the end we collected all the bigger blocks together to have our full puzzle. Possibly, if we didn’t follow this approach and we tried to build line by line, we could have done it, but it would have taken a lot more effort and energy. We also wouldn’t have benefitted from being a team because we would have been looking at the same line, instead of doing working collaboratively and efficiently.<br/><br/>This is the same for software! Building software is quite complex, and that’s why software architects used to design the solution into separate modules, built by separate teams, then integrated into a full solution. However, a lot of the teams were still struggling with this approach. A single error in a small module could bring the entire solution down. Also, any update to any of the components meant that you would have to build the entire solution again. If a certain module has performance issues, you’d likely need to upgrade all of the servers supporting your application.<br/><br/>For these reasons (and many others), software firms such as Netflix, Google, and Amazon have started to adopt a “Microservices Architecture.”<br/><br/>There is no widely accepted definition for Microservices, but there is consensus about the characteristics.  Microservices:<br/><br/>are usually autonomously developed<br/>are independently deployable<br/>use messaging to communicate<br/>each deliver a certain business capability<br/>Reference:https://sdtimes.com/apis/securing-microservices-the-api-gateway-authentication-and-authorization/',author_id=1,date="2020-09-04",image_file="image1.png"))
	db.session.commit()

	db.session.add(Post(title='Build environmental sustainability into your development teams',content='Over the past several years, it’s become not just a cool thing for companies to appear to care about the environment, but a must to show customers what they’re actually doing about it. “Green pledges” have become the norm for a number of companies in order to publicly set sustainability goals and prove to customers that “Yes, we do care, and here’s what we’re going to do.” <br/><br/>For example, Amazon’s Climate Pledge promises the company will be net zero carbon by 2040, which is 10 years prior to the goal of the Paris Agreement. Last year, Microsoft pledged to be carbon negative—actually removing the carbon it emits from the environment—by 2030 and to completely remove all carbon the company has emitted since its founding in 1975 by 2050. In December 2020, Disney set new environmental goals for 2030, focusing on five areas: greenhouse gas emissions, water, waste, materials, and sustainable design.  The list of companies making similar pledges goes on and on.<br/><br/>While often when you think of what contributes the most to climate change, you might think of electronics that require mining rare minerals, one-time use products that end up in landfills, fossil fuels burned by various modes of transportation, or what we eat, but the internet — while not a physical product — is actually a huge contributor to greenhouse gas emissions. <br/><br/>In fact, according to a report from The Shift Project, digital technologies contributed to 3.8% of global emissions in 2018.  To put this in perspective, the Sustainable Web Manifesto notes that “if the Internet was a country, it would be the 7th largest polluter.”<br/><br/>“An internet application is the silent killer when it comes to carbon emissions and things like that. A developer, when they’re writing a line of code, or adding an image or a third-party tag to a page, the last thing on their mind is the impact that’s going to have on energy efficiency,” said Michael Gooding, manager of solutions engineering at EMEA Akamai Technologies, a CDN company that has been investing in reducing its carbon footprint and that of its customers. <br/><br/>In addition to reducing greenhouse gas emissions, there are a number of benefits that building more sustainable applications will provide. According to Chris Adams, co-founder of sustainability consultancy Greening Digital and director at the Green Web Foundation, the decisions that make an organization’s digital technologies greener also tend to save the company money. “If you’re burning needless compute as a developer, not only are you burning loads of cash, but the internet is basically the world’s biggest machine and still runs mostly on fossil fuels, so it also means you’re burning a lot of fossil fuels,” said Adams.<br/><br/>In addition to saving money, going green can also help your company attract top talent. “You can talk about climate in terms of retaining your best people or making it easier to attract people to a company, especially if you’re looking to hire a younger set of people, or actually once people have kids they tend to suddenly become much more interested in climate,” said Adams.<br/><br/>At a high level, efficiencies can be made in both software and hardware. According to Mike Mattera, director of corporate sustainability at Akamai Technologies, on the software side, there are efficiencies that can be built into code, such as optimizing images and being conscious of third-party libraries being added to an application. On the hardware side, improvements can be made such as running servers at hotter temperatures or using renewable energy. <br/><br/>There are a number of resources out there that teams can use as a starting place and to look at for best practices. One popular resource is the Principles of Sustainable Software Engineering (Principles.green), which is a set of eight practices that can be used to “define, build, and run sustainable software applications.”<br/><br/>The eight principles include:<br/><br/>Carbon: Companies should build applications that emit as little carbon as possible. <br/>Electricity: Because most electricity is produced by burning fossil fuels, companies should build applications that are energy efficient.<br/>Carbon Intensity: Applications should be consuming the lowest amount of carbon intensity, which is a measure of how much carbon emissions are produced per kWh of electricity that is consumed. For example, wind, solar, and hydroelectric emit no carbon, while fossil fuel sources emit some amount of carbon to produce electricity. <br/>Embodied Carbon: When possible, build applications that can run on older hardware, because hardware releases carbon both when it is created and destroyed, so elongating the lifespan of a device helps to reduce carbon emissions. <br/>Energy Proportionality: Servers should be utilized as efficiently as possible. Servers aren’t configured for power-saving, and often are left in idle mode during low demand periods. To combat this, run work on as few servers as possible. <br/>Networking: Companies should try to reduce the amount of data they produce and store, and reduce the distance that data needs to travel across the network. <br/>Demand shaping: Rather than shaping supply to meet demand, consider shaping demand to match the supply. For example, video conferencing software often reduces the video quality to prioritize audio quality, rather than streaming at the highest quality possible the whole time.<br/>Measurement and Optimization: Companies should focus on end-to-end optimizations on carbon efficiency across the entire organization. According to the Principle.green site, the most impactful optimizations will come from those who understand the carbon footprint of the entire stack, from the front-end to the data center. <br/>According to Adams, the Principles of Sustainable Software Engineering started when he was speaking with Asim Hussain, Green Cloud Advocacy Lead at Microsoft, who wanted to put together something like a 12 Factor App Methodology for sustainable software. “I thought yeah that’s a really good idea because in many cases there’s been a number of pieces and manifestos and things that have been put into the world previous, but in many cases it’s not always obvious how to go from something like signing a manifesto saying ‘yeah, I think we should care about humans as well as computers and the climate’ to then how does that translate into something meaningful?”<br/>Reference:https://sdtimes.com/softwaredev/build-environmental-sustainability-into-your-development-teams/',author_id=1,date="2020-08-04",image_file="sustainability-1024x575.jpg"))
	db.session.commit()

	db.session.add(Post(title='A guide to low-code platforms',content='HCL Volt MX: HCL Volt MX is an industry-leading low-code app-dev platform that powers developer productivity, agility, and speed to build apps that transform the business. HCL Volt MX makes it easy to deliver amazing apps across all digital touchpoints, integrate diverse and complex systems, and add innovative experiences such as VR and AR to meet ever-evolving customer expectations.  <br/><br/>Quickbase: Quickbase provides a no-code operational agility platform that enables organizations to improve operations through real-time insights and automation across complex processes and disparate systems. Our goal is to help companies achieve operational agility–to be more responsive to customers, more engaging to employees and as adaptable as possible to what’s next. Quickbase helps nearly 6,000 customers, including over 80% of the Fortune 50. Visit quickbase.com to learn more.  <br/><br/>Isomorphic: Isomorphic Software is the global leader in high-end, web-based business applications. They develop, market, and support the Reify low-code platform, as well as the SmartClient & Smart GWT HTML5/Ajax platform Reify is based on. Their technology gives you all the productivity of a low-code approach, combined with all the power of an enterprise-grade web application platform.<br/><br/>RELATED CONTENT:<br/>Businesses in 2021 think high for low code<br/>How do you help customers with their low-code initiatives?<br/><br/>AgilePoint: AgilePoint NX is a low-code development platform that allows both developers and “citizen programmers” to easily implement and deploy cross-functional/cross-organizational business apps into digital processes across multiple environments and cloud platforms. <br/><br/>Alpha Software Corporation: Alpha Software offers the only unified mobile and web development and deployment platform with distinct “no-code” and “low-code” modes. The platform materially accelerates digital transformation by allowing line of business professionals to work in parallel with IT developers.<br/><br/>Altova’s MobileTogether provides developers with the tools needed to build complex mobile applications quickly and easily. With MobileTogether, developers can create apps without having to manually write code, without needing to sacrifice quality. It uses a combination of drag-and-drop components and easy-to-understand functional programming, making it easy for developers to use it to build sophisticated mobile apps. <br/><br/>Appian: Appian’s platform allows teams to quickly build unified views of business information from across existing systems, and lets them create optimized processes that manage and interact with their data. Abandon the need for code with drag-and-drop, declarative, visual development for all aspects of app dev – UX design, process design, rules design, and more.<br/><br/>Boomi: Boomi is a provider of cloud integration and workflow automation software that lets organizations connect everything and engage everywhere across any channel, device or platform using Boomi’s industry leading low-code iPaaS platform. The Boomi unified platform includes Boomi Flow, low-code workflow automation with cloud native integration for building and deploying simple and sophisticated workflows to efficiently drive business.<br/>Reference:https://sdtimes.com/lowcode/a-guide-to-low-code-platforms/',author_id=1,date="2020-07-04",image_file="doors-1767563_640.jpg"))
	db.session.commit()

	db.session.add(Post(title='Why developers love Go',content='The open source Go programming language, also known as Golang, has worked to simplify developer lives since it first appeared in 2009.<br/><br/>While it may have been Google’s backing that gained developers’ attention, its efficiency, simplicity and tooling are the reason developers keep coming back, according to Nathan Youngman, author of Get Programming with Go. He explained that efficiency equates to fewer servers, which is good for business. Simplicity and familiarity mean it’s easy to learn. And the tooling means more uniform code, making it easier to understand. <br/><br/>Last year, the Stack Overflow developer survey reported that Go was the fifth most loved programming language, moving up from the 10th spot the previous year. It is also the third most wanted language among developers who aren’t using it,  but are interested in it. <br/><br/>According to the language’s 2019 annual developer survey, the reason more developers don’t use it is because they are working on a project in another language, their team prefers another language, and the lack of critical features doesn’t make it suitable for their needs. However, the number of developers that prefer a different language is decreasing every year. Eighty-nine percent of respondents indicated they want to use Go for their next project, and 86% who are using it reported it is working well for their teams. <br/><br/>What makes Go special?<br/>The beauty of Go has more to do with its lack of features than its actual features, according to Jonathan Bodner, distinguished engineer at Capital One. He explained it’s intentionally small and tries to be boring. “It’s not the prettiest language, or the one with the most features, but its focus on maintainability, testability, repeatable builds, and developer productivity gives it the right priorities for modern cloud development,” Bodner said. <br/><br/>According to Steve Francia, product and strategic lead for Go at Google, Go grew out of the need for simplicity. Programming languages were starting to get more and more complex and the readability was becoming untenable. When you have hundreds of teams working on the same codebase, much like Google does, readability is crucial. “One of the big catalysts for Go was to create a language that was simple, easy to read, easy to scale up on a human basis,” said Francia. <br/><br/>This is important because coding is a team sport, according to Thomas Limoncelli, SRE manager at Stack Overflow. “Devs spend more time reading existing code and updating it than writing new code from scratch. Code readability is undervalued in this industry. Google culture encourages engineers to change teams frequently (every 1.5-3 years). Therefore code readability is highly valued,” he said. <br/><br/>Limoncelli explained Google’s backing also didn’t hurt the language’s rise in popularity. “As a company grows they face more and more problems that Google faced years ago. It’s nice to have a trailblazer that cleared the way,” he added. <br/><br/>Go also has an advantage over older languages because decades ago when languages like Python, Java and JavaScript were developed, no one could have imagined how the world and technology would evolve. For instance, Francia explained pretty soon Moore’s Law will be coming to an end, and we will no longer have single-core machines. Go has concurrency baked in, making it easier to program on multiple cores and multiple threads. <br/><br/>Starting a language from scratch enabled the programming language’s team to learn and be inspired from other languages. “Making a new language allows for a reset. For example, C++ classes support multiple inheritance, whereas Java has interfaces and single-inheritance, and Go has interfaces but no inheritance,” said Youngman. “Such a reduction takes a best practice from other languages and makes it the ‘one way to do it.’ Simplifying the language in this way may benefit other aspects of the implementation, such as improving compile times.”<br/><br/>Luck and the right timing also had a lot to do with Go’s success, according to Google’s Francia. “[Go] happened to hit the right set of features at the same time the cloud was emerging, and as a result a lot of cloud native stuff (Docker, Kubernetes, Istio) was written in Go,” he said. “That was the incubation moment where it proved this wasn’t a research language, that it had practical use and that allowed it to cross into the mainstream.”<br/><br/>Since so many cloud development tools are written in the language, as companies move to the cloud and rethink their development stacks, they are starting to investigate the language, according to Capital One’s Bodner. <br/><br/>The language’s concurrency support “allows people to think about concurrency as data flowing through a system, with goroutines processing data that’s passed in and out via channels, with the data flow managed by select statements,” Bodner explained.<br/><br/>Other key features of the language include its fast compiler, which allows developers to get rapid feedback; its standard library and compatibility guarantee; and its implicit interfaces that enable duck typing while enforcing type safety, according to Bodner. <br/><br/>Areas for improvement<br/>With the variety of programming languages available for developers to learn, some languages are better than others for certain things, and Go is no exception. Capital One’s Bodner explained better immutability in Go would make it easier to understand how data flows through a program. “There are techniques that you can use in Go programs to mitigate this, but it’d be nice if there was a way to tag a value as immutable and have the compiler validate this,” he said.<br/><br/>Stack Overflow’s Limoncelli explained that while Go is very good at error handling, it can be verbose. “It would be nice to have a more concise syntax for dealing with errors,” he said. In addition, Go is aggressive about dropping support for older operating systems, and best suited for servers and systems that are updated frequently.<br/><br/>Youngman also noted that type parameters for generic programming “could open the floodgates for new kinds of libraries without sacrificing type safety.”<br/><br/>Google’s Francia added that GUI-based objects are more challenging in Go, and that Go is not a scripting language, so there may be places where developers want to script and Go isn’t the best fit. <br/>Reference:https://sdtimes.com/softwaredev/why-developers-love-go/',author_id=1,date="2020-07-05",image_file="Go-gopher-1024x575.jpg"))
	db.session.commit()