problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static int io_open_default(AVFormatContext *s, AVIOContext **pb,
const char *url, int flags, AVDictionary **options)
{
return avio_open2(pb, url, flags, &s->interrupt_callback, options);
}
| 1threat |
Python merge dict JSON lists : I'm trying to merge two lists that I have.
gpbdict = dict(zip(namesb, GPB))
>>> {'1': True, '3': True, '2': True, '5': True, '4': True, '7': True, '6': True, '8': True}
gpadict = dict(zip(namesa, GPA))
>>> {'11': True, '10': True, '13': True, '12': True, '15': True, '14': True, '16': True, '9': True}
However, it doesn't seem to be as simple as just:
json.loads(gpadict + gpbdict)
or
gpa_gpb = [gpadict, gpbdict]
print json.dumps(gpa_gpb, indent=2, sort_keys=True))
Only the later will produce a result with two separate lists:
>>>[
>>> {
>>> "10": true,
>>> "11": true,
>>> "12": true,
>>> "13": true,
>>> "14": true,
>>> "15": true,
>>> "16": true,
>>> "9": true
>>> },
>>> {
>>> "1": true,
>>> "2": true,
>>> "3": true,
>>> "4": true,
>>> "5": true,
>>> "6": true,
>>> "7": true,
>>> "8": true
>>> }
>>>]
Is there a step I'm missing? | 0debug |
Set-Content sporadically fails with "Stream was not readable" : <p>I have some PowerShell scripts that prepare files before a build. One of the actions is to replace certain text in the files. I use the following simple function to achieve this:</p>
<pre><code>function ReplaceInFile {
Param(
[string]$file,
[string]$searchFor,
[string]$replaceWith
)
Write-Host "- Replacing '$searchFor' with '$replaceWith' in $file"
(Get-Content $file) |
Foreach-Object { $_ -replace "$searchFor", "$replaceWith" } |
Set-Content $file
}
</code></pre>
<p>This function will sporadically fail with the error:</p>
<pre><code>Set-Content : Stream was not readable.
At D:\Workspace\powershell\ReplaceInFile.ps1:27 char:5
+ Set-Content $file
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (D:\Workspace\p...AssemblyInfo.cs:String) [Set-Content], ArgumentException
+ FullyQualifiedErrorId : GetContentWriterArgumentError,Microsoft.PowerShell.Commands.SetContentCommand
</code></pre>
<p>When this happens, the result is an empty file, and an unhappy build. Any ideas why this is happening? What should I be doing differently?</p>
| 0debug |
e1000e_init_msi(E1000EState *s)
{
int res;
res = msi_init(PCI_DEVICE(s),
0xD0,
1,
true,
false);
if (res > 0) {
s->intr_state |= E1000E_USE_MSI;
} else {
trace_e1000e_msi_init_fail(res);
}
}
| 1threat |
Is there a shortcut for b && b.c && b.c.d ? b.c.d : "default"; : <p>If I want to set a constant with a value from a nested object property that can be undefined or set it to a default value, I can do this:</p>
<pre><code>const a = b && b.c && b.c.d ? b.c.d : "default value";
</code></pre>
<p>I don't like this syntax because I find it unreadable. I prefer:</p>
<pre><code>const a = b.c.d || "default value";
</code></pre>
<p>But this syntax fails if <code>b</code> or <code>c</code> is not an object (undefined). Is there a syntax for this kind of need?</p>
| 0debug |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
taking default value in argparse : <p>I am using argparser module and when using the below two commands.
The first works fine, but the second one fails.</p>
<p>SyntaxError: invalid syntax</p>
<p>I want if no value is specified it should take today as the value.</p>
<p>I am fetching the result using results.day</p>
<pre><code>parser.add_argument('-sub4' , action='store' , dest='subject4' , help='Fourth subject' , type=str , default="")
parser.add_argument('-day' , action='store' , dest='day' , help="yesterday/week default-today , type=str , default="today")
</code></pre>
<p>Thanks</p>
| 0debug |
Write to a website using java : <p>I am currently working on reading and writing to a website, only using Java. I have figured out how to read from the website, to get all the content on the actual website. But I am not completely sure where to begin with the writing, although it seems as if it is a simple action I want to do. I just want to write a specific string to a text area on a website.</p>
<p>To show the code I have for reading the site, I have attached it below. </p>
<pre><code>import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;
import org.apache.commons.io.IOUtils;
public class Read {
public static void main(String[] args) throws IOException {
URL url = new URL("http://website.com/");
URLConnection con = url.openConnection();
InputStream in = con.getInputStream();
String encoding = con.getContentEncoding();
encoding = encoding == null ? "UTF-8" : encoding;
String body = IOUtils.toString(in, encoding);
System.out.println(body);
PrintWriter pToDocu = new PrintWriter("readText.txt");
pToDocu.println(body);
pToDocu.close();
}
}
</code></pre>
<p>Now what I am trying to achieve is how to write the content of a string variable to a text area of which is on a website I have created. It is probably also pretty important to note that, for the info in the text area to be submitted a button called <em>submit</em> on the site has to be clicked. </p>
| 0debug |
How Hard reset removes everything but not removing *.zip file : <p>They tell Hard reset removes everything from our Android Phone then how is it keeping the custom-rom zip file after hard reset so that we can install the custom rom on to the device?</p>
<p>I didn't try but got the doubt when I am reading online on how to install Lineage-OS</p>
| 0debug |
bool aio_dispatch(AioContext *ctx, bool dispatch_fds)
{
bool progress;
progress = aio_bh_poll(ctx);
if (dispatch_fds) {
progress |= aio_dispatch_handlers(ctx, INVALID_HANDLE_VALUE);
}
progress |= timerlistgroup_run_timers(&ctx->tlg);
return progress;
}
| 1threat |
how to make all textarea of by website readonly : I am Using many Textarea on my [website][1] but they aren't read-only and it take a lot of time to convert them into <textarea readonly=''> by adding readonly='' in all of them. Is there is any other way to make them all readonly.
[1]: http://myblog-yard.blogspot.in | 0debug |
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
AVPacket *avpkt)
{
int ret;
*got_picture_ptr= 0;
if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
return -1;
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
av_packet_split_side_data(avpkt);
apply_param_change(avctx, avpkt);
avctx->pkt = avpkt;
if (HAVE_THREADS && avctx->active_thread_type&FF_THREAD_FRAME)
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
avpkt);
else {
ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
avpkt);
picture->pkt_dts= avpkt->dts;
if(!avctx->has_b_frames){
picture->pkt_pos= avpkt->pos;
}
if (!picture->sample_aspect_ratio.num)
picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
if (!picture->width)
picture->width = avctx->width;
if (!picture->height)
picture->height = avctx->height;
if (picture->format == PIX_FMT_NONE)
picture->format = avctx->pix_fmt;
}
emms_c();
if (*got_picture_ptr){
avctx->frame_number++;
picture->best_effort_timestamp = guess_correct_pts(avctx,
picture->pkt_pts,
picture->pkt_dts);
}
}else
ret= 0;
return ret;
}
| 1threat |
HTML input field that will post a whole number but display with commas : <p>I need an input field that matches the following criteria, I have looked at input masks but can't seem to find one that fits my needs! Any pointers would be much appreciated!</p>
<p>The field is for submitting a currency in whole numbers. I would like commas added in as the user is typing (or for it to accept properly placed commas) eg. 1,000,000, 1,000 etc.</p>
<p>It also needs to either not allow decimal places or automatically add .00 to the end.</p>
<p>Then when the PHP form is posted it needs to post only the whole number (or with the .00 on the end is fine!).</p>
<p>Does anybody have an idea how I could achieve this? Live validation would be best rather than waiting until submit. :)</p>
<p>There is server checks for the correct format so don't need to worry much about somebody without JS submitting bad input.</p>
<p>I have tried HTML5 number input with step as 1 but this still allows me to type decimals in and will even submit. I assume this is just for the arrows!</p>
| 0debug |
PHP function that accepts a JSON encoded array : <p>I was solving some math matrix problem, and I got idea to write PHP function that accepts a JSON encoded array and:</p>
<p>1) Sort first row of the given matrix (2D array) in ascending order. During the sorting, other rows should be moved like they are sticked to the first row (you are moving all columns when sorting first row).</p>
<p>2) Find the biggest number in the sorted 2D array except of first row. Then calculate the sum of the biggest number's coordinates (coordinates are starting at [1, 1]).</p>
<p>-- First row is only for sorting, it is not used for calculations</p>
<p>-- If the biggest number exist in more than one row then all coordinates of this biggest number have to be added to the sum) </p>
<p>Example of matrix (2D array) is:</p>
<p>6 3 9</p>
<p>9 1 6</p>
<p>4 7 9</p>
<p>Solution to the example is following:</p>
<p>6 3 9 => 3 6 9 => 3 6 9</p>
<p>9 1 6 => 1 9 6 => 1 <strong>9</strong> 6 => 9 (2, 2) and 9 (3, 3) => (2 + 2) + (3 + 3) => 10</p>
<p>4 7 9 => 7 4 9 => 7 4 <strong>9</strong></p>
<p>But, at the moment,I`m beginner in PHP and such code is above my skill, so I need some help.</p>
<p>First part is PHP array, but how to write such array with values found with coordinates as index. As you see, I`m stuck at the beginning of the problem!</p>
| 0debug |
How do I run webpack from SBT : <p>I'm developing a Play 2.4 application and would like SBT to run webpack to generate static assets during compilation. </p>
<p>I tried <a href="https://github.com/stejskal/sbt-webpack">https://github.com/stejskal/sbt-webpack</a> but it does't seem to work for me.</p>
| 0debug |
Excel import check Sheet password asp.net EPPLUS : I'm using EPPlus to create excel file with some restriction (lock, validation,..) and i have set a password for the sheet :
sheet.Protection.IsProtected = true;
sheet.Protection.SetPassword("pass");
Users have to make some changes in the file and import the same file.
How can i check when importing file that the passwod is the same ("pass")
using EPPLUS ? i want to be sure that user use and import the same Excel file.
Thanks a lot for your help. | 0debug |
Please i need a solution regarding python 2.7 : I am new to coding, this is my script I run on python 2.7
binme=binascii.b2a_hex(url)
file=('e1xydGYxbnNpbnNpY3BnMTI1MlxkZWZmMFxkZWZsYW5nMTAzM3sNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb250dGJsew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXNzDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0MCBBcmlhbDt9fXtcKlxnZW5lcmF0b3IgTXNmdGVkaXQgNS40MS4xNS4xNTA3O30NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlld2tpbmQ0XHVjMVxwYXJkDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMyMCBwYXJkXGYwXGZzXHBhci90YWJccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhci5ccGFyLlxwYXIuXHBhclxwYXJ7XHNocHtcc3B9fXtcc2hwe1xzcH19e1xzaHB7XHNwfX17XHNocHtcKlxzaHBpbnN0XHNocGZoZHIwXHNocGJ4Y29sdW1uXHNocGJ5cGFyYVxzaCBwd3IyfXtcc3B7XHNue317fXtcc259e1xzbn17XCpcKn1wRnJhZ21lbnRzfXtcKlwqXCp9e1wqXCpcc3Z7XCp9OTsyO2ZmZmZmZmZmZmYjMDUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwZTBiOTJjM2ZBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBNWMxMTEwM2ZhNTljMzgzZmNmYWYzOTNmMTAwMTA0MDEwMTAxMDEwMTAxMDEwMTAxZTBiOTJjM2YwMDgwMDAwMDQ2Y2IzOTNmZGVhZGJlZWZlMGI5MmMzZmMwM2QzYjNmY2MzMzIyM2ZkZjU5MmQzZmM0M2QzYjNmY2MxODJmM2ZjNDNkM2IzZjVlNzQyYjNmNWU3OTM5M2YyNDAwMDAwMDQ0Y2IzOTNmc2x1dGZ1Y2s2NzgyMzkzZmRlMTYzYTNmNjc4MjM5M2ZlMGI5MmMzZmMwM2QzYjNmYTU5YzM4M2Y3YzBhMmIzZmUwYjkyYzNmNTU2Njc3ODhjMDNkM2IzZmE1OWMzODNmZmJiZTM4M2ZlMGI5MmMzZjgwMDAwMDAwYjQ0MTM0M2Y1NTU1NTU1NTY2NjY2NjY2Y2ZhZjM5M2Y0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxNDE0MTQxZWI3NzMxYzk2NDhiNzEzMDhiNzYwYzhiNzYxYzhiNWUwODhiN2UyMDhiMzY2NjM5NGYxODc1ZjJjMzYwOGI2YzI0MjQ4YjQ1M2M4YjU0MDU3ODAxZWE4YjRhMTg4YjVhMjAwMWViZTMzNDQ5OGIzNDhiMDFlZTMxZmYzMWMwZmNhYzg0YzA3NDA3YzFjZjBkMDFjN2ViZjQzYjdjMjQyODc1ZTE4YjVhMjQwMWViNjY4YjBjNGI4YjVhMWMwMWViOGIwNDhiMDFlODg5NDQyNDFjNjFjM2U4OTJmZmZmZmY1ZjgxZWY5OGZmZmZmZmViMDVlOGVkZmZmZmZmNjg4ZTRlMGVlYzUzZTg5NGZmZmZmZjMxYzk2NmI5NmY2ZTUxNjg3NTcyNmM2ZDU0ZmZkMDY4MzYxYTJmNzA1MGU4N2FmZmZmZmYzMWM5NTE1MThkMzc4MWM2ZWVmZmZmZmY4ZDU2MGM1MjU3NTFmZmQwNjg5OGZlOGEwZTUzZTg1YmZmZmZmZjQxNTE1NmZmZDA2ODdlZDhlMjczNTNlODRiZmZmZmZmZmZkMDYzNmQ2NDJlNjU3ODY1MjAyZjYzMjAyMDYxMmU2NTc4NjUwMA==\n')
textfile = open(filename , 'w')
textfile.write(file.decode('base64')+binme+close)
But I get this error when I try to run it:
Traceback (most recent call last):
File "<string>", line 420, in run_nodebug
File "<module1>", line 32, in <module>
TypeError: 'str' does not support the buffer interface
Please what is wrong? | 0debug |
SQL get min, max, and average using GROUP BY : <p>I have a table that looks like:</p>
<pre><code>βββββββββββ€βββββββββββ
β user_id β quantity β
β ββββββββββͺβββββββββββ£
β 5 β 1 β
βββββββββββΌβββββββββββ’
β 5 β 5 β
βββββββββββΌβββββββββββ’
β 5 β 9 β
βββββββββββΌβββββββββββ’
β 6 β 0 β
βββββββββββΌβββββββββββ’
β 6 β 1 β
βββββββββββΌβββββββββββ’
β 7 β NULL β
βββββββββββΌβββββββββββ’
β 7 β 2 β
βββββββββββΌβββββββββββ’
β 7 β NULL β
βββββββββββΌβββββββββββ’
β 7 β 5 β
βββββββββββΌβββββββββββ’
β 7 β 0 β
βββββββββββΌβββββββββββ’
β 7 β 1 β
βββββββββββ§βββββββββββ
</code></pre>
<p>And I would like to create a query that uses <code>GROUP BY</code> in order to generate a result that looks like this:</p>
<pre><code>βββββββββββ€βββββββββββββββββ€βββββββββββββββ€βββββββββββββββ€βββββββββββββββββββ
β user_id β quantity_total β quantity_min β quantity_max β quantity_average β
β ββββββββββͺβββββββββββββββββͺβββββββββββββββͺβββββββββββββββͺβββββββββββββββββββ£
β 5 β 15 β 1 β 9 β 5 β
βββββββββββΌβββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββ’
β 6 β 1 β 0 β 1 β 0.5 β
βββββββββββΌβββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββ’
β 7 β 8 β 0 β 5 β 2 β
βββββββββββ§βββββββββββββββββ§βββββββββββββββ§βββββββββββββββ§βββββββββββββββββββ
</code></pre>
<p>Please note that there are random fields that may have a value of <code>NULL</code> and they are to be skipped and <em>not</em> to be accounted for in the min, max, or average. Thanks in advance for your guidance!</p>
| 0debug |
Syntax error or access violation: 1055 Expression #8 of SELECT list is not in GROUP BY clause and contains nonaggregated column : <p>i tried the CakePHP 3.x "Bookmaker Tutorial" and i followed the instruction step by step. Unfortunately, at the end of the first chapter i get the attached error:</p>
<pre><code>Error: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #8 of SELECT list
is not in GROUP BY clause and contains nonaggregated column 'wis.Tags.id' which is not
functionally dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by
</code></pre>
<p>Furthermore, i get the information to check my "BookmarksTags" table but i do not have to creat one before. I little bit confused.</p>
<pre><code>Please try correcting the issue for the following table aliases:
BookmarksTags
</code></pre>
<p>I already google my problem and i found information to update the "my.cnf" with a extra line. i already try but nothing happed. I also check the spelling and downloaded the "bookmarker-tutorial" from github but i still get this error above.</p>
<p>I use MySQL 5.7.11 and PHP 5.6.14. </p>
| 0debug |
What is the equivalent of ExternalResource and TemporaryFolder in JUnit 5? : <p>According to the <a href="http://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-rulesupport" rel="noreferrer">JUnit 5 User Guide</a>, JUnit Jupiter provides backwards compatibility for some JUnit 4 Rules in order to assist with migration.</p>
<blockquote>
<p>As stated above, JUnit Jupiter does not and will not support JUnit 4 rules natively. The JUnit team realizes, however, that many organizations, especially large ones, are likely to have large JUnit 4 codebases including custom rules. To serve these organizations and enable a gradual migration path the JUnit team has decided to support a selection of JUnit 4 rules verbatim within JUnit Jupiter. </p>
</blockquote>
<p>The guide goes on to say that one of the rules is <a href="http://junit.org/junit4/javadoc/4.12/org/junit/rules/ExternalResource.html" rel="noreferrer">ExternalResource</a>, which is a parent for <a href="http://junit.org/junit4/javadoc/4.12/org/junit/rules/TemporaryFolder.html" rel="noreferrer">TemporaryFolder</a>.</p>
<p>However, the guide unfortunately doesn't go on to say what the migration path is, or what the equivalent is for those writing new JUnit 5 tests. So what should we use?</p>
| 0debug |
static uint64_t cadence_ttc_read(void *opaque, target_phys_addr_t offset,
unsigned size)
{
uint32_t ret = cadence_ttc_read_imp(opaque, offset);
DB_PRINT("addr: %08x data: %08x\n", offset, ret);
return ret;
}
| 1threat |
SQL How to query for earliest stock price? : <p>I have a table that has rows for various stock prices at various times of the day for many different companies. Each row is a stocks price at a particular time of day. The times are not the same for each stock. </p>
<p>I can't figure out how to query for the price of each stock at the earliest time point. </p>
<p>For example, from the below example table I would want the query to return:
ABC 1.25
XYZ 0.95</p>
<p><em>[Stock]</em> <em>[Trade Time]</em> <em>[Price]</em></p>
<p>ABC 9:35 1.25</p>
<p>ABC 9:55 1.15</p>
<p>ABC 10:35 1.50</p>
<p>XYZ 9:47 0.95</p>
<p>XYZ 9:53 1.00</p>
<p>XYZ 11:10 0.85</p>
| 0debug |
av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
{
int j;
fs->plane_count = f->plane_count;
fs->transparency = f->transparency;
for (j = 0; j < f->plane_count; j++) {
PlaneContext *const p = &fs->plane[j];
if (fs->ac) {
if (!p->state)
p->state = av_malloc_array(p->context_count, CONTEXT_SIZE *
sizeof(uint8_t));
if (!p->state)
return AVERROR(ENOMEM);
} else {
if (!p->vlc_state)
p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState));
if (!p->vlc_state)
return AVERROR(ENOMEM);
}
}
if (fs->ac > 1) {
for (j = 1; j < 256; j++) {
fs->c. one_state[ j] = f->state_transition[j];
fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j];
}
}
return 0;
}
| 1threat |
How Java random generator works? : <p>I wrote program that simulates dice roll</p>
<pre><code> Random r = new Random();
int result = r.nextInt(6);
System.out.println(result);
</code></pre>
<p>I want to know if there is a way to "predict" next generated number and how JVM determines what number to generate next?</p>
<p>Will my code output numbers close to real random at any JVM and OS?</p>
| 0debug |
The Value value from final Variable Give me minus : I try to make some some with various variables and it should give 200 on final response But It Give me -200 What Is Wrong With My Code Why It give -200 i want it to give me 200 on final some
My App Send An Ajax call With a variable $Points but for security i have made a some with more two variables
for example if the user have 200 points the app it will add the ntruck=412020 and truck=20201
so on final it send to the php script the value 432221+200=432421
wen the script is load it take from total 432421-ntruck-truck so it will stay only the value of the points 200
This Is my code:
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<?php
$point = "432421";
$ntruck = "412020";
$truck = "20201";
$sum_total = $truck + $ntruck;
$npoints = $sum_total - $point;
$points = $npoints;
echo $points;
?>
<!-- end snippet -->
But Wen I Make An Echo It Give me minus -200 where i have failed | 0debug |
"Empty continuation lines will become errors"β¦ how should I comment my Dockerfile now? : <p>Consider the following Dockerfile:</p>
<pre class="lang-docker prettyprint-override"><code>FROM alpine:edge
EXPOSE \
# web portal
8080 \
# backdoor
8081
</code></pre>
<p>Built like so:</p>
<pre class="lang-bash prettyprint-override"><code>docker build .
</code></pre>
<p>We observe such output:</p>
<pre><code>Sending build context to Docker daemon 17.1TB
Step 1/2 : FROM alpine:edge
---> 7463224280b0
Step 2/2 : EXPOSE 8080 8081
---> Using cache
---> 7953f8df04d9
[WARNING]: Empty continuation line found in:
EXPOSE 8080 8081
[WARNING]: Empty continuation lines will become errors in a future release.
Successfully built 7953f8df04d9
</code></pre>
<p>So, given that it'll soon become illegal to put comments in the middle of a multi-line section: <strong>what's the new recommended way to comment multi-line commands</strong>?</p>
<p>This is particularly important for <code>RUN</code> commands, since we are encouraged to reduce image layers by <code>&&</code>ing commands together.</p>
<hr>
<p>Not sure exactly when this was introduced, but I'm currently experiencing this in version:</p>
<pre><code>π docker --version
Docker version 17.07.0-ce, build 8784753
</code></pre>
<p>I'm using Docker's <em>edge</em> release stream, so maybe this will not yet look familiar if you are using Docker stable.</p>
| 0debug |
How write singleton class stuff in SWIFT 3.0 : <p>How write singleton class setup in swift 3.0. Currently i am using this code in objective c .
How write singleton class setup in swift 3.0. Currently i am using this code in objective c</p>
<pre><code> #pragma mark Singleton
static ModelManager* _instance = nil;
+ (ModelManager *) sharedInstance {
@synchronized([ModelManager class]){
if (!_instance) {
_instance = [[self alloc] init];
}
return _instance;
}
return nil;
}
+ (id)alloc {
@synchronized([ModelManager class]){
NSAssert(_instance == nil, @"Attempted to allocate a second instance of a singleton.");
_instance = [super alloc];
return _instance;
}
return nil;
}
+ (id)allocWithZone:(NSZone *)zone {
@synchronized([CTEModelManager class]) {
NSAssert(_instance == nil, @"Attempted to allocate a second instance of a singleton.");
_instance= [super allocWithZone:zone];
return _instance; // assignment and return on first allocation
}
return nil; //on subsequent allocation attempts return nil
}
- (id)init {
self = [super init];
if (self != nil) {
}
return self;
}
- (id)copyWithZone:(NSZone *)zone {
return self;
}
</code></pre>
| 0debug |
Program putting too much stress on computer, how to fix? : <p>I've been working on a machine learning program. When it runs for a few minutes my computer gets very hot. Is there a way to limit the amount of pressure it's putting on the CPU? </p>
| 0debug |
What to do when pip & conda overlap? : <p>I have a reasonable understanding of the difference between <code>conda install</code> & <code>pip install</code>; How <code>pip</code> installs python only packages & <code>conda</code> can install non-python binaries. However, there is some overlap between these two. Which leads me to ask:</p>
<p><strong>What's the rule of thumb for whether to use <code>conda</code> or <code>pip</code> when both offer a package?</strong></p>
<p>For example, <code>TensorFlow</code> is available on both repositories but from the <a href="https://www.tensorflow.org/install/install_linux" rel="noreferrer">tensorflow docs</a>:</p>
<blockquote>
<p>within Anaconda, we recommend installing TensorFlow with the
<code>pip install</code> command, not with the <code>conda install</code> command.</p>
</blockquote>
<p>But, there are many other packages that overlap, like <code>numpy</code>, <code>scipy</code> etc.</p>
<p><br>
However, <a href="https://stackoverflow.com/a/33626087/7607701">this Stackoverflow answer</a> suggests that <code>conda install</code> should be the default & <code>pip</code> should only be used if a package is unavailable from <code>conda</code>. Is this true even for <code>TensorFlow</code> or other python-only packages?</p>
| 0debug |
What does solid in border-style:solid mean? CSS : <p>I have an exam tomorrow and it's about CSS, we have always had border-style:solid; but I don't really know what it exactly does. It sure shows a border but why is it called "solid"? W3S doesn't really give me the answer...</p>
<p>Does solid mean e.g. the paraghraph's border is not movable?</p>
<p>Or does it mean the border's size cant change?</p>
| 0debug |
Right to left letters in cards unity : I'm building a game where the player draw a path between some letters to make a word. the problem there that the letters appear in the cards from left to right. is that related to vector3. I can't find a solution. I put values to (-1,1,1). the letters sorted from right to left but flipped. what are your suggestions please.
You may find the concept in image below
[Image concept][1]
[1]: https://i.stack.imgur.com/JYWyV.png | 0debug |
Operations inside variables : <p>I want to make a python script that finds the maximum possible output using 2 operations. The problem it says that there is a syntax error at the 2nd to the last line, in the <code>b</code> in there. How can I fix it? </p>
<pre><code>x = 0
a = int(input("1st number:"))
c = int(input("2nd number:" ))
e = int(input("3rd number:" ))
for i in range(4):
if i == 0:
b = "+"
elif i == 1:
b = "-"
elif i == 2:
b = "/"
else:
b = "*"
for j in range(4):
if j == 0:
d = "+"
elif j == 1:
d = "-"
elif j == 2:
d = "/"
else:
d = "*"
k = a b c d e
print(k)
</code></pre>
| 0debug |
Scatter plot with colormap makes X-axis disappear : <p>I want to scatter plot the first two columns of the following pandas.DataFrame, with the third column as color values. </p>
<pre><code>>>>df = pd.DataFrame({'a': {'1128': -2, '1129': 0, '1146': -4, '1142': -3, '1154': -2,
'1130': -1, '1125': -1, '1126': -2, '1127': -5, '1135': -2},
'c': {'1128': 5300, '1129': 6500, '1146': 8900, '1142': 8900,
'1154': 9000, '1130': 5600, '1125': 9400, '1126': 6000, '1127': 7200,
'1135': 7700}, 'b': {'1128': -3, '1129': -10, '1146': -6, '1142': -3,
'1154': -7, '1130': -2, '1125': -7, '1126': -7, '1127': 0, '1135': -1}}
>>>df
a b c
did
1125 -1 -7 9400
1126 -2 -7 6000
1127 -5 0 7200
1128 -2 -3 5300
1129 0 -10 6500
1130 -1 -2 5600
1135 -2 -1 7700
1142 -3 -3 8900
1146 -4 -6 8900
1154 -2 -7 9000
</code></pre>
<p>If I try:</p>
<pre><code>>>>df.plot('a', 'b', kind='scatter', color=df['c'], colormap='YlOrRd')
</code></pre>
<p>I get </p>
<p><a href="https://i.stack.imgur.com/WS6B4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WS6B4.png" alt="Plot with no X axis"></a></p>
<p>And the X-axis disappears.</p>
<p>I tried <code>ax.set_axis_on()</code> and <code>ax.axis('on')</code> to no avail. </p>
| 0debug |
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
{
int pic_size_indx, i, p;
IVIPicConfig pic_conf;
if (get_bits(&ctx->gb, 18) != 0x3FFF8) {
av_log(avctx, AV_LOG_ERROR, "Invalid picture start code!\n");
return AVERROR_INVALIDDATA;
}
ctx->prev_frame_type = ctx->frame_type;
ctx->frame_type = get_bits(&ctx->gb, 3);
if (ctx->frame_type == 7) {
av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d\n", ctx->frame_type);
return AVERROR_INVALIDDATA;
}
if (ctx->frame_type == IVI4_FRAMETYPE_BIDIR)
ctx->has_b_frames = 1;
ctx->transp_status = get_bits1(&ctx->gb);
if (ctx->transp_status) {
ctx->has_transp = 1;
}
if (get_bits1(&ctx->gb)) {
av_log(avctx, AV_LOG_ERROR, "Sync bit is set!\n");
return AVERROR_INVALIDDATA;
}
ctx->data_size = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 24) : 0;
if (ctx->frame_type >= IVI4_FRAMETYPE_NULL_FIRST) {
ff_dlog(avctx, "Null frame encountered!\n");
return 0;
}
if (get_bits1(&ctx->gb)) {
skip_bits_long(&ctx->gb, 32);
ff_dlog(avctx, "Password-protected clip!\n");
}
pic_size_indx = get_bits(&ctx->gb, 3);
if (pic_size_indx == IVI4_PIC_SIZE_ESC) {
pic_conf.pic_height = get_bits(&ctx->gb, 16);
pic_conf.pic_width = get_bits(&ctx->gb, 16);
} else {
pic_conf.pic_height = ivi4_common_pic_sizes[pic_size_indx * 2 + 1];
pic_conf.pic_width = ivi4_common_pic_sizes[pic_size_indx * 2 ];
}
if (get_bits1(&ctx->gb)) {
pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, get_bits(&ctx->gb, 4));
pic_conf.tile_width = scale_tile_size(pic_conf.pic_width, get_bits(&ctx->gb, 4));
ctx->uses_tiling = 1;
} else {
pic_conf.tile_height = pic_conf.pic_height;
pic_conf.tile_width = pic_conf.pic_width;
}
if (get_bits(&ctx->gb, 2)) {
av_log(avctx, AV_LOG_ERROR, "Only YVU9 picture format is supported!\n");
return AVERROR_INVALIDDATA;
}
pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;
pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2;
pic_conf.luma_bands = decode_plane_subdivision(&ctx->gb);
if (pic_conf.luma_bands)
pic_conf.chroma_bands = decode_plane_subdivision(&ctx->gb);
ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
pic_conf.luma_bands, pic_conf.chroma_bands);
return AVERROR_INVALIDDATA;
}
if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) {
if (ff_ivi_init_planes(ctx->planes, &pic_conf, 1)) {
av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n");
ctx->pic_conf.luma_bands = 0;
return AVERROR(ENOMEM);
}
ctx->pic_conf = pic_conf;
for (p = 0; p <= 2; p++) {
for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {
ctx->planes[p].bands[i].mb_size = !p ? (!ctx->is_scalable ? 16 : 8) : 4;
ctx->planes[p].bands[i].blk_size = !p ? 8 : 4;
}
}
if (ff_ivi_init_tiles(ctx->planes, ctx->pic_conf.tile_width,
ctx->pic_conf.tile_height)) {
av_log(avctx, AV_LOG_ERROR,
"Couldn't reallocate internal structures!\n");
return AVERROR(ENOMEM);
}
}
ctx->frame_num = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 20) : 0;
if (get_bits1(&ctx->gb))
skip_bits(&ctx->gb, 8);
if (ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_MB_HUFF, &ctx->mb_vlc, avctx) ||
ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_BLK_HUFF, &ctx->blk_vlc, avctx))
return AVERROR_INVALIDDATA;
ctx->rvmap_sel = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 3) : 8;
ctx->in_imf = get_bits1(&ctx->gb);
ctx->in_q = get_bits1(&ctx->gb);
ctx->pic_glob_quant = get_bits(&ctx->gb, 5);
ctx->unknown1 = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 3) : 0;
ctx->checksum = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 16) : 0;
while (get_bits1(&ctx->gb)) {
ff_dlog(avctx, "Pic hdr extension encountered!\n");
skip_bits(&ctx->gb, 8);
}
if (get_bits1(&ctx->gb)) {
av_log(avctx, AV_LOG_ERROR, "Bad blocks bits encountered!\n");
}
align_get_bits(&ctx->gb);
return 0;
}
| 1threat |
The most effective method to discover Birthdays between two Dates regardless of year? : <p>I have rundown of records from which I need to extricate Birthdays between two given dates, paying little heed to the year. </p>
<p>That is, I need the birthdays falls between dates, say 2015-12-01 and 2015-12-31 </p>
<p>The straightforward between Query checks whether the Date of Birth fields falls between these two or not. </p>
<p>It would be ideal if you offer assistance... </p>
<p>Much obliged</p>
| 0debug |
uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
int size)
{
AVPacketSideData *sd, *tmp;
int i;
uint8_t *data = av_malloc(size);
if (!data)
return NULL;
for (i = 0; i < st->nb_side_data; i++) {
sd = &st->side_data[i];
if (sd->type == type) {
av_freep(&sd->data);
sd->data = data;
sd->size = size;
return sd->data;
}
}
tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
if (!tmp) {
av_freep(&data);
return NULL;
}
st->side_data = tmp;
st->nb_side_data++;
sd = &st->side_data[st->nb_side_data - 1];
sd->type = type;
sd->data = data;
sd->size = size;
return data;
}
| 1threat |
Dynamic Theme in Styled Components : <p>I'm using styled-components in my React app and wanting to use a dynamic theme. Some areas it will use my dark theme, some will use the light. Because the styled components have to be declared outside of the component they are used in, how do we pass through a theme dynamically?</p>
| 0debug |
static uint16_t pci_req_id_cache_extract(PCIReqIDCache *cache)
{
uint8_t bus_n;
uint16_t result;
switch (cache->type) {
case PCI_REQ_ID_BDF:
result = pci_get_bdf(cache->dev);
break;
case PCI_REQ_ID_SECONDARY_BUS:
bus_n = pci_bus_num(cache->dev->bus);
result = PCI_BUILD_BDF(bus_n, 0);
break;
default:
error_printf("Invalid PCI requester ID cache type: %d\n",
cache->type);
exit(1);
break;
}
return result;
}
| 1threat |
POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
dc->fw_name = "PowerPC,POWER7";
dc->desc = "POWER7";
dc->props = powerpc_servercpu_properties;
pcc->pvr_match = ppc_pvr_match_power7;
pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06;
pcc->init_proc = init_proc_POWER7;
pcc->check_pow = check_pow_nocheck;
pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
PPC_FLOAT_FRSQRTES |
PPC_FLOAT_STFIWX |
PPC_FLOAT_EXT |
PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
PPC_MEM_SYNC | PPC_MEM_EIEIO |
PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
PPC_SEGMENT_64B | PPC_SLBI |
PPC_POPCNTB | PPC_POPCNTWD;
pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205 |
PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
PPC2_FP_TST_ISA206 | PPC2_FP_CVT_S64;
pcc->msr_mask = (1ull << MSR_SF) |
(1ull << MSR_VR) |
(1ull << MSR_VSX) |
(1ull << MSR_EE) |
(1ull << MSR_PR) |
(1ull << MSR_FP) |
(1ull << MSR_ME) |
(1ull << MSR_FE0) |
(1ull << MSR_SE) |
(1ull << MSR_DE) |
(1ull << MSR_FE1) |
(1ull << MSR_IR) |
(1ull << MSR_DR) |
(1ull << MSR_PMM) |
(1ull << MSR_RI) |
(1ull << MSR_LE);
pcc->mmu_model = POWERPC_MMU_2_06;
#if defined(CONFIG_SOFTMMU)
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
pcc->sps = &POWER7_POWER8_sps;
#endif
pcc->excp_model = POWERPC_EXCP_POWER7;
pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
pcc->bfd_mach = bfd_mach_ppc64;
pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
POWERPC_FLAG_VSX;
pcc->l1_dcache_size = 0x8000;
pcc->l1_icache_size = 0x8000;
pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
}
| 1threat |
int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y)
{
if (!mb_x)
return mb_y ? VERT_PRED8x8 : DC_129_PRED8x8;
else
return mb_y ? mode : HOR_PRED8x8;
}
| 1threat |
Express - understanding require() : In a simple javascript file, we can use express by adding these two lines of code at the beginning (after installing it through npm):
var express = require('express');
var app = express();
Now, according to the express API guide:
> The app object conventionally denotes the Express application. Create it by calling the top-level express() function exported by the Express module
Since the app object is calling the top-level express() function, how come am I not able to just simply use:
var app = express.express;
Please forgive me if this makes absolutely no sense, I am just trying to connect dots in my head. | 0debug |
static inline void gen_op_arith_divw(DisasContext *ctx, TCGv ret, TCGv arg1,
TCGv arg2, int sign, int compute_ov)
{
TCGLabel *l1 = gen_new_label();
TCGLabel *l2 = gen_new_label();
TCGv_i32 t0 = tcg_temp_local_new_i32();
TCGv_i32 t1 = tcg_temp_local_new_i32();
tcg_gen_trunc_tl_i32(t0, arg1);
tcg_gen_trunc_tl_i32(t1, arg2);
tcg_gen_brcondi_i32(TCG_COND_EQ, t1, 0, l1);
if (sign) {
TCGLabel *l3 = gen_new_label();
tcg_gen_brcondi_i32(TCG_COND_NE, t1, -1, l3);
tcg_gen_brcondi_i32(TCG_COND_EQ, t0, INT32_MIN, l1);
gen_set_label(l3);
tcg_gen_div_i32(t0, t0, t1);
} else {
tcg_gen_divu_i32(t0, t0, t1);
}
if (compute_ov) {
tcg_gen_movi_tl(cpu_ov, 0);
}
tcg_gen_br(l2);
gen_set_label(l1);
if (sign) {
tcg_gen_sari_i32(t0, t0, 31);
} else {
tcg_gen_movi_i32(t0, 0);
}
if (compute_ov) {
tcg_gen_movi_tl(cpu_ov, 1);
tcg_gen_movi_tl(cpu_so, 1);
}
gen_set_label(l2);
tcg_gen_extu_i32_tl(ret, t0);
tcg_temp_free_i32(t0);
tcg_temp_free_i32(t1);
if (unlikely(Rc(ctx->opcode) != 0))
gen_set_Rc0(ctx, ret);
}
| 1threat |
QPCIBus *qpci_init_spapr(QGuestAllocator *alloc)
{
QPCIBusSPAPR *ret;
ret = g_malloc(sizeof(*ret));
ret->alloc = alloc;
ret->bus.io_readb = qpci_spapr_io_readb;
ret->bus.io_readw = qpci_spapr_io_readw;
ret->bus.io_readl = qpci_spapr_io_readl;
ret->bus.io_writeb = qpci_spapr_io_writeb;
ret->bus.io_writew = qpci_spapr_io_writew;
ret->bus.io_writel = qpci_spapr_io_writel;
ret->bus.config_readb = qpci_spapr_config_readb;
ret->bus.config_readw = qpci_spapr_config_readw;
ret->bus.config_readl = qpci_spapr_config_readl;
ret->bus.config_writeb = qpci_spapr_config_writeb;
ret->bus.config_writew = qpci_spapr_config_writew;
ret->bus.config_writel = qpci_spapr_config_writel;
ret->bus.iomap = qpci_spapr_iomap;
ret->bus.iounmap = qpci_spapr_iounmap;
ret->buid = 0x800000020000000ULL;
ret->pio_cpu_base = SPAPR_PCI_WINDOW_BASE + SPAPR_PCI_IO_WIN_OFF;
ret->pio.pci_base = 0;
ret->pio.size = SPAPR_PCI_IO_WIN_SIZE;
ret->mmio32_cpu_base = SPAPR_PCI_WINDOW_BASE + SPAPR_PCI_MMIO32_WIN_OFF;
ret->mmio32.pci_base = 0x80000000;
ret->mmio32.size = SPAPR_PCI_MMIO32_WIN_SIZE;
ret->pci_hole_start = 0xC0000000;
ret->pci_hole_size =
ret->mmio32.pci_base + ret->mmio32.size - ret->pci_hole_start;
ret->pci_hole_alloc = 0;
ret->pci_iohole_start = 0xc000;
ret->pci_iohole_size =
ret->pio.pci_base + ret->pio.size - ret->pci_iohole_start;
ret->pci_iohole_alloc = 0;
return &ret->bus;
}
| 1threat |
R watercolor plot : <p>I am dealing with a fairly large dataset (2000 columns, 11 rows). A subset of which is what I have here below</p>
<pre><code> Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col10
1 2509.60840 650.44520 1208.00000 1795.00000 2889.000000 2158.00000 1827.25070 1482.000000 1858.00000 2544.39450
2 58.03994 -23.13326 -15.49636 12.09075 86.300341 34.46581 13.94546 -4.533958 15.89606 60.50394
3 94.15235 48.95360 80.27238 120.64317 62.791467 309.90168 175.94835 175.427179 83.94264 173.50097
4 245.69264 55.18302 137.75501 200.89969 -26.608255 161.46379 237.20321 84.304826 178.47248 97.40814
5 48.63110 70.49905 111.77759 181.52456 -107.426908 278.38505 116.95109 151.338578 218.93919 57.89194
6 264.90391 71.18622 129.02855 116.35842 -49.956152 147.17100 147.19528 229.756718 98.92684 193.43460
7 208.02697 75.31583 70.26002 136.39284 4.383722 150.74978 156.59314 162.983479 87.34028 358.01097
8 168.77588 71.57783 156.26653 132.90093 46.189138 254.28341 131.49356 211.540117 69.87448 312.34010
9 212.42247 53.04903 165.36475 49.42609 -14.050163 75.35783 160.37957 150.106290 96.19735 170.49562
10 175.34079 56.51675 148.31084 150.04976 32.373020 120.79866 147.48743 126.595648 84.46121 142.00257
11 249.20497 60.53568 139.56612 145.09104 6.308908 127.05724 141.34019 134.092717 103.45419 294.44998
12 67.80644 46.36427 101.25284 128.60477 -33.661878 361.66227 81.30154 88.232663 138.95064 83.37984
</code></pre>
<p>How do I create a waterfall line plot from this dataset ? Something that looks like this <a href="https://andrewgelman.com/2012/08/26/graphs-showing-regression-uncertainty-the-code/" rel="nofollow noreferrer">https://andrewgelman.com/2012/08/26/graphs-showing-regression-uncertainty-the-code/</a></p>
<p>Please note the values in 1st row <code>{2509.60840 650.44520 1208.00000 1795.00000 2889.000000 2158.00000 1827.25070 1482.000000 1858.00000 2544.39450}</code> are my x values and rest are y values corresponding to each x values. For instance.</p>
<p><code>{58.03994, 94.15235, 245.69264, 48.63110,264.90391.....67.80644}</code> are my <code>y</code> values related to <code>x=2509.60840</code> and so on.</p>
| 0debug |
How to strip letters off a string with numbers, so that it can be changed to int and sorted (python) : I am making a dice rolling game where the scores and players have to be stored in an array and then printed out in order as a scoreboard. I can do all of this but sorting the scoreboard. I have worked out that I need to strip the letters from the string (player1 37 to just 37). The current code that I'm using is `delchars = Player1.join(c for c in map(chr, range(256)) if not c.isalnum())` but it doesn't seem to be working, anyone know what to do | 0debug |
Creating a hyperlink from a file name read from input file to write to a output text file : <p>I would like to convert the text name of each of the several files listed on the input text file (compatible with NotePad) to a hyperlink and would like to use the file name as the text display associated with each hyperlink and write the result with the hyperlinks to an output text file (also compatible with NotePAd).</p>
<p>I would lilke to use either VB Script or VB.Net as the programming language. I cannot find instructions for creating the hyperlink from a character string using either VB Script or VB.Net. Can someone point me to some relevant documentation?</p>
| 0debug |
in c++ how to declare 3D dimensional vector in a 3D dimensional vector : <p>How can I declare a 3D dimensional vector in C++ such that each element is in turn a 3d vector whose size I would in prior.</p>
| 0debug |
Writing Apache Zookeeper like service in go : <p>I want to write a very simple (but fully functional) Apache Zookeeper like service in go? Where do I start ? </p>
| 0debug |
Spring Security, JUnit: @WithUserDetails for user created in @Before : <p>In JUnit tests with Spring MockMVC, there are two methods for authenticating as a Spring Security user: <code>@WithMockUser</code> creates a dummy user with the provided credentials, <code>@WithUserDetails</code> takes a user's name and resolves it to the correct custom <code>UserDetails</code> implementation with a custom <code>UserDetailsService</code> (the <code>UserDetailsServiceImpl</code>).</p>
<p>In my case, the <code>UserDetailsService</code> loads an user from the database. The user I want to use was inserted in the <code>@Before</code> method of the test suite.</p>
<p>However, my <code>UserDetailsServiceImpl</code> does not find the user.</p>
<p>In my <code>@Before</code>, I insert the user like this:</p>
<pre><code>User u = new User();
u.setEMail("test@test.de");
u = userRepository.save(u);
</code></pre>
<p>And in the <code>UserDetailsServiceImpl</code>:</p>
<pre><code>public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = this.userRepository.findOneByEMail(username);
if (user == null)
throw new UsernameNotFoundException(String.format("No user found with username '%s'.", username));
return user;
}
</code></pre>
<p>How can I use an account created in <code>@Before</code> with <code>@WithUserDetails</code>?</p>
| 0debug |
Windows [10] File Folder Denied Access : <p>I have a file folder called, <code>my_folder</code> it has been created by a program and has been made into a read-only access. I have admin rights to the computer I'm using but when I try to make it non-read-only it says that I don't have access to it. I've tried using Admin Command Prompt and deleting it with Admin rights in the File Explorer. The end goal is to delete the folder.</p>
<p>Here is the error I get when I try to delete it via the File Explorer:
<a href="https://i.stack.imgur.com/3v2hr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3v2hr.png" alt="File Deletion Error"></a></p>
<p>And here is the error I get when trying to do the deletion via Admin Terminal:</p>
<pre><code>$> rmdir my_folder
Access is denied
</code></pre>
| 0debug |
static int setfsugid(int uid, int gid)
{
cap_value_t cap_list[] = {
CAP_DAC_OVERRIDE,
};
setfsgid(gid);
setfsuid(uid);
if (uid != 0 || gid != 0) {
return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
}
return 0;
}
| 1threat |
static int bt_hci_name_req(struct bt_hci_s *hci, bdaddr_t *bdaddr)
{
struct bt_device_s *slave;
evt_remote_name_req_complete params;
int len;
for (slave = hci->device.net->slave; slave; slave = slave->next)
if (slave->page_scan && !bacmp(&slave->bd_addr, bdaddr))
break;
if (!slave)
return -ENODEV;
bt_hci_event_status(hci, HCI_SUCCESS);
params.status = HCI_SUCCESS;
bacpy(¶ms.bdaddr, &slave->bd_addr);
len = snprintf(params.name, sizeof(params.name),
"%s", slave->lmp_name ?: "");
memset(params.name + len, 0, sizeof(params.name) - len);
bt_hci_event(hci, EVT_REMOTE_NAME_REQ_COMPLETE,
¶ms, EVT_REMOTE_NAME_REQ_COMPLETE_SIZE);
return 0;
}
| 1threat |
void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
{
VP8Macroblock *mb_edge[3] = { mb + 2 ,
mb - 1 ,
mb + 1 };
enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT };
int idx = CNT_ZERO;
int cur_sign_bias = s->sign_bias[mb->ref_frame];
int8_t *sign_bias = s->sign_bias;
VP56mv near_mv[4];
uint8_t cnt[4] = { 0 };
VP56RangeCoder *c = &s->c;
AV_ZERO32(&near_mv[0]);
AV_ZERO32(&near_mv[1]);
#define MV_EDGE_CHECK(n)\
{\
VP8Macroblock *edge = mb_edge[n];\
int edge_ref = edge->ref_frame;\
if (edge_ref != VP56_FRAME_CURRENT) {\
uint32_t mv = AV_RN32A(&edge->mv);\
if (mv) {\
if (cur_sign_bias != sign_bias[edge_ref]) {\
\
mv = ~mv;\
mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\
}\
if (!n || mv != AV_RN32A(&near_mv[idx]))\
AV_WN32A(&near_mv[++idx], mv);\
cnt[idx] += 1 + (n != 2);\
} else\
cnt[CNT_ZERO] += 1 + (n != 2);\
}\
}
MV_EDGE_CHECK(0)
MV_EDGE_CHECK(1)
MV_EDGE_CHECK(2)
mb->partitioning = VP8_SPLITMVMODE_NONE;
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_ZERO]][0])) {
mb->mode = VP8_MVMODE_MV;
if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1 + VP8_EDGE_TOP]) == AV_RN32A(&near_mv[1 + VP8_EDGE_TOPLEFT]))
cnt[CNT_NEAREST] += 1;
if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) {
FFSWAP(uint8_t, cnt[CNT_NEAREST], cnt[CNT_NEAR]);
FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]);
}
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) {
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAR]][2])) {
clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]);
cnt[CNT_SPLITMV] = ((mb_edge[VP8_EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) +
(mb_edge[VP8_EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 +
(mb_edge[VP8_EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT);
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_SPLITMV]][3])) {
mb->mode = VP8_MVMODE_SPLIT;
mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1];
} else {
mb->mv.y += read_mv_component(c, s->prob->mvc[0]);
mb->mv.x += read_mv_component(c, s->prob->mvc[1]);
mb->bmv[0] = mb->mv;
}
} else {
clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR]);
mb->bmv[0] = mb->mv;
}
} else {
clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST]);
mb->bmv[0] = mb->mv;
}
} else {
mb->mode = VP8_MVMODE_ZERO;
AV_ZERO32(&mb->mv);
mb->bmv[0] = mb->mv;
}
} | 1threat |
Javascript Redux - how to get an element from store by id : <p>For the past weeks I've been trying to learn React and Redux.
Now I have met a problem thay I haven't found a right answer to.</p>
<p>Suppose I have a page in React that gets props from the link.</p>
<pre><code>const id = this.props.params.id;
</code></pre>
<p>Now on this page, I'd like to display an object from STORE with this ID.</p>
<pre><code> const initialState = [
{
title: 'Goal',
author: 'admin',
id: 0
},
{
title: 'Goal vol2',
author: 'admin',
id: 1
}
]
</code></pre>
<p>My question is:
should the function to query the the object from the STORE be in the page file, before the render method, or should I use action creators and include the function in reducers.
I've noticed that the reduceres seem to contain only actions that have an impoact on store, but mine just queries the store.</p>
<p>Thank you in advance.</p>
| 0debug |
How to work with database in asp.net : I am php web developer .now i want to work with asp.net but it's very difficult for me to work with databases in asp.net.I need some source link from where i can easily learn asp.net.
----------------------------------
-----------------------------------=
| 0debug |
php code for displaying Featured Article in joomla : <p>I am new in using joomla.</p>
<p>I want to display Featured Articles on my site but I've searched on different tutorials but none of them has a code-wise instruction on how to display the featured articles.</p>
<p>and is displaying articles by category any different from displaying featured articles?</p>
<p>thanks in advanced!</p>
| 0debug |
How to iterate over HashMap<String, ArrayList<Record>> in Java? : <p>I want to access the Records I have created in the HashMap.<br>
Due to some requirements, I am unable to create a new data structure for holding my data.</p>
<pre><code>private HashMap<String, ArrayList<Record>> customerInfoTable = new
HashMap<String, ArrayList<Record>>();
</code></pre>
| 0debug |
static av_cold int smvjpeg_decode_end(AVCodecContext *avctx)
{
SMVJpegDecodeContext *s = avctx->priv_data;
MJpegDecodeContext *jpg = &s->jpg;
int ret;
jpg->picture_ptr = NULL;
av_frame_free(&s->picture[0]);
av_frame_free(&s->picture[1]);
ret = avcodec_close(s->avctx);
av_freep(&s->avctx);
return ret;
}
| 1threat |
static void msix_handle_mask_update(PCIDevice *dev, int vector)
{
if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) {
msix_clr_pending(dev, vector);
msix_notify(dev, vector);
}
}
| 1threat |
Completely blown away at how to write scripts in linux : So i started today taking a look at scripting using vim and im just so very lost and was looking for some help in a few areas. First is when something says that it wants me to process a file as a command line argument and if a file isnt included when the user executes this script then a usage message is displayed followed by exiting the program. I have no clue where to even start with that, will i need and if then statement or what? | 0debug |
Google App Engine Error: <gcloud.app.deploy> INVALID_ARGUMENT: The following quotas were exceeded:BACKEND_SERVICES (quota: 5, used: 5 + needed 1) : <p>I am trying to deploy my node application on Google App Engine Flexible Environment. Previously it was working well but yesterday it starts refusing giving this error:</p>
<blockquote>
<p>Error: INVALID_ARGUMENT: The following quotas were
exceeded:BACKEND_SERVICES (quota: 5, used: 5 + needed 1)</p>
</blockquote>
<p>How can I sort that problem? I am still using the free trial credit that google gives.</p>
| 0debug |
Why sysout allways prints 1? : <p>In below code, why sysout allways prints 1?</p>
<pre><code>public class A implements ActionListener{
public static int X = 0;
private Timer timer;
public A(){
timer = new Timer(16 ,this);
timer.setInitialDelay(16);
timer.start();
}
public void actionPerformed(ActionEvent arg0) {
System.out.println(X);
}
public static void main(String args[]){
new A();
new B().start();
}
}
class B extends Thread{
public void run(){
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
A.X++;
}
}
</code></pre>
<p>I expect something like this output:</p>
<pre><code>1
2
3
...
</code></pre>
<p>Note that I dont want to use another approach.</p>
| 0debug |
How do I detect I am on server vs client in Next.js : <p>I am using a customer express server with Next.js. It's running within a container. I am doing an http request with <code>isomorphic-fetch</code> to get data for my render. I'd like to do <code>localhost</code> when running on server and <code>mysite.com</code> when running on client. Not sure the best way to accomplish this. I can do it hackily by doing <code>const isServer = typeof window === 'undefined'</code> but that seems pretty bad. </p>
| 0debug |
Why do we really need "fallthrough" in Golang? Which use case made Golang creators to include this in first place? : <p>"fallthrough" used in switch block, will transfer the execution to the next case's first statement without evaluating the next case statement. In real world, why do we need it? If at all we had to execute the next case block, we could have combined that code in the evaluated case already. Why do we really need "fallthrough"? What is its significance?</p>
| 0debug |
swift - how to go to another view controller during pressing the button. I don't have storyboard. Pragmatically : i have a button which is located on superview
let buttonSignUp = UIButton()
self.view.addSubview(buttonSignUp)
When I press this button I want to go to another view controller scene | 0debug |
static void vmxnet3_ack_events(VMXNET3State *s, uint32_t val)
{
uint32_t events;
VMW_CBPRN("Clearing events: 0x%x", val);
events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) & ~val;
VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events);
}
| 1threat |
Xcode 8 project navigator font size : <p>I have updated to MacOS 10.12.4 Sierra and Xcode 8.3.2 but now going blind because the Xcode project navigator font size is so small. Is there a way to increase the navigator font size? We used to be allowed to do this with a plugin such as MMNavigatorFont but no longer. </p>
| 0debug |
AWS Subnet CIDR in confliction : <p>What's IP does not conflict with 172.31.0.0/16. I'm not a networking guy and would like to get this resolved.
I'm getting this error.
CIDR Address overlaps with existing Subnet CIDR: 172.31.0.0/20</p>
| 0debug |
S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid)
{
S390PCIBusDevice *pbdev;
int i;
S390pciState *s = s390_get_phb();
for (i = 0; i < PCI_SLOT_MAX; i++) {
pbdev = s->pbdev[i];
if (pbdev && pbdev->fid == fid) {
return pbdev;
}
}
return NULL;
}
| 1threat |
Userscript to strip a portion of a pages title : <p>IMDb's reference view was recently changed to include "- Reference View - IMDb" after the page title that only used to have Movie (year)</p>
<p>New...</p>
<pre><code><title>Movie Title (2018) - Reference View - IMDb</title>
</code></pre>
<p>Old...</p>
<pre><code><title>Movie Title (2018)</title>
</code></pre>
<p>How do i strip the stuff they added to the reference pages so I just have Title (year)?</p>
<pre><code>// ==UserScript==
// @name IMDb - strip garbage from reference view page titles
// @match *://www.imdb.com/title/tt*/reference
</code></pre>
<p>Code makes my head spin and the above is all I can manage.</p>
| 0debug |
Routing between modules in Angular 2 : <p>I'm writing an application where all features got it's own module (A feature could be a page, or a part of a page). This because we want all features to have it's own domain logic, services, directives and components, i.e. in the dashboard module we got an ChartComponent widget that I don't want to expose to other views like login or profile.</p>
<p>The problem is when working with routing in Angular 2 you always routes to a particular component, not a module.</p>
<p>In our case, to set up a route for path: '/dashboard' component: DashboardComponent we need to declare DashboardComponent in app.module.ts, and that's fine, but since we're still in the module app.module our CharComponent is not exposed and will not render in our DashboardComponent since it's declared in dashboard.module.ts and not app.module.ts.</p>
<p>If we declare ChartComponent in app.module.ts it's working as it should but we lost the architecture for our application.</p>
<p>The file structure for the application is something like this:</p>
<pre><code>ββ src/
ββ app/
ββ app.module.ts
ββ app.component.ts
ββ app.routing.ts
ββ profile/
| ββ profile.module.ts
| ββ profile.component.ts
ββ login/
| ββ login.module.ts
| ββ login.component.ts
ββ dashboard/
ββ dashboard.module.ts
ββ dashboard.component.ts
ββ chart/
ββ chart.component.ts
</code></pre>
| 0debug |
static void gen_check_privilege(DisasContext *dc)
{
if (dc->cring) {
gen_exception_cause(dc, PRIVILEGED_CAUSE);
dc->is_jmp = DISAS_UPDATE;
}
}
| 1threat |
Powershell: Reading txt-file, change rows to columns, save txt file : I have a txt files (semicolon separated) containing over 3 Million records where columns 1 to 4 have some general information. Columns 5 and 6 have detailed information. There can be up to 4 different detailed information for the same general information in columns 1 to 4.
My sample input:
> Server;Owner;Company;Username;Property;Value
Srv1;Dave;Sandbox;kwus91;Memory;4GB
Srv1;Dave;Sandbox;kwus91;Processes;135
Srv1;Dave;Sandbox;kwus91;Storage;120GB
Srv1;Dave;Sandbox;kwus91;Variant;16
Srv2;Pete;GWZ;aiwq71;Memory;8GB
Srv2;Pete;GWZ;aiwq71Processes;234
Srv3;Micael;P12;mxuq01;Memory;16GB
Srv3;Micael;P12;mxuq01;Processes;239
Srv3;Micael;P12;mxuq01;Storage;160GB
Srv4;Stefan;MTC;spq61ep;Storage;120GB
Desired Output:
> Sever;Owner;Company;Username;Memory;Processes;Storage;Variant
Srv1;Dave;Sandbox;kwus91;4GB;135;120GB;16
Srv2;Pete;GWZ;aiwq71;8GB;234;;
Srv3;Micael;P12;mxuq01;16GB;239;160GB;
Srv4;Stefan;MTC;spq61ep;;;120GB;
If a values doesn't exist for general information (Columns 1-4) it has to stay blank.
I found [this one][1] but have troubles with the code. It's only working with comma separated values (CSV and TXT) but not with my semicolon separated files. And I read that this kind of solution is not the most efficient in my case with over 3 Million records.
My current code (The same as in link, because I have almost no idea how it works):
$a = Import-csv .\table1.txt
$a | FT -AutoSize
$Duration = Measure-Command {
$b = @()
foreach ($Property in $a.Property | Select -Unique) {
$Props = [ordered]@{ Property = $Property }
foreach ($Server in $a.Server | Select -Unique){
$Value = ($a.where({ $_.Server -eq $Server -and
$_.Property -eq $Property })).Value
$Props += @{ $Server = $Value }
}
$b += New-Object -TypeName PSObject -Property $Props
}
}
Write-Host "Finished transposing " -ForegroundColor Green -NoNewline
Write-Host "$(($a | Get-Member -MemberType Properties).count)/$($a.Count)" -ForegroundColor Yellow -NoNewline
Write-Host " columns/rows into " -ForegroundColor Green -NoNewline
Write-Host "$(($b | Get-Member -MemberType Properties).count)/$($b.Count)" -ForegroundColor Yellow -NoNewline
Write-Host " columns/rows in " -ForegroundColor Green -NoNewline
Write-Host $Duration.Milliseconds -ForegroundColor Yellow -NoNewline
Write-Host " Milliseconds" -ForegroundColor Green
$b | FT -AutoSize
$b | Out-GridView
$b | Export-Csv .\table2.txt -NoTypeInformation
Summary:
Reading in the txt-file with semicolon separated records
Transpose the "table" with unique values in columns 1-4 and the detailed information in columns and their values in their rows
Save transposed table into a new txt-file with semicolon separator.
I'm running Win7 64bit with Powershell 4.0.
Any ideas?
Thanks in forward.
[1]: https://gallery.technet.microsoft.com/scriptcenter/Powershell-Script-to-7c8368be#content | 0debug |
Removing character from a list of words : <p>I have a list of strings like below.</p>
<pre><code>arr = ['U.S.A','Ph.D','Mr.']
</code></pre>
<p>I would like to clean this array of the period so that the output would be like</p>
<pre><code>arr = ['USA','PhD','Mr']
</code></pre>
<p>Is there a clean regex way to do this?</p>
| 0debug |
Put two array together : <p>I try to put two array together, but I will not work.</p>
<pre><code>$vars['project_title'] = $data['post_title'];
</code></pre>
<p>It works if I only print out the array separately</p>
<pre><code>echo $data['post_title'];
</code></pre>
<p>I have also tried the following but it does not work</p>
<pre><code>$mytitle = $data['post_title'];
$vars['project_title'] = $mytitle
</code></pre>
<p>Have I missed something?
thankful for all your help!</p>
| 0debug |
Json Dump in particular format : **I have a list of dictionary:**
[Β Β
{Β Β
Β Β '_item_id1β:β0002',
Β Β '_ticket_quantity1β:1,
Β Β '_showtime_id':5635775Β Β Β
},
{Β Β
Β Β '_item_id2β:β0001β,
Β Β '_ticket_quantity2β:1,
Β Β Β '_showtime_id':5635775Β Β Β Β
}
]
**I want to do json.dumps in this format:**
data = json.dumps({
'ticketTypes': [{
'showtimeId': showtime_id,
'id': item_id1,
'quantity': ticket_quantity1
},
{
'showtimeId': showtime_id,
'id': item_id2,
'quantity': ticket_quantity2
}]
}) | 0debug |
How do I add lines in a text email? : <p>First, I'm not a programmer and totally lost.
I have a simple text email I want to edit for more content and multiple lines. I want to eliminate the html section and make it pure text so long as I can set line breaks. I read about using \r\n for line breaks but it doesn't seem to work right in the emails I test send. There will be paragraphs that will need multiple blank lines between them, too.</p>
<pre><code><?php
$mail_from='member@mywebsite.com';
$mail_from_name='Business';
$mail_subject="2019 Planning";
$mail_text='Are you ready for the new year?
Have you planned 2019's events
or are you going to wait until the last minute?';
$mail_html='This is the HTML message body <b>in bold!</b>';
>
</code></pre>
| 0debug |
av_cold int ff_mpv_common_init(MpegEncContext *s)
{
int i;
int nb_slices = (HAVE_THREADS &&
s->avctx->active_thread_type & FF_THREAD_SLICE) ?
s->avctx->thread_count : 1;
if (s->encoding && s->avctx->slices)
nb_slices = s->avctx->slices;
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
s->mb_height = (s->height + 31) / 32 * 2;
else
s->mb_height = (s->height + 15) / 16;
if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) {
av_log(s->avctx, AV_LOG_ERROR,
"decoding to AV_PIX_FMT_NONE is not supported.\n");
return -1;
}
if (nb_slices > MAX_THREADS || (nb_slices > s->mb_height && s->mb_height)) {
int max_slices;
if (s->mb_height)
max_slices = FFMIN(MAX_THREADS, s->mb_height);
else
max_slices = MAX_THREADS;
av_log(s->avctx, AV_LOG_WARNING, "too many threads/slices (%d),"
" reducing to %d\n", nb_slices, max_slices);
nb_slices = max_slices;
}
if ((s->width || s->height) &&
av_image_check_size(s->width, s->height, 0, s->avctx))
return -1;
dct_init(s);
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,
&s->chroma_x_shift,
&s->chroma_y_shift);
FF_ALLOCZ_OR_GOTO(s->avctx, s->picture,
MAX_PICTURE_COUNT * sizeof(Picture), fail);
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
s->picture[i].f = av_frame_alloc();
if (!s->picture[i].f)
goto fail;
}
memset(&s->next_picture, 0, sizeof(s->next_picture));
memset(&s->last_picture, 0, sizeof(s->last_picture));
memset(&s->current_picture, 0, sizeof(s->current_picture));
memset(&s->new_picture, 0, sizeof(s->new_picture));
s->next_picture.f = av_frame_alloc();
if (!s->next_picture.f)
goto fail;
s->last_picture.f = av_frame_alloc();
if (!s->last_picture.f)
goto fail;
s->current_picture.f = av_frame_alloc();
if (!s->current_picture.f)
goto fail;
s->new_picture.f = av_frame_alloc();
if (!s->new_picture.f)
goto fail;
if (init_context_frame(s))
goto fail;
s->parse_context.state = -1;
s->context_initialized = 1;
memset(s->thread_context, 0, sizeof(s->thread_context));
s->thread_context[0] = s;
if (nb_slices > 1) {
for (i = 0; i < nb_slices; i++) {
if (i) {
s->thread_context[i] = av_memdup(s, sizeof(MpegEncContext));
if (!s->thread_context[i])
goto fail;
}
if (init_duplicate_context(s->thread_context[i]) < 0)
goto fail;
s->thread_context[i]->start_mb_y =
(s->mb_height * (i) + nb_slices / 2) / nb_slices;
s->thread_context[i]->end_mb_y =
(s->mb_height * (i + 1) + nb_slices / 2) / nb_slices;
}
} else {
if (init_duplicate_context(s) < 0)
goto fail;
s->start_mb_y = 0;
s->end_mb_y = s->mb_height;
}
s->slice_context_count = nb_slices;
return 0;
fail:
ff_mpv_common_end(s);
return -1;
}
| 1threat |
Change <td> background color in PHP using CSS : <p>I have the following PHP code that fill table from mySQL database</p>
<pre><code><?php
while($res = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$res['id']."</td>";
echo "<td>".$res['name']."</td>";
echo "<td>".$res['number']."</td>";
echo "<td>".$res['nid']."</td>";
}
?>
</code></pre>
<p>Using CSS, How can I change background color for <strong>nid</strong> field?</p>
<p>I'm has trying the below, but it doesn't work:</p>
<pre><code>echo "<td style="background-color:red" >".$res['nid']."</td>";
</code></pre>
| 0debug |
FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
{
JNIEnv *env = NULL;
FFAMediaCodec *codec = NULL;
jstring mime_type = NULL;
codec = av_mallocz(sizeof(FFAMediaCodec));
if (!codec) {
return NULL;
}
codec->class = &amediacodec_class;
env = ff_jni_get_env(codec);
if (!env) {
av_freep(&codec);
return NULL;
}
if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) {
goto fail;
}
mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec);
if (!mime_type) {
goto fail;
}
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
codec->object = (*env)->NewGlobalRef(env, codec->object);
if (!codec->object) {
goto fail;
}
if (codec_init_static_fields(codec) < 0) {
goto fail;
}
if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) {
codec->has_get_i_o_buffer = 1;
}
return codec;
fail:
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
if (mime_type) {
(*env)->DeleteLocalRef(env, mime_type);
}
av_freep(&codec);
return NULL;
}
| 1threat |
Unable to get current time using javascript : <p>Displaying only today's date unable to get time.</p>
<pre><code><script type="text/javascript">
n = new Date();
y = n.getFullYear();
m = n.getMonth() + 1;
d = n.getDate();
document.getElementById("date").innerHTML = m + "/" + d + "/" + y;
</script>
<li id="date"></li>
</code></pre>
| 0debug |
Hamburger menu not working on iPhone 5SE? : I have been going in circles looking for a solution to a problem I never thought could exist in 2019.
I am busy building a site and made use of the Hamburger menu for smaller screen sizes. Everything looks good in Google Dev tools for multiple devices, but once I do a real world test on my iPhone the hamburger menus is dead, and the styling of the "Order now!" button is messed up?
Is there an easy way to change the css or JS so that the site can work on ios?
The site is under construction but you can look here to see: http://www.encoreservices.co.za/ESMS/index.html | 0debug |
sort positive float numbers in c : <p>I'm trying to sort positive float numbers in the most efficient way possible. I have more or less 10k elements.</p>
<p>I thought about radix sort (best one so far) or bucket sort, someone has some suggestions and why.
ty</p>
| 0debug |
generic Cryptarithmetic prblem asked in my exam :
ONE + ONE +TWO = FOUR
Can anybody can solve this cryptarithmetic in step by step process
Thank you | 0debug |
static void gt64120_isd_mapping(GT64120State *s)
{
target_phys_addr_t start = s->regs[GT_ISD] << 21;
target_phys_addr_t length = 0x1000;
if (s->ISD_length) {
memory_region_del_subregion(get_system_memory(), &s->ISD_mem);
}
check_reserved_space(&start, &length);
length = 0x1000;
DPRINTF("ISD: "TARGET_FMT_plx"@"TARGET_FMT_plx
" -> "TARGET_FMT_plx"@"TARGET_FMT_plx"\n",
s->ISD_length, s->ISD_start, length, start);
s->ISD_start = start;
s->ISD_length = length;
memory_region_add_subregion(get_system_memory(), s->ISD_start, &s->ISD_mem);
}
| 1threat |
void helper_rfi(CPUPPCState *env)
{
do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1],
~((target_ulong)0x783F0000), 1);
}
| 1threat |
document.getElementById('input').innerHTML = user_input; | 1threat |
Why Eclipse give me errors on the break statments of this switch case structure? : <p>I have created this <strong>switch case</strong> structure in a Java program but Eclipse sign me errors on all the <strong>break</strong> statments:</p>
<pre><code>public class LoadPlacesService {
public String getPlaces(String source, String selval) {
switch(source) {
case "country":
if (selval.equals("italy")) {
return "<option value='marche'>Marche</option>\n<option value='lazio'>Lazio</option>\n<option value='lombardia'>Lombardia</option>\n<option value='puglia'>Puglia</option>";
} else {
return "0";
}
break;
case "region":
if (selval.equals("lazio")) {
return "<option value='roma'>Roma</option>\n<option value='viterbo'>Viterbo</option>\n<option value='latina'>Latina</option>\n<option value='rieti'>Rieti</option>\n<option value='frosinone'>Frosinone</option>";
} else {
return "0";
}
break;
// eventuali altri case
case "district":
if (selval.equals("roma")) {
return "<option value='roma'>Roma</option>\n<option value='guidonia-montecelio'>Guidonia Montecelio</option>\n<option value='fiumicino'>Fiumicino</option>\n<option value='aprilia'>Aprilia</option>";
} else {
return "0";
}
break;
}
return "";
}
}
</code></pre>
| 0debug |
I has some wrong about insert data to SQLite. Please help me : I'm try to insert data to SQLite. But something are wrong in AddActivity.java.
My concept is insert data to SQLite.
After read data from data show list.
When click list on data list it will be show detail of this list.
[Click here to see a picture.][1]
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
Cannot resolve method 'Insertdata(java.lang.String,java.lang.String,java.lang.String)'
<!-- end snippet -->
Please help me. And sorry for my bad English.
myDBClass.java
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
package com.example.puen.projectdemo;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
public class myDBClass extends SQLiteOpenHelper {
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "mydatabase";
// Table Name
private static final String TABLE_MEMBER = "members";
public myDBClass(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
// Create Table Name
db.execSQL("CREATE TABLE " + TABLE_MEMBER +
"(MemberID INTEGER PRIMARY KEY AUTOINCREMENT," +
" Name TEXT(100)," +
" Tel TEXT(100));");
Log.d("CREATE TABLE", "Create Table Successfully.");
}
// Select Data
public String[] SelectData(String strMemberID) {
// TODO Auto-generated method stub
try {
String arrData[] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
Cursor cursor = db.query(TABLE_MEMBER, new String[]{"*"},
"MemberID=?",
new String[]{String.valueOf(strMemberID)}, null, null, null, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getColumnCount()];
/***
* 0 = MemberID
* 1 = Name
* 2 = Tel
*/
arrData[0] = cursor.getString(0);
arrData[1] = cursor.getString(1);
arrData[2] = cursor.getString(2);
}
}
cursor.close();
db.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Show All Data
public ArrayList<HashMap<String, String>> SelectAllData() {
// TODO Auto-generated method stub
try {
ArrayList<HashMap<String, String>> MyArrList = new ArrayList<>();
HashMap<String, String> map;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_MEMBER;
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
do {
map = new HashMap<>();
map.put("MemberID", cursor.getString(0));
map.put("Name", cursor.getString(1));
map.put("Tel", cursor.getString(2));
MyArrList.add(map);
} while (cursor.moveToNext());
}
}
cursor.close();
db.close();
return MyArrList;
} catch (Exception e) {
return null;
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE IF EXISTS " + TABLE_MEMBER);
// Re Create on method onCreate
onCreate(db);
}
}
<!-- end snippet -->
AddActivity.java
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
package com.example.puen.projectdemo;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class AddActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add);
// btnSave (Save)
final Button save = (Button) findViewById(R.id.btnSave);
save.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// If Save Complete
if(SaveData())
{
// Open Form Main
Intent newActivity = new Intent(AddActivity.this,MainActivity.class);
startActivity(newActivity);
}
}
});
// btnCancel (Cancel)
final Button cancel = (Button) findViewById(R.id.btnCancel);
cancel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Open Form Main
Intent newActivity = new Intent(AddActivity.this,MainActivity.class);
startActivity(newActivity);
}
});
}
public boolean SaveData()
{
// txtMemberID, txtName, txtTel
final EditText tMemberID = (EditText) findViewById(R.id.txtMemberID);
final EditText tName = (EditText) findViewById(R.id.txtName);
final EditText tTel = (EditText) findViewById(R.id.txtTel);
// Dialog
final AlertDialog.Builder adb = new AlertDialog.Builder(this);
AlertDialog ad = adb.create();
// Check MemberID
if(tMemberID.getText().length() == 0)
{
ad.setMessage("Please input [MemberID] ");
ad.show();
tMemberID.requestFocus();
return false;
}
// Check Name
if(tName.getText().length() == 0)
{
ad.setMessage("Please input [Name] ");
ad.show();
tName.requestFocus();
return false;
}
// Check Tel
if(tTel.getText().length() == 0)
{
ad.setMessage("Please input [Tel] ");
ad.show();
tTel.requestFocus();
return false;
}
// new Class DB
final myDBClass myDb = new myDBClass(this);
// Check Data (MemberID exists)
String arrData[] = myDb.SelectData(tMemberID.getText().toString());
if(arrData != null)
{
ad.setMessage("MemberID already exists! ");
ad.show();
tMemberID.requestFocus();
return false;
}
// Save Data
long saveStatus = myDb.InsertData(tMemberID.getText().toString(),
tName.getText().toString(),
tTel.getText().toString());
if(saveStatus <= 0)
{
ad.setMessage("Error!! ");
ad.show();
return false;
}
Toast.makeText(AddActivity.this,"Add Data Successfully. ",
Toast.LENGTH_SHORT).show();
return true;
}
}
<!-- end snippet -->
DetialActivity.java
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
package com.example.puen.projectdemo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class DetailActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
// Read var from Intent
Intent intent= getIntent();
String MemID = intent.getStringExtra("MemID");
// Show Data
ShowData(MemID);
// btnCancel (Cancel)
final Button cancel = (Button) findViewById(R.id.btnCancel);
cancel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Open Form Show
Intent newActivity = new Intent(DetailActivity.this,ShowActivity.class);
startActivity(newActivity);
}
});
}
public void ShowData(String MemID)
{
// txtMemberID, txtName, txtTel
final TextView tMemberID = (TextView) findViewById(R.id.txtMemberID);
final TextView tName = (TextView) findViewById(R.id.txtName);
final TextView tTel = (TextView) findViewById(R.id.txtTel);
// new Class DB
final myDBClass myDb = new myDBClass(this);
// Show Data
String arrData[] = myDb.SelectData(MemID);
if(arrData != null)
{
tMemberID.setText(arrData[0]);
tName.setText(arrData[1]);
tTel.setText(arrData[2]);
}
}
}
<!-- end snippet -->
ShowActivity.java
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
package com.example.puen.projectdemo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.ArrayList;
import java.util.HashMap;
public class ShowActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show);
final myDBClass myDb = new myDBClass(this);
final ArrayList<HashMap<String, String>> MebmerList = myDb.SelectAllData();
// listView1
ListView lisView1 = (ListView)findViewById(R.id.listView1);
SimpleAdapter sAdap;
sAdap = new SimpleAdapter(ShowActivity.this, MebmerList, R.layout.activity_column,
new String[] {"MemberID", "Name", "Tel"}, new int[] {R.id.ColMemberID, R.id.ColName, R.id.ColTel});
lisView1.setAdapter(sAdap);
lisView1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> myAdapter, View myView, int position, long mylng) {
// Show on new activity
Intent newActivity = new Intent(ShowActivity.this,DetailActivity.class);
newActivity.putExtra("MemID", MebmerList.get(position).get("MemberID").toString());
startActivity(newActivity);
}
});
// btnCancel (Cancel)
final Button cancel = (Button) findViewById(R.id.btnCancel);
cancel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Open Form Main
Intent newActivity = new Intent(ShowActivity.this,MainActivity.class);
startActivity(newActivity);
}
});
}
}
<!-- end snippet -->
[1]: http://i.stack.imgur.com/MkwBY.png | 0debug |
jquery prepend item once per div : I have tried searching and can only find half an answer for my issue.
I have a dynamic select function and when a click is performed I want a prepend to happen but only once per div it within.
```
var selGroup = $(".selected-results > .results-group");
if (!$('.selected-results > .results-group > .results-category').length) {
selGroup.prepend('<li class="results-category" data-class="'+ category +'">'+ category +'</li>');
return true;
} else {
}
```
This so far just adds in the prepend every time. I just cant figure it out.
Any advice is appreciated, thank you | 0debug |
HTML Button calls a wrong function onclick : <p>I made a html document that is basically a program that converts a decimal number into binary. It works. I added a 'Reverse' button that would do the opposite (convert binary into decimal) and for some reason it runs the code that should be run by the 'Convert' button. This is the code:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function decimalToBinary() {
document.getElementsByClassName('inputBox')[0].placeholder = 'Enter decimal number'
alert('Hello')
}
function binaryToDecimal() {
document.getElementsByClassName('inputBox')[0].placeholder = 'Enter binary number'
alert('Hi')
}
function reverse() {
if (document.getElementById('decimalNumber').placeholder === 'Enter decimal number') {
document.getElementById('convertButton').onclick = binaryToDecimal()
} else if (document.getElementById('decimalNumber').placeholder === 'Enter binary number') {
document.getElementById('convertButton').onclick = decimalToBinary()
}
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><input type="number" class="inputBox" id="decimalNumber" placeholder="Enter decimal number" min="0" step="0.0001">
<button id="convertButton" class="button hoverTurquoise" onclick="decimalToBinary()">Convert</button>
<button class="button hoverTurquoise reverse" onclick="reverse()">Reverse</button></code></pre>
</div>
</div>
</p>
<p>(I replaced all the code that converts the numbers into alert messages so it's easier to understand)</p>
<p>If anyone's got any ideas on how to fix this, please let me know. Thanks</p>
| 0debug |
Check if overflow:hidden div is overflowing jQuery : <p>I just would like to know if there is a way to check if a div with the overflow hidden attribute can be checked to see if it has content overflowing it or not. Jquery</p>
| 0debug |
Hide class one if class two does not exist on the page : <p>In css, I have class 'current-cat-parent' and class 'hide-it'. One is on the top of page and 2nd is in mid of page. <br>
Now the thing is, I want to make appear 'hide-it' class's content only if class 'current-cat-parent' exist somewhere in the page, otherwise hide that content.<br>
Please let me know how can make it possible<br>
Thank you</p>
| 0debug |
How to show access modifiers for classes in IntelliJ IDEA? : <p>I've recently upgraded to Intellij IDEA 2017.2 and access modifier icons disappeared from my file tree... How to get them back?</p>
<p><a href="https://i.stack.imgur.com/gr70C.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gr70C.png" alt=""></a></p>
| 0debug |
A list and it's positions : I'm creating a code where you enter a sentence, it splits each word in the sentence to become a separate member. When I enter a word, and I enter it again, those two words will have the same position below. For instance,
This is a This is a
1 2 3 1 2 3
The problem is, that my code does this differently, for example,
This This Is Is
1 1 2 3
If it's done it twice, it will just continue to count forever.
Here is my code:
sent = input("Enter your sentence:").lower()
sentlist = sent.split()
print (sent)
if len(sent) < 1:
print ("No value entered. ")
exit()
for i in sentlist:
if sentlist.index(i) in newlist:
newlist.append(sentlist.index(i))
else:
newlist.append(int(count))
count = count + 1
Hopefully someone can help me..
Thanks stack gods. | 0debug |
Populate a table from a list using multiple criteria : <p>I need to populate a table using 2 criteria to match the information.
the source data is</p>
<pre><code> A B C
Month Segment Value
01/08/18 Alfa 236.200
01/08/18 Bravo 39.700
01/09/18 Alfa 8.400
01/09/18 Delta 48.200
01/10/18 Bravo 31.700
01/11/18 Foxtrot 53.200
01/11/18 Foxtrot 35.100...
</code></pre>
<p>And the table is</p>
<pre><code> G H I
01/08/18 01/09/18 01/10/18...
Alfa
Bravo
Delta
</code></pre>
<p>I have an idea to use Index and Match but i cant make it work.
I appreciate your help.</p>
| 0debug |
Command to find Linux terminal of the process : <p>I have pid of a process on linux machine.I want to retrieve the terminal/console on which the standard output is getting displayed. </p>
| 0debug |
Issue to node-sass and Docker : <p>I'm attempting to dockerise my node application. My current application is a nodejs express server with postgresql. ExpressJS uses node-sass-middleware to handle the sass assets. When I run node and postgresql locally on my OSX machine everything works fine. When I try to run the app with <code>docker-compose</code> I get a "Missing Binding error"</p>
<p>Here is my Dockerfile:</p>
<pre><code>FROM node:7.2.1
RUN apt-get update -qq && apt-get install -y build-essential
RUN apt-get install -y libpq-dev postgresql-client
ENV APP_HOME /my_app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD package.json .
RUN npm install
RUN npm rebuild node-sass
ADD . .
CMD [ "npm", "start" ]
EXPOSE 3000
</code></pre>
<p>Here is my <code>docker-compose.yml</code> file:</p>
<pre><code>version: '2'
services:
db:
image: postgres:9.6.1
ports:
- '5432:5432'
web:
build: . # use the Dockerfile next to this file
volumes:
- .:/my_app
ports:
- "3000:3000"
depends_on:
- db
</code></pre>
<p>When I run docker-compose up I still get the following error:</p>
<pre><code>web_1 | [nodemon] 1.11.0
web_1 | [nodemon] to restart at any time, enter `rs`
web_1 | [nodemon] watching: *.*
web_1 | [nodemon] starting `node ./bin/www`
web_1 | /my_app/node_modules/node-sass/lib/binding.js:15
web_1 | throw new Error(errors.missingBinary());
web_1 | ^
web_1 |
web_1 | Error: Missing binding /my_app/node_modules/node-sass/vendor/linux-x64-51/binding.node
web_1 | Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 7.x
web_1 |
web_1 | Found bindings for the following environments:
web_1 | - OS X 64-bit with Node.js 7.x
web_1 |
web_1 | This usually happens because your environment has changed since running `npm install`.
web_1 | Run `npm rebuild node-sass` to build the binding for your current environment.
web_1 | at module.exports (/my_app/node_modules/node-sass/lib/binding.js:15:13)
web_1 | at Object.<anonymous> (/my_app/node_modules/node-sass/lib/index.js:14:35)
web_1 | at Module._compile (module.js:571:32)
web_1 | at Object.Module._extensions..js (module.js:580:10)
web_1 | at Module.load (module.js:488:32)
web_1 | at tryModuleLoad (module.js:447:12)
web_1 | at Function.Module._load (module.js:439:3)
web_1 | at Module.require (module.js:498:17)
web_1 | at require (internal/module.js:20:19)
web_1 | at Object.<anonymous> (/my_app/node_modules/node-sass-middleware/middleware.js:3:12)
web_1 | at Module._compile (module.js:571:32)
web_1 | at Object.Module._extensions..js (module.js:580:10)
web_1 | at Module.load (module.js:488:32)
web_1 | at tryModuleLoad (module.js:447:12)
web_1 | at Function.Module._load (module.js:439:3)
web_1 | at Module.require (module.js:498:17)
web_1 | [nodemon] app crashed - waiting for file changes before starting...
</code></pre>
<p>I though by adding <code>RUN npm rebuild node-sass</code> to the Dockerfile, it would build the correct binding for the OS in the docker container... But it does not seem to work. </p>
<p>Any thoughts?</p>
| 0debug |
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
int point_transform, int ilv)
{
int i, t = 0;
uint8_t *zero, *last, *cur;
JLSState *state;
int off = 0, stride = 1, width, shift, ret = 0;
zero = av_mallocz(s->picture_ptr->linesize[0]);
if (!zero)
return AVERROR(ENOMEM);
last = zero;
cur = s->picture_ptr->data[0];
state = av_mallocz(sizeof(JLSState));
if (!state) {
av_free(zero);
return AVERROR(ENOMEM);
state->near = near;
state->bpp = (s->bits < 2) ? 2 : s->bits;
state->maxval = s->maxval;
state->T1 = s->t1;
state->T2 = s->t2;
state->T3 = s->t3;
state->reset = s->reset;
ff_jpegls_reset_coding_parameters(state, 0);
ff_jpegls_init_state(state);
if (s->bits <= 8)
shift = point_transform + (8 - s->bits);
else
shift = point_transform + (16 - s->bits);
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
av_log(s->avctx, AV_LOG_DEBUG,
"JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
"RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
s->width, s->height, state->near, state->maxval,
state->T1, state->T2, state->T3,
state->reset, state->limit, state->qbpp, state->range);
av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
ilv, point_transform, s->bits, s->cur_scan);
if (ilv == 0) {
if (s->cur_scan > s->nb_components) {
stride = (s->nb_components > 1) ? 3 : 1;
off = av_clip(s->cur_scan - 1, 0, stride - 1);
width = s->width * stride;
cur += off;
for (i = 0; i < s->height; i++) {
if (s->bits <= 8) {
ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
t = last[0];
} else {
ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
t = *((uint16_t *)last);
last = cur;
cur += s->picture_ptr->linesize[0];
if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16);
} else if (ilv == 1) {
int j;
int Rc[3] = { 0, 0, 0 };
stride = (s->nb_components > 1) ? 3 : 1;
memset(cur, 0, s->picture_ptr->linesize[0]);
width = s->width * stride;
for (i = 0; i < s->height; i++) {
for (j = 0; j < stride; j++) {
ls_decode_line(state, s, last + j, cur + j,
Rc[j], width, stride, j, 8);
Rc[j] = last[j];
if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16);
last = cur;
cur += s->picture_ptr->linesize[0];
} else if (ilv == 2) {
avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
ret = AVERROR_PATCHWELCOME;
if (s->xfrm && s->nb_components == 3) {
int x, w;
w = s->width * s->nb_components;
if (s->bits <= 8) {
uint8_t *src = s->picture_ptr->data[0];
for (i = 0; i < s->height; i++) {
switch(s->xfrm) {
case 1:
for (x = off; x < w; x += 3) {
src[x ] += src[x+1] + 128;
src[x+2] += src[x+1] + 128;
break;
case 2:
for (x = off; x < w; x += 3) {
src[x ] += src[x+1] + 128;
src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
break;
case 3:
for (x = off; x < w; x += 3) {
int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
src[x+0] = src[x+2] + g + 128;
src[x+2] = src[x+1] + g + 128;
src[x+1] = g;
break;
case 4:
for (x = off; x < w; x += 3) {
int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
src[x+0] = av_clip_uint8(r);
src[x+1] = av_clip_uint8(g);
src[x+2] = av_clip_uint8(b);
break;
src += s->picture_ptr->linesize[0];
}else
avpriv_report_missing_feature(s->avctx, "16bit xfrm");
if (shift) {
int x, w;
w = s->width * s->nb_components;
if (s->bits <= 8) {
uint8_t *src = s->picture_ptr->data[0];
for (i = 0; i < s->height; i++) {
for (x = off; x < w; x += stride)
src[x] <<= shift;
src += s->picture_ptr->linesize[0];
} else {
uint16_t *src = (uint16_t *)s->picture_ptr->data[0];
for (i = 0; i < s->height; i++) {
for (x = 0; x < w; x++)
src[x] <<= shift;
src += s->picture_ptr->linesize[0] / 2;
end:
av_free(state);
av_free(zero);
return ret; | 1threat |
static CharDriverState *qemu_chr_open_udp_fd(int fd)
{
CharDriverState *chr = NULL;
NetCharDriver *s = NULL;
chr = g_malloc0(sizeof(CharDriverState));
s = g_malloc0(sizeof(NetCharDriver));
s->fd = fd;
s->chan = io_channel_from_socket(s->fd);
s->bufcnt = 0;
s->bufptr = 0;
chr->opaque = s;
chr->chr_write = udp_chr_write;
chr->chr_update_read_handler = udp_chr_update_read_handler;
chr->chr_close = udp_chr_close;
chr->explicit_be_open = true;
return chr;
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.