problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to pass a file path to the program via command line argument. : I have 5 files, which I have parsed. They are text files, and I dont know how to pass them to the program via command line arguemnt. I am using visual studio, and C sharp. When I go into Project>Properties>Debug>Command Line Argument> Do I just type in the files? Like File01.txt,File02.txt etc... | 0debug |
Where to store static content (e.g. country codes) in a vue.js app? : <p>I have tried to find the common best practice for this issue but I seem to be looking in the wrong places. What's the best practice to store content such as country codes (or any other static content, e.g. an array of categories etc.) in a vue.js app? It would be awkward to save that in my .env file as an environment variable and it isn't really another config variable either.</p>
<p>Should I just store it in Vuex even though this is immutable data and won't be changed by the user or app ever? Or should I just create my own js file and import it whereever I need it? In AngularJS I just put it in a HelperService as a function and that was it...</p>
<pre><code>function getCountryArray() {
var countries = {
'AF': 'Afghanistan',
'AX': 'Åland Islands',
'AL': 'Albania',
'DZ': 'Algeria',
'AS': 'American Samoa',
'AD': 'Andorra',
'AO': 'Angola',
'AI': 'Anguilla',
'AQ': 'Antarctica',
'AG': 'Antigua and Barbuda',
'AR': 'Argentina'
...
</code></pre>
| 0debug |
Data Table with select inputs and print option button : I have a data table with select inputs and a print button, while printing I am getting all the select option tag text how to fix that | 0debug |
static void gen_exception_return(DisasContext *s, TCGv_i32 pc)
{
TCGv_i32 tmp;
store_reg(s, 15, pc);
tmp = load_cpu_field(spsr);
gen_set_cpsr(tmp, CPSR_ERET_MASK);
tcg_temp_free_i32(tmp);
s->is_jmp = DISAS_JUMP;
}
| 1threat |
How can I publish NUnit test results using Jenkins Pipeline? : <p>Trying to use the nifty Jenkins Pipeline, I had problems finding out how to publish NUnit test results.</p>
<p>I am able to run the tests by specifying the following command in the pipeline script:</p>
<pre><code>stage 'Test'
bat '"C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe" "ProjectName\\bin\\Release\\UnitTests.net.dll"'
</code></pre>
<p>But how to make Jenkins "publish" the test results is not obvious. The Snippet Generator only suggests junit, and that does not seem to work.</p>
| 0debug |
static av_cold int raw_encode_init(AVCodecContext *avctx)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
if(!avctx->codec_tag)
avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);
return 0;
}
| 1threat |
void OPPROTO op_set_Rc0 (void)
{
env->crf[0] = T0 | xer_ov;
RETURN();
}
| 1threat |
static void pointer_event(VncState *vs, int button_mask, int x, int y)
{
static uint32_t bmap[INPUT_BUTTON__MAX] = {
[INPUT_BUTTON_LEFT] = 0x01,
[INPUT_BUTTON_MIDDLE] = 0x02,
[INPUT_BUTTON_RIGHT] = 0x04,
[INPUT_BUTTON_WHEEL_UP] = 0x08,
[INPUT_BUTTON_WHEEL_DOWN] = 0x10,
};
QemuConsole *con = vs->vd->dcl.con;
int width = pixman_image_get_width(vs->vd->server);
int height = pixman_image_get_height(vs->vd->server);
if (vs->last_bmask != button_mask) {
qemu_input_update_buttons(con, bmap, vs->last_bmask, button_mask);
vs->last_bmask = button_mask;
}
if (vs->absolute) {
qemu_input_queue_abs(con, INPUT_AXIS_X, x, width);
qemu_input_queue_abs(con, INPUT_AXIS_Y, y, height);
} else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
qemu_input_queue_rel(con, INPUT_AXIS_X, x - 0x7FFF);
qemu_input_queue_rel(con, INPUT_AXIS_Y, y - 0x7FFF);
} else {
if (vs->last_x != -1) {
qemu_input_queue_rel(con, INPUT_AXIS_X, x - vs->last_x);
qemu_input_queue_rel(con, INPUT_AXIS_Y, y - vs->last_y);
}
vs->last_x = x;
vs->last_y = y;
}
qemu_input_event_sync();
}
| 1threat |
document.write('<script src="evil.js"></script>'); | 1threat |
Learing JavaScript : > iam new to javascript and i got a problem
> This is my jsp code with checkboxes
<div class="col-md-2 right2 fon">
<h6>Clinical Practice/Procedure</h6>
<hr>
<p><input type="hidden" name="clinicalStat" id="clinicalStat" value="0"></p>
<p><input type="checkbox" name="clinicalDoc" class="clinicalCheck" id="clinicalDoc" value="0">Documentation</p>
<p><input type="checkbox" name="clinicalMiss" class="clinicalCheck" id="clinicalDoc" value="0">Missing Files</p>
<p><input type="checkbox" name="clinicalPol" class="clinicalCheck" id="clinicalDoc" value="0" > Policy not available</p>
<p><input type="checkbox" name="clinicalMed" class="clinicalCheck" id="clinicalDoc" value="0" > Medical records unavailable</p>
<p><input type="checkbox" name="clinicalCon" class="clinicalCheck" id="clinicalDoc" value="0" > Confidentiality</p>
<p><input type="checkbox" name="clinicalProc" class="clinicalCheck" id="clinicalDoc" value="0">Procedures not followed</p>
<p><input type="hidden" name="clinicalVals" id="clinicalVals" value="0"></p>
<p><input type="checkbox" id="checkBox" onclick="EnableDisableTextBox(this)" > Other (Specify)</p>
<p><input type="text2" id="text" name="incidentClassClinicalVal" disabled="disabled" style="width: 92%"></p>
</div>
> I want to get value of selected checkbox with alert and iam storing that value in variable checked1 "var checked1" and again iwant to pass the "var checked1" value to another variable checkedval "var checkedval" and when iam trying to alert the checkedval it showing me with this error "undefined"
> this is my JavaScript Code
$(":checkbox").click(function()
{
//alert(" you checked");
if(this.checked)
{
var checked1=document.getElementById('clinicalDoc').value;
alert("The value for selected checkbox = "+checked1);
var checkedval=$("#checked1").val('1');
alert("checkedval="+checkedval);
}
}); | 0debug |
PHP connecting to database fails without error : <p>I am trying to connect to databse on my server by using this code:</p>
<pre><code><?php
$username = "username";
$servername = "localhost";
$password = "password";
echo "Before connection";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
</code></pre>
<p>But code after <code>$conn = new mysqli($servername, $username, $password);</code> is not executing. When i try to echo anything after it I do not get output. Code before that line works as expected. I do not get any errors from php.</p>
<p>I am not sure what is problem. Could it be something server related? I did try to add:</p>
<pre><code>ini_set('display_errors',1);
error_reporting(E_ALL);
</code></pre>
<p>but it didn't help, no errors have been displayed.</p>
<p>I have been trying many things from stackoverflow (and other places) but they didnt help, some examples:</p>
<p><a href="https://stackoverflow.com/questions/16683337/connecting-to-a-mysql-database-from-php-error-but-no-error-shown">Connecting to a mysql database from php, error but no error shown?</a></p>
<p><a href="https://stackoverflow.com/questions/41878840/connection-of-mysql-with-php-not-working">Connection of MySQL with PHP not working</a></p>
| 0debug |
Sending data to Database in React.js web application : <p>I'm creating a web application and I'm curious how to send data to MySQL database in it. I have a function that is invoked when user presses button, I want this function somehow to send data to the MySQL server. Does anyone know how to approach this problem? I tried npm MySQL module but it seems the connection doesn't work as it is client side. Is there any other way of doing it? I need an idea to get me started. </p>
<p>Regards</p>
| 0debug |
Pandas: Ternary conditional operator for setting a value in a DataFrame : <p>I have a dataframe <code>pd</code>. I would like to change a value of column <code>irr</code> depending on whether it is above or below a thresh hold.</p>
<p>How can I do this in a single line? Now I have </p>
<pre><code>pd['irr'] = pd['irr'][pd['cs']*0.63 > pd['irr']] = 1.0
pd['irr'] = pd['irr'][pd['cs']*0.63 <= pd['irr']] = 0.0
</code></pre>
<p>The problem of course is that I change <code>irr</code> and check it again in the next line.</p>
<p>Is there something like a ternary conditional operator for pandas?</p>
| 0debug |
static void ioapic_common_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = ioapic_common_realize;
dc->vmsd = &vmstate_ioapic_common;
dc->no_user = 1;
}
| 1threat |
Is there any functional difference between AtomicInteger.updateAndGet() and AtomicInteger.accumulateAndGet()? : <p>Is there any scenario in which <code>AtomicInteger.accumulateAndGet()</code> can't be replaced with <code>AtomicInteger.updateAndGet()</code>, or is it just a convenience for method references?</p>
<p>Here's a simple example where I don't see any functional difference:</p>
<pre><code>AtomicInteger i = new AtomicInteger();
i.accumulateAndGet(5, Math::max);
i.updateAndGet(x -> Math.max(x, 5));
</code></pre>
<p>Obviously, the same goes for <code>getAndUpdate()</code> and <code>getAndAccumulate()</code>.</p>
| 0debug |
C how to insert string into array? : I want to insert string to the array until I type "ok". Why I am getting just "ok" and original array at the output?
int main(void)
{
char b[20];
char* str[10] = { "1","2" };
int i = 2;
while (1) {
gets(b);
if (strcmp(b, "ok") == 0) break;
str[i] = b;
i++;
}
for (int j = 0; j < i; j++)
printf("%s ", str[j]);
return 0;
} | 0debug |
Need syntax in batch to concat %var_1% and "VarText" eg Dir *.Jpg > %%Var_1 + filenam.txt : Goal: In a batch file, append or concatenate the text in Var_1 with the string "JpgList" and add the extension .txt to the output file
In the batch, Dir *.Jpg > JpgList.txt works.
In the batch, I have already retrieved a Variable %Var_1%
Problem is: concatenating the Var with the literal string "JpgList" and appending .txt as the output filename.
Here are code examples of what I have tried along with pseudo code that fails
Some produce a .txt file with no name
some produce nothing
some produce a file with the Var_1 name, but no content in file
dir *.jpg Var_1 + jpgList.txt
dir > %label_% >>".txt"
dir > %%label_%% >>".txt"
etc
I have tried every which way but upside down to put this together, and
appreciate any tips or syntax for making the code work.
Thanks | 0debug |
can anyone please tell me how to create a custom datePicker view in android. I have searched the whole google but could not find it. : <p>I want to learn how to create custom android views. I don't want to use any library. I have looked searched for it.</p>
| 0debug |
subtract two row's values within same column using Mysql group by ID : I have table like shown below. I want to do partition and then subtract the values in the same column to get the difference.
Since there is no partition or equalent function available in the mysql
Can anyone get me an idea of how to do it..
I have worked out the partition but not the other part
SELECT ID,Date,@row_number:=CASE WHEN @ID=ID THEN @row_number+1 ELSE 1 END AS row_number,@ID:=ID AS ID,value
FROM table1, (SELECT @row_number:=0,@ID:='') AS t
ORDER BY id,Date;
ID Date Value
1001 24-07-2017 09:43 10
1002 24-07-2017 09:43 11
1003 22-08-2017 21:42 10
1001 07-09-2017 20:33 11
1003 07-09-2017 20:33 44
1002 24-07-2017 09:43 55
1004 07-09-2017 20:33 66
[enter image description here][1]
Output should be:
rowno ID Date Value Diff
1 1001 24-07-2017 09:43 10 N/A
2 1001 07-09-2017 20:33 11 1
1 1002 24-07-2017 09:43 11 N/A
2 1002 24-07-2017 09:43 55 44
1 1003 22-08-2017 21:42 10 n/A
2 1003 07-09-2017 20:33 44 34
1 1004 07-09-2017 20:33 66 N/A
[enter image description here][2]
[1]: https://i.stack.imgur.com/ijm9L.jpg
[2]: https://i.stack.imgur.com/jwp1E.jpg | 0debug |
Ruby Rails - Where to start my understanding : <p>I'm trying to learn code and currently running through the exercises within codecademy for Rails.</p>
<p>Though I find this a good learning resource, i'm struggling to understand the relevance of the commands etc to "real life", so I can relate to it.</p>
<p>Can anyone recommend "real life" projects to work through on line re. rails, so I can piece all the fundamental pieces together, whilst seeing what my actions do to the outcome project.</p>
<p>Thank you in advance.</p>
<p>Brendan</p>
| 0debug |
static void unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
{
int i, j, k;
int coding_mode;
int motion_x[6];
int motion_y[6];
int last_motion_x = 0;
int last_motion_y = 0;
int prior_last_motion_x = 0;
int prior_last_motion_y = 0;
int current_macroblock;
int current_fragment;
debug_vp3(" vp3: unpacking motion vectors\n");
if (s->keyframe) {
debug_vp3(" keyframe-- there are no motion vectors\n");
} else {
memset(motion_x, 0, 6 * sizeof(int));
memset(motion_y, 0, 6 * sizeof(int));
coding_mode = get_bits(gb, 1);
debug_vectors(" using %s scheme for unpacking motion vectors\n",
(coding_mode == 0) ? "VLC" : "fixed-length");
for (i = 0; i < s->u_superblock_start; i++) {
for (j = 0; j < 4; j++) {
current_macroblock = s->superblock_macroblocks[i * 4 + j];
if ((current_macroblock == -1) ||
(!s->macroblock_coded[current_macroblock]))
continue;
current_fragment = s->macroblock_fragments[current_macroblock * 6];
switch (s->all_fragments[current_fragment].coding_method) {
case MODE_INTER_PLUS_MV:
case MODE_GOLDEN_MV:
if (coding_mode == 0) {
motion_x[0] = get_motion_vector_vlc(gb);
motion_y[0] = get_motion_vector_vlc(gb);
} else {
motion_x[0] = get_motion_vector_fixed(gb);
motion_y[0] = get_motion_vector_fixed(gb);
}
for (k = 1; k < 6; k++) {
motion_x[k] = motion_x[0];
motion_y[k] = motion_y[0];
}
if (s->all_fragments[current_fragment].coding_method ==
MODE_INTER_PLUS_MV) {
prior_last_motion_x = last_motion_x;
prior_last_motion_y = last_motion_y;
last_motion_x = motion_x[0];
last_motion_y = motion_y[0];
}
break;
case MODE_INTER_FOURMV:
motion_x[4] = motion_y[4] = 0;
for (k = 0; k < 4; k++) {
if (coding_mode == 0) {
motion_x[k] = get_motion_vector_vlc(gb);
motion_y[k] = get_motion_vector_vlc(gb);
} else {
motion_x[k] = get_motion_vector_fixed(gb);
motion_y[k] = get_motion_vector_fixed(gb);
}
motion_x[4] += motion_x[k];
motion_y[4] += motion_y[k];
}
if (motion_x[4] >= 0)
motion_x[4] = (motion_x[4] + 2) / 4;
else
motion_x[4] = (motion_x[4] - 2) / 4;
motion_x[5] = motion_x[4];
if (motion_y[4] >= 0)
motion_y[4] = (motion_y[4] + 2) / 4;
else
motion_y[4] = (motion_y[4] - 2) / 4;
motion_y[5] = motion_y[4];
prior_last_motion_x = last_motion_x;
prior_last_motion_y = last_motion_y;
last_motion_x = motion_x[3];
last_motion_y = motion_y[3];
break;
case MODE_INTER_LAST_MV:
motion_x[0] = last_motion_x;
motion_y[0] = last_motion_y;
for (k = 1; k < 6; k++) {
motion_x[k] = motion_x[0];
motion_y[k] = motion_y[0];
}
break;
case MODE_INTER_PRIOR_LAST:
motion_x[0] = prior_last_motion_x;
motion_y[0] = prior_last_motion_y;
for (k = 1; k < 6; k++) {
motion_x[k] = motion_x[0];
motion_y[k] = motion_y[0];
}
prior_last_motion_x = last_motion_x;
prior_last_motion_y = last_motion_y;
last_motion_x = motion_x[0];
last_motion_y = motion_y[0];
break;
}
debug_vectors(" vectors for macroblock starting @ fragment %d (coding method %d):\n",
current_fragment,
s->all_fragments[current_fragment].coding_method);
for (k = 0; k < 6; k++) {
current_fragment =
s->macroblock_fragments[current_macroblock * 6 + k];
s->all_fragments[current_fragment].motion_x = motion_x[k];
s->all_fragments[current_fragment].motion_x = motion_y[k];
debug_vectors(" vector %d: fragment %d = (%d, %d)\n",
k, current_fragment, motion_x[k], motion_y[k]);
}
}
}
}
}
| 1threat |
*ngFor running an infinite loop in angular2 : <p>I am trying to render object properties using keys in angular2 using below code:</p>
<pre><code><ul>
<li *ngFor="let element of componentModel | keys;let i=index">
{{element.key}}--{{element.value}} // 1---Bhushan...loaded only once
<span *ngIf="element">{{ loadProperty(i,element) }}</span>
</li>
</ul>
</code></pre>
<p>But I am facing a problem here. The output in the browser in loaded only once.
but the method call i.e. <code>loadProperty(i,element)</code> is running in an infinite loop.</p>
<pre><code>loadProperty(i:number,element:any){
console.log(element.key+'========'+element.value);
console.log(element);
}
</code></pre>
<p>means on browser output </p>
<blockquote>
<p>(1---Bhushan)</p>
</blockquote>
<p>is displayed only once but on the console its running infinitely like below:</p>
<p><a href="https://i.stack.imgur.com/YN902.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YN902.png" alt="Snapshot of the console"></a></p>
<p>I want to call this method only once per iteration.</p>
<p>any inputs?</p>
| 0debug |
Bubble sort in java , method (static or non staic)? ,(void or int[] )?,instance variable needed? : <p>Can someone explain for me when do I use static /non-static
, void or int[]x , and when do I use instance variables </p>
<p>because I can't seem to figure out which is when resulting in errors like this in the bubble sort code</p>
<pre><code>public class PA2 {
//int []a ;
//int maxsize ;
//int temp;
public static int[] bubblesort(int [] a1) {
int temp ;
for(int i=0;i<a.length-1;i++) {
for(int j=0 ; j<a.length-1-i;j++) {
if(a[i]>a[i+1])
temp = a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
}
public static void main(String[] args) {
int [] a1 = {11,5,14,10,2};
bubblesort(a1);
//a.bubblesort();
//a.selectionsort();
// a.insertionsort(); } }
</code></pre>
| 0debug |
i want to trace this method to know why it stop looping after the second record : <p>i wanna to make a button to loop in all records and do a method that makes a list from ranges between tow fields and pop another record from the list and but the value in result field </p>
<p>i make it like in the code below and it work well just in the first record and the second record it working but without remove the record form the list and it's important for me to remove it like
then it stop working </p>
<pre><code>class relate(models.Model):
_name = 'relate'
_rec_name = 'car'
@api.multi
@api.onchange('start', 'end', 'ignore')
def years_rang(self):
for rec in self.search([]):
if not rec.rang:
record = [int(x) for x in range(int(rec.start), int(rec.end) + 1)]
list = []
if rec.ignore:
try:
record.remove(int(self.ignore))
list= []
print(record)
except ValueError:
return {'warning': {'title': 'Warning!', 'message': "the Ignored year doesn't in range"}}
else:
for item in record:
range_id = self.env['yearrange'].create({'name': str(item)})
list.append(range_id.id)
rec.rang = [(4, x, None) for x in list]
else:
return
start = fields.Char(string="", required=False, )
end = fields.Char(string="", required=False, )
rang = fields.One2many(comodel_name="yearrange", inverse_name="product_id", store=True, string="Years" ,)
ignore = fields.Char(string="Ignore", required=False, )
class yearrange(models.Model):
_name = 'yearrange'
_rec_name = 'name'
name = fields.Char()
product_id = fields.Many2one(comodel_name="relate")
</code></pre>
<p>any kind of help will be appreciated</p>
| 0debug |
How to add custom header to ASP.NET Core Web API response : <p>I am porting my API from Web API 2 to ASP.NET Core Web API. I used to be able to add a custom header in the following manner:</p>
<pre><code> HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
response.Headers.Add("X-Total-Count", count.ToString());
return ResponseMessage(response);
</code></pre>
<p>How does one add a custom header in ASP.NET Core Web API?</p>
| 0debug |
How do I deal with installing peer dependencies in Angular CLI? : <p>I've found myself in an almost endless cycle of errors when trying to update my Angular CLI and NPM. Every time I update, I am met with WARN messages telling me to install peer dependencies (see below), but each time I install a dependency, I am met with more WARN messages. Is there a better way of handling this situation or does it seriously take hours?</p>
<pre><code>npm WARN @angular/animations@5.2.1 requires a peer of @angular/core@5.2.1
but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@5.1.0 requires a peer of typescript@>=2.4.2
<2.6 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-beta.6 requires a peer of
@angular/core@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-beta.6 requires a peer of
@angular/common@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-beta.6 requires a peer of
@angular/forms@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @schematics/angular@0.1.17 requires a peer of @angular-
devkit/core@0.0.29 but none is installed. You must install peer dependencies
yourself.
npm WARN @schematics/angular@0.1.17 requires a peer of @angular-
devkit/schematics@0.0.52 but none is installed. You must install peer
dependencies yourself.
npm WARN @schematics/schematics@0.0.11 requires a peer of @angular-
devkit/core@0.0.22 but none is installed. You must install peer dependencies
yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of
@angular/core@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of
@angular/common@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of @angular/platform-
browser@^4.0.0 but none is installed. You must install peer dependencies
yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of
@angular/animations@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN bootstrap@4.0.0-beta.2 requires a peer of jquery@1.9.1 - 3 but none
is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.0.0-beta.2 requires a peer of popper.js@^1.12.3 but
none is installed. You must install peer dependencies yourself.
npm WARN ng2-toasty@4.0.3 requires a peer of @angular/core@^2.4.7 || ^4.0.0
but none is installed. You must install peer dependencies yourself.
npm WARN ngx-carousel@1.3.5 requires a peer of @angular/core@^2.4.0 ||
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-carousel@1.3.5 requires a peer of @angular/common@^2.4.0 ||
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsickle@0.25.5 requires a peer of typescript@>=2.4.2 <2.6 but none
is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
</code></pre>
<p>I know I must be doing something wrong, but I'm new to Angular.</p>
| 0debug |
void ff_avg_h264_qpel8_mc12_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_midh_qrt_and_aver_dst_8w_msa(src - (2 * stride) - 2,
stride, dst, stride, 8, 0);
}
| 1threat |
C Code 'exits with non-zero status : I'm making a program in C that is supposed to ask for two numbers and find their LCM and GCF. However, after asking for those two numbers the code just exits with a non-zero status. [Link to code here](https://repl.it/NKgR/9), any help would be appreciated. | 0debug |
How to Auth to Google Cloud using Service Account in Python? : <p>Im trying to make a project that will upload google storage json file to BigQuery (just automate something that is done manually now).</p>
<p>And i'd like to use 'service account' for this as my script is going to be run on daily basis.</p>
<p>After reading everything i can found about using service account im still struggling to authenticate. </p>
<p>I wonder if someone could check and point me to what i missed?</p>
<p>Here is what i've done so far:</p>
<ol>
<li>Created json key file for service account</li>
<li>Installed client libraries: <code>pip install --upgrade
google-cloud-bigquery</code></li>
<li>Installed google cloud sdk according to: <a href="https://cloud.google.com/sdk/docs/" rel="noreferrer">https://cloud.google.com/sdk/docs/</a></li>
<li>Run <code>export GOOGLE_APPLICATION_CREDENTIALS=<path_to_service_account_file></code> with key path specified correctly</li>
</ol>
<p>Now im trying to run the following python script:</p>
<pre><code>from google.cloud import bigquery
bigquery_client = bigquery.Client()
</code></pre>
<p>i get this error:</p>
<p>google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or
explicitly create credential and re-run the application. For more
information, please see
<a href="https://developers.google.com/accounts/docs/application-default-credentials" rel="noreferrer">https://developers.google.com/accounts/docs/application-default-credentials</a>.</p>
<p>Im quite new to both python and google cloud API so possbily missed something,</p>
<p>Wonder if someone could point out where/what was wrong in my steps above or point me to clear instruction for dummys about setting up and running simple script with Bigquery using service account?</p>
| 0debug |
Write a PHP program that reads a word and prints the word in reverse. For example, if the user provides the input "Harry", the program prints yrraH : <p>Write a PHP program that reads a word and prints the word in reverse. For example, if the user provides the input "Harry", the program prints yrraH.</p>
<p>I've been stuck on this problem for a while now.
I was also given some tips on how to start off as given here;</p>
<p><strong>Hint: use a loop and the strlen() method for a string
strlen("Hello") will yield the value 5 since Hello has 5 characters
Strings can also be treated like an array, so for instance:
$s = "Hello";
print $s[0]; // this would yield H since H is in the 0 position of the string
Think about using a for loop that starts with the length of the string and counts backward.</strong></p>
<p>So far I've been going back and forth between the code but right now I can't even get myself to think of how to start the code.</p>
<p>Any help would be appreciated. </p>
| 0debug |
int css_do_tsch(SubchDev *sch, IRB *target_irb)
{
SCSW *s = &sch->curr_status.scsw;
PMCW *p = &sch->curr_status.pmcw;
uint16_t stctl;
uint16_t fctl;
uint16_t actl;
IRB irb;
int ret;
if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) {
ret = 3;
goto out;
}
stctl = s->ctrl & SCSW_CTRL_MASK_STCTL;
fctl = s->ctrl & SCSW_CTRL_MASK_FCTL;
actl = s->ctrl & SCSW_CTRL_MASK_ACTL;
memset(&irb, 0, sizeof(IRB));
memcpy(&irb.scsw, s, sizeof(SCSW));
if (stctl & SCSW_STCTL_STATUS_PEND) {
if (s->cstat & (SCSW_CSTAT_DATA_CHECK |
SCSW_CSTAT_CHN_CTRL_CHK |
SCSW_CSTAT_INTF_CTRL_CHK)) {
irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF;
irb.esw[0] = 0x04804000;
} else {
irb.esw[0] = 0x00800000;
}
if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) &&
(p->chars & PMCW_CHARS_MASK_CSENSE)) {
irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL;
memcpy(irb.ecw, sch->sense_data, sizeof(sch->sense_data));
irb.esw[1] = 0x01000000 | (sizeof(sch->sense_data) << 8);
}
}
copy_irb_to_guest(target_irb, &irb, p);
if (stctl & SCSW_STCTL_STATUS_PEND) {
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
if ((stctl != (SCSW_STCTL_INTERMEDIATE | SCSW_STCTL_STATUS_PEND)) ||
((fctl & SCSW_FCTL_HALT_FUNC) &&
(actl & SCSW_ACTL_SUSP))) {
s->ctrl &= ~SCSW_CTRL_MASK_FCTL;
}
if (stctl != (SCSW_STCTL_INTERMEDIATE | SCSW_STCTL_STATUS_PEND)) {
s->flags &= ~SCSW_FLAGS_MASK_PNO;
s->ctrl &= ~(SCSW_ACTL_RESUME_PEND |
SCSW_ACTL_START_PEND |
SCSW_ACTL_HALT_PEND |
SCSW_ACTL_CLEAR_PEND |
SCSW_ACTL_SUSP);
} else {
if ((actl & SCSW_ACTL_SUSP) &&
(fctl & SCSW_FCTL_START_FUNC)) {
s->flags &= ~SCSW_FLAGS_MASK_PNO;
if (fctl & SCSW_FCTL_HALT_FUNC) {
s->ctrl &= ~(SCSW_ACTL_RESUME_PEND |
SCSW_ACTL_START_PEND |
SCSW_ACTL_HALT_PEND |
SCSW_ACTL_CLEAR_PEND |
SCSW_ACTL_SUSP);
} else {
s->ctrl &= ~SCSW_ACTL_RESUME_PEND;
}
}
}
if (p->chars & PMCW_CHARS_MASK_CSENSE) {
memset(sch->sense_data, 0 , sizeof(sch->sense_data));
}
}
ret = ((stctl & SCSW_STCTL_STATUS_PEND) == 0);
out:
return ret;
}
| 1threat |
int v9fs_device_realize_common(V9fsState *s, Error **errp)
{
V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
int i, len;
struct stat stat;
FsDriverEntry *fse;
V9fsPath path;
int rc = 1;
QLIST_INIT(&s->free_list);
QLIST_INIT(&s->active_list);
for (i = 0; i < (MAX_REQ - 1); i++) {
QLIST_INSERT_HEAD(&s->free_list, &v->pdus[i], next);
v->pdus[i].s = s;
v->pdus[i].idx = i;
}
v9fs_path_init(&path);
fse = get_fsdev_fsentry(s->fsconf.fsdev_id);
if (!fse) {
error_setg(errp, "9pfs device couldn't find fsdev with the "
"id = %s",
s->fsconf.fsdev_id ? s->fsconf.fsdev_id : "NULL");
goto out;
}
if (!s->fsconf.tag) {
error_setg(errp, "fsdev with id %s needs mount_tag arguments",
s->fsconf.fsdev_id);
goto out;
}
s->ctx.export_flags = fse->export_flags;
s->ctx.fs_root = g_strdup(fse->path);
s->ctx.exops.get_st_gen = NULL;
len = strlen(s->fsconf.tag);
if (len > MAX_TAG_LEN - 1) {
error_setg(errp, "mount tag '%s' (%d bytes) is longer than "
"maximum (%d bytes)", s->fsconf.tag, len, MAX_TAG_LEN - 1);
goto out;
}
s->tag = g_strdup(s->fsconf.tag);
s->ctx.uid = -1;
s->ops = fse->ops;
s->fid_list = NULL;
qemu_co_rwlock_init(&s->rename_lock);
if (s->ops->init(&s->ctx) < 0) {
error_setg(errp, "9pfs Failed to initialize fs-driver with id:%s"
" and export path:%s", s->fsconf.fsdev_id, s->ctx.fs_root);
goto out;
}
if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
error_setg(errp,
"error in converting name to path %s", strerror(errno));
goto out;
}
if (s->ops->lstat(&s->ctx, &path, &stat)) {
error_setg(errp, "share path %s does not exist", fse->path);
goto out;
} else if (!S_ISDIR(stat.st_mode)) {
error_setg(errp, "share path %s is not a directory", fse->path);
goto out;
}
v9fs_path_free(&path);
rc = 0;
out:
if (rc) {
if (s->ops->cleanup && s->ctx.private) {
s->ops->cleanup(&s->ctx);
}
g_free(s->tag);
g_free(s->ctx.fs_root);
v9fs_path_free(&path);
}
return rc;
}
| 1threat |
Python type hints and context managers : <p>How should a context manager be annotated with Python type hints?</p>
<pre><code>import typing
@contextlib.contextmanager
def foo() -> ???:
yield
</code></pre>
<p>The <a href="https://docs.python.org/3.8/library/contextlib.html" rel="noreferrer">documentation on contextlib</a> doesn't mention types much.</p>
<p>The <a href="https://docs.python.org/3.6/library/typing.html#typing.ContextManager" rel="noreferrer">documentation on typing.ContextManager</a> is not all that helpful either.</p>
<p>There's also <a href="https://docs.python.org/3.8/library/typing.html#typing.Generator" rel="noreferrer">typing.Generator</a>, which at least has an example. Does that mean I should use <code>typing.Generator[None, None, None]</code> and not <code>typing.ContextManager</code>?</p>
<pre><code>import typing
@contextlib.contextmanager
def foo() -> typing.Generator[None, None, None]:
yield
</code></pre>
| 0debug |
Jquery for adding-delete button is not working : For one of my clients, I have developed an inquiry form as per the need. The data to be entered may be of multiples for which I designed the dynamic form so that the rows may be increased or decreased. The add button in the form is working fine but the delete button is not working.
Please check the [DEMO][1] and code is given below.
[1]: http://www.piperate.com/contact.html
<style type="text/css">
.k input { width:95px; margin: 2px;}
.i { width:40px; margin: 3px; text-align: center;}
.l { width:390px; margin: 3px; text-align: left;}
.j { width:95px; margin: 3px; text-align: center;}
.m { padding: 10px; margin: 5px; font-weight: bold; line-height: 25px;}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script> <!-- add /del rows -->
$(document).ready(function() {
var max_fields = 10; //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x = 1; //initlal text box count
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
if(x < max_fields){ //max input box allowed
x++; //text box increment
$(wrapper).append('<div><input type="text" class="i" name="sl[]"><input type="text" class="l" name="item[]"><input
type="text" class="j" name="unit[]"><input type="text" class="j" name="qty[]"/> <a href="#" class="remove_field">X</a></div>');
//add input box
}
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});
</script>
**DATE PICKER**
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script> <!-- date picker-->
$(document).ready(function() {
$(".datepicker").datepicker({ dateFormat: 'dd-M-yy' });
});
</script>
**HTML FORM**
<form method="post" action="xxx/enq.php">
<label>Name:</label>
<input type="text" name="com" />
<label>Required at: </label>
<input type="text" name="req2" />
<label> Location: </label>
<input type="text" name="place" />
<label>Required Dt: </label>
<input type="text" name="req1" class="datepicker" />
<div class="input_fields_wrap">
<table><tr><td class="i">SL </td><td class="l">ITEM DESCRIPTION</td>
<td class="j">UNIT</td><td class="j">QTY </td</tr></table>
<input type="text" class="i" name="sl[]"><input type="text" class="l" name="item[]">
<input type="text" class="j" name="unit[]"><input type="text" class="j" name="qty[]">
<button class="add_field_button">+</button>
</div>
<input type="submit" name='submit' onclick="show_confirm()" value="SUBMIT">
<input type="reset" value="CLEAR">
</form>
I have tried in number of ways and googled but in-vain. Could any one help me in this regard please. | 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
int x, y;
const int width= f->avctx->width;
const int height= f->avctx->height;
uint16_t *dst= (uint16_t*)f->current_picture.data[0];
const int stride= f->current_picture.linesize[0]>>1;
const unsigned int bitstream_size= AV_RL32(buf);
const int token_count av_unused = AV_RL32(buf + bitstream_size + 8);
unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4);
const uint8_t *prestream= buf + bitstream_size + 12;
if(prestream_size + bitstream_size + 12 != length
|| bitstream_size > (1<<26)
|| prestream_size > (1<<26)){
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length);
return -1;
}
prestream= read_huffman_tables(f, prestream);
init_get_bits(&f->gb, buf + 4, 8*bitstream_size);
prestream_size= length + buf - prestream;
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
memset((uint8_t*)f->bitstream_buffer + prestream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
f->last_dc= 0*128*8*8;
for(y=0; y<height; y+=16){
for(x=0; x<width; x+=16){
if(decode_i_mb(f) < 0)
return -1;
idct_put(f, x, y);
}
dst += 16*stride;
}
if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n");
return 0;
}
| 1threat |
Launch Screen storyboard not displaying image : <p>I'm trying to get an image to display as the launch screen from my Launch Screen.storyboard file, however the image never displays. I have labels that show up fine, but the image doesn't appear.</p>
<p>This is how the launch screen looks in the Launch Screen.storyboard file:
<a href="https://i.stack.imgur.com/Vjy5B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Vjy5B.png" alt="enter image description here"></a></p>
<p>However when I run the app on the simulator (as well as on the physical device) this is what shows up:</p>
<p><a href="https://i.stack.imgur.com/kjUeh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kjUeh.png" alt="enter image description here"></a></p>
<p>As you can see, the label "Test" shows up fine, however the image does not display. I'm really not sure why this is happening and nothing I try seems to work. If anyone has any ideas of how to fix this it would be greatly appreciated. </p>
| 0debug |
Call a already generated C code from java : <p>Is it possible to call the C code (which has been generated py Beremiz Editor) from java?
I dont want to edit the generated C code i just want to call it from my Java program.</p>
| 0debug |
ASP MVC Linq Query Error Some part of your SQL statement is nested too deeply : I have a linq query show in below but generating a server error. **Rewrite the query or break it up into smaller queries how I can solve it or or break it up into smaller queries Please advice me.** In my case my local server working fine with it but generating error in IIS live server.
| 0debug |
static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
vorbis_residue *vr,
uint_fast8_t ch,
uint_fast8_t *do_not_decode,
float *vec,
uint_fast16_t vlen,
int vr_type)
{
GetBitContext *gb = &vc->gb;
uint_fast8_t c_p_c = vc->codebooks[vr->classbook].dimensions;
uint_fast16_t ptns_to_read = vr->ptns_to_read;
uint_fast8_t *classifs = vr->classifs;
uint_fast8_t pass;
uint_fast8_t ch_used;
uint_fast8_t i,j,l;
uint_fast16_t k;
if (vr_type == 2) {
for (j = 1; j < ch; ++j)
do_not_decode[0] &= do_not_decode[j];
if (do_not_decode[0])
return 0;
ch_used = 1;
} else {
ch_used = ch;
}
AV_DEBUG(" residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c);
for (pass = 0; pass <= vr->maxpass; ++pass) {
uint_fast16_t voffset;
uint_fast16_t partition_count;
uint_fast16_t j_times_ptns_to_read;
voffset = vr->begin;
for (partition_count = 0; partition_count < ptns_to_read;) {
if (!pass) {
uint_fast32_t inverse_class = ff_inverse[vr->classifications];
for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) {
if (!do_not_decode[j]) {
uint_fast32_t temp = get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table,
vc->codebooks[vr->classbook].nb_bits, 3);
AV_DEBUG("Classword: %d \n", temp);
assert(vr->classifications > 1 && temp <= 65536);
for (i = 0; i < c_p_c; ++i) {
uint_fast32_t temp2;
temp2 = (((uint_fast64_t)temp) * inverse_class) >> 32;
if (partition_count + c_p_c - 1 - i < ptns_to_read)
classifs[j_times_ptns_to_read + partition_count + c_p_c - 1 - i] = temp - temp2 * vr->classifications;
temp = temp2;
}
}
j_times_ptns_to_read += ptns_to_read;
}
}
for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) {
for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) {
uint_fast16_t voffs;
if (!do_not_decode[j]) {
uint_fast8_t vqclass = classifs[j_times_ptns_to_read+partition_count];
int_fast16_t vqbook = vr->books[vqclass][pass];
if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {
uint_fast16_t coffs;
unsigned dim = vc->codebooks[vqbook].dimensions;
uint_fast16_t step = dim == 1 ? vr->partition_size
: FASTDIV(vr->partition_size, dim);
vorbis_codebook codebook = vc->codebooks[vqbook];
if (vr_type == 0) {
voffs = voffset+j*vlen;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l)
vec[voffs + k + l * step] += codebook.codevectors[coffs + l];
}
} else if (vr_type == 1) {
voffs = voffset + j * vlen;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l, ++voffs) {
vec[voffs]+=codebook.codevectors[coffs+l];
AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs);
}
}
} else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) {
voffs = voffset >> 1;
if (dim == 2) {
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;
vec[voffs + k ] += codebook.codevectors[coffs ];
vec[voffs + k + vlen] += codebook.codevectors[coffs + 1];
}
} else if (dim == 4) {
for (k = 0; k < step; ++k, voffs += 2) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;
vec[voffs ] += codebook.codevectors[coffs ];
vec[voffs + 1 ] += codebook.codevectors[coffs + 2];
vec[voffs + vlen ] += codebook.codevectors[coffs + 1];
vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3];
}
} else
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; l += 2, voffs++) {
vec[voffs ] += codebook.codevectors[coffs + l ];
vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];
AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l);
}
}
} else if (vr_type == 2) {
voffs = voffset;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l, ++voffs) {
vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l]; FIXME use if and counter instead of / and %
AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l);
}
}
}
}
}
j_times_ptns_to_read += ptns_to_read;
}
++partition_count;
voffset += vr->partition_size;
}
}
}
return 0;
}
| 1threat |
Jupyter Notebook error : <p>I am not able to run the notebook in my browser. It does not appear. The console is giving me the following error. I have Anaconda installed. Any help would be highly appreciated. Thanks</p>
<pre><code> C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\Cython\Distutils\old_build_ext.py:30: UserWarning: Cython.Distutils.old_build_ext does not properly handle dependencies and is deprecated.
"Cython.Distutils.old_build_ext does not properly handle dependencies "
_cffi_ext.c
AppData\Roaming\Python\Python35\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(209): fatal error C1083: Cannot open include file: 'sys/un.h': No such file or directory
Traceback (most recent call last):
File "C:\Users\Myamoto\Anaconda3\Scripts\jupyter-notebook-script.py", line 3, in <module>
import notebook.notebookapp
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\notebook\notebookapp.py", line 32, in <module>
from zmq.eventloop import ioloop
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\zmq\__init__.py", line 34, in <module>
from zmq import backend
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Myamoto\AppData\Roaming\Python\Python35\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
</code></pre>
| 0debug |
int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
bool exact_size)
{
BDRVQcowState *s = bs->opaque;
int new_l1_size2, ret, i;
uint64_t *new_l1_table;
int64_t new_l1_table_offset, new_l1_size;
uint8_t data[12];
if (min_size <= s->l1_size)
return 0;
if (exact_size) {
new_l1_size = min_size;
} else {
new_l1_size = s->l1_size;
if (new_l1_size == 0) {
new_l1_size = 1;
}
while (min_size > new_l1_size) {
new_l1_size = (new_l1_size * 3 + 1) / 2;
}
}
if (new_l1_size > INT_MAX) {
return -EFBIG;
}
#ifdef DEBUG_ALLOC2
fprintf(stderr, "grow l1_table from %d to %" PRId64 "\n",
s->l1_size, new_l1_size);
#endif
new_l1_size2 = sizeof(uint64_t) * new_l1_size;
new_l1_table = g_malloc0(align_offset(new_l1_size2, 512));
memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t));
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ALLOC_TABLE);
new_l1_table_offset = qcow2_alloc_clusters(bs, new_l1_size2);
if (new_l1_table_offset < 0) {
g_free(new_l1_table);
return new_l1_table_offset;
}
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
if (ret < 0) {
goto fail;
}
ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT,
new_l1_table_offset, new_l1_size2);
if (ret < 0) {
goto fail;
}
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_WRITE_TABLE);
for(i = 0; i < s->l1_size; i++)
new_l1_table[i] = cpu_to_be64(new_l1_table[i]);
ret = bdrv_pwrite_sync(bs->file, new_l1_table_offset, new_l1_table, new_l1_size2);
if (ret < 0)
goto fail;
for(i = 0; i < s->l1_size; i++)
new_l1_table[i] = be64_to_cpu(new_l1_table[i]);
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ACTIVATE_TABLE);
cpu_to_be32w((uint32_t*)data, new_l1_size);
cpu_to_be64wu((uint64_t*)(data + 4), new_l1_table_offset);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_size), data,sizeof(data));
if (ret < 0) {
goto fail;
}
g_free(s->l1_table);
qcow2_free_clusters(bs, s->l1_table_offset, s->l1_size * sizeof(uint64_t),
QCOW2_DISCARD_OTHER);
s->l1_table_offset = new_l1_table_offset;
s->l1_table = new_l1_table;
s->l1_size = new_l1_size;
return 0;
fail:
g_free(new_l1_table);
qcow2_free_clusters(bs, new_l1_table_offset, new_l1_size2,
QCOW2_DISCARD_OTHER);
return ret;
}
| 1threat |
JQuery : Select an element with N clases and not class X : <p>so i have a <code><div></code> that has 3 classes <code><div class='a b c'></code> and another <code><div></code> with 2 classes <code><div class='a b'></code> how can i select all the <code><div></code> that have classes A and B and not C.</p>
<p>Is this possible with JQuery?</p>
| 0debug |
static void s390_qemu_cpu_model_initfn(Object *obj)
{
} | 1threat |
crush on button click when i try to add dinamically items in listview : I have an activity named EfortActivity which contains 3 EditText, a Spinner and a RadioGroup and a Button - saveButton. My purpose is to add data dinamically in a ListView(the listView is implemented in another acitivity called HistoryActivity).
The problem is that when I click o the saveButton my app crash.
Here is the code in EfortActivity:
public class EfortMonitorizareActivity extends AppCompatActivity {
RadioGroup radioGroupDaNu;
Spinner spinnerTip;
EditText editTextDurata;
EditText editTextInainte;
EditText editTextDupa;
Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_efort_monitorizare);
intent = getIntent();
initializareComponente();
}
private void initializareComponente() {
radioGroupDaNu = (RadioGroup) findViewById(R.id.rg_activitateDANU);
spinnerTip = (Spinner) findViewById(R.id.spin_tip_efort);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getApplicationContext(),
R.array.TipEfort, R.layout.support_simple_spinner_dropdown_item);
spinnerTip.setAdapter(adapter);
editTextDurata = (EditText) findViewById(R.id.edt_durataAnt_efort);
editTextInainte = (EditText) findViewById(R.id.edt_greuteInainteAnt_efort);
editTextDupa = (EditText) findViewById(R.id.edt_greutateDupaAnt_efort);
Button btn_inregistrareDate = (Button) findViewById(R.id.btn_adaugaDate_efort);
btn_inregistrareDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (validare()) {
Efort efort = createPlayerFromComponents();
if (efort != null) {
intent.putExtra(Constants.ADD_EFORT_KEY,efort);
setResult(RESULT_OK,intent);
finish();
}
}
}
});
}
private Efort createPlayerFromComponents() {
RadioButton checkDaNu = (RadioButton) findViewById(radioGroupDaNu.getCheckedRadioButtonId());
String radioDaNu = checkDaNu.getText().toString();
String tip = spinnerTip.getSelectedItem().toString();
Integer durata = Integer.parseInt(editTextDurata.getText().toString());
Integer inainte = Integer.parseInt(editTextInainte.getText().toString());
Integer dupa = Integer.parseInt(editTextDupa.getText().toString());
return new Efort(radioDaNu, tip, durata, inainte, dupa);
}
private boolean validare() {
RadioButton nu = (RadioButton) findViewById(R.id.button_nu_efort);
if (editTextDurata.getText() == null || editTextDurata.getText().toString().trim().isEmpty()) {
Toast.makeText(getApplicationContext(), R.string.addplayer_number_error, Toast.LENGTH_SHORT).show();
return false;
}
if (editTextInainte.getText() == null || editTextDurata.getText().toString().trim().isEmpty()) {
Toast.makeText(getApplicationContext(), R.string.addplayer_number_error, Toast.LENGTH_SHORT).show();
return false;
}
if (editTextDupa.getText() == null || editTextDurata.getText().toString().trim().isEmpty()) {
Toast.makeText(getApplicationContext(), R.string.addplayer_number_error, Toast.LENGTH_SHORT).show();
return false;
} }
Here is the code for HistoryActivity:
public class IstoricActivity extends AppCompatActivity {
ListView lvEfort;
List<String> listaEfort = new ArrayList<>();
Button deconectare;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_istoric);
deconectare=(Button)findViewById(R.id.btn_deconectareIstoric);
deconectare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
//initializare componente
lvEfort = (ListView) findViewById(R.id.lw_listaEfort);
Efort efortDefault = new Efort("Da", "Tennis", 40, 55, 53);
listaEfort.add(efortDefault.toString());
//declarare + initializare adapter
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, listaEfort);
lvEfort.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
}
And the class Efort:
public class Efort implements Parcelable {
private String radioDaNu;
private String tip;
private Integer durata;
private Integer inainte;
private Integer dupa;
public Efort(String radioDaNu, String tip, Integer durata, Integer inainte, Integer dupa) {
this.radioDaNu = radioDaNu;
this.tip = tip;
this.durata = durata;
this.inainte = inainte;
this.dupa = dupa;
}
public String getRadioDaNu() {
return radioDaNu;
}
public void setRadioDaNu(String radioDaNu) {
this.radioDaNu = radioDaNu;
}
public String getTip() {
return tip;
}
public void setTip(String tip) {
this.tip = tip;
}
public Integer getDurata() {
return durata;
}
public void setDurata(Integer durata) {
this.durata = durata;
}
public Integer getInainte() {
return inainte;
}
public void setInainte(Integer inainte) {
this.inainte = inainte;
}
public Integer getDupa() {
return dupa;
}
public void setDupa(Integer dupa) {
this.dupa = dupa;
}
@Override
public String toString() {
return "Efort{" +
// ", datePicker=" + datePicker +
", Activitate efort :" + radioDaNu +
", tip : '" + tip + '\'' +
", tipm de : " + durata +
", inainte de antrenamnet aveam : " + inainte +
", dupa antrenamnet am : " + dupa +
'}';
}
public Efort(Parcel in) {
this.radioDaNu = in.readString();
this.tip = in.readString();
this.durata = in.readInt();
this.inainte = in.readInt();
this.dupa = in.readInt();
}
public static Parcelable.Creator<Efort> CREATOR = new Creator<Efort>() {
@Override
public Efort createFromParcel(Parcel parcel) {
return new Efort(parcel);
}
@Override
public Efort[] newArray(int i) {
return new Efort[i];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(radioDaNu);
parcel.writeString(tip);
parcel.writeInt(durata);
parcel.writeInt(inainte);
parcel.writeInt(dupa);
}
}
| 0debug |
void qemu_savevm_state_begin(QEMUFile *f,
const MigrationParams *params)
{
SaveStateEntry *se;
int ret;
trace_savevm_state_begin();
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
if (!se->ops || !se->ops->set_params) {
continue;
}
se->ops->set_params(params, se->opaque);
}
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
if (!se->ops || !se->ops->save_live_setup) {
continue;
}
if (se->ops && se->ops->is_active) {
if (!se->ops->is_active(se->opaque)) {
continue;
}
}
save_section_header(f, se, QEMU_VM_SECTION_START);
ret = se->ops->save_live_setup(f, se->opaque);
if (ret < 0) {
qemu_file_set_error(f, ret);
break;
}
}
} | 1threat |
static void decode_v4_vector(CinepakEncContext *s, AVPicture *sub_pict, int *v4_vector, strip_info *info)
{
int i, x, y, entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4;
for(i = y = 0; y < 4; y += 2) {
for(x = 0; x < 4; x += 2, i++) {
sub_pict->data[0][x + y*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size];
sub_pict->data[0][x+1 + y*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+1];
sub_pict->data[0][x + (y+1)*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+2];
sub_pict->data[0][x+1 + (y+1)*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+3];
if(s->pix_fmt == AV_PIX_FMT_YUV420P) {
sub_pict->data[1][(x>>1) + (y>>1)*sub_pict->linesize[1]] = info->v4_codebook[v4_vector[i]*entry_size+4];
sub_pict->data[2][(x>>1) + (y>>1)*sub_pict->linesize[2]] = info->v4_codebook[v4_vector[i]*entry_size+5];
}
}
}
}
| 1threat |
static int coroutine_fn cow_co_is_allocated(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *num_same)
{
int64_t bitnum = sector_num + sizeof(struct cow_header_v2) * 8;
uint64_t offset = (bitnum / 8) & -BDRV_SECTOR_SIZE;
bool first = true;
int changed = 0, same = 0;
do {
int ret;
uint8_t bitmap[BDRV_SECTOR_SIZE];
bitnum &= BITS_PER_BITMAP_SECTOR - 1;
int sector_bits = MIN(nb_sectors, BITS_PER_BITMAP_SECTOR - bitnum);
ret = bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap));
if (ret < 0) {
return ret;
}
if (first) {
changed = cow_test_bit(bitnum, bitmap);
first = false;
}
same += cow_find_streak(bitmap, changed, bitnum, nb_sectors);
bitnum += sector_bits;
nb_sectors -= sector_bits;
offset += BDRV_SECTOR_SIZE;
} while (nb_sectors);
*num_same = same;
return changed;
}
| 1threat |
React functions inside render() : <p>Is there a preference on where you put functions inside a react component. I am still learning react so just trying to figure out the best practices. </p>
<pre><code>class Content extends React.Component {
/// Whats the difference between putting functions here such as
Hello(){
}
render(){
/// or here
Hello(){
}
return()(
<div>blah blah </div>
)
}
}
</code></pre>
| 0debug |
Making copies of large lists to trigger change detection for pure pipes in Angular 2 affecting performance : <p>I have an array <code>a</code> containing 50,000+ objects and I have a pipe which takes this array <code>a</code> and transforms this into some output which is then displayed in the view.</p>
<p>The pipe is pure meaning that only when the reference to array <code>a</code> changes will it re-evaluate.</p>
<p>I have a method <code>modifyArray</code> which adds/removes some elements from array <code>a</code>. When completed I would like the pipe to be re-evaluated so that the view re-renders.</p>
<p>Because of the way that Angular enforces immutability, the only option I have for the pipe to be re-evaluated is for the method <code>modifyArray</code> to return a copy of array <code>a</code> with the changes applied, so that Angular can detect that the reference has changed and trigger the pipe, something like this:</p>
<pre><code>modifyArray(a: T[]): T[] {
a.push(b);
a.slice(c);
return [...a];
}
</code></pre>
<p>However for such an array with 50,000+ elements, there is a real performance degradation when making a copy of the array.</p>
<p>I would have expected that explicitly triggering change detection after invocation of this method, for example by calling <code>ApplicationRef.tick()</code> or <code>ChangeDetectorRef.detectChanges()</code>, would allow Angular to figure out that the array has been modified, but this is not the case:</p>
<pre><code>this.a = modifyArray(a);
this.applicationRef.tick();
</code></pre>
<p>Making a copy of the array is not an option as the data set is too large. Making the pipe not pure is also not an option as the transformation the pipe applies to the input is expensive.</p>
<p>Does anyone have any ideas on how this can be achieved?</p>
| 0debug |
Swift: UnsafeMutablePointer.deinitialize fatal error with negative count when appending to array : <p>The code below generates this error (appending to <code>exporters</code>):</p>
<blockquote>
<p>fatal error: UnsafeMutablePointer.deinitialize with negative count</p>
</blockquote>
<pre><code> var exporters = [AVAssetExportSession]()
let exporter = AVAssetExportSession(asset: mainComposition, presetName: AVAssetExportPresetHighestQuality)!
exporter.videoComposition = videoComposition
exporter.outputFileType = AVFileTypeMPEG4
exporter.outputURL = exportURL
exporter.shouldOptimizeForNetworkUse = true
exporters.append(exporter)
</code></pre>
<p>The other posts on StackOverflow regarding <code>UnsafeMutablePointer.deinitialize</code> do not shed much light on the issue, which doesn't happen consistently.</p>
<p>Any ideas?</p>
| 0debug |
static int vfio_pci_hot_reset_multi(VFIOPCIDevice *vdev)
{
return vfio_pci_hot_reset(vdev, false);
}
| 1threat |
How to translate this line of code from C++ to Objective-C : <p>I need to translate this line from C++ to Objective-C
but I don't really understand this line</p>
<pre><code>IntVar* MakeIntVar(int64 vmin, int64 vmax, const std::string& name);
</code></pre>
<p>This seems to be for me a function without a return value? </p>
<p>IntVar is by the way a class</p>
<pre><code>class IntVar;
</code></pre>
| 0debug |
static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
{
BlockDriverState *old_bs = child->bs;
if (old_bs) {
if (old_bs->quiesce_counter && child->role->drained_end) {
child->role->drained_end(child);
}
QLIST_REMOVE(child, next_parent);
}
child->bs = new_bs;
if (new_bs) {
QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent);
if (new_bs->quiesce_counter && child->role->drained_begin) {
child->role->drained_begin(child);
}
}
}
| 1threat |
PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
{
PXA2xxState *s;
int i;
DriveInfo *dinfo;
s = g_new0(PXA2xxState, 1);
s->cpu = cpu_arm_init("pxa255");
if (s->cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
memory_region_init_ram(&s->sdram, NULL, "pxa255.sdram", sdram_size,
&error_fatal);
vmstate_register_ram_global(&s->sdram);
memory_region_add_subregion(address_space, PXA2XX_SDRAM_BASE, &s->sdram);
memory_region_init_ram(&s->internal, NULL, "pxa255.internal",
PXA2XX_INTERNAL_SIZE, &error_fatal);
vmstate_register_ram_global(&s->internal);
memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE,
&s->internal);
s->pic = pxa2xx_pic_init(0x40d00000, s->cpu);
s->dma = pxa255_dma_init(0x40000000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_DMA));
sysbus_create_varargs("pxa25x-timer", 0x40a00000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 0),
qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 1),
qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 2),
qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 3),
NULL);
s->gpio = pxa2xx_gpio_init(0x40e00000, s->cpu, s->pic, 85);
dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) {
fprintf(stderr, "qemu: missing SecureDigital device\n");
exit(1);
}
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,
blk_by_legacy_dinfo(dinfo),
qdev_get_gpio_in(s->pic, PXA2XX_PIC_MMC),
qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_MMCI),
qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_MMCI));
for (i = 0; pxa255_serial[i].io_base; i++) {
if (serial_hds[i]) {
serial_mm_init(address_space, pxa255_serial[i].io_base, 2,
qdev_get_gpio_in(s->pic, pxa255_serial[i].irqn),
14745600 / 16, serial_hds[i],
DEVICE_NATIVE_ENDIAN);
} else {
break;
}
}
if (serial_hds[i])
s->fir = pxa2xx_fir_init(address_space, 0x40800000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_ICP),
qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_ICP),
qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_ICP),
serial_hds[i]);
s->lcd = pxa2xx_lcdc_init(address_space, 0x44000000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_LCD));
s->cm_base = 0x41300000;
s->cm_regs[CCCR >> 2] = 0x02000210;
s->clkcfg = 0x00000009;
memory_region_init_io(&s->cm_iomem, NULL, &pxa2xx_cm_ops, s, "pxa2xx-cm", 0x1000);
memory_region_add_subregion(address_space, s->cm_base, &s->cm_iomem);
vmstate_register(NULL, 0, &vmstate_pxa2xx_cm, s);
pxa2xx_setup_cp14(s);
s->mm_base = 0x48000000;
s->mm_regs[MDMRS >> 2] = 0x00020002;
s->mm_regs[MDREFR >> 2] = 0x03ca4000;
s->mm_regs[MECR >> 2] = 0x00000001;
memory_region_init_io(&s->mm_iomem, NULL, &pxa2xx_mm_ops, s, "pxa2xx-mm", 0x1000);
memory_region_add_subregion(address_space, s->mm_base, &s->mm_iomem);
vmstate_register(NULL, 0, &vmstate_pxa2xx_mm, s);
s->pm_base = 0x40f00000;
memory_region_init_io(&s->pm_iomem, NULL, &pxa2xx_pm_ops, s, "pxa2xx-pm", 0x100);
memory_region_add_subregion(address_space, s->pm_base, &s->pm_iomem);
vmstate_register(NULL, 0, &vmstate_pxa2xx_pm, s);
for (i = 0; pxa255_ssp[i].io_base; i ++);
s->ssp = g_new0(SSIBus *, i);
for (i = 0; pxa255_ssp[i].io_base; i ++) {
DeviceState *dev;
dev = sysbus_create_simple(TYPE_PXA2XX_SSP, pxa255_ssp[i].io_base,
qdev_get_gpio_in(s->pic, pxa255_ssp[i].irqn));
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
}
if (usb_enabled()) {
sysbus_create_simple("sysbus-ohci", 0x4c000000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
}
s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000);
s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000);
sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM));
s->i2c[0] = pxa2xx_i2c_init(0x40301600,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_I2C), 0xffff);
s->i2c[1] = pxa2xx_i2c_init(0x40f00100,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_PWRI2C), 0xff);
s->i2s = pxa2xx_i2s_init(address_space, 0x40400000,
qdev_get_gpio_in(s->pic, PXA2XX_PIC_I2S),
qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_I2S),
qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_I2S));
qdev_connect_gpio_out(s->gpio, 1, s->reset);
return s;
}
| 1threat |
How can I make this function work with php 7.2? : <p>I have this piece of code that works fine with php5.6 but it breaks with php7.2.
I had three errors and I was able to fix two, I believe :)</p>
<pre><code>$link = mysql_connect($hostname, $username, $password);
if (!$link) {
die('Could not connect !');
exit();
}
else{
mysql_set_charset('utf8',$link);
mysql_select_db($database, $link) or die('Could not select database.');
}
</code></pre>
<p>this is what I have so far</p>
<pre><code>$link = mysqli_connect($hostname, $username, $password);
if (!$link) {
die('Could not connect !');
exit();
}
else{
mysqli_set_charset('utf8',$link);
mysqli_select_db($database, $link) or die('Could not select database.');
}
</code></pre>
<p><strong>Fatal error</strong> with mysql_select_db()</p>
<p>How can I make this function work with php 7.2? any help will be greatly appreciated, thank you in advance!!</p>
| 0debug |
static int vscsi_send_iu(VSCSIState *s, vscsi_req *req,
uint64_t length, uint8_t format)
{
long rc, rc1;
rc = spapr_vio_dma_write(&s->vdev, req->crq.s.IU_data_ptr,
&req->iu, length);
if (rc) {
fprintf(stderr, "vscsi_send_iu: DMA write failure !\n");
}
req->crq.s.valid = 0x80;
req->crq.s.format = format;
req->crq.s.reserved = 0x00;
req->crq.s.timeout = cpu_to_be16(0x0000);
req->crq.s.IU_length = cpu_to_be16(length);
req->crq.s.IU_data_ptr = req->iu.srp.rsp.tag;
if (rc == 0) {
req->crq.s.status = 0x99;
} else {
req->crq.s.status = 0x00;
}
rc1 = spapr_vio_send_crq(&s->vdev, req->crq.raw);
if (rc1) {
fprintf(stderr, "vscsi_send_iu: Error sending response\n");
return rc1;
}
return rc;
}
| 1threat |
Stacked TouchableOpacity inside another TouchableOpacity is not clickable : <p>Even though this document (<a href="https://facebook.github.io/react-native/docs/gesture-responder-system.html" rel="noreferrer">https://facebook.github.io/react-native/docs/gesture-responder-system.html</a>) states, that touch events are passed down to the children and are only consumed by a parent, if the child doesn't react on the event, I face the issue, that a TouchableOpacity nested inside another TouchableOpacity doesn't react properly on touches.</p>
<p>My structure is like follows</p>
<pre><code><ScrollView>
<TouchableOpacity onPress={() => console.log('This is printed always')}>
<View>
<Text>I can click here</Text>
<TouchableOpacity onPress={() => console.log('This is printed never')}>
<Text>I can click here but the outer onPress is called instead of the inner one</text>
</TouchableOpacity>
</View>
</TouchableOpacity>
</ScrollView>
</code></pre>
<p>The same happens for Buttons inside TouchableOpacitys: Clicking the Buttons calls the onPress method of the parent TouchableOpacity</p>
<p>Am I overseeing something?</p>
| 0debug |
How do i use Qvarient in cpp for set functions : <p>I want to pass values from qml to set function written in Qt cpp, the values that will be passed is of different data types, example int or string, I will be writing only one set function in cpp which will take this values and return Qstring or int or double.How can I write a code for this.</p>
| 0debug |
How can I convert epoch time in microseconds to readable format : <p>I have integer like this, 1522711404881438, it is the epoch time in microseconds. How can I convert it to human readable format, something like, <code>2018-04-03 11:22:33.123456</code>. My local time is GMT-7:00 time zone.</p>
<p>Thanks!</p>
| 0debug |
Producer consumer in c, algorithm : I was reading Galvin OS book about producer consumer problem and came through this piece of code,
Initially and shared are,
#define BUFFER SIZE 10
typedef struct {
. . .
}item;
int in =0;
int out=0;
**Producer**
item next produced;
while (true) {
while (((in + 1) % BUFFER SIZE ) == out)
; /* do nothing */
buffer[in] = next produced;
in = (in + 1) % BUFFER SIZE ;
}
**Consumer**
item next consumed;
while (true) {
while (in == out)
; /* do nothing */
next consumed = buffer[out];
out = (out + 1) % BUFFER SIZE ;
/* consume the item in next consumed */
}
Now this is what Galvin book says,
>This scheme allows at most BUFFER SIZE − 1 items in the buffer at the
same time. We leave it as an exercise for you to provide a solution in which
BUFFER SIZE items can be in the buffer at the same time.
This is what I came up with. Is this correct?
**Producer**
item next produced;
while (true) {
buffer[in] = next produced; //JUST MOVED THIS LINE!
while (((in + 1) % BUFFER SIZE ) == out)
; /* do nothing */
in = (in + 1) % BUFFER SIZE ;
}
**Consumer**
item next consumed;
while (true) {
while (in == out)
; /* do nothing */
next consumed = buffer[out];
out = (out + 1) % BUFFER SIZE ;
/* consume the item in next consumed */
}
I think this solves! but is this correct? Correct me if i am wrong? Any other better solution possible?
| 0debug |
static void bmds_set_aio_inflight(BlkMigDevState *bmds, int64_t sector_num,
int nb_sectors, int set)
{
int64_t start, end;
unsigned long val, idx, bit;
start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK;
end = (sector_num + nb_sectors - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK;
for (; start <= end; start++) {
idx = start / (sizeof(unsigned long) * 8);
bit = start % (sizeof(unsigned long) * 8);
val = bmds->aio_bitmap[idx];
if (set) {
val |= 1UL << bit;
} else {
val &= ~(1UL << bit);
}
bmds->aio_bitmap[idx] = val;
}
}
| 1threat |
Whoops, looks like something went wrong. + laravel log : <p>Im getting error <strong>Whoops, looks like something went wrong</strong> when im trying to open my site.
Laravel.log below.
Any ideas?
I can not find the reason.</p>
<pre><code> [2018-02-12 15:54:33] local.ERROR: ErrorException: Undefined offsetlocal.ERROR: ErrorException: Undefined offset: 1 in /var/www/html/app/Http/Controllers/GameController.php:1187
Stack trace:
#0 /var/www/html/app/Http/Controllers/GameController.php(1187): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/var/www/html/a...', 1187, Array)
#1 /var/www/html/storage/framework/views/d9e75a6376cb0f1bf817fd268d5b1ee4(70): App\Http\Controllers\GameController::getActualCurs(0)
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/var/www/html/s...')
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(58): Illuminate\View\Engines\PhpEngine->evaluatePath('/var/www/html/s...', Array)
</code></pre>
| 0debug |
def trim_tuple(test_list, K):
res = []
for ele in test_list:
N = len(ele)
res.append(tuple(list(ele)[K: N - K]))
return (str(res)) | 0debug |
printing function and pass into onther function : [enter image description here][1]e`
What does it mean passing Fun. to other who does it work'is it because we need a specify average grade so at first the programme well chooses A or b etc and then calculate using the get average? why if u do the opposite it
and why we use return instead of print (my guess 'is it because it has to calculate or there is another answer?
[1]: https://i.stack.imgur.com/BWzvq.png | 0debug |
static int img_open_password(BlockBackend *blk, const char *filename,
int flags, bool quiet)
{
BlockDriverState *bs;
char password[256];
bs = blk_bs(blk);
if (bdrv_is_encrypted(bs) && !(flags & BDRV_O_NO_IO)) {
qprintf(quiet, "Disk image '%s' is encrypted.\n", filename);
if (qemu_read_password(password, sizeof(password)) < 0) {
error_report("No password given");
return -1;
}
if (bdrv_set_key(bs, password) < 0) {
error_report("invalid password");
return -1;
}
}
return 0;
}
| 1threat |
why i cant break nor exit a while loop : <p>for some reason when I type "exit" or "EXIT" the loop continues to iterate</p>
<p>I tried breaking using variables and the break statement</p>
<pre class="lang-py prettyprint-override"><code>obj = 1
while obj != None:
a = input("enter a number:\n")
b = input("enter a number:\n")
try:
int(a)
int(b)
print("succes!")
except ValueError:
print("you didnt enterd numbers")
continue
print("what do yo want to do?\n")
donxt = input("for exit the program type EXIT, to continue tap CONTINUE:\n")
if donxt == "continue" or "CONTINUE":
continue
elif donxt == "EXIT" or "exit":
obj = None
</code></pre>
| 0debug |
SQL query to Postgres Query : select a.TABLESPACE_NAME ,a.MAXBYTES,a.MBYTES,(a.MAXBYTES-a.MBYTES),round(((a.MAXBYTES-a.MBYTES)/a.MAXBYTES)*100,2) as fieldvalues
from
(select TABLESPACE_NAME,sum(MAXBYTES/1024/1024) MAXBYTES,sum(BYTES/1024/1024) MBYTES from dba_data_files
where TABLESPACE_NAME in (select TABLESPACE_NAME from dba_segments where owner='TEST') group by TABLESPACE_NAME) a,
(select TABLESPACE_NAME,sum(BYTES/1024/1024) MBYTES from dba_free_space where TABLESPACE_NAME in (select TABLESPACE_NAME from dba_segments where owner='TEST') group by TABLESPACE_NAME) b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME order by a.TABLESPACE_NAME; | 0debug |
I am new to openCV and javaCV and i am trying the following code but getting 'ImageGenerator' cannot be resolve. Anybody can help me out? : I have imported the required libraries of javacv and opencv. I need to import more libraries? if yes may i know the name? coz i have seacrhed it so much, but could not find it!!!
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.nio.ByteBuffer;
import javax.naming.Context;
enum Resolution {
NORMAL, HIGH
}
public class KinectCapture
{
private BufferedImage image = null;
private int imWidth, imHeight;
private int fps;
private boolean isReleased = true;
// when Kinect context has been released
// OpenNI
private Context context;
private ImageGenerator imageGen; **Here I am getting the error.**
public KinectCapture()
{ this(Resolution.NORMAL); }
public KinectCapture(Resolution res)
{ configOpenNI(res); }
private void configOpenNI(Resolution res)
// create context and image generator
{
try {
context = new Context();
// add the NITE Licence
License licence = new License("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4="); // vendor, key
context.addLicense(licence);
imageGen = ImageGenerator.create(context);
| 0debug |
static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset,
unsigned int *nb_clusters)
{
BDRVQcowState *s = bs->opaque;
QCowL2Meta *old_alloc;
QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) {
uint64_t start = guest_offset >> s->cluster_bits;
uint64_t end = start + *nb_clusters;
uint64_t old_start = old_alloc->offset >> s->cluster_bits;
uint64_t old_end = old_start + old_alloc->nb_clusters;
if (end < old_start || start > old_end) {
} else {
if (start < old_start) {
*nb_clusters = old_start - start;
} else {
*nb_clusters = 0;
}
if (*nb_clusters == 0) {
qemu_co_mutex_unlock(&s->lock);
qemu_co_queue_wait(&old_alloc->dependent_requests);
qemu_co_mutex_lock(&s->lock);
return -EAGAIN;
}
}
}
if (!*nb_clusters) {
abort();
}
return 0;
}
| 1threat |
How to get the value of one of the key-value pairs of JSON in Javascrpt? : I want to get the value of gid in Javascrpt
alert($.parseJSON(data); √
alert($.parseJSON(data['responseJSON'].gid)); ×
alert($.parseJSON(data['responseJSON']['gid'])); ×
I tried to use it like this but I got an error.
I found a lot of answers but still can't get the value I need.
{"form":{},"files":[{}],"filenames":["timg.jpg"],"filescount":1,"extra":{},"response":{"success":true,"msg":"image url after upload","gid":81},"reader":{},"jqXHR":{"readyState":4,"responseText":"{\"success\":true,\"msg\":\"image url after upload\",\"gid\":81}","responseJSON":{"success":true,"msg":"image url after upload","gid":81},"status":200,"statusText":"OK"}}
alert($.parseJSON(data));
I want to get the value of gid (81),but it is not use. | 0debug |
When to use 'config' level in logging : <pre><code>public static void main(String[] arg)
{
LOGGER.config("");
}
</code></pre>
<p>I visited many websites but i couldn't find an exact answer</p>
| 0debug |
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
{
ff_draw_horiz_band(s->avctx, &s->current_picture.f,
&s->last_picture.f, y, h, s->picture_structure,
s->first_field, s->low_delay);
}
| 1threat |
how can I find relative path for andriod.jar? : I'm doing some hotcoding thing, and I need to use android.jar in the process. However I have to manually add android.jar to javassist(a bytecode manipulation tool) classpool, but I dont want to use the absolute path of android.jar like now,
pool.insertClassPath("/Users/xinmei/Library/Android/sdk/platforms/android-
26/android.jar")
but I dont know how to get the relative path of it, can anyone give me some hint? thanks! | 0debug |
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
{
#if COMPILE_TEMPLATE_MMX
RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);
#else
int i;
for (i=0; i<width; i++) {
int b= src1[3*i + 0];
int g= src1[3*i + 1];
int r= src1[3*i + 2];
dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
}
#endif
assert(src1 == src2);
}
| 1threat |
how to fix - urllib.error.HTTPError: HTTP Error 403: Forbidden : I do not understand how to fix it.
I did not find anything on the Internet
>
import re
@client.event
async def on_message(message):
if message.content.startswith(prefix + 'getimg'):
from urllib.request import urlopen
website = urlopen('https://nekos.life/api/hug')
html = website.read()
links = re.findall('"((http|ftp)s?://.*?)"', html)
print(links)
await client.send_message(message.channel, 'get')
| 0debug |
static ram_addr_t qxl_rom_size(void)
{
uint32_t required_rom_size = sizeof(QXLRom) + sizeof(QXLModes) +
sizeof(qxl_modes);
uint32_t rom_size = 8192;
QEMU_BUILD_BUG_ON(required_rom_size > rom_size);
return rom_size;
}
| 1threat |
How to convert the below text string into a date type using sql 2016 : ActivateDate ShipDate Month Month_Length Day-2c Day-2c_Length YEAR-201x SHIPDateConcatenate ActivateDateConcatenate
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
NULL 6/12/2018 12:00:00 AM 6 1 12 2 2018 6-12-2018 NULL
10/12/2018 14:45 10/16/2018 12:00:00 AM 10 2 16 2 2018 10-16-2018 10-12-2018
The two columns [ActivateDate] and [ShipDate] datatype is listed below; however each time i try to use convert() or cast() to a date type, a conversion error occurs.
Any assistance would be much appreciated.
Regards
TMilzSr
SELECT
[ActivateDate], -- '10/12/2018 14:45' nvarchar(100)
[ShipDate], -- '6/12/2018 12:00:00 AM' nvarchar(100)
SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/', iedimpr.[ShipDate])-2,2) as 'Month',
LEN(SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/', iedimpr.[ShipDate])-2,2)) as 'Month_Length',
REPLACE(SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/', iedimpr.[ShipDate])+1,2),'/','') as 'Day-2c',
LEN(REPLACE(SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/', iedimpr.[ShipDate])+1,2),'/','')) as 'Day-2c_Length',
SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/201', iedimpr.[ShipDate])+1,4) as 'YEAR-201x',
SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/', iedimpr.[ShipDate])-2,2)
+'-'+REPLACE(SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/', iedimpr.[ShipDate])+1,2),'/','')
+'-'+SUBSTRING(iedimpr.[ShipDate],CHARINDEX('/201', iedimpr.[ShipDate])+1,4) as 'SHIPDateConcatenate',
SUBSTRING(iedimpr.[ActivateDate],CHARINDEX('/', iedimpr.[ActivateDate])-2,2)
+'-'+REPLACE(SUBSTRING(iedimpr.[ActivateDate],CHARINDEX('/', iedimpr.[ActivateDate])+1,2),'/','')
+'-'+SUBSTRING(iedimpr.[ActivateDate],CHARINDEX('/201', iedimpr.[ActivateDate])+1,4) as 'ActivateDateConcatenate' | 0debug |
How to get a complete topic distribution for a document using gensim LDA? : <p>When I train my lda model as such</p>
<pre><code>dictionary = corpora.Dictionary(data)
corpus = [dictionary.doc2bow(doc) for doc in data]
num_cores = multiprocessing.cpu_count()
num_topics = 50
lda = LdaMulticore(corpus, num_topics=num_topics, id2word=dictionary,
workers=num_cores, alpha=1e-5, eta=5e-1)
</code></pre>
<p>I want to get a full topic distribution for all <code>num_topics</code> for each and every document. That is, in this particular case, I want each document to have 50 topics contributing to the distribution <strong><em>and</em></strong> I want to be able to access all 50 topics' contribution. This output is what LDA should do if adhering strictly to the mathematics of LDA. However, gensim only outputs topics that exceed a certain threshold as shown <strong><a href="https://stackoverflow.com/questions/23509699/understanding-lda-transformed-corpus-in-gensim/37708396?noredirect=1#comment77429460_37708396">here</a></strong>. For example, if I try</p>
<pre><code>lda[corpus[89]]
>>> [(2, 0.38951721864890398), (9, 0.15438596408262636), (37, 0.45607443684895665)]
</code></pre>
<p>which shows only 3 topics that contribute most to document 89. I have tried the solution in the link above, however this does not work for me. I still get the same output:</p>
<pre><code>theta, _ = lda.inference(corpus)
theta /= theta.sum(axis=1)[:, None]
</code></pre>
<p>produces the same output i.e. only 2,3 topics per document.</p>
<p>My question is how do I change this threshold so I can access the <strong><em>FULL</em></strong> topic distribution for <strong><em>each</em></strong> document? How can I access the full topic distribution, no matter how insignificant the contribution of a topic to a document? The reason I want the full distribution is so I can perform a <a href="https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence" rel="noreferrer">KL similarity</a> search between documents' distribution.</p>
<p>Thanks in advance</p>
| 0debug |
int bdrv_is_inserted(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
int ret;
if (!drv)
return 0;
if (!drv->bdrv_is_inserted)
return !bs->tray_open;
ret = drv->bdrv_is_inserted(bs);
return ret;
}
| 1threat |
static void imx_fec_do_tx(IMXFECState *s)
{
int frame_size = 0;
uint8_t frame[ENET_MAX_FRAME_SIZE];
uint8_t *ptr = frame;
uint32_t addr = s->tx_descriptor;
while (1) {
IMXFECBufDesc bd;
int len;
imx_fec_read_bd(&bd, addr);
FEC_PRINTF("tx_bd %x flags %04x len %d data %08x\n",
addr, bd.flags, bd.length, bd.data);
if ((bd.flags & ENET_BD_R) == 0) {
FEC_PRINTF("tx_bd ran out of descriptors to transmit\n");
break;
}
len = bd.length;
if (frame_size + len > ENET_MAX_FRAME_SIZE) {
len = ENET_MAX_FRAME_SIZE - frame_size;
s->regs[ENET_EIR] |= ENET_INT_BABT;
}
dma_memory_read(&address_space_memory, bd.data, ptr, len);
ptr += len;
frame_size += len;
if (bd.flags & ENET_BD_L) {
qemu_send_packet(qemu_get_queue(s->nic), frame, frame_size);
ptr = frame;
frame_size = 0;
s->regs[ENET_EIR] |= ENET_INT_TXF;
}
s->regs[ENET_EIR] |= ENET_INT_TXB;
bd.flags &= ~ENET_BD_R;
imx_fec_write_bd(&bd, addr);
if ((bd.flags & ENET_BD_W) != 0) {
addr = s->regs[ENET_TDSR];
} else {
addr += sizeof(bd);
}
}
s->tx_descriptor = addr;
imx_eth_update(s);
}
| 1threat |
static uint32_t gt64120_readl (void *opaque,
target_phys_addr_t addr)
{
GT64120State *s = opaque;
uint32_t val;
uint32_t saddr;
val = 0;
saddr = (addr & 0xfff) >> 2;
switch (saddr) {
case GT_MULTI:
val = s->regs[saddr];
break;
case GT_CPUERR_ADDRLO:
case GT_CPUERR_ADDRHI:
case GT_CPUERR_DATALO:
case GT_CPUERR_DATAHI:
case GT_CPUERR_PARITY:
val = s->regs[saddr];
break;
case GT_PCI0SYNC:
case GT_PCI1SYNC:
val = 0xc000ffee;
break;
case GT_ECC_ERRDATALO:
case GT_ECC_ERRDATAHI:
case GT_ECC_MEM:
case GT_ECC_CALC:
case GT_ECC_ERRADDR:
val = s->regs[saddr];
break;
case GT_CPU:
case GT_SCS10LD:
case GT_SCS10HD:
case GT_SCS32LD:
case GT_SCS32HD:
case GT_CS20LD:
case GT_CS20HD:
case GT_CS3BOOTLD:
case GT_CS3BOOTHD:
case GT_SCS10AR:
case GT_SCS32AR:
case GT_CS20R:
case GT_CS3BOOTR:
case GT_PCI0IOLD:
case GT_PCI0M0LD:
case GT_PCI0M1LD:
case GT_PCI1IOLD:
case GT_PCI1M0LD:
case GT_PCI1M1LD:
case GT_PCI0IOHD:
case GT_PCI0M0HD:
case GT_PCI0M1HD:
case GT_PCI1IOHD:
case GT_PCI1M0HD:
case GT_PCI1M1HD:
case GT_PCI0IOREMAP:
case GT_PCI0M0REMAP:
case GT_PCI0M1REMAP:
case GT_PCI1IOREMAP:
case GT_PCI1M0REMAP:
case GT_PCI1M1REMAP:
case GT_ISD:
val = s->regs[saddr];
break;
case GT_PCI0_IACK:
val = pic_read_irq(isa_pic);
break;
case GT_SCS0LD:
case GT_SCS0HD:
case GT_SCS1LD:
case GT_SCS1HD:
case GT_SCS2LD:
case GT_SCS2HD:
case GT_SCS3LD:
case GT_SCS3HD:
case GT_CS0LD:
case GT_CS0HD:
case GT_CS1LD:
case GT_CS1HD:
case GT_CS2LD:
case GT_CS2HD:
case GT_CS3LD:
case GT_CS3HD:
case GT_BOOTLD:
case GT_BOOTHD:
case GT_ADERR:
val = s->regs[saddr];
break;
case GT_SDRAM_CFG:
case GT_SDRAM_OPMODE:
case GT_SDRAM_BM:
case GT_SDRAM_ADDRDECODE:
val = s->regs[saddr];
break;
case GT_SDRAM_B0:
case GT_SDRAM_B1:
case GT_SDRAM_B2:
case GT_SDRAM_B3:
val = s->regs[saddr];
break;
case GT_DEV_B0:
case GT_DEV_B1:
case GT_DEV_B2:
case GT_DEV_B3:
case GT_DEV_BOOT:
val = s->regs[saddr];
break;
case GT_DMA0_CNT:
case GT_DMA1_CNT:
case GT_DMA2_CNT:
case GT_DMA3_CNT:
case GT_DMA0_SA:
case GT_DMA1_SA:
case GT_DMA2_SA:
case GT_DMA3_SA:
case GT_DMA0_DA:
case GT_DMA1_DA:
case GT_DMA2_DA:
case GT_DMA3_DA:
case GT_DMA0_NEXT:
case GT_DMA1_NEXT:
case GT_DMA2_NEXT:
case GT_DMA3_NEXT:
case GT_DMA0_CUR:
case GT_DMA1_CUR:
case GT_DMA2_CUR:
case GT_DMA3_CUR:
val = s->regs[saddr];
break;
case GT_DMA0_CTRL:
case GT_DMA1_CTRL:
case GT_DMA2_CTRL:
case GT_DMA3_CTRL:
val = s->regs[saddr];
break;
case GT_DMA_ARB:
val = s->regs[saddr];
break;
case GT_TC0:
case GT_TC1:
case GT_TC2:
case GT_TC3:
case GT_TC_CONTROL:
val = s->regs[saddr];
break;
case GT_PCI0_CFGADDR:
val = s->pci->config_reg;
break;
case GT_PCI0_CFGDATA:
if (!(s->pci->config_reg & (1u << 31)))
val = 0xffffffff;
else
val = pci_host_data_readl(s->pci, 0);
break;
case GT_PCI0_CMD:
case GT_PCI0_TOR:
case GT_PCI0_BS_SCS10:
case GT_PCI0_BS_SCS32:
case GT_PCI0_BS_CS20:
case GT_PCI0_BS_CS3BT:
case GT_PCI1_IACK:
case GT_PCI0_BARE:
case GT_PCI0_PREFMBR:
case GT_PCI0_SCS10_BAR:
case GT_PCI0_SCS32_BAR:
case GT_PCI0_CS20_BAR:
case GT_PCI0_CS3BT_BAR:
case GT_PCI0_SSCS10_BAR:
case GT_PCI0_SSCS32_BAR:
case GT_PCI0_SCS3BT_BAR:
case GT_PCI1_CMD:
case GT_PCI1_TOR:
case GT_PCI1_BS_SCS10:
case GT_PCI1_BS_SCS32:
case GT_PCI1_BS_CS20:
case GT_PCI1_BS_CS3BT:
case GT_PCI1_BARE:
case GT_PCI1_PREFMBR:
case GT_PCI1_SCS10_BAR:
case GT_PCI1_SCS32_BAR:
case GT_PCI1_CS20_BAR:
case GT_PCI1_CS3BT_BAR:
case GT_PCI1_SSCS10_BAR:
case GT_PCI1_SSCS32_BAR:
case GT_PCI1_SCS3BT_BAR:
case GT_PCI1_CFGADDR:
case GT_PCI1_CFGDATA:
val = s->regs[saddr];
break;
case GT_INTRCAUSE:
val = s->regs[saddr];
dprintf("INTRCAUSE %x\n", val);
break;
case GT_INTRMASK:
val = s->regs[saddr];
dprintf("INTRMASK %x\n", val);
break;
case GT_PCI0_ICMASK:
val = s->regs[saddr];
dprintf("ICMASK %x\n", val);
break;
case GT_PCI0_SERR0MASK:
val = s->regs[saddr];
dprintf("SERR0MASK %x\n", val);
break;
case GT_HINTRCAUSE:
case GT_CPU_INTSEL:
case GT_PCI0_INTSEL:
case GT_HINTRMASK:
case GT_PCI0_HICMASK:
case GT_PCI1_SERR1MASK:
val = s->regs[saddr];
break;
default:
val = s->regs[saddr];
dprintf ("Bad register offset 0x%x\n", (int)addr);
break;
}
#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);
#endif
return val;
}
| 1threat |
How to process only the character in a image.? : I have image file which python will read and convert that to hexadecimal.
the problem here is, even if i give a empty blank image its giving hexadeciaml numbers as output.
I need python to process only the alphabets in the image and covert them to hexadecimal and give that as output.
here is the program which i tired
import binascii
filename = 'a.png'
with open(filename, 'rb') as f:
content = f.read()
print(binascii.hexlify(content)) | 0debug |
C# Error "An object reference is required for the non-static field, method or propery..." : I am creating a program to access a database.
The code that is causing me trouble is meant to open a new form when a button is pressed. It then gets data based on the selected values in a listbox on the main form and is needed to send that data to the second form to be placed in textboxes and labels.
The problem I have, is that in order for the code to execute without throwing the Error "An object reference is required for the non-static field, method or propery...", I must make the method in the secondary form static; however this prevents me from accessing the controls on the secondary form.
Main Form Code Snippet:
private void MemView_Click(object sender, EventArgs e)
{
string selected = lstMember.SelectedItems[0].Text;
//MessageBox.Show(selected);
string[] data = P.selectMem(selected);
MessageBox.Show(data[0]);
MemForm mem = new MemForm(); //How to open a designed form
mem.Show(); //Displays the addmem form
MemForm.getData(data);
}
Secondary Form Code Snippet:
public void getData(string[] Data)
{
int index = 0;
bool loop = false;
string text;
while (loop == true)
{
if (index < 10)
{ text = "tb0" + index.ToString(); }
else
{ text = "tb" + index.ToString(); }
index = index + 1;
}
}
My secondary code snippet is meant to use the loop to fill all the data into the textboxes without me having to manually write out each tb00.Text = data[] etc.
I am unable to access the FindControls() method in C# most likely due to the need for a static method.
The P class used in the Main Form performs the SQL code and is working fully.
I've tried to give enough information for an answer, however if more is needed just ask in a comment I will try and provide more. :) | 0debug |
int qemu_devtree_setprop_cell(void *fdt, const char *node_path,
const char *property, uint32_t val)
{
int offset;
offset = fdt_path_offset(fdt, node_path);
if (offset < 0)
return offset;
return fdt_setprop_cell(fdt, offset, property, val);
}
| 1threat |
How to check if the dates are of same format in PERL? : <p>I have a .csv file.
The second column are dates.</p>
<p>The dates maye not be of the same format.</p>
<p>how can I check to make sure if they are in same format or if I can use some method to change all dates into 1 specific format?</p>
| 0debug |
How to enable large index in MariaDB 10? : <p>In Debian Jessie I installed MariaDB server 10.0.30 and I try to increase max key length. AFAIU it depends of the config parameter <code>innodb_large_prefix</code> being enabled. According to the <a href="https://mariadb.com/kb/en/mariadb/xtradbinnodb-server-system-variables/#innodb_large_prefix" rel="noreferrer">docs</a>, it also requires <code>barracuda</code> file format and <code>innodb_file_per_table</code>. After setting them in config and restarting server I see in client, that those parameters are set correctly:</p>
<pre><code>> SHOW GLOBAL VARIABLES LIKE 'innodb_large%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| innodb_large_prefix | ON |
+---------------------+-------+
1 row in set (0.00 sec)
> SHOW GLOBAL VARIABLES LIKE 'innodb_file%';
+--------------------------+-----------+
| Variable_name | Value |
+--------------------------+-----------+
| innodb_file_format | Barracuda |
| innodb_file_format_check | OFF |
| innodb_file_format_max | Antelope |
| innodb_file_per_table | ON |
+--------------------------+-----------+
4 rows in set (0.00 sec)
> SHOW GLOBAL VARIABLES LIKE 'innodb_page%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| innodb_page_size | 16384 |
+------------------+-------+
1 row in set (0.00 sec)
</code></pre>
<p>I am not sure, why <code>innodb_file_format_max</code> is set <code>Antelope</code>, but while <code>innodb_file_format_check</code> is OFF, it should not matter. Actually, even if I had it also set <code>Barracuda</code>, it did not made difference.</p>
<p>If i try now create table with large index like:</p>
<pre><code>CREATE TABLE `some_table` (
`some_tableID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`column` varchar(750) COLLATE utf8mb4_estonian_ci NOT NULL DEFAULT '',
PRIMARY KEY (`some_tableID`),
KEY `column` (`column`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_estonian_ci;
</code></pre>
<p>I get error:</p>
<pre><code>ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.
</code></pre>
<p>On Ubuntu 16.04 with mysql server 5.7.17 are all related settings same (by default) and there is no problem with large index (for utf8mb4 it is 750*4 = 3000).</p>
<p>What is wrong with my MariaDB setup?</p>
| 0debug |
How to add my host to Multicast Group(Windows) : I can use the command "netsh interface ip show joins" in cmd to show multicast group under each interface. But I really don't know how to add a group to a
interface, like adding a IP address 239.39.188.188 to "Interface 8: VirtualBox Host-Only Network". The simplest way would be appreciated.
Interface 3: Ethernet
Scope References Last Address
---------- ---------- ---- ---------------------
0 0 Yes 224.0.0.1
Interface 1: Loopback Interface
Scope References Last Address
---------- ---------- ---- ---------------------
0 2 Yes 239.255.255.250
Interface 8: VirtualBox Host-Only Network
Scope References Last Address
---------- ---------- ---- ---------------------
0 0 Yes 224.0.0.1
0 1 Yes 224.0.0.251
239.39.188.188 // this is what I want to add
Btw, I tried with some methods, like opening UDP socket and setting IP_ADD_MEMBERSHIP (http://stackoverflow.com/questions/18503464/how-to-add-my-host-to-multicast-group). Also, I tried with a command on linux "ip maddr [ add | del ] MULTIADDR dev STRING" But all of them are failed. | 0debug |
static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
unsigned int slot, fn, n;
Error *local_err = NULL;
char *str = (char *)"";
if (dev->state != DEV_STATE_CREATED) {
error_set(errp, QERR_PERMISSION_DENIED);
return;
}
visit_type_str(v, &str, name, &local_err);
if (local_err) {
error_free(local_err);
return set_int32(obj, v, opaque, name, errp);
}
if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
fn = 0;
if (sscanf(str, "%x%n", &slot, &n) != 1) {
goto invalid;
}
}
if (str[n] != '\0' || fn > 7 || slot > 31) {
goto invalid;
}
*ptr = slot << 3 | fn;
return;
invalid:
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
}
| 1threat |
Flutter - Default image to Image.network when it fails : <p>Is there any way you can control exceptions launched by Image.network() so you can provide it a default AssetImage ?</p>
| 0debug |
static void parse_chap(struct iscsi_context *iscsi, const char *target,
Error **errp)
{
QemuOptsList *list;
QemuOpts *opts;
const char *user = NULL;
const char *password = NULL;
const char *secretid;
char *secret = NULL;
list = qemu_find_opts("iscsi");
if (!list) {
return;
}
opts = qemu_opts_find(list, target);
if (opts == NULL) {
opts = QTAILQ_FIRST(&list->head);
if (!opts) {
return;
}
}
user = qemu_opt_get(opts, "user");
if (!user) {
return;
}
secretid = qemu_opt_get(opts, "password-secret");
password = qemu_opt_get(opts, "password");
if (secretid && password) {
error_setg(errp, "'password' and 'password-secret' properties are "
"mutually exclusive");
return;
}
if (secretid) {
secret = qcrypto_secret_lookup_as_utf8(secretid, errp);
if (!secret) {
return;
}
password = secret;
} else if (!password) {
error_setg(errp, "CHAP username specified but no password was given");
return;
}
if (iscsi_set_initiator_username_pwd(iscsi, user, password)) {
error_setg(errp, "Failed to set initiator username and password");
}
g_free(secret);
}
| 1threat |
static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,
BdrvTrackedRequest *req, int64_t offset, unsigned int bytes,
int64_t align, QEMUIOVector *qiov, int flags)
{
BlockDriver *drv = bs->drv;
bool waited;
int ret;
int64_t start_sector = offset >> BDRV_SECTOR_BITS;
int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE);
assert(is_power_of_2(align));
assert((offset & (align - 1)) == 0);
assert((bytes & (align - 1)) == 0);
assert(!qiov || bytes == qiov->size);
assert((bs->open_flags & BDRV_O_NO_IO) == 0);
assert(!(flags & ~BDRV_REQ_MASK));
waited = wait_serialising_requests(req);
assert(!waited || !req->serialising);
assert(req->overlap_offset <= offset);
assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
if (!ret && bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF &&
!(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_pwrite_zeroes &&
qemu_iovec_is_zero(qiov)) {
flags |= BDRV_REQ_ZERO_WRITE;
if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {
flags |= BDRV_REQ_MAY_UNMAP;
}
}
if (ret < 0) {
} else if (flags & BDRV_REQ_ZERO_WRITE) {
bdrv_debug_event(bs, BLKDBG_PWRITEV_ZERO);
ret = bdrv_co_do_pwrite_zeroes(bs, offset, bytes, flags);
} else {
bdrv_debug_event(bs, BLKDBG_PWRITEV);
ret = bdrv_driver_pwritev(bs, offset, bytes, qiov, flags);
}
bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE);
bdrv_set_dirty(bs, start_sector, end_sector - start_sector);
if (bs->wr_highest_offset < offset + bytes) {
bs->wr_highest_offset = offset + bytes;
}
if (ret >= 0) {
bs->total_sectors = MAX(bs->total_sectors, end_sector);
}
return ret;
} | 1threat |
void qemu_thread_get_self(QemuThread *thread)
{
if (!thread->thread) {
qemu_thread_init();
TlsSetValue(qemu_thread_tls_index, thread);
thread->thread = GetCurrentThread();
}
}
| 1threat |
static void *spapr_build_fdt(sPAPRMachineState *spapr,
hwaddr rtas_addr,
hwaddr rtas_size)
{
MachineState *machine = MACHINE(qdev_get_machine());
MachineClass *mc = MACHINE_GET_CLASS(machine);
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int ret;
void *fdt;
sPAPRPHBState *phb;
char *buf;
fdt = g_malloc0(FDT_MAX_SIZE);
_FDT((fdt_create_empty_tree(fdt, FDT_MAX_SIZE)));
_FDT(fdt_setprop_string(fdt, 0, "device_type", "chrp"));
_FDT(fdt_setprop_string(fdt, 0, "model", "IBM pSeries (emulated by qemu)"));
_FDT(fdt_setprop_string(fdt, 0, "compatible", "qemu,pseries"));
if (kvmppc_get_host_model(&buf)) {
_FDT(fdt_setprop_string(fdt, 0, "host-model", buf));
g_free(buf);
}
if (kvmppc_get_host_serial(&buf)) {
_FDT(fdt_setprop_string(fdt, 0, "host-serial", buf));
g_free(buf);
}
buf = qemu_uuid_unparse_strdup(&qemu_uuid);
_FDT(fdt_setprop_string(fdt, 0, "vm,uuid", buf));
if (qemu_uuid_set) {
_FDT(fdt_setprop_string(fdt, 0, "system-id", buf));
}
g_free(buf);
if (qemu_get_vm_name()) {
_FDT(fdt_setprop_string(fdt, 0, "ibm,partition-name",
qemu_get_vm_name()));
}
_FDT(fdt_setprop_cell(fdt, 0, "#address-cells", 2));
_FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2));
spapr_dt_xics(spapr->xics, fdt, PHANDLE_XICP);
ret = spapr_populate_memory(spapr, fdt);
if (ret < 0) {
error_report("couldn't setup memory nodes in fdt");
exit(1);
}
spapr_dt_vdevice(spapr->vio_bus, fdt);
if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL)) {
ret = spapr_rng_populate_dt(fdt);
if (ret < 0) {
error_report("could not set up rng device in the fdt");
exit(1);
}
}
QLIST_FOREACH(phb, &spapr->phbs, list) {
ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
if (ret < 0) {
error_report("couldn't setup PCI devices in fdt");
exit(1);
}
}
spapr_populate_cpus_dt_node(fdt, spapr);
if (smc->dr_lmb_enabled) {
_FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB));
}
if (mc->query_hotpluggable_cpus) {
int offset = fdt_path_offset(fdt, "/cpus");
ret = spapr_drc_populate_dt(fdt, offset, NULL,
SPAPR_DR_CONNECTOR_TYPE_CPU);
if (ret < 0) {
error_report("Couldn't set up CPU DR device tree properties");
exit(1);
}
}
spapr_dt_events(fdt, spapr->check_exception_irq);
spapr_dt_rtas(spapr, fdt);
spapr_dt_chosen(spapr, fdt);
if (kvm_enabled()) {
spapr_dt_hypervisor(spapr, fdt);
}
if (spapr->kernel_size) {
_FDT((fdt_add_mem_rsv(fdt, KERNEL_LOAD_ADDR, spapr->kernel_size)));
}
if (spapr->initrd_size) {
_FDT((fdt_add_mem_rsv(fdt, spapr->initrd_base, spapr->initrd_size)));
}
ret = spapr_dt_cas_updates(spapr, fdt, spapr->ov5_cas);
if (ret < 0) {
error_report("couldn't setup CAS properties fdt");
exit(1);
}
return fdt;
}
| 1threat |
Immutable.js: How to find an object in an array by specify property value : <p>I have an array made by Immutable.js:</p>
<pre><code> var arr = Immutable.List.of(
{
id: 'id01',
enable: true
},
{
id: 'id02',
enable: true
},
{
id: 'id03',
enable: true
},
{
id: 'id04',
enable: true
}
);
</code></pre>
<p>How can I find the object with <code>id: id03</code>? I want to update its <code>enable</code> value and get an new array</p>
| 0debug |
pointer variable is not working in cout function in cpp : I have written a code in c++ to check the variable increment (Screenshot added). In line 13 when i use "++x" in printing function to print the value of x and y. The value I'm getting is not equal but the memory address are same.
In line 17 I've incremented y as ++y and I got my expected equal ans (Screenshot added) [My Code Screenshot][1].
What is the reason for not getting the unexpected ans in line 13?
[1]: https://i.stack.imgur.com/mwCBW.png | 0debug |
static void ss5_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
if (cpu_model == NULL)
cpu_model = "Fujitsu MB86904";
sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
kernel_cmdline, initrd_filename, cpu_model,
0);
}
| 1threat |
How to get data from read only field to a new input text field usinf valuechangelistner in ADF ,Jedeveloper 12.1.3.0.0 : My requirement is, once I input a value in a input text field , valuechangelistner will call & data will be populated in the next read only fileds & then also for the below two input text data should be populated .
I am using a query based VO for this.
Please refer to the screenshot.
When I entered Employee number, Employee Number also populated in the below input text, but I want Level also populated in the below input text of Level.
<af:panelGroupLayout id="pgl1">
<af:spacer width="40" height="20" id="s5"/>
<af:panelGroupLayout id="pgl2" layout="horizontal">
<af:button text="Back to Search Page" id="b1" action="backCompEmptoSearch"/>
</af:panelGroupLayout>
<!--<af:inputText value="#{bindings.EmployeeNumber.inputValue}" label="#{bindings.EmployeeNumber.hints.label}"
required="#{bindings.EmployeeNumber.hints.mandatory}"
columns="#{bindings.EmployeeNumber.hints.displayWidth}"
maximumLength="#{bindings.EmployeeNumber.hints.precision}"
shortDesc="#{bindings.EmployeeNumber.hints.tooltip}" id="it1"
valueChangeListener="#{CompBean.emphdrVCL}" autoSubmit="true">
<f:validator binding="#{bindings.EmployeeNumber.validator}"/>
<af:convertNumber groupingUsed="false" pattern="#{bindings.EmployeeNumber.format}"/>
</af:inputText>-->
<af:inputText label="EmployeeNumber" id="it9" valueChangeListener="#{CompBean.emphdrVCL}" autoSubmit="true"/>
<af:spacer width="40" height="60" id="s3"/>
<af:panelFormLayout id="pfl1" partialTriggers="it9" rows="2">
<af:inputText value="#{bindings.EmployeeName.inputValue}" label="#{bindings.EmployeeName.hints.label}"
required="#{bindings.EmployeeName.hints.mandatory}" readOnly="true"
columns="#{bindings.EmployeeName.hints.displayWidth}"
maximumLength="#{bindings.EmployeeName.hints.precision}"
shortDesc="#{bindings.EmployeeName.hints.tooltip}" id="it2">
<f:validator binding="#{bindings.EmployeeName.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.ServiceLine.inputValue}" label="#{bindings.ServiceLine.hints.label}"
required="#{bindings.ServiceLine.hints.mandatory}" readOnly="true"
columns="#{bindings.ServiceLine.hints.displayWidth}"
maximumLength="#{bindings.ServiceLine.hints.precision}"
shortDesc="#{bindings.ServiceLine.hints.tooltip}" id="it3">
<f:validator binding="#{bindings.ServiceLine.validator}"/>
<af:convertNumber groupingUsed="false" pattern="#{bindings.ServiceLine.format}"/>
</af:inputText>
<af:inputText value="#{bindings.EmployeeType.inputValue}" label="#{bindings.EmployeeType.hints.label}"
required="#{bindings.EmployeeType.hints.mandatory}" readOnly="true"
columns="#{bindings.EmployeeType.hints.displayWidth}"
maximumLength="#{bindings.EmployeeType.hints.precision}"
shortDesc="#{bindings.EmployeeType.hints.tooltip}" id="it4">
<f:validator binding="#{bindings.EmployeeType.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.LevelId.inputValue}" label="#{bindings.LevelId.hints.label}"
required="#{bindings.LevelId.hints.mandatory}" readOnly="true"
columns="#{bindings.LevelId.hints.displayWidth}" maximumLength="#{bindings.LevelId.hints.precision}"
shortDesc="#{bindings.LevelId.hints.tooltip}" id="it6" autoSubmit="true"
valueChangeListener="#{CompBean.TestVcl}">
<f:validator binding="#{bindings.LevelId.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.CountryId.inputValue}" label="#{bindings.CountryId.hints.label}"
required="#{bindings.CountryId.hints.mandatory}" readOnly="true"
columns="#{bindings.CountryId.hints.displayWidth}"
maximumLength="#{bindings.CountryId.hints.precision}" shortDesc="#{bindings.CountryId.hints.tooltip}"
id="it7">
<f:validator binding="#{bindings.CountryId.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.TownOrCity.inputValue}" label="#{bindings.TownOrCity.hints.label}"
required="#{bindings.TownOrCity.hints.mandatory}" readOnly="true"
columns="#{bindings.TownOrCity.hints.displayWidth}"
maximumLength="#{bindings.TownOrCity.hints.precision}"
shortDesc="#{bindings.TownOrCity.hints.tooltip}" id="it8">
<f:validator binding="#{bindings.TownOrCity.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.EffectiveStartDate.inputValue}" label="#{bindings.EffectiveStartDate.hints.label}"
required="#{bindings.EffectiveStartDate.hints.mandatory}"
columns="#{bindings.EffectiveStartDate.hints.displayWidth}"
maximumLength="#{bindings.EffectiveStartDate.hints.precision}"
shortDesc="#{bindings.EffectiveStartDate.hints.tooltip}" id="it5">
<f:validator binding="#{bindings.EffectiveStartDate.validator}"/>
<af:convertDateTime pattern="#{bindings.EffectiveStartDate.format}"/>
</af:inputText>
<af:inputText value="#{bindings.EffectiveEndDate.inputValue}" label="#{bindings.EffectiveEndDate.hints.label}"
required="#{bindings.EffectiveEndDate.hints.mandatory}"
columns="#{bindings.EffectiveEndDate.hints.displayWidth}"
maximumLength="#{bindings.EffectiveEndDate.hints.precision}"
shortDesc="#{bindings.EffectiveEndDate.hints.tooltip}" id="it10">
<f:validator binding="#{bindings.EffectiveEndDate.validator}"/>
<af:convertDateTime pattern="#{bindings.EffectiveEndDate.format}"/>
</af:inputText>
<af:inputText value="#{bindings.Ctc.inputValue}" label="#{bindings.Ctc.hints.label}"
required="#{bindings.Ctc.hints.mandatory}" columns="#{bindings.Ctc.hints.displayWidth}"
maximumLength="#{bindings.Ctc.hints.precision}" shortDesc="#{bindings.Ctc.hints.tooltip}" id="it17">
<f:validator binding="#{bindings.Ctc.validator}"/>
<af:convertNumber groupingUsed="false" pattern="#{bindings.Ctc.format}"/>
</af:inputText>
</af:panelFormLayout>
<af:spacer width="40" height="40" id="s40"/>
<!--<af:inputText value="#{bindings.Ctc.inputValue}" label="#{bindings.Ctc.hints.label}"
required="#{bindings.Ctc.hints.mandatory}" columns="#{bindings.Ctc.hints.displayWidth}"
maximumLength="#{bindings.Ctc.hints.precision}" shortDesc="#{bindings.Ctc.hints.tooltip}" id="it5">
<f:validator binding="#{bindings.Ctc.validator}"/>
<af:convertNumber groupingUsed="false" pattern="#{bindings.Ctc.format}"/>
</af:inputText>-->
<af:panelFormLayout id="pfl2">
<af:inputText label="EMPLOYEE_NUMBER" id="it11" binding="#{CompBean.propertyEmpno}" partialTriggers="it9"/>
<af:inputText label="CTC" id="it1" binding="#{CompBean.propertyCtc}"/>
<af:inputText label="Level" id="it18" binding="#{CompBean.propertyLevel}" partialTriggers="it6"/>
<!--<af:inputDate label="EFFECTIVE_START_DATE" id="id1" binding="#{CompBean.propertyEfdate}"/>
<af:inputDate label="EFFECTIVE_END_DATE" id="id2" binding="#{CompBean.propertyEdDate}"/>-->
</af:panelFormLayout>
[enter image description here][1]
[1]: https://i.stack.imgur.com/zI7yG.jpg**strong text**
| 0debug |
def find_Product(arr,n):
arr.sort()
prod = 1
for i in range(0,n,1):
if (arr[i - 1] != arr[i]):
prod = prod * arr[i]
return prod; | 0debug |
void ga_unset_frozen(GAState *s)
{
if (!ga_is_frozen(s)) {
return;
}
if (s->deferred_options.log_filepath) {
s->log_file = fopen(s->deferred_options.log_filepath, "a");
if (!s->log_file) {
s->log_file = stderr;
}
s->deferred_options.log_filepath = NULL;
}
ga_enable_logging(s);
g_warning("logging re-enabled due to filesystem unfreeze");
if (s->deferred_options.pid_filepath) {
if (!ga_open_pidfile(s->deferred_options.pid_filepath)) {
g_warning("failed to create/open pid file");
}
s->deferred_options.pid_filepath = NULL;
}
ga_enable_non_blacklisted(s->blacklist);
s->frozen = false;
if (!ga_delete_file(s->state_filepath_isfrozen)) {
g_warning("unable to delete %s, fsfreeze may not function properly",
s->state_filepath_isfrozen);
}
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.