decoding

Android how to scale an image with BitmapFactory Options

社会主义新天地 提交于 2019-12-01 02:21:28
I want to decode an image from the SD card with BitmapFactory.decodeFile(path, options). I also want images that are larger than 2048x2048 pixels to be scaled down to at most 2048x2048 (maintaining the proportions). I could do this manually after getting the bitmap, but that would require allocating a large amount of bytes in addition to the ones already allocated. How should i set up my BitmapFactory.Options object to get that effect? Thanks jbowes Use BitmapFactory.Options.inSampleSize when you first load your image to get the size as close as possible to your target size, then use Bitmap

Python: Unicode source file adds spaces (actually null bytes) between characters

匆匆过客 提交于 2019-12-01 02:13:20
问题 I am a newbie. However, I managed to extract some lines from a txt-file (unicode) and write them in another file. lines = InFile.readlines() OutFile.writelines(lines[3:]) It is working but (I believe) due to a coding issue there is a space added between each character in the output file. Example of a result: 2 0 1 3 - 1 2 - 2 3 ; ; 3 6 0 . 3 7 2 0 1 3 - 1 2 - 2 4 ; ; 0 . 0 0 Lines in the source file: 2013-12-23;;360.37 2013-12-24;;0.00 If I save the txt source file as ANSI before running the

Python Caesar Cipher Decoder

拜拜、爱过 提交于 2019-11-30 15:09:33
In my lesson I was tasked with creating a Caesar Cipher decoder that takes a string of input and finds the best possible string using a letter frequencies. If not sure how much sense that made but let post the question: Write a program which does the following. First, it should read one line of input, which is the encoded message, and will consist of capital letters and spaces. Your program must try decoding the message with all 26 possible values of the shift S; out of these 26 possible original messages, print the one which has the highest goodness. For your convenience, we will pre-define

=?ISO-8859-1 in mail subject

笑着哭i 提交于 2019-11-30 14:48:38
I'm acquiring the unread mails I have in my GMail account through PHP and its method imap_open When I get the subjects through the method imap_fetch_overview I get some subjects like this: =?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?= It's unreadable, I think because of its character encoding. What should I do to make it readable? To get the string in UTF-8, do: $or = '=?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?='; mb_internal_encoding('UTF-8'); $v = str_replace("_"," ",

How to get h264 video info?

跟風遠走 提交于 2019-11-30 12:57:24
问题 How can I get specific h264 video information from video file? I need to know profile (Baseline/Main/High) and is there B-Frames in movie? 回答1: I've found out that the best way for this is using FFprobe with -show_streams parameter. It shows both h.264 profile and B-frames usage for video streams of the movie. ffprobe -show_streams -i "file.mp4" [STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=High codec_type=video codec_time_base=1001/48000

Shortest possible encoded string with decode possibility (shorten url) using only PHP

让人想犯罪 __ 提交于 2019-11-30 12:52:46
问题 I'm looking for a method that encodes an string to shortest possible length and lets it be decodable (pure PHP, no SQL). I have working script but I'm unsatisfied with length of the encoded string. SCENARIO: Link to an image (depends on the file resolution I want to show to the user): www.mysite.com/share/index.php?img=/dir/dir/hi-res-img.jpg&w=700&h=500 Encoded link (so the user can't guess how to get the larger image): www.mysite.com/share/encodedQUERYstring So, basicaly I'd like to encode

Failed to execute: 0x80070057, when decoding video via ffmpeg with dxva2

半腔热情 提交于 2019-11-30 12:12:26
I have successfully implemented a video player using ffmpeg. I am now trying to use hardware decoding but I'm facing a couple issues. I found a post that I followed as a starting point here: https://ffmpeg.org/pipermail/libav-user/2014-August/007323.html I have updated the code that setup the necessary stuff for the decoder. The updated code is available here: https://drive.google.com/file/d/0B5ufHdoDzA4ieVk5UVpxcDNzRHc/view?usp=sharing And this is how I'm using it to initialize the decoder: // Prepare the decoding context AVCodec *codec = nullptr; _codecContext = _avFormatContext->streams[

How to stop an html TEXTAREA from decoding html entities

本秂侑毒 提交于 2019-11-30 11:01:39
I have a strange problem: In the database, I have a literal ampersand lt semicolon: <div whenever its printed into a html textarea tag, the source code of the page shows the > as > . How do I stop this decoding? Chris Hubbard In PHP, this can be done using htmlentities(). Example below. <?php $content = "This string contains the TM symbol: ™"; print "<textarea>". htmlentities($content) ."</textarea>"; ?> Without htmlentities(), the textarea would interpret and display the TM symbol (™) instead of "™". http://php.net/manual/en/function.htmlentities.php You can't stop entities being decoded in a

How to get h264 video info?

瘦欲@ 提交于 2019-11-30 04:28:06
How can I get specific h264 video information from video file? I need to know profile (Baseline/Main/High) and is there B-Frames in movie? I've found out that the best way for this is using FFprobe with -show_streams parameter. It shows both h.264 profile and B-frames usage for video streams of the movie. ffprobe -show_streams -i "file.mp4" [STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=High codec_type=video codec_time_base=1001/48000 codec_tag_string=avc1 codec_tag=0x31637661 width=1920 height=1080 has_b_frames=0 sample_aspect_ratio=0:1

effective solution: base32 encoding in php

旧时模样 提交于 2019-11-29 22:52:58
问题 I am looking for a base32 function/class for php. the different classes and function that i found are all very ineffective. I ran a benchmark and came to the following result: 10000 decodings: base32: 2.3273 seconds base64: 0.0062 seconds The base32 class which I have used is: http://www.php.net/manual/en/function.base-convert.php#102232 Is there any way which is simpler? The reason why I want to use base32 is that it is not case sensitive and as a result I have no problems any more regarding