problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
how to count negative number in an array? : In a hacker rank problem, i want to count the number of negative numbers. if the count is greater than an integer k,then I must print no.Else yes. I get runtime error. Is there any way to count faster?
my code goes
public class Solution {
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int l=0;l<t;l++)
{
int count=0;
int k=s.nextInt();
int n=s.nextInt();
ArrayList<Integer> al=new ArrayList();
for(int i=0;i<n;i++)
{
al.add(s.nextInt());
}
Collections.sort(al);
for(int c:al)
{
if(c<=0)
{
count+=1;
}
else
break;
}
if((count>=k)||(count==k))
{
System.out.println("NO");
}
else
{
System.out.println("YES");
}
}
}}
| 0debug |
Creating a UserManager outside of built in dependency injection system : <p>This is using asp.net core with identity and entity framework core. I working on a saas application where I have a separate admin web app where you can add new tenants to the system. After a tenant is creates the app creates a default database (database per tenant set up) for the new tenant. I want to add a default user to this new database but I'm struggling with creating user manager outside of the dependency injection system.</p>
<p>The admin web app uses the usermanager that is created in the startup.cs (via the built in DI system) as the manager for the admin app. When I go to add the user to the new tenants database I am not using the DI system I just want to create a UserManager with the IdentityDbContext associated with the connection string for the new tenants database.</p>
<p>I'm am using this after a new tenant is created in the admin app:</p>
<pre><code>public class TenantDbInitializer
{
private Tenant tenant;
private ApplicationDbContext context;
private UserManager<ApplicationUser> userManager;
public TenantDbInitializer(Tenant tenant)
{
this.tenant = tenant;
}
public void Init()
{
// tenant contains connection string
context = new ApplicationDbContext(tenant);
var userStore = new UserStore<ApplicationUser>(context);
userManager = new UserManager<ApplicationUser>(.........
}
}
</code></pre>
<p>The UserManager construction parameters contain items that I can't find examples on what instances I should use. Some of the interfaces appear to have default implementations but I'm not sure if this is the way to proceed (or to pass null). The constructor is:</p>
<pre><code> public UserManager(IUserStore<TUser> store,
IOptions<IdentityOptions> optionsAccessor,
IPasswordHasher<TUser> passwordHasher,
IEnumerable<IUserValidator<TUser>> userValidators,
IEnumerable<IPasswordValidator<TUser>> passwordValidators,
ILookupNormalizer keyNormalizer,
IdentityErrorDescriber errors,
IServiceProvider services,
ILogger<UserManager<TUser>> logger)
</code></pre>
<p>Looking at the identity source it appears that I can pass null in for some of these parameters but I want to make sure I understand what is going on here so I don't do anything incorrectly.</p>
<p>The source for user manager is here:
<a href="https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNetCore.Identity/UserManager.cs" rel="noreferrer">https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNetCore.Identity/UserManager.cs</a></p>
<p>Thanks,
Brian</p>
| 0debug |
How to deploy python script? : <p>This might sound like a very open ended question, but I am a python enthusiast, and pretty new to this world of development.
I have developed a python script which takes in an input and gives an output based on the algorithm I have put in place in the script. I want to use this script and package it in a way that it can be used by end users having no technical mindset and are only concerned with input they give and the output they get. </p>
<p>I have used Jupyter Notebook to develop this complex code and I want to know a way about how I can package or deploy this code so that the end user can use it without seeing how it works as it might be overwhelming for them. </p>
<p>Can anyone help me with the idea on how to do it?
Something which is Opensource would be preferred. </p>
<p>Thanks</p>
| 0debug |
Batch insert in Laravel 5.2 : <p>I am using a API's with lot's of calculation almost 100 database fields at the end with a big Foreach loop. </p>
<p>In every iteration i insert data in database. I want to insert data in once at the end (Batch Insert like in CodeIgniter). </p>
<p>Any body have idea how to insert all data at the end of iteration. instead of every iteration it insert row in database.</p>
<p>I want to insert data at the end of loop. Any help or idea appreciated.</p>
| 0debug |
Can someone explain Google Chrome in-memory cache? : <p>According to <a href="https://developer.chrome.com/extensions/webRequest#Caching">this</a> API doc, which is the only source I've found which describes the in-memory cache:</p>
<blockquote>
<p>Chrome employs two caches — an on-disk cache and a very fast in-memory
cache. The lifetime of an in-memory cache is attached to the lifetime
of a render process, which roughly corresponds to a tab. Requests that
are answered from the in-memory cache are invisible to the web request
API. If a request handler changes its behavior (for example, the
behavior according to which requests are blocked), a simple page
refresh might not respect this changed behavior. To make sure the
behavior change goes through, call handlerBehaviorChanged() to flush
the in-memory cache. But don't do it often; flushing the cache is a
very expensive operation. You don't need to call
handlerBehaviorChanged() after registering or unregistering an event
listener.</p>
</blockquote>
<p>I need a better understanding of the in-memory cache. Specifically, I need Chrome to generate the full webRequest / resource waterfall every time I visit a site, including refreshing a page. Obviously, this can't be true if it's using an in-memory cache.</p>
<p>Is the memory cache a clean-slate for a new tab when I create a new tab? </p>
<p>What does "very expensive operation" mean quantitatively?</p>
<p>If I call handlerBehaviorChanged() every time a page is reloaded in the same tab, will that guarantee a full waterfall? In that case, a limit of 20 times over 10 minutes seems fairly low.</p>
<p>Any help is highly appreciated, thanks!</p>
| 0debug |
void ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2)
{
isa_register_portio_list(dev, iobase, ide_portio_list, bus, "ide");
if (iobase2) {
isa_register_portio_list(dev, iobase2, ide_portio2_list, bus, "ide");
}
}
| 1threat |
How can I access different Anaconda environment from Pycharm (on Windows 10) : <p>I have installed anaconda with python 3.5, and created a new environment with Python 2.7 (on windows 10). </p>
<p>I can easily change the Anaconda environment with the command line tool. However in Pycharm, when I try to change the Python interpreter, I can only see the Anaconda Python 3.5 version.</p>
<p>Is there a easy way to select the Anaconda environment from Pycharm?</p>
| 0debug |
static void write_cont (void *opaque, uint32_t nport, uint32_t data)
{
struct dma_cont *d = opaque;
int iport, ichan;
iport = (nport >> d->dshift) & 0x0f;
switch (iport) {
case 8:
if (data && (data | CMD_NOT_SUPPORTED)) {
log ("command %#x not supported\n", data);
goto error;
}
d->command = data;
break;
case 9:
ichan = data & 3;
if (data & 4) {
d->status |= 1 << (ichan + 4);
}
else {
d->status &= ~(1 << (ichan + 4));
}
d->status &= ~(1 << ichan);
break;
case 0xa:
if (data & 4)
d->mask |= 1 << (data & 3);
else
d->mask &= ~(1 << (data & 3));
break;
case 0xb:
{
ichan = data & 3;
#ifdef DEBUG_DMA
int op;
int ai;
int dir;
int opmode;
op = (data >> 2) & 3;
ai = (data >> 4) & 1;
dir = (data >> 5) & 1;
opmode = (data >> 6) & 3;
linfo ("ichan %d, op %d, ai %d, dir %d, opmode %d\n",
ichan, op, ai, dir, opmode);
#endif
d->regs[ichan].mode = data;
break;
}
case 0xc:
d->flip_flop = 0;
break;
case 0xd:
d->flip_flop = 0;
d->mask = ~0;
d->status = 0;
d->command = 0;
break;
case 0xe:
d->mask = 0;
break;
case 0xf:
d->mask = data;
break;
default:
log ("dma: unknown iport %#x\n", iport);
goto error;
}
#ifdef DEBUG_DMA
if (0xc != iport) {
linfo ("nport %#06x, ichan % 2d, val %#06x\n",
nport, ichan, data);
}
#endif
return;
error:
abort ();
}
| 1threat |
static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
{
GetBitContext *gb = &ctx->gb;
*bd->shift_lsbs = 0;
if (get_bits1(gb)) {
if (read_var_block_data(ctx, bd))
return -1;
} else {
read_const_block_data(ctx, bd);
}
return 0;
}
| 1threat |
def find_triplet_array(A, arr_size, sum):
for i in range( 0, arr_size-2):
for j in range(i + 1, arr_size-1):
for k in range(j + 1, arr_size):
if A[i] + A[j] + A[k] == sum:
return A[i],A[j],A[k]
return True
return False | 0debug |
int kvm_arch_process_irqchip_events(CPUState *env)
{
return 0;
}
| 1threat |
Button not pressed selenium java : I have a site I wanna automate. There is a popup (what before poping up is hided) with a cancel and ok button. There seems to be no way i can automaticly press the ok button (cancel also not). Please help....see code
xpath:
//*[@id=\"lightbox\"]/div[2]/div/div[1]/div[2]/button[2]
not working
ty
[code][1]
[1]: https://i.stack.imgur.com/qUJfS.jpg | 0debug |
static void generate_eeprom_spd(uint8_t *eeprom, ram_addr_t ram_size)
{
enum { SDR = 0x4, DDR2 = 0x8 } type;
uint8_t *spd = spd_eeprom.contents;
uint8_t nbanks = 0;
uint16_t density = 0;
int i;
ram_size >>= 20;
while ((ram_size >= 4) && (nbanks <= 2)) {
int sz_log2 = MIN(31 - clz32(ram_size), 14);
nbanks++;
density |= 1 << (sz_log2 - 2);
ram_size -= 1 << sz_log2;
}
if ((nbanks == 1) && (density > 1)) {
nbanks++;
density >>= 1;
}
if (density & 0xff00) {
density = (density & 0xe0) | ((density >> 8) & 0x1f);
type = DDR2;
} else if (!(density & 0x1f)) {
type = DDR2;
} else {
type = SDR;
}
if (ram_size) {
fprintf(stderr, "Warning: SPD cannot represent final %dMB"
" of SDRAM\n", (int)ram_size);
}
spd[2] = type;
spd[5] = nbanks;
spd[31] = density;
spd[63] = 0;
for (i = 0; i < 63; i++) {
spd[63] += spd[i];
}
memcpy(eeprom, spd, sizeof(spd_eeprom.contents));
}
| 1threat |
How to scrap a specific element of a website using php? : I'm trying to scrap a specific element of a website using php. I tried a few techniques using simple_html_dom but unsuccesfully. Basically I want to scrap the current variation of btc's price (a pourcentage) present on so many website.
I tried 2 ways but none of them worked: using simple_html_dom's find() method and getElementbyId(); and basically the same but with a string output at the end with saveXML(). The element that i want is inside <span id="centval"> % </span> so I tried to look for this specific id.
``` php
require_once 'lib/simple_html_dom.php';
$source_url = 'https://bitcointicker.co/';
$html_source = file_get_html($source_url);
$changes = $html_source->find('span')->plaintext;
$changes->getElementById('centval');
```
And
```php
function getElementByIdAsString() {
$pretty = true;
$url = 'https://bitcointicker.co/';
$id = "centval";
$doc = new DOMDocument();
@$doc->loadHTMLFile($url);
$element = $doc->getElementById($id);
echo $doc->saveXML($element);
}
```
So I expected my page to output the pourcentage of variation in the btc price but it didn't output anything, still loading, so I guess I'm doing something wrong but I can't see what :x | 0debug |
Windows Form size property doesn't match the size on the code. Even the size property itself is not right : Is it just me or there's someone out there experiencing the same problem as mine.
My Visual Studio Enterprise 2015 on my Laptop doesn't work as I like. On my friend's laptop with the same version of Visual Studio do not have this problem.
I feel like the size property on my Visual Studio isn't working properly.
This is the screenshot of my problem:
[Panel Size on the Property Window][1]
[Panel Size on the code][2]
[1]: https://i.stack.imgur.com/fhHgC.jpg
[2]: https://i.stack.imgur.com/yIlKw.jpg | 0debug |
document.getElementById('input').innerHTML = user_input; | 1threat |
static inline void RENAME(yuv2yuvX)(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW,
int16_t * lumMmxFilter, int16_t * chrMmxFilter)
{
#ifdef HAVE_MMX
if(uDest != NULL)
{
asm volatile(
YSCALEYUV2YV12X(0)
:: "m" (-chrFilterSize), "r" (chrSrc+chrFilterSize),
"r" (chrMmxFilter+chrFilterSize*4), "r" (uDest), "m" (dstW>>1)
: "%eax", "%edx", "%esi"
);
asm volatile(
YSCALEYUV2YV12X(4096)
:: "m" (-chrFilterSize), "r" (chrSrc+chrFilterSize),
"r" (chrMmxFilter+chrFilterSize*4), "r" (vDest), "m" (dstW>>1)
: "%eax", "%edx", "%esi"
);
}
asm volatile(
YSCALEYUV2YV12X(0)
:: "m" (-lumFilterSize), "r" (lumSrc+lumFilterSize),
"r" (lumMmxFilter+lumFilterSize*4), "r" (dest), "m" (dstW)
: "%eax", "%edx", "%esi"
);
#else
int i;
for(i=0; i<dstW; i++)
{
int val=0;
int j;
for(j=0; j<lumFilterSize; j++)
val += lumSrc[j][i] * lumFilter[j];
dest[i]= MIN(MAX(val>>19, 0), 255);
}
if(uDest != NULL)
for(i=0; i<(dstW>>1); i++)
{
int u=0;
int v=0;
int j;
for(j=0; j<lumFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
v += chrSrc[j][i + 2048] * chrFilter[j];
}
uDest[i]= MIN(MAX(u>>19, 0), 255);
vDest[i]= MIN(MAX(v>>19, 0), 255);
}
#endif
}
| 1threat |
static void ide_test_start(const char *cmdline_fmt, ...)
{
va_list ap;
char *cmdline;
va_start(ap, cmdline_fmt);
cmdline = g_strdup_vprintf(cmdline_fmt, ap);
va_end(ap);
qtest_start(cmdline);
qtest_irq_intercept_in(global_qtest, "ioapic");
guest_malloc = pc_alloc_init();
} | 1threat |
"vbscript" find lines have the similar words separated by the colon " : " : <p>I have a text file contains more than 5000 lines, each line has two words separated by colon eg( word1:word2 )
I need a script compares the (word1) with (word2) on each line if they exactly matched it saves the line as it in a new text file.
Thank you in advance for your help</p>
| 0debug |
uint32_t HELPER(mvcle)(CPUS390XState *env, uint32_t r1, uint64_t a2,
uint32_t r3)
{
uintptr_t ra = GETPC();
uint64_t destlen = get_length(env, r1 + 1);
uint64_t dest = get_address(env, r1);
uint64_t srclen = get_length(env, r3 + 1);
uint64_t src = get_address(env, r3);
uint8_t pad = a2 & 0xff;
uint8_t v;
uint32_t cc;
if (destlen == srclen) {
cc = 0;
} else if (destlen < srclen) {
cc = 1;
} else {
cc = 2;
}
if (srclen > destlen) {
srclen = destlen;
}
for (; destlen && srclen; src++, dest++, destlen--, srclen--) {
v = cpu_ldub_data_ra(env, src, ra);
cpu_stb_data_ra(env, dest, v, ra);
}
for (; destlen; dest++, destlen--) {
cpu_stb_data_ra(env, dest, pad, ra);
}
set_length(env, r1 + 1 , destlen);
set_length(env, r3 + 1, env->regs[r3 + 1] - src - env->regs[r3]);
set_address(env, r1, dest);
set_address(env, r3, src);
return cc;
}
| 1threat |
display only the date and not the time in c# from sql : <p>Hi I have this code in my .cs file and the output is 5/27/2017 12:00:00 AM but I want it to format only the date like 5/27/2017. This is my code to show the value in the label. If I add any parameter in the ToString("dd/MM/yyyy") it tells me No overload for method 'ToString' takes '1' arguments.</p>
<pre><code> Date.Text = ds.Tables[0].Rows[0]["AUM"].ToString();
</code></pre>
| 0debug |
std::cout<<!+2 How does result 0 , '!' ASCII 33 and if add 2 it should return 35, can anyone help me out there? :
How does result 0 , '!' ASCII 33 and if add 2 it should return 35,
can anyone help me out there?
std::cout<<!+2;
result: 0
| 0debug |
Capture values from a string based on pattern : <p>I am looking for an approach to the following problem. It captures all <code>*</code> values from the string using a provided pattern.</p>
<pre><code>function capture(pattern, string) {
}
</code></pre>
<p>Example:</p>
<p>Input</p>
<ul>
<li><p>Pattern <code>The quick brown * jumps over the lazy *</code></p></li>
<li><p>String <code>The quick brown fox jumps over the lazy dog</code></p></li>
</ul>
<p>Output <code>[fox, dog]</code></p>
<p>Is it possible to solve it using regex?</p>
| 0debug |
store procedure performance issue : how store procedure could create performance issue,can anyone show production DB store procedure which create performance issue please it will help me to improve
| 0debug |
VectorDrawable rendering issue : <p>I'm having problems with the VectorDrawables introduced by the support library.</p>
<p>Looking around, I read about similar issues regarding bad scaling or incorrect preview in Android Studio. Well, my problem is unluckily different.</p>
<p>PROBLEM:</p>
<p>In fact, my VectorDrawable renders perfectly in the Android Studio preview but gets messed up at runtime on device (Android v. 5.1.1 and 6.0).</p>
<p>EXPORTING:</p>
<p>Starting from an SVG file (with only one compounded path), I imported it with the Android Studio tool (but I also tried many other tools to convert it).
The file was made in the same way as a bunch of others, though only some render bad.</p>
<p>WHAT I ALREADY TRIED:</p>
<p>I tried to set it in an imageview with app:srcCompat (even with src:).
I tried to use it in a menu (directly setting the icon, or using a
selector).</p>
<p>SVG CODE:</p>
<pre><code><svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 626.96 610.53"><title>PATHOLOGIES</title><path d="M5766.55,588.54a54.73,54.73,0,0,0-4.23-3.81,248.33,248.33,0,0,0,31.34-121.54c-0.23-138.68-114.72-251.15-253.38-249-134.71,2.07-243.52,110.91-245.54,245.64a249.48,249.48,0,0,0,390.59,209.52l0.21,0.22,155.12,155.12,81-81Zm-222.36,64.92c-104.85,0-189.85-85-189.85-189.85s85-189.85,189.85-189.85S5734,358.76,5734,463.61,5649,653.46,5544.19,653.46ZM5452,347.1l7.72-22.08a161.29,161.29,0,0,1,52.5-20.55l-19.84,56.75A19.25,19.25,0,0,1,5467.83,373l-4-1.41A19.25,19.25,0,0,1,5452,347.1Zm20.13,82.62L5430,502.57a19.25,19.25,0,0,1-26.29,7l-3.71-2.14a19.25,19.25,0,0,1-7-26.29L5435,408.33a19.25,19.25,0,0,1,26.29-7l3.71,2.14A19.25,19.25,0,0,1,5472.1,429.72Zm-82.73-14.9A161.59,161.59,0,0,1,5408.85,374l9.06,9.06a19.25,19.25,0,0,1,0,27.22l-3,3A19.24,19.24,0,0,1,5389.37,414.82Zm151.76-54A19.25,19.25,0,0,1,5552,335.85l55.51-21.72a162.36,162.36,0,0,1,43.87,27.64A19.17,19.17,0,0,1,5646,345l-78.34,30.65a19.25,19.25,0,0,1-24.94-10.91Zm-13.43,29.12,66.74,51.21a19.25,19.25,0,0,1,3.55,27l-2.61,3.4a19.25,19.25,0,0,1-27,3.55l-66.74-51.21a19.25,19.25,0,0,1-3.55-27l2.61-3.4A19.25,19.25,0,0,1,5527.69,389.91Zm83.57,191.47-2.82,3.23a19.25,19.25,0,0,1-27.15,1.86l-63.41-55.28A19.25,19.25,0,0,1,5516,504l2.82-3.23a19.25,19.25,0,0,1,27.16-1.86l63.41,55.28A19.25,19.25,0,0,1,5611.26,581.38Zm60.09-191.15,4,1.59a19.25,19.25,0,0,1,10.71,25l-31.28,78.09a19.25,19.25,0,0,1-25,10.71l-4-1.59A19.25,19.25,0,0,1,5615,479l31.28-78.09A19.25,19.25,0,0,1,5671.34,390.24ZM5504.73,604.39a19.19,19.19,0,0,1-4.85,15.4,161.36,161.36,0,0,1-38.43-16.53l-9.92-76.83a19.25,19.25,0,0,1,16.62-21.55l4.25-.55A19.25,19.25,0,0,1,5494,521ZM5686.4,538L5685,544.4a163.11,163.11,0,0,1-56.5,57.93l16.12-73.51a19.25,19.25,0,0,1,22.92-14.68l4.19,0.92A19.25,19.25,0,0,1,5686.4,538Z" transform="translate(-5294.72 -214.14)"/></svg>
</code></pre>
<p>VECTORDRAWABLE CODE:</p>
<pre><code><vector android:height="24dp" android:viewportHeight="610.53"
android:viewportWidth="626.96" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M471.8,374.4a54.7,54.7 0,0 0,-4.2 -3.8,248.3 248.3,0 0,0 31.3,
-121.5c-0.2,-138.7 -114.7,-251.1 -253.4,-249 -134.7,2.1 -243.5,110.9 -245.5,245.6a249.5,249.5 0,0 0,390.6 209.5l0.2,
0.2 155.1,155.1 81,-81ZM249.5,439.3c-104.8,0 -189.9,-85 -189.9,-189.9s85,-189.9 189.9,-189.9S439.3,144.6 439.3,
249.5 354.3,439.3 249.5,439.3ZM157.3,133l7.7,-22.1a161.3,161.3 0,0 1,52.5 -20.5l-19.8,56.8A19.3,19.3 0,0 1,
173.1 158.9l-4,-1.4A19.3,19.3 0,0 1,157.3 133ZM177.4,215.6L135.3,288.4a19.3,19.3 0,0 1,-26.3 7l-3.7,-2.1a19.3,
19.3 0,0 1,-7 -26.3L140.3,194.2a19.3,19.3 0,0 1,26.3 -7l3.7,2.1A19.3,19.3 0,0 1,177.4 215.6ZM94.7,200.7A161.6,
161.6 0,0 1,114.1 159.9l9.1,9.1a19.3,19.3 0,0 1,0 27.2l-3,3A19.2,19.2 0,0 1,94.6 200.7ZM246.4,146.7A19.3,19.3 0,
0 1,257.3 121.7l55.5,-21.7a162.4,162.4 0,0 1,43.9 27.6A19.2,19.2 0,0 1,351.3 130.9l-78.3,30.6a19.3,19.3 0,0 1,
-24.9 -10.9ZM233,175.8 L299.7,227a19.3,19.3 0,0 1,3.5 27l-2.6,3.4a19.3,19.3 0,0 1,-27 3.5l-66.7,-51.2a19.3,19.3 0,
0 1,-3.5 -27l2.6,-3.4A19.3,19.3 0,0 1,233 175.8ZM316.6,367.3 L313.8,370.5a19.3,19.3 0,0 1,-27.1 1.9l-63.4,-55.3A19.3,
19.3 0,0 1,221.3 289.9l2.8,-3.2a19.3,19.3 0,0 1,27.2 -1.9l63.4,55.3A19.3,19.3 0,0 1,316.5 367.2ZM376.7,176.1 L380.7,
177.7a19.3,19.3 0,0 1,10.7 25l-31.3,78.1a19.3,19.3 0,0 1,-25 10.7l-4,-1.6A19.3,19.3 0,0 1,320.3 264.9l31.3,-78.1A19.3,
19.3 0,0 1,376.6 176.1ZM210,390.3a19.2,19.2 0,0 1,-4.8 15.4,161.4 161.4,0 0,1 -38.4,-16.5l-9.9,-76.8a19.3,19.3 0,0 1,
16.6 -21.5l4.3,-0.6A19.3,19.3 0,0 1,199.3 306.9ZM391.7,323.9L390.3,330.3a163.1,163.1 0,0 1,-56.5 57.9l16.1,-73.5a19.3,
19.3 0,0 1,22.9 -14.7l4.2,0.9A19.3,19.3 0,0 1,391.7 323.9Z"/>
</code></pre>
<p></p>
<p>As rendered on Android Studio:</p>
<p><a href="https://i.stack.imgur.com/pOHsx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pOHsx.png" alt="As rendered on Android Studio"></a></p>
<p>As rendered on device (after AndroidStudio import):</p>
<p><a href="https://i.stack.imgur.com/wjCXi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wjCXi.png" alt="As rendered on device"></a></p>
<p>I can't really figure out what's causing the bad rendering. I'm pretty sure it's not an svg problem (correct me if I'm wrong, please) since the other drawables are rendering correctly. I wouldn't even call for a library bug since I happen to be the only one experiencing the problem. What am I doing wrong?</p>
<p>Thanks for the help</p>
| 0debug |
static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
{
TCGMemOp opc = l->opc;
TCGReg data_reg;
uint8_t **label_ptr = &l->label_ptr[0];
*(uint32_t *)label_ptr[0] = (uint32_t)(s->code_ptr - label_ptr[0] - 4);
if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) {
*(uint32_t *)label_ptr[1] = (uint32_t)(s->code_ptr - label_ptr[1] - 4);
}
if (TCG_TARGET_REG_BITS == 32) {
int ofs = 0;
tcg_out_st(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_ESP, ofs);
ofs += 4;
tcg_out_st(s, TCG_TYPE_I32, l->addrlo_reg, TCG_REG_ESP, ofs);
ofs += 4;
if (TARGET_LONG_BITS == 64) {
tcg_out_st(s, TCG_TYPE_I32, l->addrhi_reg, TCG_REG_ESP, ofs);
ofs += 4;
}
tcg_out_sti(s, TCG_TYPE_I32, TCG_REG_ESP, ofs, l->mem_index);
ofs += 4;
tcg_out_sti(s, TCG_TYPE_I32, TCG_REG_ESP, ofs, (uintptr_t)l->raddr);
} else {
tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0], TCG_AREG0);
tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[2],
l->mem_index);
tcg_out_movi(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[3],
(uintptr_t)l->raddr);
}
tcg_out_calli(s, (uintptr_t)qemu_ld_helpers[opc & ~MO_SIGN]);
data_reg = l->datalo_reg;
switch (opc & MO_SSIZE) {
case MO_SB:
tcg_out_ext8s(s, data_reg, TCG_REG_EAX, P_REXW);
break;
case MO_SW:
tcg_out_ext16s(s, data_reg, TCG_REG_EAX, P_REXW);
break;
#if TCG_TARGET_REG_BITS == 64
case MO_SL:
tcg_out_ext32s(s, data_reg, TCG_REG_EAX);
break;
#endif
case MO_UB:
case MO_UW:
case MO_UL:
tcg_out_mov(s, TCG_TYPE_I32, data_reg, TCG_REG_EAX);
break;
case MO_Q:
if (TCG_TARGET_REG_BITS == 64) {
tcg_out_mov(s, TCG_TYPE_I64, data_reg, TCG_REG_RAX);
} else if (data_reg == TCG_REG_EDX) {
tcg_out_opc(s, OPC_XCHG_ax_r32 + TCG_REG_EDX, 0, 0, 0);
tcg_out_mov(s, TCG_TYPE_I32, l->datahi_reg, TCG_REG_EAX);
} else {
tcg_out_mov(s, TCG_TYPE_I32, data_reg, TCG_REG_EAX);
tcg_out_mov(s, TCG_TYPE_I32, l->datahi_reg, TCG_REG_EDX);
}
break;
default:
tcg_abort();
}
tcg_out_jmp(s, (uintptr_t)l->raddr);
}
| 1threat |
Create keystore file with one command : <p>I have a script which creates and signs a keystore file for an android app.</p>
<p>It is working perfectly fine but i would rather have it run without human intervention</p>
<p>what i have to create the keystore: </p>
<pre><code>keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000
</code></pre>
<p>This then prompts me to enter the following values manually using the terminal: keystore password, full name , organisation unit, organisation name, city , state, county code, key password.</p>
<p>what i have to sign the app:</p>
<pre><code>jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1
-keystore my-release-key.keystore my_application.apk alias_name
</code></pre>
<p>This then prompts me to enter passphrase for keystore.</p>
<p>Is there anyway i can pass these values in as parameters so the full script runs without anyother interaction needed? </p>
<p>PS: i'm using ubuntu 14.04 LTS.</p>
<p>Thanks For your time :)</p>
| 0debug |
How can I find the length of a tree in Haskell? : I have tried this:
tWLength (Node v l r) u | v == u = 0
| v < u = 1 + (tWLength l)
| v > u = 1 + (tWLength r)
However it returns (in WinGHCi):
experiments\treetest.hs:170:1: error:
• Occurs check: cannot construct the infinite type: a1 ~ a -> a1
Expected type: Tree a -> a1
Actual type: Tree a -> a -> a1
• Relevant bindings include
tWLength :: Tree a -> a1 (bound at experiments\treetest.hs:170:1)
|
170 | tWLength (Node v l r) u | v == u = 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
The tree is defined as:
data Tree a = NullTree | Node a (Tree a) (Tree a) deriving (Show, Read, Eq, Ord) | 0debug |
Where Should I Start to make my own Swift Library? : <p>Iv been developing Swift for 1 Year now and I feel like I have fairly good knowledge of the language.</p>
<p>Now I am wondering where do people start when creating a large open source project like AlamoFire or a small custom button/animation library for others to use?</p>
<p>Iv tried looking for some kind of "build a small swift library tutorial" but noone are around.</p>
<p>I realize this may be a broad question and I am not looking for a A-Z list. IF you can give me the main points I need to dig into and what I need to think about before attempting to create it that would be amazing!</p>
<p>Thank you!</p>
| 0debug |
How do I add an existing Solution to GitHub from Visual Studio 2017? : <p>I want to add my existing solution to Github and I've watched lots of youtube videos. But all of them only showed me about creating new projects. How can I add the existing project on Github? There is no File-> Add to source control option in Visual Studio 2017 Community Edition!</p>
| 0debug |
Junit easyMock in java : I have mocked the request and the response using the easymock, still its going through each line in the request method and getting exception.
Eg:
public class helper{
public String getCB(){
Response response = ServiceImpl.getDefaultMethod(request);
return response.getString();
}
Test:
expect(MockServiceImpl.getDefaultMethod(mockRequest)).andReturn(mockResponse);
Getting an exception, Its going inside the getDefaultMethod().
Im not understanding why its going through the code in that method. Can anyone please help me?
| 0debug |
Generating a char using input from user in C++ : <p>I wish to make a char with digits between 0-9. The user decides how many digits to use.
For example, if the user inputs 4, the char should be 01234.
Please note I cannot use the string data type. I have to use char.
I know how to generate a string for the same logic but not a char.
So if there is a way to convert string to char, that will work well. I tried</p>
<pre><code>string randomString; //this contains the set of numbers 0-9 on the basis of the users input
char charString = randomString;
</code></pre>
<p>This however does not work.</p>
| 0debug |
Immutable.js Push into array in nested object : <p>Assume there is an object:</p>
<pre><code>const object = {
'foo': {
'bar': [1, 2, 3]
}
}
</code></pre>
<p>I need to push <code>4</code> to <code>object.foo.bar</code> array. </p>
<p>Right now I'm doing it like this:</p>
<pre><code>const initialState = Immutable.fromJS(object)
const newState = initialState.setIn(
['foo', 'bar', object.foo.bar.length],
4
)
console.log(newState.toJS())
</code></pre>
<p>But I don't really like it, since I need to use <code>object.foo.bar.length</code> in the path. In my real example object is nested much deeper, and getting array's length looks very ugly. Is there another, more convenient way?</p>
| 0debug |
def find_demlo(s):
l = len(s)
res = ""
for i in range(1,l+1):
res = res + str(i)
for i in range(l-1,0,-1):
res = res + str(i)
return res | 0debug |
android get contentView id : > hi, now i develope android,
>
> and i want to get viewId.
>
> for example,
>
> `onCreat(){
> setContentView(R.layout.a) button bt1 = findViewId(R.id.bt); bt.setOnClickListener(new OnClickListener{ });`
>
> so now, i want to get view Id in `onClickListener`. I think, view Id
> same `R.layout.content` and i try to `findViewId(R.id.content)` but
> this viewid different to `R.layout.a` how can i get viewId? | 0debug |
Is there a way to return an abstraction from a function without using new (for performance reasons) : <p>For example I have some function <code>pet_maker()</code> that creates and returns a <code>Cat</code> or a <code>Dog</code> as a base <code>Pet</code>. I want to call this function many many times, and do something with the <code>Pet</code> returned.</p>
<p>Traditionally I would <code>new</code> the <code>Cat</code> or <code>Dog</code> in <code>pet_maker()</code> and return a pointer to it, however the <code>new</code> call is much slower than doing everything on the stack.</p>
<p>Is there a neat way anyone can think of to return as an abstraction without having to do the new every time the function is called, or is there some other way that I can quickly create and return abstractions?</p>
| 0debug |
How to handle and get values from dynamic tags from xml file in VBA macro : I have an xml file with 3 levels. Some of the tags are dynamic.*(Please check below xml file)*
I have to validate whether the tag "price" is present in all nodes or not and also need to get value of "price tag". I also need to fetch a value of every node present in xml file.
**My final outcome should be like below excel file :**
[Excel sheet output][1]
**Test XML file attached below:**
[XML File with dynamic tags][2]
Please assist me here.
[1]: https://i.stack.imgur.com/ZtCUc.png
[2]: https://i.stack.imgur.com/2mCr6.png | 0debug |
static int exif_decode_tag(AVCodecContext *avctx, GetByteContext *gbytes, int le,
int depth, AVDictionary **metadata)
{
int ret, cur_pos;
unsigned id, count;
enum TiffTypes type;
if (depth > 2) {
return 0;
}
ff_tread_tag(gbytes, le, &id, &type, &count, &cur_pos);
if (!bytestream2_tell(gbytes)) {
bytestream2_seek(gbytes, cur_pos, SEEK_SET);
return 0;
}
ret = ff_tis_ifd(id);
if (ret) {
ret = avpriv_exif_decode_ifd(avctx, gbytes, le, depth + 1, metadata);
} else {
const char *name = exif_get_tag_name(id);
char *use_name = (char*) name;
if (!use_name) {
use_name = av_malloc(7);
if (!use_name) {
return AVERROR(ENOMEM);
}
snprintf(use_name, 7, "0x%04X", id);
}
ret = exif_add_metadata(avctx, count, type, use_name, NULL,
gbytes, le, metadata);
if (!name) {
av_freep(&use_name);
}
}
bytestream2_seek(gbytes, cur_pos, SEEK_SET);
return ret;
}
| 1threat |
void checkasm_check_blend(void)
{
uint8_t *top1 = av_malloc(BUF_SIZE);
uint8_t *top2 = av_malloc(BUF_SIZE);
uint8_t *bot1 = av_malloc(BUF_SIZE);
uint8_t *bot2 = av_malloc(BUF_SIZE);
uint8_t *dst1 = av_malloc(BUF_SIZE);
uint8_t *dst2 = av_malloc(BUF_SIZE);
FilterParams param = {
.opacity = 1.0,
};
#define check_and_report(name, val) \
param.mode = val; \
ff_blend_init(¶m, 0); \
if (check_func(param.blend, #name)) \
check_blend_func();
check_and_report(addition, BLEND_ADDITION)
check_and_report(addition128, BLEND_ADDITION128)
check_and_report(and, BLEND_AND)
check_and_report(average, BLEND_AVERAGE)
check_and_report(darken, BLEND_DARKEN)
check_and_report(difference128, BLEND_DIFFERENCE128)
check_and_report(hardmix, BLEND_HARDMIX)
check_and_report(lighten, BLEND_LIGHTEN)
check_and_report(multiply, BLEND_MULTIPLY)
check_and_report(or, BLEND_OR)
check_and_report(phoenix, BLEND_PHOENIX)
check_and_report(screen, BLEND_SCREEN)
check_and_report(subtract, BLEND_SUBTRACT)
check_and_report(xor, BLEND_XOR)
check_and_report(difference, BLEND_DIFFERENCE)
check_and_report(extremity, BLEND_EXTREMITY)
check_and_report(negation, BLEND_NEGATION)
report("8bit");
av_freep(&top1);
av_freep(&top2);
av_freep(&bot1);
av_freep(&bot2);
av_freep(&dst1);
av_freep(&dst2);
}
| 1threat |
C++: Error C2065, C2131, a non-constant (sub-)expression was encountered : <p>I was trying to make a program that get user's integer input and then filter every single digit in that int into even number and odd number. There is no any mistake when I finished the code but error comes out when I run it.</p>
<p>My code: </p>
<pre><code>#include <iostream>
#include <string>
#include <array>
#include <stdio.h>
#include <cstring>
#include <sstream>
using namespace std;
int main() {
int input = NULL;
int EvenNumbering = 0;
int OddNumbering = 0;
cout << "Please input a number: ";
cin >> input;
string str = to_string(input); //Convert it to string
char cstr[str.length];
int EvenNo[str.length];
int OddNo[str.length];
strcpy(cstr , str.c_str()); //Put it into char array
//Now filter Even number and Odd number
for (string x : cstr) {
int z = stoi(x);
if (z % 2 == 0) {
EvenNo[EvenNumbering] += z;
EvenNumbering++;
}
else {
OddNo[OddNumbering] += z;
OddNumbering++;
}
}
cout << endl;
cout << "Even Numbers: ";
for (int x : EvenNo) {
cout << x << ", ";
}
cout << endl;
cout << "Odd Numbers: ";
for (int x : OddNo) {
cout << x << ", ";
}
system("pause");
return 0;
}
</code></pre>
<p>My error: </p>
<pre><code>source.cpp(18): error C2131: expression did not evaluate to a constant
source.cpp(18): note: a non-constant (sub-)expression was encountered
source.cpp(19): error C2131: expression did not evaluate to a constant
source.cpp(19): note: a non-constant (sub-)expression was encountered
source.cpp(20): error C2131: expression did not evaluate to a constant
source.cpp(20): note: a non-constant (sub-)expression was encountered
source.cpp(26): error C2065: 'x': undeclared identifier
source.cpp(40): error C2065: 'x': undeclared identifier
source.cpp(47): error C2065: 'x': undeclared identifier
1>Done building project "Question.vcxproj" -- FAILED.
</code></pre>
<p>Still new to C++ and this is my first Project so please forgive me if I did some beginner mistake.</p>
| 0debug |
void pause_all_vcpus(void)
{
}
| 1threat |
How c# wpf Button property name binding> : <h1>This is a code.</h1>
<p>Button Name="{Binding menu_id}"
I can't binding it with the field how can I do? Thank.</p> | 0debug |
how to download file in react js : <p>I receive file url as response from api. when user clicks on download button, the file should be downloaded without opening file preview in a new tab. How to achieve this in react js? </p>
| 0debug |
static void cg3_realizefn(DeviceState *dev, Error **errp)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
CG3State *s = CG3(dev);
int ret;
char *fcode_filename;
vmstate_register_ram_global(&s->rom);
fcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, CG3_ROM_FILE);
if (fcode_filename) {
ret = load_image_targphys(fcode_filename, s->prom_addr,
FCODE_MAX_ROM_SIZE);
g_free(fcode_filename);
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
error_report("cg3: could not load prom '%s'", CG3_ROM_FILE);
}
}
memory_region_init_ram(&s->vram_mem, NULL, "cg3.vram", s->vram_size,
&error_abort);
memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
vmstate_register_ram_global(&s->vram_mem);
sysbus_init_mmio(sbd, &s->vram_mem);
sysbus_init_irq(sbd, &s->irq);
s->con = graphic_console_init(DEVICE(dev), 0, &cg3_ops, s);
qemu_console_resize(s->con, s->width, s->height);
}
| 1threat |
Finding out who sent data to my website : <p>So, I wanted to write myself a Java program, which will send a bunch of data (probably formatted as JSON) to my website, which will then write that data to MySQL, but I also want my website to get the IP, from which this data was sent.</p>
<p>But is this even possible? I don't have too much experience with PHP :/</p>
| 0debug |
static av_cold int alac_decode_close(AVCodecContext *avctx)
{
ALACContext *alac = avctx->priv_data;
int chan;
for (chan = 0; chan < alac->numchannels; chan++) {
av_freep(&alac->predicterror_buffer[chan]);
av_freep(&alac->outputsamples_buffer[chan]);
av_freep(&alac->wasted_bits_buffer[chan]);
}
return 0;
}
| 1threat |
db.execute('SELECT * FROM products WHERE product_id = ' + product_input) | 1threat |
In Pandas, after groupby the grouped column is gone : <p>I have the following dataframe named ttm:</p>
<pre><code> usersidid clienthostid eventSumTotal LoginDaysSum score
0 12 1 60 3 1728
1 11 1 240 3 1331
3 5 1 5 3 125
4 6 1 16 2 216
2 10 3 270 3 1000
5 8 3 18 2 512
</code></pre>
<p>When i do</p>
<pre><code>ttm.groupby(['clienthostid'], as_index=False, sort=False)['LoginDaysSum'].count()
</code></pre>
<p>I get what I expected (though I would've wanted the results to be under a new label named 'ratio'):</p>
<pre><code> clienthostid LoginDaysSum
0 1 4
1 3 2
</code></pre>
<p>But when I do</p>
<pre><code>ttm.groupby(['clienthostid'], as_index=False, sort=False)['LoginDaysSum'].apply(lambda x: x.iloc[0] / x.iloc[1])
</code></pre>
<p>I get:</p>
<pre><code>0 1.0
1 1.5
</code></pre>
<ol>
<li>Why did the labels go? I still also need the grouped need the 'clienthostid' and I need also the results of the apply to be under a label too</li>
<li>Sometimes when I do groupby some of the other columns still appear, why is that that sometimes columns disappear and sometime stays? is there a flag I'm missing that do those stuff?</li>
<li>In the example that I gave, when I did count the results showed on label 'LoginDaysSum', is there a why to add a new label for the results instead? </li>
</ol>
<p>Thank you,</p>
| 0debug |
Is /dev/zero Unsafe to Use on Cygwin? : <p>So I ran the following command in Cygwin: <code>dd if=/dev/zero of=E:</code></p>
<p>Now my C: drive lost all its free space. Upon unpluggin my E: drive from its USB port, the PC automatically shuts down. Is /dev/zero being created within the C: drive, and if so does that make it potentially unsafe to use with Cygwin?</p>
| 0debug |
How do you put a restriction on a variable? (javascript) : I am trying to make an add and remove button that has an input that has a text type and it show numbers. the add and remove button work and it will show positive numbers and negative also. I don't want it to show negative numbers. How do i make it so it can't go lower than 0. Also i do not want the input to have a number type. Please help asap.
here is my code:
<button onclick="add();">ADD</button>
<button onclick="remove();">REMOVE</button>
<input type="text" id="inc">
<script>
var i = 0;
function add() {
if(i >= 0) {
i++;
document.getElementById('inc').value = i;
} else {
i = 0;
document.getElementById('inc').value = i;
}
}
function remove() {
i--;
document.getElementById('inc').value = i;
}
</script>
| 0debug |
convert stream to into intstream : I want implement a static method youngWinners that given a stream <winner> returns a new Stream<Winner> containing the winners that are younger than 35 ordered alphabetically by names
inside my file i have : index , year , age , name , movie
my problem is i don't know how can convert stream to intstream to compare this field with 35.
Also i get confused that i have to use comprator for this or not?
public static Stream<Winner> youngWinners(Stream<Winner> young) {
// Stream<Winner> youngWin = young;
String[] toString = young.toArray(s -> new String[s]);
Arrays.stream(toString).flatMap((<any> f) -> {
try {
return Files.lines(Paths.get(f))
.filter(age -> int (age) <= 35 )
.mapToInt(a -> a.getWinnerage())
.map(WinneropsDB :: new);
} catch (Exception e) {
System.out.println("error");
return null;
}
});
return null;
} | 0debug |
static void test_tco2_status_bits(void)
{
TestData d;
uint16_t ticks = 8;
uint16_t val;
int ret;
d.args = NULL;
d.noreboot = true;
test_init(&d);
stop_tco(&d);
clear_tco_status(&d);
reset_on_second_timeout(true);
set_tco_timeout(&d, ticks);
load_tco(&d);
start_tco(&d);
clock_step(ticks * TCO_TICK_NSEC * 2);
val = qpci_io_readw(d.dev, d.tco_io_base + TCO2_STS);
ret = val & (TCO_SECOND_TO_STS | TCO_BOOT_STS) ? 1 : 0;
g_assert(ret == 1);
qpci_io_writew(d.dev, d.tco_io_base + TCO2_STS, val);
g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_base + TCO2_STS), ==, 0);
qtest_end();
}
| 1threat |
static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
int16_t *exponents, int end_pos)
{
int s_index;
int linbits, code, x, y, l, v, i, j, k, pos;
int last_pos;
VLC *vlc;
s_index = 0;
for(i=0;i<3;i++) {
j = g->region_size[i];
if (j == 0)
continue;
k = g->table_select[i];
l = mpa_huff_data[k][0];
linbits = mpa_huff_data[k][1];
vlc = &huff_vlc[l];
if(!l){
memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*j);
s_index += 2*j;
continue;
}
for(;j>0;j--) {
int exponent;
if (get_bits_count(&s->gb) >= end_pos)
break;
y = get_vlc2(&s->gb, vlc->table, 7, 3);
if(!y){
g->sb_hybrid[s_index ] =
g->sb_hybrid[s_index+1] = 0;
s_index += 2;
continue;
}
x = y >> 4;
y = y & 0x0f;
exponent= exponents[s_index];
dprintf("region=%d n=%d x=%d y=%d exp=%d\n",
i, g->region_size[i] - j, x, y, exponent);
if (x) {
#if 0
if (x == 15)
x += get_bitsz(&s->gb, linbits);
v = l3_unscale(x, exponent);
#else
if (x < 15){
v = expval_table[ exponent + 400 ][ x ];
}else{
x += get_bitsz(&s->gb, linbits);
v = l3_unscale(x, exponent);
}
#endif
if (get_bits1(&s->gb))
v = -v;
} else {
v = 0;
}
g->sb_hybrid[s_index++] = v;
if (y) {
#if 0
if (y == 15)
y += get_bitsz(&s->gb, linbits);
v = l3_unscale(y, exponent);
#else
if (y < 15){
v = expval_table[ exponent + 400 ][ y ];
}else{
y += get_bitsz(&s->gb, linbits);
v = l3_unscale(y, exponent);
}
#endif
if (get_bits1(&s->gb))
v = -v;
} else {
v = 0;
}
g->sb_hybrid[s_index++] = v;
}
}
vlc = &huff_quad_vlc[g->count1table_select];
last_pos=0;
while (s_index <= 572) {
pos = get_bits_count(&s->gb);
if (pos >= end_pos) {
if (pos > end_pos && last_pos){
s_index -= 4;
init_get_bits(&s->gb, s->gb.buffer + 4*(last_pos>>5), s->gb.size_in_bits - (last_pos&(~31)));
skip_bits(&s->gb, last_pos&31);
}
break;
}
last_pos= pos;
code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1);
dprintf("t=%d code=%d\n", g->count1table_select, code);
g->sb_hybrid[s_index+0]=
g->sb_hybrid[s_index+1]=
g->sb_hybrid[s_index+2]=
g->sb_hybrid[s_index+3]= 0;
while(code){
const static int idxtab[16]={3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
int pos= s_index+idxtab[code];
code ^= 8>>idxtab[code];
v = exp_table[ exponents[pos] + 400];
if(get_bits1(&s->gb))
v = -v;
g->sb_hybrid[pos] = v;
}
s_index+=4;
}
memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*(576 - s_index));
return 0;
}
| 1threat |
How can I implement an Onboarding / Walkthrough page in Angular Material Design? : <p>Can anyone tell me how to create an Onboarding/Walkthrough in Angular Material Design (Electron)?</p>
<p>I'm still new to the whole world of Angular. Basically I need to have a desktop app that looks like the image below. Displays a bunch of images, and allows the user to navigate between pages by clicking the arrow icons.</p>
<p><a href="https://i.stack.imgur.com/mFFhM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mFFhM.png" alt="enter image description here"></a></p>
<hr>
<p>I was unable to find any example or tutorials on where to begin.</p>
<p>Would anyone be able to get me started?</p>
<p>Thanks.</p>
| 0debug |
How to split file in windows just like linux : <p>How can we split file in windows system in command prompt based on size. like linux system we use </p>
<pre><code>"split -b 10M filename.xyz new_filename"
</code></pre>
| 0debug |
IPython console can't locate "backports.shutil_get_terminal_size" and won't load : <p>I'm running Python2.7 on windows 10 doing env and most pkg management with Anaconda. After upgrading a number of packages, my ipython console now fails to start in any IDE or at the console. When I attempt to run it at the console I get this error:</p>
<pre><code>Traceback (most recent call last):
File "C:\Anaconda3\Scripts\ipython-script.py", line 3, in <module>
import IPython
File "C:\Anaconda3\lib\site-packages\IPython\__init__.py", line 48, in <module>
from .core.application import Application
File "C:\Anaconda3\lib\site-packages\IPython\core\application.py", line 24, in <module>
from IPython.core import release, crashhandler
File "C:\Anaconda3\lib\site-packages\IPython\core\crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "C:\Anaconda3\lib\site-packages\IPython\core\ultratb.py", line 121, in <module>
from IPython.utils.terminal import get_terminal_size
File "C:\Anaconda3\lib\site-packages\IPython\utils\terminal.py", line 27, in <module>
import backports.shutil_get_terminal_size
ImportError: No module named backports.shutil_get_terminal_size
</code></pre>
<p>The first thing I tried to do was:</p>
<pre><code>pip install --upgrade backports.shutil_get_terminal_size
</code></pre>
<p>output:</p>
<pre><code>Requirement already up-to-date: backports.shutil_get_terminal_size in c:\anaconda3\lib\site-packages
</code></pre>
<p>I've uninstalled and reinstalled ipython with both</p>
<pre><code>conda uninstall ipython
conda install ipython
</code></pre>
<p>and</p>
<pre><code>pip uninstall ipython
pip install ipython
</code></pre>
<p>Still won't work. Help please!</p>
| 0debug |
ios simulator map annotations not showing up : I am trying to show markers in the mapview while loading it but the map is showing my countrymap in the mapview but not the annotations. is there anything wrong i am doing? FYI my simulator location is set as Apple.
[A class with annotation properties][1]
[Loading the annotations to the map][2]
[1]: http://i.stack.imgur.com/aGiEc.png
[2]: http://i.stack.imgur.com/C9ueF.png | 0debug |
Python Logging - Set Date as Filename : <p>I am working on implementing logging within my Python project and have hit a bit of a snag. I am trying to set up my logging such that the Handlers, and Formatters are all organized into a configuration file. What I am trying to do at the moment is to set up my <code>fileHandler</code> such that it will create a log file that looks something like this: <code>YYYY_MM_DD.log</code> obviously with the Y's representing the year, M's representing the month, and D's representing the day.</p>
<p>This is what I have attempted with my config file:</p>
<pre><code>[loggers]
keys=root,MainLogger
[handlers]
keys=fileHandler, consoleHandler
[formatters]
keys=logFormatter, consoleFormatter
[logger_root]
level=DEBUG
handlers=fileHandler
[logger_MainLogger]
level=DEBUG
handlers=fileHandler, consoleHandler
qualname=MainLogger
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=consoleFormatter
args=(sys.stdout,)
[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=logFormatter
args=(datetime.now().strftime('%Y_%m_%d.log'), 'a')
[formatter_logFormatter]
format=%(asctime)s | %(levelname)-8s | %(lineno)04d | %(message)s
[formatter_consoleFormatter]
format=%(asctime)s | %(levelname)-8s | %(fillname)s-%(funcName)s-%(lineno)04d | %message)s
</code></pre>
<p>The file I am using to test the configuration is pretty simple:</p>
<pre><code>import logging
import logging.config
logging.config.fileConfig('logging.conf')
logger = logging.getLogger('MainLogger')
logger.debug("TEST")
</code></pre>
<p>The specific error I am getting at the moment is:</p>
<pre><code>configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: "%Y_%m_%d.log'), 'a')"
</code></pre>
<p>I've tried changing the <code>%Y</code>, <code>%m</code>, and <code>%d</code> as the error says, but that doesn't fix the problem. How do I go about setting up the config file so that my log files look the way I want them to?</p>
<p>I should note when I change the filename to <code>test.log</code> everything worked fine, so this is the only error I seem to be having with this.</p>
| 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
static int advanced_decode_picture_header(VC9Context *v)
{
static const int type_table[4] = { P_TYPE, B_TYPE, I_TYPE, BI_TYPE };
int type, i, ret;
if (v->interlace)
{
v->fcm = get_bits(&v->gb, 1);
if (v->fcm) v->fcm = 2+get_bits(&v->gb, 1);
}
type = get_prefix(&v->gb, 0, 4);
if (type > 4 || type < 0) return FRAME_SKIPED;
v->pict_type = type_table[type];
av_log(v->avctx, AV_LOG_INFO, "AP Frame Type: %i\n", v->pict_type);
if (v->tfcntrflag) v->tfcntr = get_bits(&v->gb, 8);
if (v->broadcast)
{
if (!v->interlace) v->rptfrm = get_bits(&v->gb, 2);
else
{
v->tff = get_bits(&v->gb, 1);
v->rff = get_bits(&v->gb, 1);
}
}
if (v->panscanflag)
{
#if 0
for (i=0; i<v->numpanscanwin; i++)
{
v->topleftx[i] = get_bits(&v->gb, 16);
v->toplefty[i] = get_bits(&v->gb, 16);
v->bottomrightx[i] = get_bits(&v->gb, 16);
v->bottomrighty[i] = get_bits(&v->gb, 16);
}
#else
skip_bits(&v->gb, 16*4*v->numpanscanwin);
#endif
}
v->rndctrl = get_bits(&v->gb, 1);
v->uvsamp = get_bits(&v->gb, 1);
if (v->finterpflag == 1) v->interpfrm = get_bits(&v->gb, 1);
switch(v->pict_type)
{
case I_TYPE: if (decode_i_picture_header(v) < 0) return -1;
case P_TYPE: if (decode_p_picture_header(v) < 0) return -1;
case BI_TYPE:
case B_TYPE: if (decode_b_picture_header(v) < 0) return FRAME_SKIPED;
default: break;
}
v->transacfrm = get_bits(&v->gb, 1);
if (v->transacfrm) v->transacfrm += get_bits(&v->gb, 1);
if (v->pict_type == I_TYPE || v->pict_type == BI_TYPE)
{
v->transacfrm2 = get_bits(&v->gb, 1);
if (v->transacfrm2) v->transacfrm2 += get_bits(&v->gb, 1);
}
v->transacdctab = get_bits(&v->gb, 1);
if (v->pict_type == I_TYPE) vop_dquant_decoding(v);
return 0;
}
| 1threat |
LED board in python using tkinter,matrix and pixels : As a part of a python project I am trying to make an LED board using tkinter library.This board should receive an input (a sentence) and show it on the board.I have started by making 0 and 1 (6*7) matrix es for each letter but I really don't know what to do next and how should these letters be shown on the board
For example:
A=[[0,1,1,1,0,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,1,1,1,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0]]
Letters should be shown as below
[enter image description here][1]
[1]: http://i.stack.imgur.com/gwyHZ.png | 0debug |
static void virtio_blk_dma_restart_cb(void *opaque, int running,
RunState state)
{
VirtIOBlock *s = opaque;
if (!running) {
return;
}
if (!s->bh) {
s->bh = qemu_bh_new(virtio_blk_dma_restart_bh, s);
qemu_bh_schedule(s->bh);
}
}
| 1threat |
enum in class doesn't change when call own function : <h1>Short Problem Description</h1>
<p>I have a problem that is when I change a enum but it doesn't change.<br>
It looks like just a local change.</p>
<p>if I do the below quote is fine.</p>
<pre><code>level = new level_1();
while(true)
{
cout << level->state << endl; // show '1' at first loop. Another loop show '2'
level->state = STATE_INITIALIZE;
}
</code></pre>
<p>but I have to change state in his function</p>
<pre><code>level = new level_1();
while(true)
{
cout << level->state << endl; // show '1' only
level.do();
}
</code></pre>
<p>level.do function </p>
<pre><code>void Level_1::do()
{
state = STATE_INITIALIZE; // If this work, it should be '2'
// this->state = STATE_INITIALIZE;
}
</code></pre>
<p>so this is a big problem for me it doesn't change!! T_T</p>
<hr>
<h1>Long Code</h1>
<p>this is some code (almost full code)</p>
<h1>Level.h</h1>
<pre><code>enum LEVEL_STATE
{ STATE_LOAD = 1,
STATE_INITIALIZE = 2,
STATE_UPDATE = 3,
STATE_DRAW = 4,
STATE_FREE = 5,
STATE_UNLOAD = 6
};
class Level {
public:
LEVEL_STATE state = STATE_LOAD;
vector<Shader> shader;
vector<Model> model;
virtual void load()=0;
virtual void initialize()=0;
virtual void update()=0;
virtual void draw(Shader)=0;
virtual void free()=0;
virtual void unload()=0;
virtual Level* next()=0;
};
</code></pre>
<h1>Map_Level_1.h</h1>
<pre><code>#include"Level.h"
class Level_1 : public Level {
public:
LEVEL_STATE state;
vector<Shader> shader;
vector<Model> model;
void load();
void initialize();
void update();
void draw(Shader);
void free();
void unload();
Level* next();
};
</code></pre>
<h1>Map_Level_1.cpp</h1>
<pre><code>#pragma once
#include"Map_Level_0.h"
#include"Map_Level_1.h"
extern Camera camera;
extern float SCR_WIDTH;
extern float SCR_HEIGHT;
void Level_1::load()
{
shader.push_back(Shader("../Shader/alpha.vertex", "../Shader/alpha.fragment")); // this worked!
model.push_back(Model (FileSystem::getPath("res/arcade/arcade.obj"))); // this worked!
state = STATE_INITIALIZE; // this is not worked! the value doesn't change!
}
void Level_1::initialize()
{
shader[0].use();
state = STATE_UPDATE; // this is not worked! the value doesn't change!
}
void Level_1::update()
{
shader[0].use();
state = STATE_DRAW; // this is not worked! the value doesn't change!
}
void Level_1::draw(Shader shader)
{
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 10000.0f);
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 model;
shader.setMat4("projection", projection);
shader.setMat4("view", view);
shader.setInt("mode", 0);
//model = scale(vec3(5.0f, 5.0f, 5.0f));
shader.setMat4("model", model);
shader.setInt("fragMode", 1);
shader.setVec3("fragColor", vec3(0.92f, 0.92f, 0.92f));
this->model[0].Draw(shader);
state = STATE_UPDATE; // this is not worked! the value doesn't change!
}
void Level_1::free()
{
}
void Level_1::unload()
{
}
Level* Level_1::next() {
return new Level_0();
}
</code></pre>
<h1>Main.cpp</h1>
<pre><code>level = new Level_1();
while (!glfwWindowShouldClose(window))
{
DEV_processInput(window);
cout << level->state;
switch (level->state)
{
case STATE_LOAD:
level->load();
case STATE_INITIALIZE:
level->initialize();
case STATE_UPDATE:
level->update();
case STATE_DRAW:
level->draw(shader_1);
case STATE_FREE:
level->free();
case STATE_UNLOAD:
level->unload();
}
glfwSwapBuffers(window);
glfwPollEvents();
}
</code></pre>
<hr>
<p>If I<br>
1.) do something wrong that it is easy to fix<br>
2.) repeat any questions</p>
<p>I will apologize.. </p>
| 0debug |
why using stack data structure for storing primitive values instead of linked lists or arrays ? : <p>Since Stacks internally uses either Linked Lists / Arrays, why don't java directly store primitive values in Linked Lists / Arrays instead of Stacks ? </p>
| 0debug |
unexpected else statement in php : <p>My code retrieve videos based on user connection speed.</p>
<p>I am getting syntax error unexpected else on my code. i am troubleshooting this for the past few days and had run out of idea on how to solve it..</p>
<p>ajax code</p>
<pre><code> $.ajax({
method: "POST",
url: "viewvideo.php",
data: {speedMbps: speedMbps,
video_id: $('[name="video_id"').val()},
cache: false
}).done(function( html ) {
$( "#speed" ).val( html );
});
</code></pre>
<p>viewvideo.php</p>
<pre><code> if(isset($_POST['video_id']) && isset($_POST['speedMbps'] )){
$id = trim($_POST['video_id']);
$speed = $_POST['speedMbps'];
echo $id;
$result = mysqli_query($dbc , "SELECT `video_id`, `video_link` FROM `video480p` WHERE `video_id`='".$id."'");
$count = mysqli_num_rows($result);
if (($speed < 100) && ($count>0)) { //if user speed is less than 100 retrieve 480p quailtiy video
//does it exist?
//if($count>0){
//exists, so fetch it in an associative array
$video_480p = mysqli_fetch_assoc($result);
//this way you can use the column names to call out its values.
//If you want the link to the video to embed it;
echo $video_480p['video_link'];
}
else{
//does not exist
}
?>
<video id="video" width="640" height="480" controls autoplay>
<source src="<?php echo $video_480p['video_link']; ?>" type="video/mp4">
Your browser does not support the video tag.
</video>
<br />
<?php
$result2 = mysqli_query($dbc , "SELECT `video_id`, `video_link` FROM `viewvideo` WHERE `video_id`='".$video_id."'");
$count2 = mysqli_num_rows($result2);
// retrieve original video
else (($speed >= 100) && ($count2 >0)) {
//does it exist?
//if($count2>0){
//exists, so fetch it in an associative array
$video_arr = mysqli_fetch_assoc($result2);
//this way you can use the column names to call out its values.
//If you want the link to the video to embed it;
echo $video_arr['video_link'];
}
else{
//does not exist
}
}
?>
<video id="video" width="640" height="480" controls autoplay>
<source src="<?php echo $video_arr['video_link']; ?>" type="video/mp4">
Your browser does not support the video tag.
</video>
<br />
<?php
}
mysqli_close($dbc);
?>
</code></pre>
| 0debug |
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
{
AVStream *st;
MOVStreamContext *sc;
int j, pseudo_stream_id;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
for (pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {
enum CodecID id;
int dref_id = 1;
MOVAtom a = { AV_RL32("stsd") };
int64_t start_pos = avio_tell(pb);
int size = avio_rb32(pb);
uint32_t format = avio_rl32(pb);
if (size >= 16) {
avio_rb32(pb);
avio_rb16(pb);
dref_id = avio_rb16(pb);
}
if (st->codec->codec_tag &&
st->codec->codec_tag != format &&
(c->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != c->fc->video_codec_id
: st->codec->codec_tag != MKTAG('j','p','e','g'))
){
multiple_stsd:
av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
avio_skip(pb, size - (avio_tell(pb) - start_pos));
continue;
}
if (st->codec->codec_tag && st->codec->codec_tag == AV_RL32("avc1"))
goto multiple_stsd;
sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id;
sc->dref_id= dref_id;
st->codec->codec_tag = format;
id = ff_codec_get_id(codec_movaudio_tags, format);
if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8)))
id = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF);
if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && id > 0) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
} else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO &&
format && format != MKTAG('m','p','4','s')) {
id = ff_codec_get_id(codec_movvideo_tags, format);
if (id <= 0)
id = ff_codec_get_id(ff_codec_bmp_tags, format);
if (id > 0)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
else if (st->codec->codec_type == AVMEDIA_TYPE_DATA){
id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
if (id > 0)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
}
}
av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
(format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
(format >> 24) & 0xff, st->codec->codec_type);
if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
unsigned int color_depth, len;
int color_greyscale;
st->codec->codec_id = id;
avio_rb16(pb);
avio_rb16(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
st->codec->width = avio_rb16(pb);
st->codec->height = avio_rb16(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb32(pb);
avio_rb16(pb);
len = avio_r8(pb);
if (len > 31)
len = 31;
mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
if (len < 31)
avio_skip(pb, 31 - len);
if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
st->codec->codec_tag=MKTAG('I', '4', '2', '0');
st->codec->bits_per_coded_sample = avio_rb16(pb);
st->codec->color_table_id = avio_rb16(pb);
av_dlog(c->fc, "depth %d, ctab id %d\n",
st->codec->bits_per_coded_sample, st->codec->color_table_id);
color_depth = st->codec->bits_per_coded_sample & 0x1F;
color_greyscale = st->codec->bits_per_coded_sample & 0x20;
if ((color_depth == 2) || (color_depth == 4) ||
(color_depth == 8)) {
unsigned int color_start, color_count, color_end;
unsigned char r, g, b;
if (color_greyscale) {
int color_index, color_dec;
st->codec->bits_per_coded_sample = color_depth;
color_count = 1 << color_depth;
color_index = 255;
color_dec = 256 / (color_count - 1);
for (j = 0; j < color_count; j++) {
if (id == CODEC_ID_CINEPAK){
r = g = b = color_count - 1 - color_index;
}else
r = g = b = color_index;
sc->palette[j] =
(r << 16) | (g << 8) | (b);
color_index -= color_dec;
if (color_index < 0)
color_index = 0;
}
} else if (st->codec->color_table_id) {
const uint8_t *color_table;
color_count = 1 << color_depth;
if (color_depth == 2)
color_table = ff_qt_default_palette_4;
else if (color_depth == 4)
color_table = ff_qt_default_palette_16;
else
color_table = ff_qt_default_palette_256;
for (j = 0; j < color_count; j++) {
r = color_table[j * 3 + 0];
g = color_table[j * 3 + 1];
b = color_table[j * 3 + 2];
sc->palette[j] =
(r << 16) | (g << 8) | (b);
}
} else {
color_start = avio_rb32(pb);
color_count = avio_rb16(pb);
color_end = avio_rb16(pb);
if ((color_start <= 255) &&
(color_end <= 255)) {
for (j = color_start; j <= color_end; j++) {
avio_r8(pb);
avio_r8(pb);
r = avio_r8(pb);
avio_r8(pb);
g = avio_r8(pb);
avio_r8(pb);
b = avio_r8(pb);
avio_r8(pb);
sc->palette[j] =
(r << 16) | (g << 8) | (b);
}
}
}
sc->has_palette = 1;
}
} else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
int bits_per_sample, flags;
uint16_t version = avio_rb16(pb);
st->codec->codec_id = id;
avio_rb16(pb);
avio_rb32(pb);
st->codec->channels = avio_rb16(pb);
av_dlog(c->fc, "audio channels %d\n", st->codec->channels);
st->codec->bits_per_coded_sample = avio_rb16(pb);
sc->audio_cid = avio_rb16(pb);
avio_rb16(pb);
st->codec->sample_rate = ((avio_rb32(pb) >> 16));
av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom);
if (!c->isom) {
if (version==1) {
sc->samples_per_frame = avio_rb32(pb);
avio_rb32(pb);
sc->bytes_per_frame = avio_rb32(pb);
avio_rb32(pb);
} else if (version==2) {
avio_rb32(pb);
st->codec->sample_rate = av_int2double(avio_rb64(pb));
st->codec->channels = avio_rb32(pb);
avio_rb32(pb);
st->codec->bits_per_coded_sample = avio_rb32(pb);
flags = avio_rb32(pb);
sc->bytes_per_frame = avio_rb32(pb);
sc->samples_per_frame = avio_rb32(pb);
if (format == MKTAG('l','p','c','m'))
st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
}
}
switch (st->codec->codec_id) {
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
if (st->codec->bits_per_coded_sample == 16)
st->codec->codec_id = CODEC_ID_PCM_S16BE;
break;
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
if (st->codec->bits_per_coded_sample == 8)
st->codec->codec_id = CODEC_ID_PCM_S8;
else if (st->codec->bits_per_coded_sample == 24)
st->codec->codec_id =
st->codec->codec_id == CODEC_ID_PCM_S16BE ?
CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE;
break;
case CODEC_ID_MACE3:
sc->samples_per_frame = 6;
sc->bytes_per_frame = 2*st->codec->channels;
break;
case CODEC_ID_MACE6:
sc->samples_per_frame = 6;
sc->bytes_per_frame = 1*st->codec->channels;
break;
case CODEC_ID_ADPCM_IMA_QT:
sc->samples_per_frame = 64;
sc->bytes_per_frame = 34*st->codec->channels;
break;
case CODEC_ID_GSM:
sc->samples_per_frame = 160;
sc->bytes_per_frame = 33;
break;
default:
break;
}
bits_per_sample = av_get_bits_per_sample(st->codec->codec_id);
if (bits_per_sample) {
st->codec->bits_per_coded_sample = bits_per_sample;
sc->sample_size = (bits_per_sample >> 3) * st->codec->channels;
}
} else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
if (format != AV_RL32("mp4s"))
mov_read_glbl(c, pb, fake_atom);
st->codec->codec_id= id;
st->codec->width = sc->width;
st->codec->height = sc->height;
} else {
if (st->codec->codec_tag == MKTAG('t','m','c','d')) {
int val;
avio_rb32(pb);
val = avio_rb32(pb);
if (val & 1)
st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE;
avio_rb32(pb);
avio_rb32(pb);
st->codec->time_base.den = avio_r8(pb);
st->codec->time_base.num = 1;
}
avio_skip(pb, size - (avio_tell(pb) - start_pos));
}
a.size = size - (avio_tell(pb) - start_pos);
if (a.size > 8) {
if (mov_read_default(c, pb, a) < 0)
} else if (a.size > 0)
avio_skip(pb, a.size);
}
if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
st->codec->sample_rate= sc->time_scale;
switch (st->codec->codec_id) {
#if CONFIG_DV_DEMUXER
case CODEC_ID_DVAUDIO:
c->dv_fctx = avformat_alloc_context();
c->dv_demux = avpriv_dv_init_demux(c->dv_fctx);
if (!c->dv_demux) {
av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n");
}
sc->dv_audio_container = 1;
st->codec->codec_id = CODEC_ID_PCM_S16LE;
break;
#endif
case CODEC_ID_QCELP:
if (st->codec->codec_tag != MKTAG('Q','c','l','p'))
st->codec->sample_rate = 8000;
st->codec->frame_size= 160;
st->codec->channels= 1;
break;
case CODEC_ID_AMR_NB:
st->codec->channels= 1;
st->codec->sample_rate = 8000;
st->codec->frame_size = 160;
break;
case CODEC_ID_AMR_WB:
st->codec->channels = 1;
st->codec->sample_rate = 16000;
st->codec->frame_size = 320;
break;
case CODEC_ID_MP2:
case CODEC_ID_MP3:
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->need_parsing = AVSTREAM_PARSE_FULL;
break;
case CODEC_ID_GSM:
case CODEC_ID_ADPCM_MS:
case CODEC_ID_ADPCM_IMA_WAV:
st->codec->frame_size = sc->samples_per_frame;
st->codec->block_align = sc->bytes_per_frame;
break;
case CODEC_ID_ALAC:
if (st->codec->extradata_size == 36) {
st->codec->frame_size = AV_RB32(st->codec->extradata+12);
st->codec->channels = AV_RB8 (st->codec->extradata+21);
st->codec->sample_rate = AV_RB32(st->codec->extradata+32);
}
break;
case CODEC_ID_AC3:
st->need_parsing = AVSTREAM_PARSE_FULL;
break;
case CODEC_ID_MPEG1VIDEO:
st->need_parsing = AVSTREAM_PARSE_FULL;
break;
default:
break;
}
return 0;
} | 1threat |
I changed my string to Public and suddenly got 76 problems : I have a string called password which my user can define with whatever, kim123 is an example.
So later in the code I want to say something like: "You have entered (password but in * ) as your password.
If you are still unclear by what I mean, I basically want to turn the password he/she chose into stars:
password = hey123
"You have entered ****** as your password"
| 0debug |
Need help Deleting a Row On T-Sql : i need to delete a row on a table, first of all I have 2 Tables,and i want to delete a row when table 1.a is the same as Table2.a, would like ot get some help,i want to delete the table2.a, sorry for bad english | 0debug |
Image centering with pandoc markdown : <p>I need to create documents periodically for Word-using administrators. How can I centre an image using pandoc markdown? I see mention of div blocks, but I have no idea what they are. </p>
<pre><code>{.center}
</code></pre>
<p>With image code such as that above, and a command line such as:</p>
<pre><code>pandoc -s test.md -o test.docx
</code></pre>
<p>or</p>
<pre><code>pandoc -s test.md -o test.pdf
</code></pre>
<p>I always end up with left-aligned images in my document.</p>
| 0debug |
What is the different between Docker bundles and docker-compose? : <p>Docker 1.12 introduced the new concept of bundles. A new file format to describe a set of services.</p>
<p>My application is already deployed with <em>docker-compose</em>. I have a <code>docker-compose.yml</code> for each of my environments and I can quickly deploy my app just with a <code>docker-compose up</code>.</p>
<p>From what I understand of <a href="https://blog.docker.com/2016/06/docker-app-bundle/">this post</a>, <em>Docker bundles</em> is just a new way built-in Docker to do the same thing as docker-compose does as an external software.</p>
<p>Is that it ? What can I expect from <em>Docker bundles</em> that I won't have with <em>docker-compose</em> ?</p>
| 0debug |
iPhone X status bar black web app : <p>I am working on a web-app and in testing on iPhone X using the Simulator, the status bar is completely black. How do I make my website cover the entire screen? I am not using any library; I have seen many questions mentioning something called Cordova but what I have is just HTML with CSS.</p>
<p><a href="https://i.stack.imgur.com/VwNNa.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/VwNNa.jpg" alt="Screenshot of iPhone X simulator"></a></p>
<p>Here is my HTML code in the head.</p>
<pre><code><head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta content="viewport-fit=cover, width=device-width, initial-scale=1.0" name="viewport">
<title>My PWA</title>
<link rel="stylesheet" href="/assets/styles/design.css">
</head>
</code></pre>
| 0debug |
regarding the validation of the input file separator in perl : I have csv input file in perl which is tab separated.
I would like to add a check if it find anything other than tab as field separator then it should through error message.I am new to perl I don't know how to check.
example of my input file:My file having only two field.
10001027^I1000102713921-1274^M$
10010121^I1001012113921-1234^M$
10000104^I10010126139211-9999^M$
10010119^I10010126139211-9999^M$
Thanks
| 0debug |
Java Sorting Error : <pre><code>public class Main {
public static void main(String[] args) {
int z;
int [] a = new int[5];
a[0]=4;
a[1]=8;
a[2]=5;
a[3]=1;
a[4]=3;
for(;;){
z=0;
for(int i=1;i<a.length;i++){
if(a[i-1]>a[i]){
int tmp = a[i];
a[i-1]=a[i];
a[i]=tmp;
z++;
}
}
if(z==0){
break;
}
}
for(int i=0;i<a.length;i++)
{
System.out.println(a[i]);
}
}}
</code></pre>
<p>Hi. I have this problem. I want to sort array items, but result of this code is 1 1 1 1 3. I can't understand where is problem.
Thanks you very much! </p>
| 0debug |
Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement : <p>I am trying to install doctrine to my project. I am getting the error about the wrong PHP version. What can be done to remove the real reason for this error? The way to overcome it is to use the option "<code>--ignore-platform-reqs</code>" as described <a href="https://getcomposer.org/doc/03-cli.md#require">https://getcomposer.org/doc/03-cli.md#require</a> .</p>
<p>PHP version: PHP 5.6.18</p>
<pre><code>PHP 5.6.18 (cli) (built: Feb 3 2016 17:20:21)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
</code></pre>
<p>The error: c..>composer require doctrine/data-fixtures</p>
<pre><code>Using version ^1.1 for doctrine/data-fixtures
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/migrations v1.3.0 requires php ^5.5|^7.0 -> your PHP version (5.6
.18) overriden by "config.platform.php" version (5.3.9) does not satisfy that re
quirement.
- doctrine/migrations v1.2.2 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
- doctrine/migrations v1.2.1 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
- doctrine/migrations v1.2.0 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
- doctrine/migrations v1.1.0 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
- doctrine/migrations v1.0.0 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
- Installation request for doctrine/migrations ~1.0 -> satisfiable by doctri
ne/migrations[v1.0.0, v1.1.0, v1.2.0, v1.2.1, v1.2.2, v1.3.0].
Installation failed, reverting ./composer.json to its original content.
</code></pre>
<p>The content of composer.json</p>
<pre><code>"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/data-fixtures" : "~1.1",
"doctrine/doctrine-fixtures-bundle": "dev-master",
</code></pre>
| 0debug |
A better alternative to Microsoft Access? : <p>I've been using Microsoft Access for a few years but I'm starting to lament the lack of command line in the development interface. I use a couple of command line prompt programs for design and web development, so when I have to do something in Access, it seems so slow to have to scroll through Form Properties and Access Objects to find what I want to edit. </p>
<p>I'm wondering what other options are out there for making personal use databases (just desktop, don't need web). I'm just interested in solutions that I could implement as an individual, not on a corporate scale. </p>
<p>Or maybe there's a plugin or workflow for Access that I don't know about?</p>
| 0debug |
I am getting 'can not be used as a function error" in C++ when using for loop to calculate yc : I am calculating NACA 4 digit airfoil coordinates using C++. In this code i used armadillo library's linspace function to divide x into linearly spaced points. When i use for loop to calculate yc's value for each x's value I get error "yc" can not be used as function. Thanks for helping.
#include<iostream>
#include<armadillo>
#include<vector>
using namespace std;
using namespace arma;
int main()
{
float a[3];
float c;
int gp = 100;
cout << "Please Enter NACA 4 digits" << endl;
cout << "Please Enter 1st digit" << endl;
cin >> a[0] ;
cout << "Please Enter 2nd digit" << endl;
cin >> a[1] ;
cout << "Please Enter last 2 digits" << endl;
cin >> a[2] ;
cout << "Please Enter Chord Length" << endl;
cin >> c;
float m=(a[0]*c)/100;
float p=(a[1]*c)/10;
float t=(a[2]*c)/100;
cout << m << endl;
cout << p << endl;
cout << t << endl;
vec x = linspace<vec>(0, c, gp);
float yc;
for(int i=0;i<gp;++i)
{
if (x(i) = 0 && x(i) <= p){
yc(i) = (m/(p*p))*((2*p*(x(i)))-(x(i)*x(i)));
}
if (x(i) > p && x(i) <= c) {
yc(i) =(m/((1-p)*(1-p)))*((1-(2*p))+(2*p*x(i))-(x(i)*x(i)));
}
}
cout<< yc <<endl;
return 0;
}
| 0debug |
static av_always_inline void mc_chroma_dir(VP9Context *s, vp9_mc_func(*mc)[2],
uint8_t *dst_u, uint8_t *dst_v,
ptrdiff_t dst_stride,
const uint8_t *ref_u,
ptrdiff_t src_stride_u,
const uint8_t *ref_v,
ptrdiff_t src_stride_v,
ThreadFrame *ref_frame,
ptrdiff_t y, ptrdiff_t x,
const VP56mv *mv,
int bw, int bh, int w, int h)
{
int mx = mv->x, my = mv->y;
int th;
y += my >> 4;
x += mx >> 4;
ref_u += y * src_stride_u + x;
ref_v += y * src_stride_v + x;
mx &= 15;
my &= 15;
th = (y + bh + 4 * !!my + 7) >> 5;
ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
if (x < !!mx * 3 || y < !!my * 3 ||
x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) {
s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
ref_u - !!my * 3 * src_stride_u - !!mx * 3,
80,
src_stride_u,
bw + !!mx * 7, bh + !!my * 7,
x - !!mx * 3, y - !!my * 3, w, h);
ref_u = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3;
mc[!!mx][!!my](dst_u, dst_stride, ref_u, 80, bh, mx, my);
s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
ref_v - !!my * 3 * src_stride_v - !!mx * 3,
80,
src_stride_v,
bw + !!mx * 7, bh + !!my * 7,
x - !!mx * 3, y - !!my * 3, w, h);
ref_v = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3;
mc[!!mx][!!my](dst_v, dst_stride, ref_v, 80, bh, mx, my);
} else {
mc[!!mx][!!my](dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my);
mc[!!mx][!!my](dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my);
}
}
| 1threat |
java.lang.NullPointerException error with adapter how to fix it? : <p>I'm getting a fatal exception / null pointer exception
i dont know what is the problem and why this error is happen </p>
<p>If any additional information is required please let me know.</p>
<p>LOGCAT</p>
<pre><code>> 03-09 18:18:52.423 3765-3765/com.mosabalzouby.myapplication
> E/AndroidRuntime: FATAL EXCEPTION: main
> java.lang.NullPointerException
> at
> com.mosabalzouby.myapplication.IndianMoviesAdapter.onBindViewHolder(IndianMoviesAdapter.java:38)
> at
> com.mosabalzouby.myapplication.IndianMoviesAdapter.onBindViewHolder(IndianMoviesAdapter.java:16)
> at
> android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:5217)
> at
> android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5250)
> at
> android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4487)
> at
> android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
> at
> android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
> at
> android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
> at
> android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
> at
> android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
> at
> android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
> at
> android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.RelativeLayout.onLayout(RelativeLayout.java:925)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at
> android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1037)
> at
> android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:747)
> at
> android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
> at
> android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1156)
> at
> android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:760)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
> at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
> at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
> at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
> at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1468)
> at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418)
> at android.os.Handler.dispatchMessage(Handler.java:99)
> at android.os.Looper.loop(Looper.java:137)
> at android.app.ActivityThread.main(ActivityThread.java:4340)
> at java.lang.reflect.Method.invokeNative(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:511)
> at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
> at dalvik.system.NativeStart.main(Native Method)
</code></pre>
<p>MainActivity :</p>
<pre><code> List<IndianMovies> movies=new ArrayList<>();
int posters[]={R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers};
String moviename[]={"aaaaa","bbbbbb","ccccc","vvvvvv","eeeeeee","wwwwww"};
String movierate[]={"9.9","5.5","2.3","4.4","5.1","6.2"};
String moviestory[]={"aaaaaaaaaaa","aaaaaaaaa","wwwwwwwwwww","eeeee","rrrrrrr","qqqqq"};
for (int i=0;i<posters.length;i++){
IndianMovies movie=
new IndianMovies(moviename[i],movierate[i],moviestory[i],posters[i]);
movies.add(movie);
}
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
IndianMoviesAdapter adapter = new IndianMoviesAdapter(movies);
recyclerView.setAdapter(adapter);
</code></pre>
<p>My Adapter :</p>
<pre><code>public class IndianMoviesAdapter extends RecyclerView.Adapter<IndianMoviesAdapter.IndianMovieHolder>{
List<IndianMovies> moviesList;
public IndianMoviesAdapter(List<IndianMovies> moviesList){
this.moviesList=moviesList;
}
@Override
public IndianMovieHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View row = LayoutInflater.from(parent.getContext()).inflate(R.layout.indian_movie_row,parent,false);
IndianMovieHolder holder = new IndianMovieHolder(row);
return holder;
}
@Override
public void onBindViewHolder(IndianMovieHolder holder, int position) {
IndianMovies movie =moviesList.get(position);
holder.movietitle.setText(movie.moviename);
holder.movierat.setText(movie.movierate);
holder.moviesdesc.setText(movie.moviestory);
holder.poster.setImageResource(movie.posterimage);
}
@Override
public int getItemCount() {
return moviesList.size();
}
class IndianMovieHolder extends RecyclerView.ViewHolder{
TextView movietitle,movierat,moviesdesc;
ImageView poster;
public IndianMovieHolder(View itemView) {
super(itemView);
movietitle =(TextView) itemView.findViewById(R.id.movietitleTV);
movietitle =(TextView) itemView.findViewById(R.id.movieratTV);
moviesdesc =(TextView) itemView.findViewById(R.id.moviedescTV);
poster =(ImageView) itemView.findViewById(R.id.movieposteIMG);
}
}
}
</code></pre>
<p>How to fix it ??</p>
| 0debug |
I am using Redux. Should I manage controlled input state in the Redux store or use setState at the component level? : <p>I have been trying to figure out the best way to manage my react forms. I have tried to use the onChange to fire an action and update my redux store with my form data. I have also tried creating local state and when my form gets submitted I trigger and action and update the redux store. </p>
<p>How should i manage my controlled input state?</p>
| 0debug |
static inline PageDesc *page_find_alloc(target_ulong index)
{
PageDesc **lp, *p;
lp = page_l1_map(index);
if (!lp)
return NULL;
p = *lp;
if (!p) {
#if defined(CONFIG_USER_ONLY)
unsigned long addr;
size_t len = sizeof(PageDesc) * L2_SIZE;
p = mmap(0, len, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
*lp = p;
addr = h2g(p);
if (addr == (target_ulong)addr) {
page_set_flags(addr & TARGET_PAGE_MASK,
TARGET_PAGE_ALIGN(addr + len),
PAGE_RESERVED);
}
#else
p = qemu_mallocz(sizeof(PageDesc) * L2_SIZE);
*lp = p;
#endif
}
return p + (index & (L2_SIZE - 1));
}
| 1threat |
trying to connect database with php : <p>I'm making a registration page and I have phpmyadmin set on xampp, my apache's port is <code>8080</code> and
my table's name is <code>registration</code> and my database's name is <code>loginregister</code>,
whenever I submit it the values arent getting transmitted to the table and i don't see any errors, help?</p>
<p>this is my code:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<title>Register</title>
</head>
<body>
<form action="" method="post" name="form1">
<table>
<tr>
<td>Enter your first name*</td>
<td><input type="text" name="fname" required="yes" pattern="^[a-z1-9]+"></td>
<td><p>Username takes only small letters or numbers, no capital letters</p></td>
</tr>
<tr>
<td>Enter your last name*</td>
<td><input type="text" name="lname" required="yes"></td>
</tr>
<tr>
<td>Enter your password*</td>
<td><input type="password" name="pw" required="yes"></td>
</tr>
<tr>
<td>Enter your email adress*</td>
<td><input type="email" name="email" required="yes"></td>
</tr>
<tr>
<td>Enter your username*</td>
<td><input type="text" name="uname" required="yes"></td>
</tr>
<tr>
<td><input type="submit" value="submit" name="submit1"></input></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit1']))
{
$link=mysqli_connect('localhost','root','' , "loginregister");
$res= "INSERT INTO loginregister (fname , lname , pw , email , uname) VALUES('$_POST[$fname]','$_POST[$lname]','$_POST[$pw]','$_POST[$email]','$_POST[$uname]'))";
}
?>
</body>
</html>
</code></pre>
| 0debug |
How do I make a sideways L look in html/css? : <p><a href="https://i.stack.imgur.com/PXZnP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PXZnP.png" alt="enter image description here"></a></p>
<p>I know the title wasn't the best way to describe it. But I am trying to recreate the symbols shown in the image on both sides of the word interval. I have no idea how to do this. Is it a symbol? Or some kind of graphic using svg?</p>
| 0debug |
how to pass arguments in constructor : here I attached my code:
I have a class called Contacts():
public class Contacts {
int _id;
String _name;
String _mobile;
String _home;
String _office;
String _email;
String _companyName;
String _jobRole;
String _address;
public Contacts( String name, String mobile, String home, String office, String address, String email,String companyName, String jobRole ) {
this._name = name;
this._mobile = mobile;
this._home = home;
this._office = office;
this._address = address;
this._email = email;
this._companyName = companyName;
this._jobRole = jobRole;
}
public Contacts(int id, String name, String mobile, String home, String office,String address,String email,String companyName, String jobRole ) {
this._id = id;
this._name = name;
this._mobile = mobile;
this._home = home;
this._office = office;
this._address = address;
this._email = email;
this._companyName = companyName;
this._jobRole = jobRole;
}
public Contacts() {
}
public String getCompanyName() {
return _companyName;
}
public void setCompanyName(String companyName) {
this._companyName = companyName;
}
public String getEmail() {
return _email;
}
public void setEmail(String email) {
this._email = email;
}
public String getHome() {
return _home;
}
public void setHome(String home) {
this._home = home;
}
public int getId() {
return _id;
}
public void setId(int id) {
this._id = id;
}
public String getJobRole() {
return _jobRole;
}
public void setJobRole(String jobRole) {
this._jobRole = jobRole;
}
public String getMobile() {
return _mobile;
}
public void setMobile(String mobile) {
this._mobile = mobile;
}
public String getName() {
return _name;
}
public void setName(String name) {
this._name = name;
}
public String getOffice() {
return _office;
}
public void setOffice(String office) {
this._office = office;
}
public String getAddress() {
return _address;
}
public void setAddress(String address) {
this._address = address;
}
}
and i have method called updateContact() and addContact() which are present inside a class called Dbhandler() that extends SQLiteOpenHelper()
public boolean updateContact(Contacts contacts) {
SQLiteDatabase sqLiteDatabase = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(KEY_NAME,contacts.getName());
contentValues.put(KEY_MOBILE,contacts.getMobile());
contentValues.put(KEY_HOME,contacts.getHome());
contentValues.put(KEY_OFFICE,contacts.getOffice());
contentValues.put(KEY_ADDRESS,contacts.getAddress());
contentValues.put(KEY_EMAIL,contacts.getEmail());
contentValues.put(KEY_COMPANYNAME,contacts.getCompanyName());
contentValues.put(KEY_JOBROLE,contacts.getJobRole());
sqLiteDatabase.update(TABLE_CONTACTS,contentValues,KEY_ID + "= ?",new String[] {String.valueOf(contacts.getId())});
return true;
}
public void addContact(Contacts contacts) {
SQLiteDatabase sqLiteDatabase = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(KEY_NAME,contacts.getName());
contentValues.put(KEY_MOBILE,contacts.getMobile());
contentValues.put(KEY_HOME,contacts.getHome());
contentValues.put(KEY_OFFICE,contacts.getOffice());
contentValues.put(KEY_ADDRESS,contacts.getAddress());
contentValues.put(KEY_EMAIL,contacts.getEmail());
contentValues.put(KEY_COMPANYNAME,contacts.getCompanyName());
contentValues.put(KEY_JOBROLE,contacts.getJobRole());
sqLiteDatabase.insert(TABLE_CONTACTS,null,contentValues);
sqLiteDatabase.close();
}
and I have a button which is represented as button1 in display.xml file.
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="run"
android:text="@string/save"
android:layout_below="@+id/editAddress"
android:layout_centerHorizontal="true" />
onClick(), I implemented run() method in DisplayContacts() class.
public void run(View view) {
Bundle bundle = getIntent().getExtras();
if(bundle != null) {
int value =bundle.getInt("id");
if(value > 0) {
if(dbHandler.updateContact(id_update,name.getText().toString(),mobile.getText().toString(),home.getText().toString(),office.getText().toString(),companyName.getText().toString(),jobRole.getText().toString(),email.getText().toString(),address.getText().toString())) {
Toast.makeText(getApplicationContext(), "Updated", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(),Example4.class);
startActivity(intent);
} else{
Toast.makeText(getApplicationContext(), "not Updated", Toast.LENGTH_SHORT).show();
}
} else{
if(dbHandler.addContact(name.getText().toString(), mobile.getText().toString(),home.getText().toString(),office.getText().toString(), companyName.getText().toString(),jobRole.getText().toString(),email.getText().toString(),address.getText().toString())){
Toast.makeText(getApplicationContext(), "done", Toast.LENGTH_SHORT).show();
} else{
Toast.makeText(getApplicationContext(), "not done", Toast.LENGTH_SHORT).show();
}
Intent intent = new Intent(getApplicationContext(),Example4.class);
startActivity(intent);
}
}
At this point I am getting error.ie.,
if(dbHandler.updateContact(id_update,name.getText().toString(),mobile.getText().toString(),home.getText().toString(),office.getText().toString(),companyName.getText().toString(),jobRole.getText().toString(),email.getText().toString(),address.getText().toString())) {}
and
if(dbHandler.addContact(name.getText().toString(), mobile.getText().toString(),home.getText().toString(),office.getText().toString(), companyName.getText().toString(),jobRole.getText().toString(),email.getText().toString(),address.getText().toString())){}
Why this?
and
How to fix this?
can you please help me with updated code.
thank you...
| 0debug |
ANTLR 3 GRAMMAR : A Signed Even Number Grammar. Consider the following language description of a signed even number: A signed even number optionally has a “+” or “-“ to denote its sign followed by one more number of which the last number must be even.
Task 1. Define the legal lexical tokens in the grammar for this language. You will likely want to define separate lexical rules for the numbers 0-9 as well as the even numbers.
Task 2. Develop the parser rules for this grammar. As you develop/troubleshoot your grammar, be
sure to utilize the Syntax Diagram to visualize the rules you are defining.
this what I got so far but still out an error
NUMBER : '0'..'9';
EVEN_NUMBER : '0' | '2' | '4' | '6' | '8' ;
signedevennumber : ('+' | '-')? EVEN_NUMBER? NUMBER? NUMBER? EVEN_NUMBER;
ANY HELP PLEASE | 0debug |
static void expr_error(const char *fmt)
{
term_printf(fmt);
term_printf("\n");
longjmp(expr_env, 1);
}
| 1threat |
static unsigned long copy_elf_strings(int argc,char ** argv, void **page,
unsigned long p)
{
char *tmp, *tmp1, *pag = NULL;
int len, offset = 0;
if (!p) {
return 0;
}
while (argc-- > 0) {
tmp = argv[argc];
if (!tmp) {
fprintf(stderr, "VFS: argc is wrong");
exit(-1);
}
tmp1 = tmp;
while (*tmp++);
len = tmp - tmp1;
if (p < len) {
return 0;
}
while (len) {
--p; --tmp; --len;
if (--offset < 0) {
offset = p % TARGET_PAGE_SIZE;
pag = (char *)page[p/TARGET_PAGE_SIZE];
if (!pag) {
pag = (char *)malloc(TARGET_PAGE_SIZE);
page[p/TARGET_PAGE_SIZE] = pag;
if (!pag)
return 0;
}
}
if (len == 0 || offset == 0) {
*(pag + offset) = *tmp;
}
else {
int bytes_to_copy = (len > offset) ? offset : len;
tmp -= bytes_to_copy;
p -= bytes_to_copy;
offset -= bytes_to_copy;
len -= bytes_to_copy;
memcpy_fromfs(pag + offset, tmp, bytes_to_copy + 1);
}
}
}
return p;
}
| 1threat |
Python set: fill with odd numbers : <p>I have following assignment:</p>
<p>Create a <strong>set called 'c' with all the odd numbers less than 10</strong>.</p>
<p>I create the set manually:</p>
<pre><code>c={'1', '3', '5', '7', '9'}
</code></pre>
<p>How can I create this set by a formula so that it would also be feasible with a larger scale?</p>
<p>Thank you for you help?</p>
| 0debug |
An interesting subquiry in MYSQL : Oh God, I think it will take a while to explain the question but I'll do my best to make it as clear as possible.
Here is the link to the entity-relationship diagram of the database.
https://ibb.co/knPSFe
Here is the statement I'm interesting in. It is taken from the book called "Alan Beaulieu Learning_SQL". It can be found on page 177 in case you want to read about it there. The topic of this query is "Subqueries as Expression Generators".
[![enter image description here][1]][1]
As you can see the result set includes the three "NULL" rows.They are thought to be sorted out by the WHERE clause of the first subquery:
**AND p.product_type_cd = 'ACCOUNT'**
Here is an extract from the book :"The reason for the extra three rows in the result set is that the previous version of the
query included the filter condition p.product_type_cd = 'ACCOUNT'. That filter eliminated
rows with product types of INSURANCE and LOAN, such as small business loans.
Since this version of the query doesn’t include a join to the product table, there is no
way to include the filter condition in the main query. The correlated subquery against
the product table does include this filter, but the only effect is to leave the product name
null."
It is "the previous version of the query":
[![enter image description here][2]][2]
"The correlated subquery against the product table does include this filter, but the only effect is to leave the product name null". **How does it do it? What is the order of evaluation?**
The query [![enter image description here][3]][3]
returns the first column "product" with INSURANCE and LOAN products types sorted out. **What does make them appear in the result set again and how their names were replaced with NULL values?**
[1]: https://i.stack.imgur.com/jWBkb.png
[2]: https://i.stack.imgur.com/m1jjq.png
[3]: https://i.stack.imgur.com/fznxj.png | 0debug |
static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
int width)
{
target_ulong boff;
uint8_t *p;
uint8_t cmd;
if (pfl->wcycle == 0)
offset -= (target_ulong)(long)pfl->storage;
else
offset -= pfl->base;
cmd = value;
DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__,
offset, value, width);
if (pfl->cmd != 0xA0 && cmd == 0xF0) {
DPRINTF("%s: flash reset asked (%02x %02x)\n",
__func__, pfl->cmd, cmd);
goto reset_flash;
}
cpu_register_physical_memory(pfl->base, pfl->total_len, pfl->fl_mem);
boff = offset & (pfl->sector_len - 1);
if (pfl->width == 2)
boff = boff >> 1;
else if (pfl->width == 4)
boff = boff >> 2;
switch (pfl->wcycle) {
case 0:
check_unlock0:
if (boff == 0x55 && cmd == 0x98) {
enter_CFI_mode:
pfl->wcycle = 7;
pfl->cmd = 0x98;
return;
}
if (boff != 0x555 || cmd != 0xAA) {
DPRINTF("%s: unlock0 failed " TARGET_FMT_lx " %02x %04x\n",
__func__, boff, cmd, 0x555);
goto reset_flash;
}
DPRINTF("%s: unlock sequence started\n", __func__);
break;
case 1:
check_unlock1:
if (boff != 0x2AA || cmd != 0x55) {
DPRINTF("%s: unlock1 failed " TARGET_FMT_lx " %02x\n", __func__,
boff, cmd);
goto reset_flash;
}
DPRINTF("%s: unlock sequence done\n", __func__);
break;
case 2:
if (!pfl->bypass && boff != 0x555) {
DPRINTF("%s: command failed " TARGET_FMT_lx " %02x\n", __func__,
boff, cmd);
goto reset_flash;
}
switch (cmd) {
case 0x20:
pfl->bypass = 1;
goto do_bypass;
case 0x80:
case 0x90:
case 0xA0:
pfl->cmd = cmd;
DPRINTF("%s: starting command %02x\n", __func__, cmd);
break;
default:
DPRINTF("%s: unknown command %02x\n", __func__, cmd);
goto reset_flash;
}
break;
case 3:
switch (pfl->cmd) {
case 0x80:
goto check_unlock0;
case 0xA0:
DPRINTF("%s: write data offset " TARGET_FMT_lx " %08x %d\n",
__func__, offset, value, width);
p = pfl->storage;
switch (width) {
case 1:
p[offset] &= value;
pflash_update(pfl, offset, 1);
break;
case 2:
#if defined(TARGET_WORDS_BIGENDIAN)
p[offset] &= value >> 8;
p[offset + 1] &= value;
#else
p[offset] &= value;
p[offset + 1] &= value >> 8;
#endif
pflash_update(pfl, offset, 2);
break;
case 4:
#if defined(TARGET_WORDS_BIGENDIAN)
p[offset] &= value >> 24;
p[offset + 1] &= value >> 16;
p[offset + 2] &= value >> 8;
p[offset + 3] &= value;
#else
p[offset] &= value;
p[offset + 1] &= value >> 8;
p[offset + 2] &= value >> 16;
p[offset + 3] &= value >> 24;
#endif
pflash_update(pfl, offset, 4);
break;
}
pfl->status = 0x00 | ~(value & 0x80);
if (pfl->bypass)
goto do_bypass;
goto reset_flash;
case 0x90:
if (pfl->bypass && cmd == 0x00) {
goto reset_flash;
}
if (boff == 0x55 && cmd == 0x98)
goto enter_CFI_mode;
default:
DPRINTF("%s: invalid write for command %02x\n",
__func__, pfl->cmd);
goto reset_flash;
}
case 4:
switch (pfl->cmd) {
case 0xA0:
return;
case 0x80:
goto check_unlock1;
default:
DPRINTF("%s: invalid command state %02x (wc 4)\n",
__func__, pfl->cmd);
goto reset_flash;
}
break;
case 5:
switch (cmd) {
case 0x10:
if (boff != 0x555) {
DPRINTF("%s: chip erase: invalid address " TARGET_FMT_lx "\n",
__func__, offset);
goto reset_flash;
}
DPRINTF("%s: start chip erase\n", __func__);
memset(pfl->storage, 0xFF, pfl->total_len);
pfl->status = 0x00;
pflash_update(pfl, 0, pfl->total_len);
qemu_mod_timer(pfl->timer,
qemu_get_clock(vm_clock) + (ticks_per_sec * 5));
break;
case 0x30:
p = pfl->storage;
offset &= ~(pfl->sector_len - 1);
DPRINTF("%s: start sector erase at " TARGET_FMT_lx "\n", __func__,
offset);
memset(p + offset, 0xFF, pfl->sector_len);
pflash_update(pfl, offset, pfl->sector_len);
pfl->status = 0x00;
qemu_mod_timer(pfl->timer,
qemu_get_clock(vm_clock) + (ticks_per_sec / 2));
break;
default:
DPRINTF("%s: invalid command %02x (wc 5)\n", __func__, cmd);
goto reset_flash;
}
pfl->cmd = cmd;
break;
case 6:
switch (pfl->cmd) {
case 0x10:
return;
case 0x30:
return;
default:
DPRINTF("%s: invalid command state %02x (wc 6)\n",
__func__, pfl->cmd);
goto reset_flash;
}
break;
case 7:
DPRINTF("%s: invalid write in CFI query mode\n", __func__);
goto reset_flash;
default:
DPRINTF("%s: invalid write state (wc 7)\n", __func__);
goto reset_flash;
}
pfl->wcycle++;
return;
reset_flash:
if (pfl->wcycle != 0) {
cpu_register_physical_memory(pfl->base, pfl->total_len,
pfl->off | IO_MEM_ROMD | pfl->fl_mem);
}
pfl->bypass = 0;
pfl->wcycle = 0;
pfl->cmd = 0;
return;
do_bypass:
pfl->wcycle = 2;
pfl->cmd = 0;
return;
}
| 1threat |
static int ram_save_complete(QEMUFile *f, void *opaque)
{
rcu_read_lock();
if (!migration_in_postcopy(migrate_get_current())) {
migration_bitmap_sync();
}
ram_control_before_iterate(f, RAM_CONTROL_FINISH);
while (true) {
int pages;
pages = ram_find_and_save_block(f, true, &bytes_transferred);
if (pages == 0) {
break;
}
}
flush_compressed_data(f);
ram_control_after_iterate(f, RAM_CONTROL_FINISH);
rcu_read_unlock();
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
return 0;
}
| 1threat |
MediatR when and why I should use it? vs 2017 webapi : <p>It might have been asked before but I cannot find even in the official site why I should use MediatR and what problems it solves? </p>
<ul>
<li><p>Is it because I can pass a single object in my constructor rather than a multitude of Interfaces?</p></li>
<li><p>Is it a replacement or competitor of ServicesBus etc...</p></li>
<li><p>Basically what are the benefit and what problem does it solve</p></li>
</ul>
<p>I want to buy into it but its not clear to me why I should use it.</p>
<p>many thanks</p>
| 0debug |
I want to false autoComplete for all form in Ext.js 2.3 : I need help in ext.js 2.3. I am unable to Sucess for autoComplete = "false".
I want to false autoComplete for all form in extjs 2.3 | 0debug |
Substituting backlash by forwardslash : I am writing a python function that takes the string of a path as copy-pasted from windows (so with backslashes) and returns a string with forwardslashes, that can be used by python as a path. The problem arises with the combination of backlashes and other characters, like \n, \b...
I have tried two solutions: 1) turning the input string into raw; 2) escaping the backlashes. Please see my code:
def back2forwardSlash(backSlash_string):
'''input is the string of a path with backslashes (typically from windows) which are unusable in python'''
backSlash_string_raw = "%r"%backSlash_string # turning the string to raw
forwChars = []
for char in backSlash_string_raw:
if char == '\\': # escaping the backlashes
forwChars.append('/')
else:
forwChars.append(char)
forwPath = ''.join(forwChars)
return forwPath
a = back2forwardSlash('C:\Users\Dropbox\netCFD4\b30.137.nc')
print a
This will return `'C://Users//Dropbox/netCFD4/x0830.137.nc'`, which gets it in one single instance but is wrong in two ways: 1) it adds two slashes in place of one, in some instances; 2) it turns `\b` into `/x08`.
Do you have a solution please? | 0debug |
I want to run the hello.py file in google-python-exercises in my Windows cmd terminal : <p>I want to run the hello.py file in google-python-exercises in my Windows cmd terminal. Typing python is showing the exact python version which is Python 2.7.14 but typing google-python-exercises> python hello.py returns error. </p>
| 0debug |
static SCSIDiskReq *scsi_new_request(SCSIDiskState *s, uint32_t tag,
uint32_t lun)
{
SCSIRequest *req;
SCSIDiskReq *r;
req = scsi_req_alloc(sizeof(SCSIDiskReq), &s->qdev, tag, lun);
r = DO_UPCAST(SCSIDiskReq, req, req);
r->iov.iov_base = qemu_blockalign(s->bs, SCSI_DMA_BUF_SIZE);
return r;
}
| 1threat |
discord.js - I wanna block the commands in DMs : I realized that, on my bot, the commands can be executed in directs messages.
I wanna know how to block them in this type of channel.
Thanks. | 0debug |
Sorting JavaScript Object by Secific property value : If I have a JavaScript object such as:
var currencies= {
"EUR": 100,
"CHF": 15,
"GPB": 75,
"JPN": 116,
"EUR": 12,
"JPN": 15,
"USD": 55,
"CHF": 22,
"USD": 100,
};
Is there a way to sort them in this specific order
var currencies= {
"EUR": 12,
"EUR": 100,
"USD": 55,
"USD": 100,
"GPB": 75,
"CHF": 15,
"CHF": 22,
"JPN": 15,
"JPN": 116,
};
| 0debug |
static void fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, const H264Context *h,
DXVA_PicParams_H264 *pp)
{
const H264Picture *current_picture = h->cur_pic_ptr;
const SPS *sps = h->ps.sps;
const PPS *pps = h->ps.pps;
int i, j;
memset(pp, 0, sizeof(*pp));
fill_picture_entry(&pp->CurrPic,
ff_dxva2_get_surface_index(avctx, ctx, current_picture->f),
h->picture_structure == PICT_BOTTOM_FIELD);
pp->UsedForReferenceFlags = 0;
pp->NonExistingFrameFlags = 0;
for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
const H264Picture *r;
if (j < h->short_ref_count) {
r = h->short_ref[j++];
} else {
r = NULL;
while (!r && j < h->short_ref_count + 16)
r = h->long_ref[j++ - h->short_ref_count];
}
if (r) {
fill_picture_entry(&pp->RefFrameList[i],
ff_dxva2_get_surface_index(avctx, ctx, r->f),
r->long_ref != 0);
if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX)
pp->FieldOrderCntList[i][0] = r->field_poc[0];
if ((r->reference & PICT_BOTTOM_FIELD) && r->field_poc[1] != INT_MAX)
pp->FieldOrderCntList[i][1] = r->field_poc[1];
pp->FrameNumList[i] = r->long_ref ? r->pic_id : r->frame_num;
if (r->reference & PICT_TOP_FIELD)
pp->UsedForReferenceFlags |= 1 << (2*i + 0);
if (r->reference & PICT_BOTTOM_FIELD)
pp->UsedForReferenceFlags |= 1 << (2*i + 1);
} else {
pp->RefFrameList[i].bPicEntry = 0xff;
pp->FieldOrderCntList[i][0] = 0;
pp->FieldOrderCntList[i][1] = 0;
pp->FrameNumList[i] = 0;
}
}
pp->wFrameWidthInMbsMinus1 = h->mb_width - 1;
pp->wFrameHeightInMbsMinus1 = h->mb_height - 1;
pp->num_ref_frames = sps->ref_frame_count;
pp->wBitFields = ((h->picture_structure != PICT_FRAME) << 0) |
((sps->mb_aff &&
(h->picture_structure == PICT_FRAME)) << 1) |
(sps->residual_color_transform_flag << 2) |
(0 << 3) |
(sps->chroma_format_idc << 4) |
((h->nal_ref_idc != 0) << 6) |
(pps->constrained_intra_pred << 7) |
(pps->weighted_pred << 8) |
(pps->weighted_bipred_idc << 9) |
(1 << 11) |
(sps->frame_mbs_only_flag << 12) |
(pps->transform_8x8_mode << 13) |
((sps->level_idc >= 31) << 14) |
(1 << 15);
pp->bit_depth_luma_minus8 = sps->bit_depth_luma - 8;
pp->bit_depth_chroma_minus8 = sps->bit_depth_chroma - 8;
if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG)
pp->Reserved16Bits = 0;
else if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO)
pp->Reserved16Bits = 0x34c;
else
pp->Reserved16Bits = 3;
pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
pp->CurrFieldOrderCnt[0] = 0;
if ((h->picture_structure & PICT_TOP_FIELD) &&
current_picture->field_poc[0] != INT_MAX)
pp->CurrFieldOrderCnt[0] = current_picture->field_poc[0];
pp->CurrFieldOrderCnt[1] = 0;
if ((h->picture_structure & PICT_BOTTOM_FIELD) &&
current_picture->field_poc[1] != INT_MAX)
pp->CurrFieldOrderCnt[1] = current_picture->field_poc[1];
pp->pic_init_qs_minus26 = pps->init_qs - 26;
pp->chroma_qp_index_offset = pps->chroma_qp_index_offset[0];
pp->second_chroma_qp_index_offset = pps->chroma_qp_index_offset[1];
pp->ContinuationFlag = 1;
pp->pic_init_qp_minus26 = pps->init_qp - 26;
pp->num_ref_idx_l0_active_minus1 = pps->ref_count[0] - 1;
pp->num_ref_idx_l1_active_minus1 = pps->ref_count[1] - 1;
pp->Reserved8BitsA = 0;
pp->frame_num = h->frame_num;
pp->log2_max_frame_num_minus4 = sps->log2_max_frame_num - 4;
pp->pic_order_cnt_type = sps->poc_type;
if (sps->poc_type == 0)
pp->log2_max_pic_order_cnt_lsb_minus4 = sps->log2_max_poc_lsb - 4;
else if (sps->poc_type == 1)
pp->delta_pic_order_always_zero_flag = sps->delta_pic_order_always_zero_flag;
pp->direct_8x8_inference_flag = sps->direct_8x8_inference_flag;
pp->entropy_coding_mode_flag = pps->cabac;
pp->pic_order_present_flag = pps->pic_order_present;
pp->num_slice_groups_minus1 = pps->slice_group_count - 1;
pp->slice_group_map_type = pps->mb_slice_group_map_type;
pp->deblocking_filter_control_present_flag = pps->deblocking_filter_parameters_present;
pp->redundant_pic_cnt_present_flag= pps->redundant_pic_cnt_present;
pp->Reserved8BitsB = 0;
pp->slice_group_change_rate_minus1= 0;
//pp->SliceGroupMap[810];
}
| 1threat |
static void vp8_idct_dc_add4uv_c(uint8_t *dst, int16_t block[4][16],
ptrdiff_t stride)
{
vp8_idct_dc_add_c(dst + stride * 0 + 0, block[0], stride);
vp8_idct_dc_add_c(dst + stride * 0 + 4, block[1], stride);
vp8_idct_dc_add_c(dst + stride * 4 + 0, block[2], stride);
vp8_idct_dc_add_c(dst + stride * 4 + 4, block[3], stride);
}
| 1threat |
what is the error C4996 means? : there is a simple case of C++
#include <cstring>
using namespace std;
int main(int argc, _TCHAR* argv[])
{
char str[80];
cout << "輸入字串:";
gets(str);
cout << "輸入的字串:" << str << endl;
return 0;
}
when click running there is a error
"错误1 error C4996: 'gets': This function or variable may be unsafe.
Consider using gets_s instead. To disable deprecation,
use _CRT_SECURE_NO_WARNINGS. See online help for details." | 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.