#finds the differences in runtime automatically and flags the biggest differences
Explore tagged Tumblr posts
Text
not to brag about being good at my job but Iâve now developed two separate tools for debugging entirely on my own within my company entirely from scratch without help and A. it makes my job so much fucking easier and B. my boss is thinks im incredible just because im too lazy to want to write the same bits of code over and over just for debugging purposes
#unimportant thoughts#one i wrote 2-3 months ago#but i upgraded it this week to add in even more#and its just. perfect now.#given an id from any of the programs we built and run in our company#i instantaneously return everything about it#its name; what it does; what type of program it is; what server its run on; when it runs; where it connects; the parameters needed to#connect to wherever it connects; whether the program is currently turned on; the last 10 times the program ran; how many minutes each of#those runs took; how many files each of those runs created; whether those runs were successful; code snippets you can copy paste and run in#another window to look at the files created by each of those runs; the files created by the most recent run; thise file names; those file s#sizes; what types of files they are; whether theyre encrypted#how theyre encrypted#all of that and MORE#most of the information was already there but it took fucking 20 minutes to get all the information you needed#and you had to run a bunch of different snippets of code to get all the information and then put it all together#and now you can just fucking pop in the id of the program and .02 of a second later all the information is on your screen#AND IT MAKES MY LIFE SO MUCH EASIER#so. so. so. much. easier.#and then this week I wrote another program so I can compare runtimes of two different runs of the same program together based on how we stor#runtime data in our database#csuse i was tired of going back and forth manually between to different runs to compare#so now i have a program that just takes the ids of two different runs and compares them#doesnt even matter if the checkpoints are different I programmed it to figure out the order automatically and plug in any missing holes#finds the differences in runtime automatically and flags the biggest differences#and I can even customize how much of a difference I care about or to hide things I donât care about
12 notes
¡
View notes
Text
Google launches Angular 8.0: Check out Exciting Facts about It

Angular 8.0: Check out Exciting Facts
All anticipation and speculation are over. Google finally released its latest version Angular 8.0 in May. It arrived just at the right time; six months after the launch of Angular in 7.0. As expected, Google has made some changes with a focus on performance and workflow enhancements. One of the biggest changes is the introduction of Ivy, Angularâs new runtime compiler. Apart from that, there are several other upgraded features in the new variant such as support for TypeScript 3.4, differential loading, Bazel support, and more. Thus, letâs find out whatâs new in Angular 8.0 Support for TypeScript 3.4 The Angular 8.0 extends its support to the TypeScript 3.4 version. TypeScript is a Microsoft-based open-source programming language, which provides an optional static typing facility. However, developers using TypeScript will need to upgrade to the latest version. TypeScript 3.4 offers various advantages such as generating clean, clear and readable JavaScript codes. Ivy Hogs the Limelight As mentioned, the Ivy render engine has been the showâs topper in the Angular 8.0 release. Ivy acts both as a runtime compiler and rendering pipeline. Google has asked developers not for a preview version for development purposes as it is still in the experimental phase. Therefore, you can create an application using an enable-ivy flag if you want to test it. The Ivy Comprises of Two Major Concepts Local, which helps in recompiling components Tree Shakable to remove unused codes How the Ivy preview will benefit the developers Ships pre-compiled code Easier to read and debug the code at runtime. Reduces Angular App bundle size âHello Worldâ from 30 KB to a mere 2.7 KB, which is almost equal to 93%.  Decreases the loading time of Hello World from 4 seconds to 2.2 seconds. Developers donât need any Metadata.json. The payload size gets enhanced. Differential Loading The Angular 8.0 will also support various browsers along with different bundles by default. The CLI (Command-Line Interface) extension creates more distinct bundles for both old and new JavaScript browsers. This is known as differential loading. The differential loading process allows browsers to choose new or old bundles based on their ability. Once chosen, the bundle gets automatically loaded. Users receive the bundle they need upon loading the application. For example, if you are using an ng update, tsconfig.json gets upgraded. The Command-Line Interface focuses on the target JS level in tscongfig.json to check if developers can benefit from the differential loading or not. Differential loading helps to speed up the development process using advanced syntax and smaller polyfills. Differential loading also helps to increase the loading speed of modern browsers to accelerate the interaction time. Advanced browsers can reduce the bundle size by 7 to 20% on average. Bazel: Creating the Hype When we analyze the updates and changes in Angular 8.0, it becomes important to highlight Bazel. Bazel is a Google-based open-source powerful tool that helps in tracking dependencies between packages and building targets. Bazel can function with any language input. Bazel allows you to- Use the same tool to develop both client-side and server-side applications Clearly, define the tasks based on inputs and outputs to run the important ones. Enhanced Support for Web Worker Bundling Web workers play an important role in simplifying and speeding the CPU-based intensive tasks. You can write code away from the main thread and task to a different background thread. However, you may have to face a challenge here. The code that runs on the web worker will not remain in a similar JavaScript file. Thus, you need to separate them, which at times can be tedious if working with Angular CLI tools. The Angular 8.0 provides complete parallelization of web worker bundling. Parallelizing helps front-end developers to streamline application development, which isn't possible with single thread limitations. Improvements in ViewChild and ContentChild The Angular JS Development Services version 8.0 offers a Boolean static flag, focusing on an instance of ViewChild and ContentChild. These instances can be accessed in ngOnInit. However, at times you cannot view them until the use of programming code ngAfterContentInit or ngAfterViewInit. The elements get loaded into DOM due to the data binding process. Seamless Migration to Angular.js With Angular 8.0 in place, it enables a LocationUpgradeModule in the Angular.js applications. It has allowed developers to seamlessly migrate applications to Angular.js with the help of a unified location service. Moreover, the LocationUpgradeModule can shift its base from $location service to Angular Location. It simplifies the development of hybrid applications depending on ngUpgrade. Opt-in Usage Sharing We can describe it as one of the interesting assets Angular 8.0. Opt-in usage sharing has been introduced to specifically suit the community's needs. Angular.js will only collect anonymous data when they are allowed to. The developers have access to commands used to build and accelerate application development. The developers can also share telemetry regarding CLI usage with their respective team members. The consent about data sharing improves development tools. The Final Words Angular 8.0 brings several other impressive features with support for SVG templates, lazy loading with dynamic imports, access to dart saas for SaaS files, and more. However, in order to reap the full comprehensive benefits of the latest version, you need to get in touch with a reliable and proficient Angular.js Development Company to upgrade your framework.   Read the full article
0 notes
Photo
Boost your app downloads by shrinking your app size Since the Android Marketplace launched in March 2012, average app size has quintupled. Some of this increase makes sense. Today, we expect richer content, better graphics, and more features from our mobile apps, and none of this comes for free! The memory available on your typical Android device has increased, so why shouldnât apps make use of this extra space if it helps them deliver a better user experience? If your app is going to reach as many users as possible, you need to pay attention to the size of your Android Package Kit (APK). A recent study published by a Strategy and Operations Analyst at Google showed APK size directly affects the number of people who end up installing your application after visiting its store page. According to these findings, for every 6 MB increase in the size of your APK, you can expect to see a 1 percent decrease in the installation conversion rate. There are many reasons why the size of your APK might be holding your application back: The user notices the APK size on your appâs Google Play listing, and decides not to install it based on this information. The user is approaching their data limit and doesnât want to incur additional costs. The installation fails due to a lack of space on the target device. This is a problem particularly in markets where budget devices are more common, such as emerging markets. The installation fails due to network connectivity issues, which are more likely to occur during lengthy downloads. In this article, Iâm going to show you how to ensure people visiting your appâs Google Play page actually end up installing it by sharing tools, techniques, and new features to help create a much leaner APK. Remove unused methods and classes with ProGuard ProGuard is a tool which can identify and remove unused classes, fields, methods, and attributes from your application code and any libraries you may be using. For the best result use the proguard-android-optimize.txt file, which has the same settings as the default proguard-android.txt file, but with optimizations that perform analysis inside and across methods. Hereâs how to enable ProGuard in your projectâs module-level build.gradle file: buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } Every time you build your project, ProGuard will generate a app/build/outputs/mapping/release/usage.txt file that lists everything ProGuard has removed from your APK, so check it to make sure it hasnât stripped away any code your project actually needs. If ProGuard does remove necessary code, then open the build/intermediates/proguard-files/proguard-android-optimize.txt-3.0.1.txt file and use the -keep flag to specify the code that you want to hang onto: -keep public class MyActivity Since ProGuard may remove code that your project does actually require, you should always test your project with ProGuard enabled, before publishing your final APK. Remove all unreferenced resources Sometimes unused resources can find their way into your project, particularly if youâre using libraries. Since unreferenced resources are just taking up unnecessary space, you should tell Gradle to search for, and remove these resources by enabling resource shrinking: buildTypes { release { shrinkResources true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } Whenever you build your project, the Gradle Console will provide an overview of how many resources itâs managed to remove, but you can view a list of these resources in your projectâs app/build/outputs/mapping/release/resources.txt file. While resource shrinking can help reduce the size of your APK, it has its limitations. It cannot remove resources from the âvaluesâ folder, and it wonât remove unnecessary alternative resources. For every 6MB increase in the size of your APK, you can expect to see a 1% decrease in the installation conversion rate. You should use resource shrinking in combination with Lint, a static scanning tool which can identify resources that arenât referenced in your code.s To run Lint, select Analyze â Inspect Code⌠from the Android Studio toolbar. If Lint detects any unused resources, then itâll display the following message in a new Inspection Results window: âUnused resources â The resource R.drawable.ic_launcher_background2 appears to be unused.â Lint can only detect unused resources, so youâll still need to remove them manually. Compress your drawables Graphical assets are often the biggest contributor to APK size, so compressing your drawables can significantly reduce the size. If youâre working with JPEGs, you can try a compression tool such as packJPG. If your project contains PNGs you can use zopflipng, pngcrush, OptiPNG, TinyPNG or pngquant. The Android Asset Packaging Tool (AAPT) optimizes the contents of your res/drawable folder automatically. If you compress your PNGs before passing them to AAPT, then it may actually end up inflating your PNGs. If you compress your PNGs manually, make sure you disable the AAPT process for them like this: android { aaptOptions { cruncherEnabled = false } Switch to WebP If your projectâs minSdkVersion is 18 or higher, converting a PNG, JPEG or BMP to WebP format often provides better compression, as well as the same image quality. In Android Studio, control-click the image you want to convert, or a folder containing multiple images. Select Convert to WebP⌠In the next menu, choose between lossy or lossless encoding. Check the Skip images when the encoded result is larger than the original box. Click OK to perform the conversion. If you switch to WebP, youâll still need to provide your launcher icon as a PNG. Modify images at runtime If you need to use variations of the same image, try to supply a single âbaseâ image that you customize at runtime wherever possible. You can apply a tint to an image using setTint() and rotate drawables using attributes like android:fromDegrees and android:pivotY. Use vector graphics On Android 5.0 and higher, you can draw assets at runtime by defining a VectorDrawable, which is an XML representation of a vector. These XML files contain path commands telling Android how to draw the lines and arcs that make up this graphic. Unlike many image formats, vectors can scale without losing definition, so you only need to provide one asset per image. However, rendering VectorDrawable objects is an intensive process, and you should only use them for small, simple graphics. Always do your research On Android 5.0 and higher, you can draw assets at runtime by defining a VectorDrawable, which is an XML representation of a vector. Before adding any library to your project, you should check its code size so you know exactly what impact itâs going to have on your final APK. You should also look critically at the features this library provides, as it may contain a significant amount of code, as well as resources your project doesnât actually need. For best results, always choose a library thatâs compact, optimized for mobile, and contains only the features that youâre actually going to use. Thereâs no shortage of third-party libraries out there, so itâs always worth shopping around to find the smallest library that still meets your needs. Remove unused library code Libraries may contain strings for a range of languages, but if you project doesnât explicitly support these languages then these strings are just adding unnecessary bulk to your final APK. Open your build.gradle file and specify the languages that your application officially supports, then Gradle will automatically exclude all resources for languages your application doesnât support, including strings from third party libraries: android { defaultConfig { //Use resConfigs to specify the languages that your app officially supports// resConfigs "en" Get specific with Google Play Services Many projects use Google Play Services. Rather than adding the entire library to your project, you should only include the APIs youâre actually going to use. If you only require access to the Google Location APIs, then just use this: implementation 'com.google.android.gms:play-services-location:11.8.0' Rather than this: implementation 'com.google.android.gms:play-services:11.8.0' Consider creating multiple APKs Itâs pretty standard practice to publish a single APK containing alternate resources for different device configurations. Occasionally this strategy may require users to download a large number of assets theyâll never use. If your APK is packed with high-density graphics, youâre essentially asking users on low-density screens to waste precious storage space on images their device physically cannot display. In this scenario, you may want to consider separating your single APK into multiple APKs which contain only the code and resources required for specific screen densities or Application Binary Interfaces (ABIs). When the user downloads your app from Google Play, theyâll receive an APK containing just the resources to target their particular device. To generate APKs based on screen density, add the following to your build.gradle file: android { ... ... ... //Create a âsplitsâ block// splits { //Create a âdensityâ block// density { enable true //Generate separate APKs for the following screen densities// include "ldpi", "mdpi" Even if you generate multiple APKs for specific screen densities, Gradle will always generate an APK containing the assets for all screen densities, so make sure you publish this universal APK to provide a fallback for devices that donât match any of your density-specific APKs. Different Android devices use different CPUs, which in turn support different instruction sets. Each combination of CPU and instruction set has an ABI, which defines how the applicationâs machine code interacts with the system. Gradle bundles the binaries for all ABIs into a single APK by default, but you can also create APKs based on ABI. When you tell Gradle to generate ABI-specific APKs, it wonât automatically generate a universal APK, so youâll need to include explicit instructions to create this universal APK: android { ... //Create a âsplitsâ block// splits { //Create an âABIâ block// abi { //Build multiple APKs based on ABI// enable true //Generate separate APKs for the following ABIs// include "arm64-v8a", "armeabi-v7a", "x86" //Generate a universal APK// universalApk true } } } Google Play will not allow you to upload multiple APKs to the same listing, if those APKs have the same version information. If you create multiple APKs, youâll need to assign each APK its own versionCode value. Allow your app to be installed on external storage Some users may choose to extend their deviceâs built-in memory by adding external storage (most commonly an SD card). Unless you request otherwise, Android will prevent the system from installing your app on external storage, so installation will fail if there isnât adequate on-device storage, though plenty of external storage is available. To give Android the option of installing your app on external storage, open your projectâs Manifest, and add either of the following lines: android:installLocation=âpreferExternal.â Your app prefers to be stored externally, but can also be installed on internal storage. android:installLocation=âauto.â Your app can be installed on internal or external storage, but the system will install your app on internal storage by default. Even if your APK is installed on external storage, all private user data, databases, optimized .dex files, and extracted native code will still be saved to internal memory. Consider offering your project as an Instant App For users who are struggling with storage space, connectivity issues or restrictive data plans, instant apps may be the only viable way of experiencing what your application has to offer. If you follow all the above techniques and best practices, you should be able to significantly reduce the size of your APK. No matter how slim your APK, the process of downloading and installing an app will always be the biggest barrier between your application and potential new users. So why not give users a way to experience your application without installing your APK? Androidâs âInstant Appsâ feature lets you separate your appâs most important functionality into stand-alone modules, and map each of these modules to a URL. The user can then load a module on demand by clicking its URL, which makes your app instantly accessible from any location that supports URLs, like emails, Google search results, forums, and YouTube comments. Behind the scenes, Instant Apps are delivered via a lightweight Instant Apps APK which contains only the code and resources required to deliver this particular feature, and always comes in at 4MB or under. For users struggling with storage space, connectivity issues, or restrictive data plans, instant apps may be the only viable way of experiencing what your application has to offer. Hopefully, their experience with your Instant App will motivate them to install the complete APK further down the line, once theyâre able. Wrapping up To ensure users arenât put off by the size of your app or arenât able to install it because it takes up too much of the internal storage, it is important to reduce the size of your final APK file. The techniques above could bring some dramatic savings which hopefully will convert directly into downloads and a healthier installed base. Do you have any additional tips for slimming down your Android apps? Let us know in the comments below! , via Android Authority http://bit.ly/2DE4Uj5
0 notes