problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Write text in particular font color in MS word using python-docx : <p>I am trying to write text in an MS Word file using python library python-docx.
I have gone through the documentation of python-docx's font color <a href="http://python-docx.readthedocs.io/en/latest/dev/analysis/features/text/font-color.html" rel="noreferrer">on this link</a> and applied the same in my code, but am unsuccessful so far.</p>
<p>Here is my code:</p>
<pre><code>from docx import Document
from docx.shared import RGBColor
document = Document()
run = document.add_paragraph('some text').add_run()
font = run.font
font.color.rgb = RGBColor(0x42, 0x24, 0xE9)
p=document.add_paragraph('aaa')
document.save('demo1.docx')
</code></pre>
<p>The text in word file 'demo.docx' is simply in black color.</p>
<p>I am not able to figure this out, help would be appreciated.</p>
| 0debug |
static void add_sel_entry(IPMIBmcSim *ibs,
uint8_t *cmd, unsigned int cmd_len,
uint8_t *rsp, unsigned int *rsp_len,
unsigned int max_rsp_len)
{
IPMI_CHECK_CMD_LEN(18);
if (sel_add_event(ibs, cmd + 2)) {
rsp[2] = IPMI_CC_OUT_OF_SPACE;
return;
}
IPMI_ADD_RSP_DATA(cmd[2]);
IPMI_ADD_RSP_DATA(cmd[3]);
}
| 1threat |
Pick random row from mysql : im trying to echo my mysql query, but it doesnt seem to work. Here is my code:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<button onlick="myFunction()">Click me</button>
<?php
function myFunction() {
$con = mysqli_connect("mysql.hostinger.no", "u452849516_altge", "absha001", "u452849516_altge");
$query = "SELECT * FROM altbruker ORDER BY RAND() LIMIT 1";
mysqli_query($con, $query);
$results = mysqli_query($query);
var_dump($results);
}
?>
<!-- end snippet -->
| 0debug |
static void i440fx_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->no_hotplug = 1;
k->init = i440fx_initfn;
k->config_write = i440fx_write_config;
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82441;
k->revision = 0x02;
k->class_id = PCI_CLASS_BRIDGE_HOST;
dc->desc = "Host bridge";
dc->no_user = 1;
dc->vmsd = &vmstate_i440fx;
}
| 1threat |
I am trying to find a function or expression which finds reads the resulting value and if it is a whole number. then ends program : <p>this is my program I hope you understand what I am trying to do. </p>
<pre class="lang-js prettyprint-override"><code> if (primeNum = int)
{
Console.WriteLine(" the number entered is not prime ");
}
</code></pre>
| 0debug |
static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
{
NSVContext *nsv = s->priv_data;
ByteIOContext *pb = &s->pb;
uint32_t tag, tag1, handler;
int codec_type, stream_index, frame_period, bit_rate, scale, rate;
unsigned int file_size, size, nb_frames;
int64_t duration;
int strings_size;
int table_entries;
int table_entries_used;
int i, n;
AVStream *st;
NSVStream *ast;
PRINT(("%s()\n", __FUNCTION__));
nsv->state = NSV_UNSYNC;
size = get_le32(pb);
if (size < 28)
nsv->NSVf_end = size;
file_size = (uint32_t)get_le32(pb);
PRINT(("NSV NSVf chunk_size %ld\n", size));
PRINT(("NSV NSVf file_size %Ld\n", file_size));
duration = get_le32(pb);
nsv->duration = duration * AV_TIME_BASE / 1000;
PRINT(("NSV NSVf duration %Ld ms\n", duration));
strings_size = get_le32(pb);
table_entries = get_le32(pb);
table_entries_used = get_le32(pb);
PRINT(("NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
strings_size, table_entries, table_entries_used));
if (url_feof(pb))
PRINT(("NSV got header; filepos %Ld\n", url_ftell(pb)));
if (strings_size > 0) {
char *strings;
char *p, *endp;
char *token, *value;
char quote;
p = strings = av_mallocz(strings_size + 1);
endp = strings + strings_size;
get_buffer(pb, strings, strings_size);
while (p < endp) {
while (*p == ' ')
p++;
if (p >= endp-2)
break;
token = p;
p = strchr(p, '=');
if (!p || p >= endp-2)
break;
*p++ = '\0';
quote = *p++;
value = p;
p = strchr(p, quote);
if (!p || p >= endp)
break;
*p++ = '\0';
PRINT(("NSV NSVf INFO: %s='%s'\n", token, value));
if (!strcmp(token, "ASPECT")) {
} else if (!strcmp(token, "CREATOR") || !strcmp(token, "Author")) {
strncpy(s->author, value, 512-1);
} else if (!strcmp(token, "Copyright")) {
strncpy(s->copyright, value, 512-1);
} else if (!strcmp(token, "TITLE") || !strcmp(token, "Title")) {
strncpy(s->title, value, 512-1);
}
}
av_free(strings);
}
if (url_feof(pb))
PRINT(("NSV got infos; filepos %Ld\n", url_ftell(pb)));
if (table_entries_used > 0) {
nsv->index_entries = table_entries_used;
nsv->nsvf_index_data = av_malloc(table_entries * sizeof(uint32_t));
get_buffer(pb, nsv->nsvf_index_data, table_entries * sizeof(uint32_t));
}
PRINT(("NSV got index; filepos %Ld\n", url_ftell(pb)));
#ifdef DEBUG_DUMP_INDEX
#define V(v) ((v<0x20 || v > 127)?'.':v)
PRINT(("NSV %d INDEX ENTRIES:\n", table_entries));
PRINT(("NSV [dataoffset][fileoffset]\n", table_entries));
for (i = 0; i < table_entries; i++) {
unsigned char b[8];
url_fseek(pb, size + nsv->nsvf_index_data[i], SEEK_SET);
get_buffer(pb, b, 8);
PRINT(("NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
"%c%c%c%c%c%c%c%c\n",
nsv->nsvf_index_data[i], size + nsv->nsvf_index_data[i],
b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ));
}
#undef V
#endif
url_fseek(pb, nsv->base_offset + size, SEEK_SET);
if (url_feof(pb))
nsv->state = NSV_HAS_READ_NSVF;
return 0;
} | 1threat |
How to restart Postgresql : <p>I have Postgresql 9.3 and 9.4 installed on my Linux Mint machine. How can I restart postgresql 9.4? A method to restart both versions together is also fine. </p>
| 0debug |
import math
def sum_gp(a,n,r):
total = (a * (1 - math.pow(r, n ))) / (1- r)
return total | 0debug |
Css Image gallery code snippet. : <p>I would like to make something like this.</p>
<p><a href="https://i.stack.imgur.com/tMUEe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tMUEe.png" alt="enter image description here"></a></p>
<p>I have already made sample one myself, but it is not that good.So i would like to have a sample code base for this kind of image gallery. </p>
| 0debug |
java.lang.IllegalArgumentException: This component requires that you specify a valid android:textAppearance attribute : <p>I have a com.google.android.material.button.MaterialButton component in one of my layout file and I get this error when I am using the latest version of the Material Components library (com.google.android.material:material:1.0.0-alpha3):</p>
<p><strong>java.lang.IllegalArgumentException: This component requires that you specify a valid android:textAppearance attribute.</strong></p>
<p>It wasn't present in 1.0.0-alpha1. Is this a bug in the library or should I just specify a textAppearance attribute from now?</p>
| 0debug |
static int get_phys_addr_v6(CPUARMState *env, uint32_t address, int access_type,
ARMMMUIdx mmu_idx, hwaddr *phys_ptr,
int *prot, target_ulong *page_size)
{
CPUState *cs = CPU(arm_env_get_cpu(env));
int code;
uint32_t table;
uint32_t desc;
uint32_t xn;
uint32_t pxn = 0;
int type;
int ap;
int domain = 0;
int domain_prot;
hwaddr phys_addr;
uint32_t dacr;
if (!get_level1_table_address(env, mmu_idx, &table, address)) {
code = 5;
goto do_fault;
}
desc = ldl_phys(cs->as, table);
type = (desc & 3);
if (type == 0 || (type == 3 && !arm_feature(env, ARM_FEATURE_PXN))) {
code = 5;
goto do_fault;
}
if ((type == 1) || !(desc & (1 << 18))) {
domain = (desc >> 5) & 0x0f;
}
if (regime_el(env, mmu_idx) == 1) {
dacr = env->cp15.dacr_ns;
} else {
dacr = env->cp15.dacr_s;
}
domain_prot = (dacr >> (domain * 2)) & 3;
if (domain_prot == 0 || domain_prot == 2) {
if (type != 1) {
code = 9;
} else {
code = 11;
}
goto do_fault;
}
if (type != 1) {
if (desc & (1 << 18)) {
phys_addr = (desc & 0xff000000) | (address & 0x00ffffff);
*page_size = 0x1000000;
} else {
phys_addr = (desc & 0xfff00000) | (address & 0x000fffff);
*page_size = 0x100000;
}
ap = ((desc >> 10) & 3) | ((desc >> 13) & 4);
xn = desc & (1 << 4);
pxn = desc & 1;
code = 13;
} else {
if (arm_feature(env, ARM_FEATURE_PXN)) {
pxn = (desc >> 2) & 1;
}
table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc);
desc = ldl_phys(cs->as, table);
ap = ((desc >> 4) & 3) | ((desc >> 7) & 4);
switch (desc & 3) {
case 0:
code = 7;
goto do_fault;
case 1:
phys_addr = (desc & 0xffff0000) | (address & 0xffff);
xn = desc & (1 << 15);
*page_size = 0x10000;
break;
case 2: case 3:
phys_addr = (desc & 0xfffff000) | (address & 0xfff);
xn = desc & 1;
*page_size = 0x1000;
break;
default:
abort();
}
code = 15;
}
if (domain_prot == 3) {
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
} else {
if (pxn && !regime_is_user(env, mmu_idx)) {
xn = 1;
}
if (xn && access_type == 2)
goto do_fault;
if ((regime_sctlr(env, mmu_idx) & SCTLR_AFE)
&& (ap & 1) == 0) {
code = (code == 15) ? 6 : 3;
goto do_fault;
}
*prot = check_ap(env, mmu_idx, ap, domain_prot, access_type);
if (!*prot) {
goto do_fault;
}
if (!xn) {
*prot |= PAGE_EXEC;
}
}
*phys_ptr = phys_addr;
return 0;
do_fault:
return code | (domain << 4);
}
| 1threat |
Connecting multiple phone calls visa VOIP using c# : I am trying to achieve below
Me (customer) press a button to speak to agent (from mobile app - Xamarin)
Then login tries to connect to (gets top 5 agents list from database / JSON - top 5 agents will vary every time based on time)
Agent 1 - rings agent 1 mobile phone as normal call, if No answer after 25 seconds
Agent 2 - ring for 25 secs
Agent 3 - ring, connected
Once call finished log date time of call
I am happy to use any VOIP provider or any other solutions.
| 0debug |
What does this line mean in JavaScript? : <p>X=(x=== images.length-1) ? 0 : x+ 1;</p>
<p>Please help me I have no idea, and it's for a school task that I have to hand in. </p>
| 0debug |
static off_t read_off(BlockDriverState *bs, int64_t offset)
{
uint64_t buffer;
if (bdrv_pread(bs->file, offset, &buffer, 8) < 8)
return 0;
return be64_to_cpu(buffer);
}
| 1threat |
void mipsnet_init (int base, qemu_irq irq, NICInfo *nd)
{
MIPSnetState *s;
qemu_check_nic_model(nd, "mipsnet");
s = qemu_mallocz(sizeof(MIPSnetState));
register_ioport_write(base, 36, 1, mipsnet_ioport_write, s);
register_ioport_read(base, 36, 1, mipsnet_ioport_read, s);
register_ioport_write(base, 36, 2, mipsnet_ioport_write, s);
register_ioport_read(base, 36, 2, mipsnet_ioport_read, s);
register_ioport_write(base, 36, 4, mipsnet_ioport_write, s);
register_ioport_read(base, 36, 4, mipsnet_ioport_read, s);
s->io_base = base;
s->irq = irq;
if (nd && nd->vlan) {
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
mipsnet_can_receive, mipsnet_receive, NULL,
mipsnet_cleanup, s);
} else {
s->vc = NULL;
}
qemu_format_nic_info_str(s->vc, nd->macaddr);
mipsnet_reset(s);
register_savevm("mipsnet", 0, 0, mipsnet_save, mipsnet_load, s);
}
| 1threat |
static int compute_mask(int step, uint32_t *mask)
{
int i, z, ret = 0;
int counter_size = sizeof(uint32_t) * (2 * step + 1);
uint32_t *temp1_counter, *temp2_counter, **counter;
temp1_counter = av_mallocz(counter_size);
if (!temp1_counter) {
ret = AVERROR(ENOMEM);
goto end;
}
temp2_counter = av_mallocz(counter_size);
if (!temp2_counter) {
ret = AVERROR(ENOMEM);
goto end;
}
counter = av_mallocz_array(2 * step + 1, sizeof(uint32_t *));
if (!counter) {
ret = AVERROR(ENOMEM);
goto end;
}
for (i = 0; i < 2 * step + 1; i++) {
counter[i] = av_mallocz(counter_size);
if (!counter[i]) {
ret = AVERROR(ENOMEM);
goto end;
}
}
for (i = 0; i < 2 * step + 1; i++) {
memset(temp1_counter, 0, counter_size);
temp1_counter[i] = 1;
for (z = 0; z < step * 2; z += 2) {
add_mask_counter(temp2_counter, counter[z], temp1_counter, step * 2);
memcpy(counter[z], temp1_counter, counter_size);
add_mask_counter(temp1_counter, counter[z + 1], temp2_counter, step * 2);
memcpy(counter[z + 1], temp2_counter, counter_size);
}
}
memcpy(mask, temp1_counter, counter_size);
end:
av_freep(&temp1_counter);
av_freep(&temp2_counter);
for (i = 0; i < 2 * step + 1; i++) {
av_freep(&counter[i]);
}
av_freep(&counter);
return ret;
}
| 1threat |
How to click link in IE with no href,onclick? : here's the web site: [enter link description here][1]
step 1:
<li class="at2" data="0">业绩预告<i></i></li>
<li data="1" class="">业绩预增<i></i></li>
<li data="2" class="">业绩预减<i></i></li>
<li data="3" id="fpygTab" class="">分配预告<i></i></li>
step 2:
<span class="clickspan">业绩变动幅度</span>
i want to click "data=1" and then click "clickspan" to let data descending ,how can i do ? i have try execScript and getElementsByClassName("").click(),but it not work.
[1]: http://data.eastmoney.com/bbsj/201603/yjyg.html
| 0debug |
How to transfer wordpress hosting website to CDN? : <p>I have wordpress hosting websites and now I want to it transfer to CDN.How can I do this?</p>
| 0debug |
Differences Between Drivers for ODBC Drivers : <p>I was setting up the System DSN (64 bit) for my database in SQL server 2016 with Windows 10 64 bit pro. While I was asked to choose the driver to set up a data source, there are the following selections:</p>
<ul>
<li>ODBC Driver 13 for SQL Server</li>
<li>SQL Server</li>
<li>SQL Server Native Client 11.0</li>
<li>SQL Server Native Client RDA 11.0</li>
</ul>
<p>It seemed I can set up the data source with all of these drivers. Then which one should I choose in terms of speed and efficiency? What's the difference between them?</p>
<p>Thanks,</p>
<p>Jason</p>
| 0debug |
Limiting mutex scope using blocks in header : <p>I have a class that has its own worker thread, and some of the member variables of the class is shared between the main thread and the worker. How can I use a mutex to lock only the member variables that are being shared?</p>
<p>For instance, this does not work (since the block scope is outside any function).</p>
<pre><code>class Foo {
public:
// Some stuff
private:
boost::thread *m_worker;
Bar m_bar_nonshared;
{
boost::mutex m_mutex;
Bar m_bar_shared;
}
};
</code></pre>
| 0debug |
Remove all characters prior to last character : <p>Consider the following string:</p>
<pre><code>Hello World
</code></pre>
<p>My aim is to remove all the characters prior to the last character ("d"), excluding the last character.</p>
<p>What is the most efficient way to accomplish this in PHP?</p>
| 0debug |
How can we calculate the area covered by the trees in google earth pic or even just a ratio of Trees to other things : <p>Is there any efficient way by which we can we calculate the area covered by trees using machine learning in any google earth image. We can re-train our data using tensorflow and inception trained dataset to identify whether there is tree or not, but I can't think of any way to find out how many trees or how kuch area it is covering. Is there anything we can do.
I use Python, Tensorflow for machine learning.
P.s : don't know much about machine learning but can work with steps.</p>
| 0debug |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
How can i make an html button automatically set? : <p>I have three pages page1, page2 and page3. My page1 have a button and it is an input in form having method POST. So press this button goes to page2, so i can pass a value from page1 to page2. But in page2 it is automatically redirected to page3, then how can i pass this value passed from page1 into page3 through page? In my opinion if any way to automatically set a button can make it possible.</p>
| 0debug |
How to get cookie value in expressjs : <p>I'm using cookie-parser, all the tutorial talk about how to set cookie and the time it expiries but no where teach us how to get the value of these cookie</p>
| 0debug |
how to restrict mail funtion to send blank emails in php : <i>"If $email is empty then don't send email. how to do this."
"Every time I submit empty email, it sent blank emails to my inbox. how to restrict this."</i>
[SEE CODE][1]
[1]: https://i.stack.imgur.com/R6NaG.png | 0debug |
C expected identifier or ‘(’ before ‘{’ : <p>The point of the exercise (for university) is to create a function that calculates the perimeter of a triangle once given the coordinates of its 3 corners.
I am a beginner at C and after some work I have managed to create a code that more or less does its intended job, however i have stumbled upon the following error: </p>
<p>trperim.c:25:1: error: expected identifier or ‘(’ before ‘{’ token
{
^
trperim.c:31:58: error: expected identifier or ‘(’ before ‘{’ token
double trperim(double r1[2], double r2[2], double r3[2]);{</p>
<p>I have been unable to solve this, and so I turn to this community. Any help would be greatly appreciated.</p>
<pre><code>#include<stdio.h>
#include<math.h>
double trperim(double r1[2], double r2[2], double r3[2]);
double norm(double r[2]);
main()
{
double r1[2], r2[2], r3[2];
printf("Ingrese las coordenadas del primer vertice en x:");
scanf("%lf",&r1[0]);
printf("Ingrese las coordenadas del primer vertice en y:");
scanf("%lf",&r1[1]);
printf("Ingrese las coordenadas del segundo vertice en x:");
scanf("%lf",&r2[0]);
printf("Ingrese las coordenadas del segundo vertice en y:");
scanf("%lf",&r2[1]);
printf("Ingrese las coordenadas del tercer vertice en x:");
scanf("%lf",&r3[0]);
printf("Ingrese las coordenadas del tercer vertice en y:");
scanf("%lf",&r3[1]);
printf("El perimetro del triangulo es %f\n", trperim(r1,r2,r3));
}
double norm(double r[2]);
{
double modulo, r[2];
modulo=sqrt(pow(r[0],2)+pow(r[1],2));
return modulo;
}
double trperim(double r1[2], double r2[2], double r3[2]);{
double nr1, nr2, nr3, p;
nr1=norm(r1-r2);
nr2=norm(r2-r3);
nr3=norm(r3-r1);
p=nr1+nr2+nr3;
return p;
}
</code></pre>
| 0debug |
What is the use of Activiti BPMN 2.0 in small service business? : <p>These days Rest API using Spring Boot can be easily developed along with frontends in Vue or React or Angular to define business workflows in a small service business for example a company that sells life insurance. In this business there are workflows like employee login and adding a new prospective customer to Customer database, workflows like sending emails to prospective customers when new life insurance product is launched meeting the customer requirements etc. Another employee with different role when logins see directory of employees or add new employee or delete employee workflows. Half of these workflows already implemented without using BPMN.</p>
<p>Given above why I as developer need BPMN 2.0 and in particular Activiti (<a href="http://activiti.org" rel="nofollow noreferrer">link here</a>) ? BPMN is very complex spec and learning this spec and Activiti is extremely time consuming. </p>
<p>I cannot understand how embedding activiti engine jar in my existing project and design BPMN 2.0 workflows would make my business run more efficiently.</p>
| 0debug |
Set text color using data binding on Android : <p>I'm trying to set <code>TextView</code> text color using data binding library</p>
<pre><code>android:textColor="@{holder.getTitleColor(context, item)}"
</code></pre>
<p>where the method in <code>Holder</code> class is defined like below</p>
<pre><code>public int getTitleColor(Context context, Item item) {
...
}
</code></pre>
<p>No matter if I return color int (<code>@ColorInt</code>) or color resource (<code>@ColorRes</code>) it paints the text solid white. What am I doing wrong?</p>
| 0debug |
static void network_to_result(RDMARegisterResult *result)
{
result->rkey = ntohl(result->rkey);
result->host_addr = ntohll(result->host_addr);
};
| 1threat |
int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
uint8_t bar_nr)
{
int ret;
char *name;
#define MSIX_EXCLUSIVE_BAR_SIZE 4096
#define MSIX_EXCLUSIVE_BAR_TABLE_OFFSET 0
#define MSIX_EXCLUSIVE_BAR_PBA_OFFSET (MSIX_EXCLUSIVE_BAR_SIZE / 2)
#define MSIX_EXCLUSIVE_CAP_OFFSET 0
if (nentries * PCI_MSIX_ENTRY_SIZE > MSIX_EXCLUSIVE_BAR_PBA_OFFSET) {
return -EINVAL;
}
name = g_strdup_printf("%s-msix", dev->name);
memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, MSIX_EXCLUSIVE_BAR_SIZE);
g_free(name);
ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr,
MSIX_EXCLUSIVE_BAR_TABLE_OFFSET, &dev->msix_exclusive_bar,
bar_nr, MSIX_EXCLUSIVE_BAR_PBA_OFFSET,
MSIX_EXCLUSIVE_CAP_OFFSET);
if (ret) {
return ret;
}
pci_register_bar(dev, bar_nr, PCI_BASE_ADDRESS_SPACE_MEMORY,
&dev->msix_exclusive_bar);
return 0;
}
| 1threat |
void qemu_iohandler_fill(GArray *pollfds)
{
IOHandlerRecord *ioh;
QLIST_FOREACH(ioh, &io_handlers, next) {
int events = 0;
if (ioh->deleted)
continue;
if (ioh->fd_read &&
(!ioh->fd_read_poll ||
ioh->fd_read_poll(ioh->opaque) != 0)) {
events |= G_IO_IN | G_IO_HUP | G_IO_ERR;
}
if (ioh->fd_write) {
events |= G_IO_OUT | G_IO_ERR;
}
if (events) {
GPollFD pfd = {
.fd = ioh->fd,
.events = events,
};
ioh->pollfds_idx = pollfds->len;
g_array_append_val(pollfds, pfd);
} else {
ioh->pollfds_idx = -1;
}
}
}
| 1threat |
def longest_common_subsequence(X, Y, m, n):
if m == 0 or n == 0:
return 0
elif X[m-1] == Y[n-1]:
return 1 + longest_common_subsequence(X, Y, m-1, n-1)
else:
return max(longest_common_subsequence(X, Y, m, n-1), longest_common_subsequence(X, Y, m-1, n)) | 0debug |
Confused between the usage of constructors and what to/what not to place in them. : <p>I had basics in C, and I've just started programming in c++ two weeks ago, and find 'classes' confusing. My question is how do i put a 'cin' to input the value to determine marks, and also how do i print the grades based on the below code? I'm only printing A to F and i'm so blur right now. And for some reason if i put 'else if' instead of just 'if' the error reads as missing ; before cout. Have way too many questions, sorry about that.. </p>
<pre><code>#include <iostream>
using namespace std;
class StudentMark {
private:
float mark;
public:
StudentMark() //constructor
{
mark = 0.0;
cout << "Constructed an instance of class StudentMark\n";
}
void SetMark(float markofstudent)
{
mark = markofstudent;
}
void IntroduceMark()
{
if (80<mark<100)
cout << "A" << endl;
if (65<mark<79)
cout << "B" << endl;
if (50<mark<64)
cout << "C" << endl;
if (40<mark<49)
cout << "D" << endl;
if (0<mark<39)
cout << "F" << endl;
}
};
int main()
{
StudentMark FirstStudent;
FirstStudent.SetMark(89);
FirstStudent.IntroduceMark();
}
</code></pre>
| 0debug |
int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
bool force)
{
uint64_t features;
int r;
if (devfd >= 0) {
hdev->control = devfd;
} else {
hdev->control = open(devpath, O_RDWR);
if (hdev->control < 0) {
return -errno;
}
}
r = ioctl(hdev->control, VHOST_SET_OWNER, NULL);
if (r < 0) {
goto fail;
}
r = ioctl(hdev->control, VHOST_GET_FEATURES, &features);
if (r < 0) {
goto fail;
}
hdev->features = features;
hdev->memory_listener = (MemoryListener) {
.begin = vhost_begin,
.commit = vhost_commit,
.region_add = vhost_region_add,
.region_del = vhost_region_del,
.region_nop = vhost_region_nop,
.log_start = vhost_log_start,
.log_stop = vhost_log_stop,
.log_sync = vhost_log_sync,
.log_global_start = vhost_log_global_start,
.log_global_stop = vhost_log_global_stop,
.eventfd_add = vhost_eventfd_add,
.eventfd_del = vhost_eventfd_del,
.priority = 10
};
hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
hdev->n_mem_sections = 0;
hdev->mem_sections = NULL;
hdev->log = NULL;
hdev->log_size = 0;
hdev->log_enabled = false;
hdev->started = false;
memory_listener_register(&hdev->memory_listener, NULL);
hdev->force = force;
return 0;
fail:
r = -errno;
close(hdev->control);
return r;
}
| 1threat |
Google Map crashing with Resources$NotFoundException when replaced in FrameLayout : <p>This how I am adding map dynamically in FrameLayout. </p>
<pre><code>new Handler().postDelayed(() -> {
if (isAdded()) {
new Thread(() -> {
try {
SupportMapFragment mf = SupportMapFragment.newInstance();
getChildFragmentManager().beginTransaction()
.replace(R.id.view_map, mf)
.commit();
mActivity.runOnUiThread(() -> mf.getMapAsync(this));
} catch (Exception ignored) {}
}).start();
}
}, 100);
</code></pre>
<p>It is working fine but in some cases the app is crashing with <code>Resources$NotFoundException</code>. This is the crash log.</p>
<pre><code>android.content.res.Resources$NotFoundException: Resource ID #0x7f07000f
at android.content.res.Resources.getValue(Resources.java: 1266)
at android.content.res.Resources.getDimensionPixelSize(Resources.java: 673)
at maps.ad.ay. < init > (Unknown Source)
at maps.ad.ay. < init > (Unknown Source)
at maps.ad.t.a(Unknown Source)
at maps.ad.M.a(Unknown Source)
at wd.onTransact(: com.google.android.gms.DynamiteModulesB: 107)
at android.os.Binder.transact(Binder.java: 380)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source)
at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
at android.support.v4.app.Fragment.performCreateView(Fragment.java: 2080)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1108)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1290)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java: 801)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java: 1677)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java: 536)
at android.os.Handler.handleCallback(Handler.java: 746)
at android.os.Handler.dispatchMessage(Handler.java: 95)
at android.os.Looper.loop(Looper.java: 135)
at android.app.ActivityThread.main(ActivityThread.java: 5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java: 372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 702)
</code></pre>
| 0debug |
Cant Assign to operator python : Why does cant assign to operator show up for this line `point * hours = QP`
> class Student(object):
def __init__(self, name, surname, grade, hours, QP):
self.name = name
self.surname = surname
self.grade = grade
self.hours = hours
self.QP = QP
def getName(self):
return '{}'.format(self.name)
def getSurname(self):
return '{}'.format(self.surname)
def getGrade(self):
return list(zip(self.grade, self.hours))
def getHours(self):
return '{}'.format(self.hours)
def point(self):
if grade == A:
point = 4.0
elif grade == B:
point = 3.0
elif grade == C:
point = 2.0
elif grade == D:
point = 1.0
else:
point = 0.0
def getQPoints(self):
point * hours = QP
return QP
stud1 = Student("John","Brown",["A","B","A"],["15.0","25.0","20.0"],"")
stud2 = Student("Mary","Watson",["C","A","B"],["15.0","25.0","20.0"],"")
print (stud1.getQPoints())
| 0debug |
docker.sock permission denied : <p>When I try to run simple docker commands like:</p>
<pre><code>$ docker ps -a
</code></pre>
<p>I get an error message:</p>
<blockquote>
<p>Got permission denied ... /var/run/docker.sock: connect: permission denied</p>
</blockquote>
<p>When I check permissions with</p>
<pre><code>$ ls -al /var/run/
</code></pre>
<p>I see this line:</p>
<pre><code>srw-rw---- root docker docker.sock
</code></pre>
<p>So, I follow an advice from many forums and add local user to docker group:</p>
<pre><code>$ sudo usermod -aG docker $USER
</code></pre>
<p>But it does not help. I still get the very same error message. How can I fix it?</p>
| 0debug |
Create custom jasmine matcher using Typescript : <p>I'm using jasmine on an angular2 project and having some trouble writing a custom matcher for a test. I want to be able to compare two relatively complex objects. I found <a href="http://www.tomdoescode.co.uk/2016/06/jasmine-custom-matchers-with-typescript.html" rel="noreferrer">this article</a> which claims to solve the issue but it simply results in a typescript error stating that it doesn't recognize the new method on jasmine's <code>Matchers</code> object. The relevant code is this:</p>
<pre><code>declare module jasmine {
interface Matchers {
toBeNumeric(): void;
}
}
</code></pre>
<p><a href="https://medium.com/@cwmrowe/making-jasmine-and-typescript-play-nicely-c2f4bef1830a#.72pdxywdl" rel="noreferrer">Another article</a> gives a similar, but slightly different solution that gives the same error.</p>
<pre><code>declare namespace jasmine {
interface Matchers {
toHaveText(expected: string): boolean;
}
}
</code></pre>
<p>I tried this</p>
<pre><code>let m: jasmine.Matchers = expect(someSpy.someMethod).toHaveBeenCalled();
</code></pre>
<p>and got this error:</p>
<blockquote>
<p>Type 'jasmine.Matchers' is not assignable to type 'jasmine.Matchers'.
Two different types with this name exist, but they are unrelated.</p>
</blockquote>
<p>That seems to indicate that the <code>declare namespace jasmine</code> statement is creating a new <code>jasmine</code> namespace rather than extending the existing one.</p>
<p>So how can I create my own matcher that typescript will be happy with?</p>
| 0debug |
How to move one file from a directory to another on vba using just partial string of the file name? : <p>I have a report that is generated daily and automatically. I need a code that moves the file from one directory to another, taking in account that I need to use it daily, and only a part of the file name is constant (the rest varies each day without a defined pattern).</p>
<p>I would be very gradeful for your help, I'm a beginner on vba and I need help, if you need additional explanation ask me for it.</p>
<p>Thank you very much </p>
| 0debug |
static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag,
uint32_t lun, void *hba_private)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);
SCSIRequest *req;
SCSIDiskReq *r;
req = scsi_req_alloc(&scsi_disk_reqops, &s->qdev, tag, lun, hba_private);
r = DO_UPCAST(SCSIDiskReq, req, req);
r->iov.iov_base = qemu_blockalign(s->bs, SCSI_DMA_BUF_SIZE);
return req;
}
| 1threat |
static void h264_free_extradata(PayloadContext *data)
{
#ifdef DEBUG
int ii;
for (ii = 0; ii < 32; ii++) {
if (data->packet_types_received[ii])
av_log(NULL, AV_LOG_DEBUG, "Received %d packets of type %d\n",
data->packet_types_received[ii], ii);
}
#endif
assert(data);
assert(data->cookie == MAGIC_COOKIE);
data->cookie = DEAD_COOKIE;
av_free(data);
}
| 1threat |
Generic type to get enum keys as union string in typescript? : <p>Consider the following typescript enum:</p>
<pre><code>enum MyEnum { A, B, C };
</code></pre>
<p>If I want another type that is the unioned strings of the keys of that enum, I can do the following:</p>
<pre><code>type MyEnumKeysAsStrings = keyof typeof MyEnum; // "A" | "B" | "C"
</code></pre>
<p>This is very useful.</p>
<p>Now I want to create a generic type that operates universally on enums in this way, so that I can instead say:</p>
<pre><code>type MyEnumKeysAsStrings = AnyEnumKeysAsStrings<MyEnum>;
</code></pre>
<p>I imagine the correct syntax for that would be:</p>
<pre><code>type AnyEnumKeysAsStrings<TEnum> = keyof typeof TEnum; // TS Error: 'TEnum' only refers to a type, but is being used as a value here.
</code></pre>
<p>But that generates a compile error: "'TEnum' only refers to a type, but is being used as a value here."</p>
<p>This is unexpected and sad. I can incompletely work around it the following way by dropping the typeof from the right side of the declaration of the generic, and adding it to the type parameter in the declaration of the specific type:</p>
<pre><code>type AnyEnumAsUntypedKeys<TEnum> = keyof TEnum;
type MyEnumKeysAsStrings = AnyEnumAsUntypedKeys<typeof MyEnum>; // works, but not kind to consumer. Ick.
</code></pre>
<p>I don't like this workaround though, because it means the consumer has to remember to do this icky specifying of typeof on the generic.</p>
<p>Is there any syntax that will allow me to specify the generic type as I initially want, to be kind to the consumer?</p>
| 0debug |
i got an warnign message in laravel in my existing project how can i resolve it : Warning: require(C:\xampp\htdocs\\****\\*****\vendor\composer/../../app/Http/Helpers/CustomHelper.php): failed to open stream: No such file or directory in C:\xampp\htdocs\\****\*****\vendor\composer\autoload_real.php on line 66
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\\****\\*****\\vendor\composer/../../app/Http/Helpers/CustomHelper.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\\****\\*****\vendor\composer\autoload_real.php on line 66 | 0debug |
static void close_slaves(AVFormatContext *avf)
{
TeeContext *tee = avf->priv_data;
AVFormatContext *avf2;
unsigned i, j;
for (i = 0; i < tee->nb_slaves; i++) {
avf2 = tee->slaves[i].avf;
for (j = 0; j < avf2->nb_streams; j++) {
AVBitStreamFilterContext *bsf_next, *bsf = tee->slaves[i].bsfs[j];
while (bsf) {
bsf_next = bsf->next;
av_bitstream_filter_close(bsf);
bsf = bsf_next;
}
}
av_freep(&tee->slaves[i].stream_map);
avio_close(avf2->pb);
avf2->pb = NULL;
avformat_free_context(avf2);
tee->slaves[i].avf = NULL;
}
} | 1threat |
psycopg2 installation for python:2.7-alpine in Docker : <p>To use PostgreSql in python I need to </p>
<pre><code>pip install psycopg2
</code></pre>
<p>However, it has dependency on libpq-dev and python-dev. I wonder how can I install the dependencies in alpine? Thanks.</p>
<p>Here is a Dockerfile:</p>
<pre><code>FROM python:2.7-alpine
RUN apk add python-dev libpq-dev
RUN pip install psycopg2
</code></pre>
<p>and the output is:</p>
<blockquote>
<p>Step 3 : RUN apk add python-dev libpq-dev ---> Running in
3223b1bf7cde WARNING: Ignoring APKINDEX.167438ca.tar.gz: No such file
or directory WARNING: Ignoring APKINDEX.a2e6dac0.tar.gz: No such file
or directory ERROR: unsatisfiable constraints: libpq-dev (missing):
required by: world[libpq-dev] python-dev (missing):
required by: world[python-dev] ERROR: Service 'service' failed to build: The command '/bin/sh -c apk add python-dev libpq-dev' returned
a non-zero code: 2</p>
</blockquote>
| 0debug |
AutoMapper throwing StackOverflowException when calling ProjectTo<T>() on IQueryable : <p>I have created classes using EF Code First that have collections of each other.
Entities:</p>
<pre><code>public class Field
{
public int Id { get; set; }
public string Name { get; set; }
public virtual List<AppUser> Teachers { get; set; }
public Field()
{
Teachers = new List<AppUser>();
}
}
public class AppUser
{
public int Id { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public string UserName => Email;
public virtual List<Field> Fields { get; set; }
public AppUser()
{
Fields = new List<FieldDTO>();
}
}
</code></pre>
<p>DTOs:</p>
<pre><code>public class FieldDTO
{
public int Id { get; set; }
public string Name { get; set; }
public List<AppUserDTO> Teachers { get; set; }
public FieldDTO()
{
Teachers = new List<AppUserDTO>();
}
}
public class AppUserDTO
{
public int Id { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public string UserName => Email;
public List<FieldDTO> Fields { get; set; }
public AppUserDTO()
{
Fields = new List<FieldDTO>();
}
}
</code></pre>
<p>Mappings:</p>
<pre><code>Mapper.CreateMap<Field, FieldDTO>();
Mapper.CreateMap<FieldDTO, Field>();
Mapper.CreateMap<AppUserDTO, AppUser>();
Mapper.CreateMap<AppUser, AppUserDTO>();
</code></pre>
<p>And I am getting StackOverflowException when calling this code (Context is my dbContext):</p>
<pre><code>protected override IQueryable<FieldDTO> GetQueryable()
{
IQueryable<Field> query = Context.Fields;
return query.ProjectTo<FieldDTO>();//exception thrown here
}
</code></pre>
<p>I guess this happens because it loops in Lists calling each other endlessly. But I do not understand why this happens. Are my mappings wrong?</p>
| 0debug |
Remove function doesn't works jquery : i'm trying to use this jquery function:
$('a').filter(function(index) { return $(this).text() === oEvent.getSource().getTarget().split("/")[0]; }).nextAll().remove();
This function is called when i press a link in a toolbar and i want to remove all next link in the toolbar but it doesn't work. When I press the link it seems to work because all next link are removed but istantanely they reappear. I'm using sapui5 and i hate it. Someone has a solution or any other ideas? | 0debug |
Does AWS supports the Oracle's autonomous Database? : Does AWS has an engine to support Oracle autonomous database ?
https://www.oracle.com/in/database/autonomous-database/feature.html | 0debug |
What is the Best Algorithm to work on in Load Balancing in Cloud Computing? Why? : I am currently work on the various algorithms existing in Load Balancing operation. Need Some Suggestions related. | 0debug |
Using variables from previous maven phases : <p>I created a mojo intended to just run test cases. In the <code>compile</code> phase of my mojo, the only thing I do is to obtain a list of paths for running dynamic tests with TestNG. However when the test phase is reached, the list has no longer anything inside it.</p>
<p>Should I move my mojo's goal execution to another phase? How should be this implementation?</p>
| 0debug |
static void qcow2_refresh_limits(BlockDriverState *bs, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
if (bs->encrypted) {
bs->request_alignment = BDRV_SECTOR_SIZE;
}
bs->bl.pwrite_zeroes_alignment = s->cluster_size;
}
| 1threat |
I've got a C# Windows Form to input values into a Sql db that just wont working, no errors though? : I've made a simple Windows form to input data into Sql db Table. On the surface it seems fine, no errors, but after submitting data into table it doesn't appear. I've looked at the where the connection is pointing and that seems fine. so I'm stuck at the moment. Any help would be great.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApp7
{
public partial class Onbutton1_Click : Form
{
public Onbutton1_Click()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
String str =
"den1.mssql7.gear.host;database=generic;UID=generic;password=Generic";
String cmdText1 = "INSERT INTO TEST1 (Name) VALUES ('%'+ @Name + '%')";
String cmdText2 = "INSERT INTO TEST1 (Age) VALUES ('%'+ @Age + '%')";
SqlConnection con = new SqlConnection(str);
SqlCommand cmd1 = new SqlCommand(cmdText1, con);
SqlCommand cmd2 = new SqlCommand(cmdText2, con);
cmd1.Parameters.Add("@Name", SqlDbType.VarChar, 255).Value = textBox1.Text;
cmd2.Parameters.Add("@Age", SqlDbType.VarChar, 255).Value = textBox2.Text;
con.Open();
cmd1.ExecuteNonQuery();
cmd2.ExecuteNonQuery();
DataSet ds = new DataSet();
con.Close();
}
catch (Exception es)
{
MessageBox.Show("Complete");
{
}
}
}
}
}
| 0debug |
Is it any way to merge together two javascript? : I just can't figure it out how to merge them together, or I always have to write a different one for all my popups? I tried different things but none of them them worked.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
$(document).ready(function() {
$('#trigger').click(function() {
$('#overlay').fadeIn(300);
});
$('#close').click(function() {
$('#overlay').fadeOut(300);
});
});
$('#overlay').click(function(e) {
if (e.target == this) {
if ($('#overlay').is(':visible')) {
$('#overlay').fadeOut(300);
}
}
});
$(document).ready(function() {
$('#trigger2').click(function() {
$('#overlay2').fadeIn(300);
});
$('#close2').click(function() {
$('#overlay2').fadeOut(300);
});
});
$('#overlay2').click(function(e) {
if (e.target == this) {
if ($('#overlay2').is(':visible')) {
$('#overlay2').fadeOut(300);
}
}
});
<!-- end snippet -->
| 0debug |
What is wrong with this code.It won't run? : public class StackSimple{
private long capacity=1000;//maximum size of array
private int idx_top;
private Object data[];
public StackSimple(int capacity)
{
idx_top=-1;
this.capacity=capacity;
data = new Object[capacity];
}
public boolean isEmpty(){
return(idx_top<0);
}
public boolean isFull(){
return(idx_top>=capacity-1);
}
public int size()
{
return idx_top+1;
}
public boolean push(Object x){
if (isFull()){
throw new IllegalArgumentException("ERROR:Stack Overflow.Full Stack");
}
else
{`enter code here`data[++idx_top]=x;
return true;
}
}
public Object pop(){
if(isEmpty())
throw new IllegalArgumentException("ERROR:Stack Underflow.Empty Stack.");
else{
return data[idx_top--];
}
}
public Object top(){
if (isEmpty())
throw new IllegalArgumentException("ERROR:Stack Underflow.Empty Stack.");
else{
return data[idx_top];
}
}
public void print()
{`
for (int i=size()-1;i>=0;i--)
System.out.println(data[i]);
}
}
public class Stack_Exercise {
public static void main(String[] args) {
StackSimple s = new StackSimple(capacity:3);//error shows here
s.push(x:"books");`enter code here`
s.push(x:"something");
s.push(x:"200");
s.print();
System.out.println("Size=" +s.size());
}
}
Why doesn't this work?
Why does it say invalid statement while creating the StackSimple object? Please tell me.
The problem is in the main class while running it. There are errors while pusing the elements.Where am i wrong in this?
i am tired of looking at it .Please Help.
[Error while compiling][1]
[1]: https://i.stack.imgur.com/vfTOi.jpg | 0debug |
static int http_connect(URLContext *h, const char *path, const char *hoststr)
{
HTTPContext *s = h->priv_data;
int post, err, ch;
char line[1024], *q;
post = h->flags & URL_WRONLY;
snprintf(s->buffer, sizeof(s->buffer),
"%s %s HTTP/1.0\r\n"
"User-Agent: %s\r\n"
"Accept: *
s->buf_ptr = s->buffer;
s->buf_end = s->buffer;
s->line_count = 0;
s->location[0] = '\0';
if (post) {
sleep(1);
return 0;
}
q = line;
for(;;) {
ch = http_getc(s);
if (ch < 0)
return AVERROR_IO;
if (ch == '\n') {
if (q > line && q[-1] == '\r')
q--;
*q = '\0';
#ifdef DEBUG
printf("header='%s'\n", line);
#endif
err = process_line(s, line, s->line_count);
if (err < 0)
return err;
if (err == 0)
return 0;
s->line_count++;
q = line;
} else {
if ((q - line) < sizeof(line) - 1)
*q++ = ch;
}
}
}
| 1threat |
Does the setTimeout() function wait until the function is executed before moving on to the next line? : <p>Does the setTimeout() function wait until the function inside of it is executed before moving on to the next line (the line AFTER "setTimeout()")? OR, does setTimeout() just parse through the code while setting the timer for the function to be activated after "x" amount of time? I ask this because I don't know if the "setTimeout()" function just finishes itself by setting a timer for another function before moving on (the function within "setTimeout()" doesn't have to be completed to move on), OR if the "setTimeout()" function stops the next line from executing until "setTimeout()'s" function is completed.</p>
| 0debug |
Why does C use asterisks to declare pointers and not carets like in Pascal? : <p>Both languages have similar origins so I'm wondering where this difference comes from.</p>
| 0debug |
Spring Data Repositories - Find where field in list : <p>I'm trying to use spring <code>PagingAndSortingRepository</code> with a <code>find MyEntity where field in fieldValues</code> query as follows:</p>
<pre><code>@Repository
public interface MyEntity extends PagingAndSortingRepository<MyEntity, String> {
List<MyEntity> findByMyField(Set<String> myField);
}
</code></pre>
<p>But of no success.</p>
<p>I expected the above function to return all entities whose field matches one of the field values but it only returns <strong>empty results</strong>.</p>
<p>Even though it seems like a pretty straight forward ability i could not find any reference to it in the <a href="http://docs.spring.io/spring-data/data-commons/docs/1.6.1.RELEASE/reference/html/repositories.html" rel="noreferrer">docs</a>.</p>
<p>Is / How that could be achieved?</p>
<p>Thanks.</p>
| 0debug |
Make a pure Javascript object from text to drag and drop : I have a Javascript drag and drop quiz for children
For example, they may have to make a sentence out of five images with “sat” “on” “the” “chair” “John”
The problem is all these images have to be specifically created.
Is there a way for pure Javascript to take the text “sat” and make it an object that could be used to drag and drop instead of images?
| 0debug |
ssh-add : Invalid key length : <p>After my mac upgraded automatically, I try ssh-add fail:</p>
<pre><code>>ssh-add
Enter passphrase for /Users/dan/.ssh/id_rsa:
Error loading key "/Users/dan/.ssh/id_rsa": Invalid key length
>ssh -V
OpenSSH_7.6p1, LibreSSL 2.6.2
</code></pre>
<p>But how can I fix this issue?</p>
<p>Thanks!</p>
| 0debug |
The issue about changing the Wordpress theme on win 10 : guys:
i installed the wordpress on my win10, and i want to change the default theme , but i got a problem that the theme can not show the screenshot but default theme is ok!
Look the following :
[default theme][1]
[using theme][2]
[can't show the screenshot][3]
[show screenshot][4]
So the reason is?
I am looking forward to your answer! Thanks!
[1]: https://i.stack.imgur.com/Sx5n2.png
[2]: https://i.stack.imgur.com/RNYC9.png
[3]: https://i.stack.imgur.com/ywpJu.png
[4]: https://i.stack.imgur.com/iVc5k.png | 0debug |
static void ac3_downmix(AC3DecodeContext *s)
{
int i, j;
float v0, v1;
for(i=0; i<256; i++) {
v0 = v1 = 0.0f;
for(j=0; j<s->fbw_channels; j++) {
v0 += s->output[j][i] * s->downmix_coeffs[j][0];
v1 += s->output[j][i] * s->downmix_coeffs[j][1];
}
v0 /= s->downmix_coeff_sum[0];
v1 /= s->downmix_coeff_sum[1];
if(s->output_mode == AC3_CHMODE_MONO) {
s->output[0][i] = (v0 + v1) * LEVEL_MINUS_3DB;
} else if(s->output_mode == AC3_CHMODE_STEREO) {
s->output[0][i] = v0;
s->output[1][i] = v1;
}
}
}
| 1threat |
int qemu_savevm_state_complete(QEMUFile *f)
{
SaveStateEntry *se;
TAILQ_FOREACH(se, &savevm_handlers, entry) {
if (se->save_live_state == NULL)
continue;
qemu_put_byte(f, QEMU_VM_SECTION_END);
qemu_put_be32(f, se->section_id);
se->save_live_state(f, QEMU_VM_SECTION_END, se->opaque);
}
TAILQ_FOREACH(se, &savevm_handlers, entry) {
int len;
if (se->save_state == NULL && se->vmsd == NULL)
continue;
qemu_put_byte(f, QEMU_VM_SECTION_FULL);
qemu_put_be32(f, se->section_id);
len = strlen(se->idstr);
qemu_put_byte(f, len);
qemu_put_buffer(f, (uint8_t *)se->idstr, len);
qemu_put_be32(f, se->instance_id);
qemu_put_be32(f, se->version_id);
vmstate_save(f, se);
}
qemu_put_byte(f, QEMU_VM_EOF);
if (qemu_file_has_error(f))
return -EIO;
return 0;
}
| 1threat |
What is .tpl.html files? (angularjs) : <p>I'm doing a angularjs blog tutorial, in the code example I see this new file type "<strong>tpl.html</strong>":</p>
<pre><code>$routeProvider
.when('/', {
templateUrl: 'views/post-list.tpl.html',
controller: 'PostListController',
controllerAs: 'postlist'
})
.when('/post/:postId', {
templateUrl: 'views/post-detail.tpl.html',
controller: 'PostDetailController',
controllerAs: 'postdetail'
})
.when('/new', {
templateUrl: 'views/post-create.tpl.html',
controller: 'PostCreateController',
controllerAs: 'postcreate'
});
</code></pre>
<p>What is this file type? Is different to html files?</p>
| 0debug |
static int v4l2_read_header(AVFormatContext *ctx)
{
struct video_data *s = ctx->priv_data;
AVStream *st;
int res = 0;
uint32_t desired_format;
enum AVCodecID codec_id = AV_CODEC_ID_NONE;
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
struct v4l2_input input = { 0 };
st = avformat_new_stream(ctx, NULL);
if (!st)
return AVERROR(ENOMEM);
#if CONFIG_LIBV4L2
if (s->use_libv4l2)
v4l2_log_file = fopen("/dev/null", "w");
#endif
s->fd = device_open(ctx);
if (s->fd < 0)
return s->fd;
if (s->channel != -1) {
av_log(ctx, AV_LOG_DEBUG, "Selecting input_channel: %d\n", s->channel);
if (v4l2_ioctl(s->fd, VIDIOC_S_INPUT, &s->channel) < 0) {
res = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_S_INPUT): %s\n", av_err2str(res));
goto fail;
}
} else {
if (v4l2_ioctl(s->fd, VIDIOC_G_INPUT, &s->channel) < 0) {
res = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_G_INPUT): %s\n", av_err2str(res));
goto fail;
}
}
input.index = s->channel;
if (v4l2_ioctl(s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
res = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMINPUT): %s\n", av_err2str(res));
goto fail;
}
s->std_id = input.std;
av_log(ctx, AV_LOG_DEBUG, "Current input_channel: %d, input_name: %s, input_std: %"PRIx64"\n",
s->channel, input.name, (uint64_t)input.std);
if (s->list_format) {
list_formats(ctx, s->list_format);
res = AVERROR_EXIT;
goto fail;
}
if (s->list_standard) {
list_standards(ctx);
res = AVERROR_EXIT;
goto fail;
}
avpriv_set_pts_info(st, 64, 1, 1000000);
if ((res = v4l2_set_parameters(ctx)) < 0)
goto fail;
if (s->pixel_format) {
AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
if (codec)
ctx->video_codec_id = codec->id;
pix_fmt = av_get_pix_fmt(s->pixel_format);
if (pix_fmt == AV_PIX_FMT_NONE && !codec) {
av_log(ctx, AV_LOG_ERROR, "No such input format: %s.\n",
s->pixel_format);
res = AVERROR(EINVAL);
goto fail;
}
}
if (!s->width && !s->height) {
struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
av_log(ctx, AV_LOG_VERBOSE,
"Querying the device for the current frame size\n");
if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) {
res = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res));
goto fail;
}
s->width = fmt.fmt.pix.width;
s->height = fmt.fmt.pix.height;
av_log(ctx, AV_LOG_VERBOSE,
"Setting frame size to %dx%d\n", s->width, s->height);
}
res = device_try_init(ctx, pix_fmt, &s->width, &s->height, &desired_format, &codec_id);
if (res < 0)
goto fail;
if (codec_id != AV_CODEC_ID_NONE && ctx->video_codec_id == AV_CODEC_ID_NONE)
ctx->video_codec_id = codec_id;
if ((res = av_image_check_size(s->width, s->height, 0, ctx)) < 0)
goto fail;
s->frame_format = desired_format;
st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id);
s->frame_size =
avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
if ((res = mmap_init(ctx)) ||
(res = mmap_start(ctx)) < 0)
goto fail;
s->top_field_first = first_field(s);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = codec_id;
if (codec_id == AV_CODEC_ID_RAWVIDEO)
st->codec->codec_tag =
avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
else if (codec_id == AV_CODEC_ID_H264) {
st->need_parsing = AVSTREAM_PARSE_HEADERS;
}
if (desired_format == V4L2_PIX_FMT_YVU420)
st->codec->codec_tag = MKTAG('Y', 'V', '1', '2');
else if (desired_format == V4L2_PIX_FMT_YVU410)
st->codec->codec_tag = MKTAG('Y', 'V', 'U', '9');
st->codec->width = s->width;
st->codec->height = s->height;
if (st->avg_frame_rate.den)
st->codec->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8;
return 0;
fail:
v4l2_close(s->fd);
return res;
}
| 1threat |
Python Gmail API 'not JSON serializable' : <p>I want to send an Email through Python using the Gmail API. Everythingshould be fine, but I still get the error "An error occurred: b'Q29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PSJ1cy1hc2NpaSIKTUlNRS..." Here is my code:</p>
<pre><code>import base64
import httplib2
from email.mime.text import MIMEText
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow
# Path to the client_secret.json file downloaded from the Developer Console
CLIENT_SECRET_FILE = 'client_secret.json'
# Check https://developers.google.com/gmail/api/auth/scopes for all available scopes
OAUTH_SCOPE = 'https://www.googleapis.com/auth/gmail.compose'
# Location of the credentials storage file
STORAGE = Storage('gmail.storage')
# Start the OAuth flow to retrieve credentials
flow = flow_from_clientsecrets(CLIENT_SECRET_FILE, scope=OAUTH_SCOPE)
http = httplib2.Http()
# Try to retrieve credentials from storage or run the flow to generate them
credentials = STORAGE.get()
if credentials is None or credentials.invalid:
credentials = run_flow(flow, STORAGE, http=http)
# Authorize the httplib2.Http object with our credentials
http = credentials.authorize(http)
# Build the Gmail service from discovery
gmail_service = build('gmail', 'v1', http=http)
# create a message to send
message = MIMEText("Message")
message['to'] = "myemail@gmail.com"
message['from'] = "python.api123@gmail.com"
message['subject'] = "Subject"
body = {'raw': base64.b64encode(message.as_bytes())}
# send it
try:
message = (gmail_service.users().messages().send(userId="me", body=body).execute())
print('Message Id: %s' % message['id'])
print(message)
except Exception as error:
print('An error occurred: %s' % error)
</code></pre>
| 0debug |
static inline void elf_core_copy_regs(target_elf_gregset_t *regs,
const CPUSH4State *env)
{
int i;
for (i = 0; i < 16; i++) {
(*regs[i]) = tswapreg(env->gregs[i]);
}
(*regs)[TARGET_REG_PC] = tswapreg(env->pc);
(*regs)[TARGET_REG_PR] = tswapreg(env->pr);
(*regs)[TARGET_REG_SR] = tswapreg(env->sr);
(*regs)[TARGET_REG_GBR] = tswapreg(env->gbr);
(*regs)[TARGET_REG_MACH] = tswapreg(env->mach);
(*regs)[TARGET_REG_MACL] = tswapreg(env->macl);
(*regs)[TARGET_REG_SYSCALL] = 0;
}
| 1threat |
Running git commands on Debian & Ubuntu on WSL is really slow for large projects : <p>We have a very large project with almost 15.000 commits total. I run Debian <code>9.3</code> on my Windows machine using WSL. My git version is <code>2.17.0</code>. </p>
<p>When I run commands such as <code>git status</code>, it takes at least 20 seconds to complete. Even if no changes were made.</p>
<p>I have tried multiple older versions of git and even tried Ubuntu, but I still experience the same result. I've tried running a bunch of commands from various posts on here and on other sites, but none of them worked.</p>
<p>Funny thing: When I open up <code>cmd.exe</code> or Git Bash on Windows, it takes less than a second to run <code>git status</code>.</p>
<p>What could be causing this? What can I do to fix this?</p>
| 0debug |
jsonArray concatenate not working : Hi Friends I am trying to merge two json arrays i have tried concat and merge method but it's not giving the correct output please suggest something...
var set_image=[{"id":"aerobics"},{"id":"kick boxing"}]
var item_json=[{"id":"net ball"},{"id":"floor ball"}]
Merged Array
var finalArray =[{"id":"aerobics"},{"id":"kick boxing"},{"id":"net ball"},{"id":"floor ball"}]
Here is my javascript
var item = JSON.parse(localStorage.getItem("test"));
var item_json = JSON.stringify(item) ;
var page= <?php echo $json_value; ?>;
var set_image=JSON.stringify(page) ;
//var image=set_image.concat(item_json);
var image= $.concat(set_image, item_json)
window.location.href = "modal.php?ids=" + image;
| 0debug |
how to get values from string : I have a huge string, that is devided to two parts that looks like this:
{\"Query\":\"blabla"","\"Subject\":\"gagaga"}","
{\"Query\":\"lalala\"","\"Subject\":\"rarara\"}","
and so on... (thousends of lines)
I need that in the end I will have a var that holds these values-
data= "blabla,gagaga","lalala,rarara",....
tryied to do this like this- not working
var contentss = JSON.stringify(allFileGenesDetails1);
data="";
var Query1="";
var Subject1="";
// Parse the data
var contentEachLines = contentss.split("\n");
for (var jj = 0; jj < contentEachLines.length; jj++) {
var lineContent = contentEachLines[jj].split("\t");
var divided = lineContent[jj].split(",");
Query1= Query1+ [divided[0]];
Query1 = Query1.replace(/Query|:|{|"|\|/gi, "");
Subject1=Subject1+ divided[1];
Subject1 = Subject1.replace(/Subject|:|{|"|\|/gi, "");
data=data+"'"+ Query1+","+Subject1 +" ' " +"," ;
| 0debug |
Make flex element ignore child element : <p>Is it possible to make a flex element ignore a child element so it's size does not affect the other elements?</p>
<p>For example, I have a wrapper with <code>display: flex</code>. It has a header, content, and footer.</p>
<pre><code><div class="wrapper">
<header></header>
<article></article>
<footer></footer>
</div>
</code></pre>
<p>I want the wrapper to ignore the header tag (the header will be fixed to the top of the window). The article will be set to <code>flex: 1</code> so it takes up the rest of the space, forcing the footer to the bottom of the page. Here is some sample CSS:</p>
<pre><code>.wrapper {
display: flex;
flex-direction: column;
height: 100%;
padding-top: 50px; /* Accounts for header */
}
header {
height: 50px;
position: fixed;
top: 0;
width: 100%;
}
article {
flex: 1;
}
footer {
height: 50px;
}
</code></pre>
<p>I know I could just move the header outside of the wrapper but I have a lot of existing code that will make that a bit more difficult. Is what I am asking even possible?</p>
| 0debug |
static void mux_chr_accept_input(CharDriverState *chr)
{
int m = chr->focus;
MuxDriver *d = chr->opaque;
while (d->prod != d->cons &&
d->chr_can_read[m] &&
d->chr_can_read[m](d->ext_opaque[m])) {
d->chr_read[m](d->ext_opaque[m],
&d->buffer[d->cons++ & MUX_BUFFER_MASK], 1);
}
}
| 1threat |
How can i send notification in same time everyday by android - ONESIGNAL : how can i send push notification to my android phone by onesignal
example i want to send automatic message at 6.00am everyday .
How can in implement is.
| 0debug |
how to decrypt value which encrypted from javascript : I'm trying to decrypt "window.btoa" in PHP, please see my PHP code in below.
<script>
var url = "?url=";
var input = 'some text';
var encrypt = window.btoa( input );
var link = "www.domain.com/"+url+encrypt;
</script>
My Link generated as below
www.domain.com/?url=c29tZSB0ZXh0
PHP code in below
<?php
$testURL = $_GET['url];
echo $testURL;
?>
Please guide me how to decrypt this value. | 0debug |
static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int file)
{
MlvContext *mlv = avctx->priv_data;
AVIOContext *pb = mlv->pb[file];
int ret;
while (!avio_feof(pb)) {
int type;
unsigned int size;
type = avio_rl32(pb);
size = avio_rl32(pb);
avio_skip(pb, 8);
if (size < 16)
break;
size -= 16;
if (vst && type == MKTAG('R','A','W','I') && size >= 164) {
vst->codec->width = avio_rl16(pb);
vst->codec->height = avio_rl16(pb);
if (avio_rl32(pb) != 1)
avpriv_request_sample(avctx, "raw api version");
avio_skip(pb, 20);
vst->codec->bits_per_coded_sample = avio_rl32(pb);
avio_skip(pb, 8 + 16 + 24);
if (avio_rl32(pb) != 0x2010100)
avpriv_request_sample(avctx, "cfa_pattern");
avio_skip(pb, 80);
vst->codec->pix_fmt = AV_PIX_FMT_BAYER_RGGB16LE;
vst->codec->codec_tag = MKTAG('B', 'I', 'T', 16);
size -= 164;
} else if (ast && type == MKTAG('W', 'A', 'V', 'I') && size >= 16) {
ret = ff_get_wav_header(pb, ast->codec, 16);
if (ret < 0)
return ret;
size -= 16;
} else if (type == MKTAG('I','N','F','O')) {
if (size > 0)
read_string(avctx, pb, "info", size);
continue;
} else if (type == MKTAG('I','D','N','T') && size >= 36) {
read_string(avctx, pb, "cameraName", 32);
read_uint32(avctx, pb, "cameraModel", "0x%"PRIx32);
size -= 36;
if (size >= 32) {
read_string(avctx, pb, "cameraSerial", 32);
size -= 32;
}
} else if (type == MKTAG('L','E','N','S') && size >= 48) {
read_uint16(avctx, pb, "focalLength", "%i");
read_uint16(avctx, pb, "focalDist", "%i");
read_uint16(avctx, pb, "aperture", "%i");
read_uint8(avctx, pb, "stabilizerMode", "%i");
read_uint8(avctx, pb, "autofocusMode", "%i");
read_uint32(avctx, pb, "flags", "0x%"PRIx32);
read_uint32(avctx, pb, "lensID", "%"PRIi32);
read_string(avctx, pb, "lensName", 32);
size -= 48;
if (size >= 32) {
read_string(avctx, pb, "lensSerial", 32);
size -= 32;
}
} else if (vst && type == MKTAG('V', 'I', 'D', 'F') && size >= 4) {
uint64_t pts = avio_rl32(pb);
ff_add_index_entry(&vst->index_entries, &vst->nb_index_entries, &vst->index_entries_allocated_size,
avio_tell(pb) - 20, pts, file, 0, AVINDEX_KEYFRAME);
size -= 4;
} else if (ast && type == MKTAG('A', 'U', 'D', 'F') && size >= 4) {
uint64_t pts = avio_rl32(pb);
ff_add_index_entry(&ast->index_entries, &ast->nb_index_entries, &ast->index_entries_allocated_size,
avio_tell(pb) - 20, pts, file, 0, AVINDEX_KEYFRAME);
size -= 4;
} else if (vst && type == MKTAG('W','B','A','L') && size >= 28) {
read_uint32(avctx, pb, "wb_mode", "%"PRIi32);
read_uint32(avctx, pb, "kelvin", "%"PRIi32);
read_uint32(avctx, pb, "wbgain_r", "%"PRIi32);
read_uint32(avctx, pb, "wbgain_g", "%"PRIi32);
read_uint32(avctx, pb, "wbgain_b", "%"PRIi32);
read_uint32(avctx, pb, "wbs_gm", "%"PRIi32);
read_uint32(avctx, pb, "wbs_ba", "%"PRIi32);
size -= 28;
} else if (type == MKTAG('R','T','C','I') && size >= 20) {
char str[32];
struct tm time = { 0 };
time.tm_sec = avio_rl16(pb);
time.tm_min = avio_rl16(pb);
time.tm_hour = avio_rl16(pb);
time.tm_mday = avio_rl16(pb);
time.tm_mon = avio_rl16(pb);
time.tm_year = avio_rl16(pb);
time.tm_wday = avio_rl16(pb);
time.tm_yday = avio_rl16(pb);
time.tm_isdst = avio_rl16(pb);
avio_skip(pb, 2);
strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S", &time);
av_dict_set(&avctx->metadata, "time", str, 0);
size -= 20;
} else if (type == MKTAG('E','X','P','O') && size >= 16) {
av_dict_set(&avctx->metadata, "isoMode", avio_rl32(pb) ? "auto" : "manual", 0);
read_uint32(avctx, pb, "isoValue", "%"PRIi32);
read_uint32(avctx, pb, "isoAnalog", "%"PRIi32);
read_uint32(avctx, pb, "digitalGain", "%"PRIi32);
size -= 16;
if (size >= 8) {
read_uint64(avctx, pb, "shutterValue", "%"PRIi64);
size -= 8;
}
} else if (type == MKTAG('S','T','Y','L') && size >= 36) {
read_uint32(avctx, pb, "picStyleId", "%"PRIi32);
read_uint32(avctx, pb, "contrast", "%"PRIi32);
read_uint32(avctx, pb, "sharpness", "%"PRIi32);
read_uint32(avctx, pb, "saturation", "%"PRIi32);
read_uint32(avctx, pb, "colortone", "%"PRIi32);
read_string(avctx, pb, "picStyleName", 16);
size -= 36;
} else if (type == MKTAG('M','A','R','K')) {
} else if (type == MKTAG('N','U','L','L')) {
} else if (type == MKTAG('M','L','V','I')) {
} else {
av_log(avctx, AV_LOG_INFO, "unsupported tag %c%c%c%c, size %u\n", type&0xFF, (type>>8)&0xFF, (type>>16)&0xFF, (type>>24)&0xFF, size);
}
avio_skip(pb, size);
}
return 0;
}
| 1threat |
go build with multiple tags : <p>As seen <a href="https://golang.org/pkg/go/build/#hdr-Build_Constraints" rel="noreferrer">here</a>, go build accepts a "tags" flag that will include files that are "tagged," i.e.</p>
<pre><code>// +build foo
package main
....
</code></pre>
<p>will be excluded from </p>
<pre><code>go build
</code></pre>
<p>but included in </p>
<pre><code>go build -tags=foo
</code></pre>
<p>Is there a way to include multiple tags? I.e.</p>
<pre><code>go build -tags=foo && bar
</code></pre>
| 0debug |
Why is my code wrong ?? -> How to determine if an int is perfect square? : My code seems to pass many cases, but my codes seem to fail a particular private test case. Can anyone help me ?
static boolean isSquare(int n) {
IntStream y=IntStream.range(1, n).map(((int x)->{return x*x;}));
return y.anyMatch(x->(x==n));
} | 0debug |
static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
MOVContext *mov = (MOVContext *) s->priv_data;
ByteIOContext *pb = &s->pb;
int i, err;
MOV_atom_t atom = { 0, 0, 0 };
mov->fc = s;
mov->parse_table = mov_default_parse_table;
if(!url_is_streamed(pb))
atom.size = url_fsize(pb);
else
atom.size = 0x7FFFFFFFFFFFFFFFLL;
err = mov_read_default(mov, pb, atom);
if (err<0 || (!mov->found_moov && !mov->found_mdat)) {
av_log(s, AV_LOG_ERROR, "mov: header not found !!! (err:%d, moov:%d, mdat:%d) pos:%"PRId64"\n",
err, mov->found_moov, mov->found_mdat, url_ftell(pb));
return -1;
}
dprintf("on_parse_exit_offset=%d\n", (int) url_ftell(pb));
if(!url_is_streamed(pb) && (url_ftell(pb) != mov->mdat_offset))
url_fseek(pb, mov->mdat_offset, SEEK_SET);
mov->total_streams = s->nb_streams;
for(i=0; i<mov->total_streams; i++) {
MOVStreamContext *sc = mov->streams[i];
if(!sc->time_rate)
sc->time_rate=1;
if(!sc->time_scale)
sc->time_scale= mov->time_scale;
av_set_pts_info(s->streams[i], 64, sc->time_rate, sc->time_scale);
if(s->streams[i]->duration != AV_NOPTS_VALUE){
assert(s->streams[i]->duration % sc->time_rate == 0);
s->streams[i]->duration /= sc->time_rate;
}
sc->ffindex = i;
mov_build_index(mov, s->streams[i]);
}
for(i=0; i<mov->total_streams; i++) {
av_freep(&mov->streams[i]->chunk_offsets);
av_freep(&mov->streams[i]->sample_to_chunk);
av_freep(&mov->streams[i]->sample_sizes);
av_freep(&mov->streams[i]->keyframes);
av_freep(&mov->streams[i]->stts_data);
}
av_freep(&mov->mdat_list);
return 0;
}
| 1threat |
how to get value from this Object? : <p>I have some obj like this...</p>
<pre><code> tdata: [
{
name: 'jims',
id: '30616'
},
{
name: 'joms',
id: '38330'
}
]
</code></pre>
<p>I want to know how to get any values from this obj </p>
<p>thanks for every answer :)</p>
| 0debug |
def nCr(n, r):
if (r > n / 2):
r = n - r
answer = 1
for i in range(1, r + 1):
answer *= (n - r + i)
answer /= i
return answer
def binomial_probability(n, k, p):
return (nCr(n, k) * pow(p, k) * pow(1 - p, n - k)) | 0debug |
Invalid prop: type check failed for prop : <p>I created a countdown with Vue.js but I am having trouble showing the values I am getting. I have two components and I have read the single file component guide from Vue but I just don't seem to understand what it is that I am doing wrong. In the console I get the follow error: </p>
<blockquote>
<p>[Vue warn]: Invalid prop: type check failed for prop "date". Expected Number, got String.</p>
</blockquote>
<p>Though in my code it is defined as a number.</p>
<p><strong>app.js</strong></p>
<pre><code>import './bootstrap.js';
import Echo from 'laravel-echo';
import Vue from 'vue';
import CurrentTime from './components/CurrentTime';
import Bitbucket from './components/Bitbucket';
import InternetConnection from './components/InternetConnection';
import LastFm from './components/LastFm';
import PackagistStatistics from './components/PackagistStatistics';
import RainForecast from './components/RainForecast';
import Placeholder from './components/Placeholder';
import Youtube from './components/Youtube';
import ProjectCountdown from './components/ProjectCountdown';
import Countdown from './components/Countdown';
Vue.component('countdown', Countdown);
new Vue({
el: '#dashboard',
components: {
CurrentTime,
InternetConnection,
Bitbucket,
LastFm,
PackagistStatistics,
RainForecast,
Placeholder,
Youtube,
ProjectCountdown,
Countdown
},
created() {
this.echo = new Echo({
broadcaster: 'pusher',
key: window.dashboard.pusherKey,
cluster: 'eu',
encrypted: true
});
},
});
</code></pre>
<p><strong>ProjectCountdown.vue</strong></p>
<pre><code><template>
<div id="dashboard">
<Countdown date="March 20, 2017 12:00"></Countdown>
{{days}}
</div>
</template>
<script>
import Grid from './Grid';
import Vue from 'vue';
import Countdown from './Countdown';
export default {
components: {
Grid,
Countdown,
},
props: {
grid: {
type: String,
},
},
data() {
return {
}
}
}
// Vue.filter('two_digits', function (value) {
// if(value.toString().length <= 1)
// {
// return "0" + value.toString()
// }
// return value.toString();
// });
</script>
</code></pre>
<p><strong>Countdown.vue</strong></p>
<pre><code><template>
<div>
{{ seconds }}
</div>
</template>
<script>
import Vue from 'vue';
export default {
props: {
date: {
type: Number,
coerce: str => Math.trunc(Date.parse(str) / 1000)
},
},
data() {
return {
now: Math.trunc((new Date()).getTime() / 1000)
}
},
ready() {
window.setInterval(() => {
this.now = Math.trunc((new Date()).getTime() / 1000);
},1000);
},
computed: {
seconds() {
return (this.date - this.now) % 60;
},
minutes() {
return Math.trunc((this.date - this.now) / 60) % 60;
},
hours() {
return Math.trunc((this.date - this.now) / 60 / 60) % 24;
},
days() {
return Math.trunc((this.date - this.now) / 60 / 60 / 24);
},
},
}
</script>
</code></pre>
| 0debug |
I am automating angular js application, i am unable to click button using ng-click ,can u please share java script code??? for ng click : Here is the HTML code :
<a ng-click="openProjectModal($event)">Create Project</a>
I tried below code:
.//a[ng-click='openProjectModal($event)']
Using xpath it is working but i don't want to use xpath.
| 0debug |
PHP data validation : <p>I am trying to create data validation code in PHP and was wondering how to go about that. I understand that someone can Inject code or scripts through the input boxes on my website. I am preventing entrance of characters such as <code>< " / \</code> but I don't know what else to use. For example I am accepting data into a $var and if someone enters echo <code>"<div style = "position: fixed; height: 1000px; width: 100%" ></div>"</code> whatever this will do, it will still run if I accept it into my $var right and run the code? Unless the host has mechanisms to prevent that</p>
| 0debug |
void do_POWER_divso (void)
{
if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) {
T0 = (long)((-1) * (T0 >> 31));
env->spr[SPR_MQ] = 0;
xer_ov = 1;
xer_so = 1;
} else {
T0 = (int32_t)T0 / (int32_t)T1;
env->spr[SPR_MQ] = (int32_t)T0 % (int32_t)T1;
xer_ov = 0;
}
}
| 1threat |
Group the map values to avoid duplicate : <p>I have a Map(map1) whose key is another map(map2) and value is string.</p>
<p>The value of map1 has several duplicate, so I must group them and set as key in another map3 whose value has to be map2.</p>
<pre><code>eg:
map1 { [[a,b],xyz], [[c,d],wrt] , [[e,f],xyz] , [[r,m],xyz] }
output should be :
map3 { [ xyz,[ [a,b],[e,f],[r,m] ] ] , [ wrt,[ [c,d] ]
</code></pre>
<p>can i obtain like this ?</p>
| 0debug |
Looking for answer to JavaSript coding quize : /*
* Programming Quiz: One Awesome Message (2-12)
*
* 1. Create the variables
* - firstName
* - interest
* - hobby
* 2. Create a variable named awesomeMessage and, using string concatenation and the variables above, create an awesome message.
* 3. Print the awesomeMessage variable to the console
*/
// Add your code here
**I have been stuck with this quite sometime**
The output suppose to be like this:
"Hi, my name is Julia. I love cats. In my spare time, I like to play video games."
"Hi, my name is James. I love baseball. In my spare time, I like to read."
I am so new to this and please don't judge me, Here is the code i wrote (and Stuck!)
firstName = ["Julia", "James"];
interest = ["cats", "baseball"];
hobby = ["play video games", "read"];
var awesomeMessage = "Hi, my name is " + firstName +". " + "I love "+interest+ ". "+ "I like to "+hobby+ ".";
console.log(awesomeMessage); | 0debug |
I understand the distinct/group by function - SQL Server 2008 : Here is an short example what I have in my BDD :
Ref | NameContact | CODE
SF005 | Toto | SF
SF006 | Titi | BC
SF005 | Toto | SF
SF007 | Foo | FB
SF006 | Bar | BC
SF005 | Tata | SF
SF005 | Tata | SF
I like to get this :
Ref | NameContact |CODE
SF005 | Toto | SF
SF005 | Tata | SF
I've tried to use Distinct but it doesn't work correctly but it'work when i use Group By with all named column with MAX() but i've many columns and the query is very big. There is a better solution ?
SELECT MAX(Ref),NameContact,Code FROM MyTable WHERE CODE = 'SF' GROUP BY NameContact,Code | 0debug |
Search bar overlaps with status bar on iOS 11 : <p>I am using a UISearchController and a UISearchResultsController to implement search functionality.</p>
<p>MySearchResultsController implements UISearchResultsUpdating and UISearchBarDelegate:</p>
<pre><code>override open func viewDidLoad() {
super.viewDidLoad()
self.edgesForExtendedLayout = [];
self.automaticallyAdjustsScrollViewInsets = false;
}
</code></pre>
<p>I display the searchbar in the tableHeader like this in MyTableViewController:</p>
<pre><code>- (void)viewDidLoad {
[super viewDidLoad];
self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultsController];
self.searchController.searchResultsUpdater = self.searchResultsController;
self.searchController.searchBar.delegate = self.searchResultsController;
self.searchController.searchBar.scopeButtonTitles = @[NSLocalizedString(@"SEARCH_SCOPE_TEMPERATURES", nil), NSLocalizedString(@"SEARCH_SCOPE_KNOWHOW", nil)];
self.tableView.tableHeaderView = self.searchController.searchBar;
self.definesPresentationContext = YES;
}
</code></pre>
<p>This worked perfectly before, but under iOS 11 the search bar overlaps with the status bar as soon as I tap into it (see screenshots). I tried lots of different things to get it to display correctly but haven't found a solution yet.</p>
<p><a href="https://i.stack.imgur.com/eC4lt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eC4lt.png" alt="enter image description here"></a></p>
| 0debug |
static void use_normal_update_speed(WmallDecodeCtx *s, int ich)
{
int ilms, recent, icoef;
s->update_speed[ich] = 8;
for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {
recent = s->cdlms[ich][ilms].recent;
if (s->bV3RTM) {
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
s->cdlms[ich][ilms].lms_updates[icoef + recent] /= 2;
} else {
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
s->cdlms[ich][ilms].lms_updates[icoef] /= 2;
}
}
}
| 1threat |
What is the best ration to divide my image dataset into train/validation for Mask_RCNN? : <p>I have 13k images , i want to choose the best ratio to divide
my dataset into train/validation to use this model
<a href="https://github.com/matterport/Mask_RCNN" rel="nofollow noreferrer">https://github.com/matterport/Mask_RCNN</a>
for object detection and instance segmentation</p>
| 0debug |
How to Make Forgot Password in Codeigniter, Password link send in email : Hello guyz i created little application in codeigniter,in this application i am doing forgot password module, i had doing function but dont know its not working,
i need forgot password like random password send in email, but email method does not work, so give me some suggestion.
Here is My view:
<form action="<?php echo base_url() . "welcome/forgotpassword" ?>" method="POST">
<div class="form-group has-feedback">
<input type="email" class="form-control" placeholder="Email" name="user_email" />
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-4">
<input type="submit" class="btn btn-primary btn-block btn-flat" value="Send">
</div>
</div>
</form>
Here is my Controller:
public function forgotpassword(){
$email = $this->input->post('user_email');
$findemail = $this->main_model->ForgotPassword($email);
$this->load->view('forgotpassword');
if ($findemail) {
$this->main_model->sendpassword($findemail);
} else {
$this->session->set_flashdata('msg', 'Email not found!');
}
}
Here is My model:
public function sendpassword($data) {
$email = $data['user_email'];
print_r($data);
$query1 = $this->db->query("SELECT * from user_registration where user_email = '" . $email . "'");
$row = $query1->result_array();
print_r($email);
if ($query1->num_rows() > 0) {
$passwordplain = "";
$passwordplain = rand(999999999, 9999999999);
$newpass['user_password'] = md5($passwordplain);
$this->db->where('user_email', $email);
$this->db->update('user_registration', $newpass);
$mail_message = 'Dear ' . $row[0]['full_name'] . ',' . "\r\n";
$mail_message .= 'Thanks for contacting regarding to forgot password,<br> Your <b>Password</b> is <b>' . $passwordplain . '</b>' . "\r\n";
$mail_message .= '<br>Please Update your password.';
$mail_message .= '<br>Thanks & Regards';
$mail_message .= '<br>Your company name';
require FCPATH . 'assets/PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPSecure = "tls";
$mail->Debugoutput = 'html';
$mail->Host = "ssl://smtp.googlemail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "xxxxxxxxx@gmail.com";
$mail->Password = "xxxxxxxx";
$mail->setFrom('xxxxxxx@gmail.com', 'admin');
$mail->IsHTML(true);
$mail->addAddress('user_email', $email);
$mail->Subject = 'OTP from company';
$mail->Body = $mail_message;
$mail->AltBody = $mail_message;
if ($mail->send()) {
echo '<script>alert("Message Send")</script>';
$this->session->set_flashdata('msg', 'Failed to send password, please try again!');
} else {
echo '<script>alert("Sending Failed")</script>';
echo $this->email->print_debugger();
$this->session->set_flashdata('msg', 'Password sent to your email!');
}
}
} | 0debug |
R crash after big for loop, apply or foreach : I wrote a script which work very correctly on a small sample datasets, but when I am trying the same on much larger - and real - datas, R Studio Session crash with fatal error, as do R session when I run the script without using RStudio. Here's is my sessionInfo() :
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rsconnect_0.4.3 tools_3.3.1
I tried building the same script using for loop, foreach package, apply functions, plyr's one... Nothing worked. I am sorry not being able to give a reproductible example, but scripts and data are very large, and when they are just extract, it works...
Do anyone know what is the problem ? I precise that I don't get any error message... | 0debug |
LiveData Observer not Called : <p>I have an activity, <code>TabBarActivity</code> that hosts a fragment, <code>EquipmentRecyclerViewFragment</code>. The fragment receives the LiveData callback but the Activity does not (as proofed with breakpoints in debugging mode). What's weird is the Activity callback does trigger if I call the ViewModel's <code>initData</code> method. Below are the pertinent sections of the mentioned components: </p>
<p><strong>TabBarActivity</strong></p>
<pre><code>override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initVM()
setContentView(R.layout.activity_nav)
val equipmentRecyclerViewFragment = EquipmentRecyclerViewFragment()
supportFragmentManager
.beginTransaction()
.replace(R.id.frameLayout, equipmentRecyclerViewFragment, equipmentRecyclerViewFragment.TAG)
.commit()
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
}
var eVM : EquipmentViewModel? = null
private fun initVM() {
eVM = ViewModelProviders.of(this).get(EquipmentViewModel::class.java)
eVM?.let { lifecycle.addObserver(it) } //Add ViewModel as an observer of this fragment's lifecycle
eVM?.equipment?.observe(this, loadingObserver)// eVM?.initData() //TODO: Not calling this causes Activity to never receive the observed ∆
}
val loadingObserver = Observer<List<Gun>> { equipment ->
...}
</code></pre>
<p><strong>EquipmentRecyclerViewFragment</strong></p>
<pre><code>override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
columnCount = 2
initVM()
}
//MARK: ViewModel Methods
var eVM : EquipmentViewModel? = null
private fun initVM() {
eVM = ViewModelProviders.of(this).get(EquipmentViewModel::class.java)
eVM?.let { lifecycle.addObserver(it) } //Add ViewModel as an observer of this fragment's lifecycle
eVM?.equipment?.observe(this, equipmentObserver)
eVM?.initData()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_equipment_list, container, false)
if (view is RecyclerView) { // Set the adapter
val context = view.getContext()
view.layoutManager = GridLayoutManager(context, columnCount)
view.adapter = adapter
}
return view
}
</code></pre>
<p><strong>EquipmentViewModel</strong></p>
<pre><code>class EquipmentViewModel(application: Application) : AndroidViewModel(application), LifecycleObserver {
var equipment = MutableLiveData<List<Gun>>()
var isLoading = MutableLiveData<Boolean>()
fun initData() {
isLoading.setValue(true)
thread { Thread.sleep(5000) //Simulates async network call
var gunList = ArrayList<Gun>()
for (i in 0..100){
gunList.add(Gun("Gun "+i.toString()))
}
equipment.postValue(gunList)
isLoading.postValue(false)
}
}
</code></pre>
<p>The ultimate aim is to have the activity just observe the <code>isLoading</code> MutableLiveData boolean, but since that wasn't working I changed the activity to observe just the equipment LiveData to minimize the number of variables at play.</p>
| 0debug |
Passport laravel createToken Personal access client not found : <p>After setup of passport, I have configured and created a controller to manage Register-Login- and - access to a resource for a general external post request. I do not need for a specific client. But when I try to create a token in the registration or in the login:</p>
<pre><code>$tokenObj=$user->createToken('APPLICATION')->accessToken;
</code></pre>
<p>The error is:</p>
<blockquote>
<p>RuntimeException: Personal access client not found. Please create one. in file
C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\ClientRepository.php
on line 94
Stack trace:
1. RuntimeException->() C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\ClientRepository.php:94
2. Laravel\Passport\ClientRepository->personalAccessClient() C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\PersonalAccessTokenFactory.php:71</p>
</blockquote>
<p>How can I solve it?</p>
| 0debug |
static void ide_atapi_cmd_ok(IDEState *s)
{
s->error = 0;
s->status = READY_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
ide_set_irq(s);
}
| 1threat |
GDPR - Consent SDK - Consent form translation : <p>The <a href="https://developers.google.com/admob/android/eu-consent" rel="noreferrer">Consent SDK</a> allows to show a consent form which, however, it is currently in English only (version 1.0.3 of the SDK). SDK page says:</p>
<blockquote>
<p>To update consent text of the Google-rendered consent form, modify the consentform.html file included in the Consent SDK as required.</p>
</blockquote>
<p>However, consentform.html is provided as an asset and I don't see a way to localize it, especially using gradle. What is the best way to handle localization in this case? And why this was not done in the first place? Europe is not just English.</p>
| 0debug |
MySQL Join with several CASE WHEN : <p>I need some help with MySQL where I want to JOIN with a CASE WHEN. I am getting 3 columns from statement below. </p>
<p>I would like to add from table Customer.name so I get a 4th column with Customer Name.
Table CustomerCategory has foreign key and ID from Customer.CustomerID<br>
Also every customer has an id but not necessary a CustomerCode, null exists.
Tried many versions of join but...</p>
<pre><code>SELECT
(CASE WHEN CustomerCategory.CustomerCode = "CUST01" THEN "Distributor" ELSE " " END ) AS Distributor,
(CASE when when CustomerCategory.CustomerCode = "CUST02" THEN "Retail" ELSE " " END ) AS Retail,
(CASE WHEN CustomerCategory.CustomerCode = "CUST03" THEN "Enduser" ELSE " " END ) AS Enduser
from CustomerCategory
</code></pre>
| 0debug |
static int acpi_load_old(QEMUFile *f, void *opaque, int version_id)
{
PIIX4PMState *s = opaque;
int ret, i;
uint16_t temp;
ret = pci_device_load(&s->dev, f);
if (ret < 0) {
return ret;
}
qemu_get_be16s(f, &s->ar.pm1.evt.sts);
qemu_get_be16s(f, &s->ar.pm1.evt.en);
qemu_get_be16s(f, &s->ar.pm1.cnt.cnt);
ret = vmstate_load_state(f, &vmstate_apm, opaque, 1);
if (ret) {
return ret;
}
qemu_get_timer(f, s->ar.tmr.timer);
qemu_get_sbe64s(f, &s->ar.tmr.overflow_time);
qemu_get_be16s(f, (uint16_t *)s->ar.gpe.sts);
for (i = 0; i < 3; i++) {
qemu_get_be16s(f, &temp);
}
qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en);
for (i = 0; i < 3; i++) {
qemu_get_be16s(f, &temp);
}
ret = vmstate_load_state(f, &vmstate_pci_status, opaque, 1);
return ret;
}
| 1threat |
static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)
{
CPUState *cs = CPU(DEVICE(pc->threads));
DeviceClass *dc = DEVICE_GET_CLASS(cs);
PowerPCCPU *cpu = POWERPC_CPU(cs);
int smt_threads = CPU_CORE(pc)->nr_threads;
CPUPPCState *env = &cpu->env;
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
uint32_t servers_prop[smt_threads];
int i;
uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40),
0xffffffff, 0xffffffff};
uint32_t tbfreq = PNV_TIMEBASE_FREQ;
uint32_t cpufreq = 1000000000;
uint32_t page_sizes_prop[64];
size_t page_sizes_prop_size;
const uint8_t pa_features[] = { 24, 0,
0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xf0,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
0x80, 0x00, 0x80, 0x00, 0x80, 0x00 };
int offset;
char *nodename;
int cpus_offset = get_cpus_node(fdt);
nodename = g_strdup_printf("%s@%x", dc->fw_name, pc->pir);
offset = fdt_add_subnode(fdt, cpus_offset, nodename);
_FDT(offset);
g_free(nodename);
_FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id", chip->chip_id)));
_FDT((fdt_setprop_cell(fdt, offset, "reg", pc->pir)));
_FDT((fdt_setprop_cell(fdt, offset, "ibm,pir", pc->pir)));
_FDT((fdt_setprop_string(fdt, offset, "device_type", "cpu")));
_FDT((fdt_setprop_cell(fdt, offset, "cpu-version", env->spr[SPR_PVR])));
_FDT((fdt_setprop_cell(fdt, offset, "d-cache-block-size",
env->dcache_line_size)));
_FDT((fdt_setprop_cell(fdt, offset, "d-cache-line-size",
env->dcache_line_size)));
_FDT((fdt_setprop_cell(fdt, offset, "i-cache-block-size",
env->icache_line_size)));
_FDT((fdt_setprop_cell(fdt, offset, "i-cache-line-size",
env->icache_line_size)));
if (pcc->l1_dcache_size) {
_FDT((fdt_setprop_cell(fdt, offset, "d-cache-size",
pcc->l1_dcache_size)));
} else {
error_report("Warning: Unknown L1 dcache size for cpu");
}
if (pcc->l1_icache_size) {
_FDT((fdt_setprop_cell(fdt, offset, "i-cache-size",
pcc->l1_icache_size)));
} else {
error_report("Warning: Unknown L1 icache size for cpu");
}
_FDT((fdt_setprop_cell(fdt, offset, "timebase-frequency", tbfreq)));
_FDT((fdt_setprop_cell(fdt, offset, "clock-frequency", cpufreq)));
_FDT((fdt_setprop_cell(fdt, offset, "ibm,slb-size", env->slb_nr)));
_FDT((fdt_setprop_string(fdt, offset, "status", "okay")));
_FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
if (env->spr_cb[SPR_PURR].oea_read) {
_FDT((fdt_setprop(fdt, offset, "ibm,purr", NULL, 0)));
}
if (env->mmu_model & POWERPC_MMU_1TSEG) {
_FDT((fdt_setprop(fdt, offset, "ibm,processor-segment-sizes",
segs, sizeof(segs))));
}
if (env->insns_flags & PPC_ALTIVEC) {
uint32_t vmx = (env->insns_flags2 & PPC2_VSX) ? 2 : 1;
_FDT((fdt_setprop_cell(fdt, offset, "ibm,vmx", vmx)));
}
if (env->insns_flags2 & PPC2_DFP) {
_FDT((fdt_setprop_cell(fdt, offset, "ibm,dfp", 1)));
}
page_sizes_prop_size = ppc_create_page_sizes_prop(env, page_sizes_prop,
sizeof(page_sizes_prop));
if (page_sizes_prop_size) {
_FDT((fdt_setprop(fdt, offset, "ibm,segment-page-sizes",
page_sizes_prop, page_sizes_prop_size)));
}
_FDT((fdt_setprop(fdt, offset, "ibm,pa-features",
pa_features, sizeof(pa_features))));
for (i = 0; i < smt_threads; i++) {
servers_prop[i] = cpu_to_be32(pc->pir + i);
}
_FDT((fdt_setprop(fdt, offset, "ibm,ppc-interrupt-server#s",
servers_prop, sizeof(servers_prop))));
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.