Posts

Showing posts from February, 2008

Can VLC 3.0 Play Frame-by-frame Backwards?

Answer : The VLC help says : "Unfortunately, VLC doesn’t support frame-stepping backwards; it’s only possible to move forward". Other players may have a limited support for backward playing. This would be somewhat slow, because video files are usually constructed with the occasional full frame, while in-between frames only contain the difference. Backward stepping would involve going back to the last full frame and then forward to the requested frame. I found two posts that relate to your request : Video players that have frame by frame playback feature video player that can step forward/backwards and change play speed These posts contain links to various players that are said to be able to step backward, but VLC is not one of them. You will need to test and see. Because product recommendations are not allowed on our site, I cannot list these players here.

Angular-cli : Using Ng Lint

Answer : Updated answer for Angular CLI v6.x, 7.x, 8.x : ng lint <project-name> --fix where <project-name> is "name:" from package.json -- answer for Angular CLI v1.x -- ng lint -fix -- Original answer below -- To have tslint autofix many errors run the following in the root of your code. Obviously it can only autofix simpler issues like let -> const, "" -> ' etc. npx tslint src/**/*.ts --fix Yesterday I did this to auto-fix hundreds of let -> const issues in our fairly large code bases. Just reviewing the changes before committing took long enough, manually fixing them all would have taken over a day. For Angular 6.0+ you can run ng lint with autofix like so: ng lint <project> --fix where <project> is the name you gave to your project when running ng new . Learn more here: https://github.com/angular/angular-cli/wiki/lint The functionality you are asking about is partially available these days in VS

Best Tool For Inspecting PDF Files?

Image
Answer : Besides the GUI-based tools mentioned in the other answers, there are a few command line tools which can transform the original PDF source code into a different representation which lets you inspect the (now modified file) with a text editor. All of the tools below work on Linux, Mac OS X, other Unix systems or Windows. qpdf (my favorite) Use qpdf to uncompress (most) object's streams and also dissect ObjStm objects into individual indirect objects: qpdf --qdf --object-streams=disable orig.pdf uncompressed-qpdf.pdf qpdf describes itself as a tool that does "structural, content-preserving transformations on PDF files" . Then just open + inspect the uncompressed-qpdf.pdf file in your favorite text editor. Most of the previously compressed (and hence, binary) bytes will now be plain text. mutool There is also the mutool command line tool which comes bundled with the MuPDF PDF viewer (which is a sister product to Ghostscript, made by the same

Algorithm To Implement A Word Cloud Like Wordle

Answer : I'm the creator of Wordle. Here's how Wordle actually works: Count the words, throw away boring words, and sort by the count, descending. Keep the top N words for some N. Assign each word a font size proportional to its count. Generate a Java2D Shape for each word, using the Java2D API. Each word "wants" to be somewhere, such as "at some random x position in the vertical center". In decreasing order of frequency, do this for each word: place the word where it wants to be while it intersects any of the previously placed words move it one step along an ever-increasing spiral That's it. The hard part is in doing the intersection-testing efficiently, for which I use last-hit caching, hierarchical bounding boxes, and a quadtree spatial index (all of which are things you can learn more about with some diligent googling). Edit: As Reto Aebersold pointed out, there's now a book chapter, freely available, that covers this same terri

What Does <<= Means In C Code Example

Example: what is -> in c arrow operator ( -> ) in C is used to access a member of a struct which is referenced by the pointer in question

Android: StopService Doesn't Call OnDestroy

Answer : First, it's onDestroy, not OnDestroy . Second, you must use the @Override annotation for compile-time checking, so your Service code should look somewhat like this: @Override public void onDestroy(){ Log.v("SERVICE","Service killed"); player.stop(); super.onDestroy(); } First, you need to clarify how many types of services in Android. AFAIK, there are: Foreground service. Background service. Bound service. Intent service. These services stop in different ways. Foreground: only stop when you intentionally stop it by calling stopService() in activity or fragment where you start that service or call stopSelf() in its own service. And Please note only these methods trigger service's onDestroy() . Background: stopService() and stopSelf() do in the same way as foreground. Moreover, you should know this service is in the same thread with activity or fragment calling it, so if you destroy activity or fragment, this ser

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

Answer : Solution 1: When configured with two or more hostnames, the correct virtual host name and username must both be sent in the username by the ftp client. Separate the site name and user with the vertical line symbol: | www.example.com|MyUser So, in your FTP Client use this for the username: ftp.telefonievergelijken.nl|tv_ftp Solution 2: It appears that you're attempting to connect to the FTP site using a hostname which is not currently configured in any of the bindings to the FTP site within IIS. I base this only on the error output from Filezilla which you have included, as you have censored the hostname (even in example form) from the output, so there isn't much more to go on. You'll need to configure a binding on the FTP site which matches the hostname you are using to connect to the FTP site (whether that be from Filezilla or any other FTP client). EDIT: From your updated post information, I notice that your bindings for the FTP site are indeed in

1cm To Inches Code Example

Example 1: cm to inch 1 cm = 0.3937 inch Example 2: cm to inches const cm = 1; console.log(`cm:${cm} = in:${cmToIn(cm)}`); function cmToIn(cm){ var in = cm/2.54; return in; }

Angular NgSwitch Example

directive The [ngSwitch] directive on a container specifies an expression to match against. The expressions to match are provided by ngSwitchCase directives on views within the container. Every view that matches is rendered. If there are no matches, a view with the ngSwitchDefault directive is rendered. Elements within the [ NgSwitch] statement but outside of any NgSwitchCase or ngSwitchDefault directive are preserved at the location. See also NgSwitchCase NgSwitchDefault Structural Directives Exported from CommonModule Selectors [ ngSwitch] Properties Property Description @ Input() ngSwitch : any Write-Only Description Define a container element for the directive, and specify the switch expression to match against as an attribute: <container-element [ngSwitch]="switch_expression"> Within the container, * ngSwitchCase statements specify the match expressions as attributes. Include * ngSwitchDefault as t

Bulk Convert DBF To CSV In A Folder ArcGIS 10.1 Using Python

Answer : I have only tested this very briefly (and with a limited variety of data), but this script demonstrates one way this might be accomplished: import arcpy import csv import os import codecs import cStringIO def batch_convert_dbf_to_csv(input_dir, output_dir, rename_func=None): """Converts shapefiles and standalone DBF tables within the input directory input_dir to CSV files within the output directory output_dir. An optional function rename_func may be used to manipulate the output file name.""" # Set workspace to input directory arcpy.env.workspace = input_dir # List shapefiles and standalone DBF tables in workspace tables = list_tables() # Only proceed if there actually exists one or more shapefiles or DBF tables if tables: # Create output directory structure make_output_dir(output_dir) # Loop over shapefiles and DBF tables for table in tables: # Generate

Can I Use HttpClientFactory In A .NET.core App Which Is Not ASP.NET Core?

Answer : According to the documentation HttpClientFactory is a part of .Net Core 2.1, so you don't need ASP.NET to use it. And there some ways to use are described. The easiest way would be to use Microsoft.Extensions.DependencyInjection with AddHttpClient extension method. static void Main(string[] args) { var serviceProvider = new ServiceCollection().AddHttpClient().BuildServiceProvider(); var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>(); var client = httpClientFactory.CreateClient(); } Thanks for replies. So it is possible to use in console app. There are a few ways to do this, depending on what way you want to go. Here are 2: Directly add to ServiceCollection e.g. services.AddHttpClient() Use Generic host e.g. Add httpclientFactory in .ConfigureServices() method See here for blog post using in console app As one of the answers suggests, you do not need ASP.NET to use it However, you need a bit of work to ge

Clang Vs GCC - Which Produces Faster Binaries?

Answer : Here are some up-to-date albeit narrow findings of mine with GCC 4.7.2 and Clang 3.2 for C++. UPDATE: GCC 4.8.1 v clang 3.3 comparison appended below. UPDATE: GCC 4.8.2 v clang 3.4 comparison is appended to that. I maintain an OSS tool that is built for Linux with both GCC and Clang, and with Microsoft's compiler for Windows. The tool, coan, is a preprocessor and analyser of C/C++ source files and codelines of such: its computational profile majors on recursive-descent parsing and file-handling. The development branch (to which these results pertain) comprises at present around 11K LOC in about 90 files. It is coded, now, in C++ that is rich in polymorphism and templates and but is still mired in many patches by its not-so-distant past in hacked-together C. Move semantics are not expressly exploited. It is single-threaded. I have devoted no serious effort to optimizing it, while the "architecture" remains so largely ToDo. I employed Clang prior to 3

How To Compare Two Char Arrays In Cpp Code Example

Example: c++ compare char array // syntax # include <cstring> // this needs to be at the top of the script/code std :: strcmp ( < 1 st - char > , < 2 nd - char > ) // example (assuming: char_1 = 'Compare me'; char_2 = 'Compare_me') # include <cstring> if ( std :: strcmp ( char_1 , char_2 ) == 0 ) { std :: cout << "The char's that you compared match!" << std :: endl ; } else { std :: cout << "The char's that you compared DON'T match" << std :: endl ; } // OUTPUT: The char's that you compared match! /* NOTE: the following outputs of std::strcmp indicate: [less than zero] : left-hand-side appears before right-hand-side in lexicographical order [zero] : the chars are equal [greater than zero] : left-hand-side appears after right-hand-side in lexicographical order */