problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
int stream_index = pkt->stream_index;
int size = pkt->size;
uint8_t *buf = pkt->data;
MpegMuxContext *s = ctx->priv_data;
AVStream *st = ctx->streams[stream_index];
StreamInfo *stream = st->priv_data;
int64_t pts, dts;
PacketDesc *pkt_desc;
int preload;
const int is_iframe = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
(pkt->flags & AV_PKT_FLAG_KEY);
preload = av_rescale(s->preload, 90000, AV_TIME_BASE);
pts = pkt->pts;
dts = pkt->dts;
if (s->last_scr == AV_NOPTS_VALUE) {
if (dts == AV_NOPTS_VALUE || (dts < preload && ctx->avoid_negative_ts) || s->is_dvd) {
if (dts != AV_NOPTS_VALUE)
s->preload += av_rescale(-dts, AV_TIME_BASE, 90000);
s->last_scr = 0;
} else {
s->last_scr = dts - preload;
s->preload = 0;
}
preload = av_rescale(s->preload, 90000, AV_TIME_BASE);
av_log(ctx, AV_LOG_DEBUG, "First SCR: %"PRId64" First DTS: %"PRId64"\n", s->last_scr, dts + preload);
}
if (dts != AV_NOPTS_VALUE) dts += preload;
if (pts != AV_NOPTS_VALUE) pts += preload;
av_log(ctx, AV_LOG_TRACE, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n",
dts / 90000.0, pts / 90000.0, pkt->flags,
pkt->stream_index, pts != AV_NOPTS_VALUE);
if (!stream->premux_packet)
stream->next_packet = &stream->premux_packet;
*stream->next_packet =
pkt_desc = av_mallocz(sizeof(PacketDesc));
pkt_desc->pts = pts;
pkt_desc->dts = dts;
pkt_desc->unwritten_size =
pkt_desc->size = size;
if (!stream->predecode_packet)
stream->predecode_packet = pkt_desc;
stream->next_packet = &pkt_desc->next;
if (av_fifo_realloc2(stream->fifo, av_fifo_size(stream->fifo) + size) < 0)
return -1;
if (s->is_dvd) {
if (is_iframe &&
(s->packet_number == 0 ||
(pts - stream->vobu_start_pts >= 36000))) {
stream->bytes_to_iframe = av_fifo_size(stream->fifo);
stream->align_iframe = 1;
stream->vobu_start_pts = pts;
}
}
av_fifo_generic_write(stream->fifo, buf, size, NULL);
for (;;) {
int ret = output_packet(ctx, 0);
if (ret <= 0)
return ret;
}
}
| 1threat
|
static void eeprom_generate(eeprom24c0x_t *eeprom, ram_addr_t ram_size)
{
enum { SDR = 0x4, DDR2 = 0x8 } type;
uint8_t *spd = eeprom->contents;
uint8_t nbanks = 0;
uint16_t density = 0;
int i;
ram_size >>= 20;
while ((ram_size >= 4) && (nbanks <= 2)) {
int sz_log2 = MIN(31 - clz32(ram_size), 14);
nbanks++;
density |= 1 << (sz_log2 - 2);
ram_size -= 1 << sz_log2;
}
if ((nbanks == 1) && (density > 1)) {
nbanks++;
density >>= 1;
}
if (density & 0xff00) {
density = (density & 0xe0) | ((density >> 8) & 0x1f);
type = DDR2;
} else if (!(density & 0x1f)) {
type = DDR2;
} else {
type = SDR;
}
if (ram_size) {
fprintf(stderr, "Warning: SPD cannot represent final %dMB"
" of SDRAM\n", (int)ram_size);
}
spd[2] = type;
spd[5] = nbanks;
spd[31] = density;
spd[63] = 0;
for (i = 0; i < 63; i++) {
spd[63] += spd[i];
}
}
| 1threat
|
static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
{
FlashSVContext * const s = avctx->priv_data;
AVFrame *pict = data;
AVFrame * const p = &s->frame;
int res;
int I_frame = 0;
int opt_w, opt_h;
*p = *pict;
if (avctx->frame_number == 0) {
s->previous_frame = av_mallocz(p->linesize[0]*s->image_height);
if (!s->previous_frame) {
av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n");
return -1;
}
I_frame = 1;
}
if (avctx->gop_size > 0) {
if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) {
I_frame = 1;
}
}
#if 0
int w, h;
int optim_sizes[16][16];
int smallest_size;
for (w=1 ; w<17 ; w++) {
for (h=1 ; h<17 ; h++) {
optim_sizes[w-1][h-1] = encode_bitstream(s, p, s->encbuffer, s->image_width*s->image_height*4, w*16, h*16, s->previous_frame);
}
}
smallest_size=optim_sizes[0][0];
opt_w = 0;
opt_h = 0;
for (w=0 ; w<16 ; w++) {
for (h=0 ; h<16 ; h++) {
if (optim_sizes[w][h] < smallest_size) {
smallest_size = optim_sizes[w][h];
opt_w = w;
opt_h = h;
}
}
}
res = encode_bitstream(s, p, buf, buf_size, (opt_w+1)*16, (opt_h+1)*16, s->previous_frame);
av_log(avctx, AV_LOG_ERROR, "[%d][%d]optimal size = %d, res = %d|\n", opt_w, opt_h, smallest_size, res);
if (buf_size < res)
av_log(avctx, AV_LOG_ERROR, "buf_size %d < res %d\n", buf_size, res);
#else
opt_w=1;
opt_h=1;
if (buf_size < s->image_width*s->image_height*3) {
av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n", buf_size, s->image_width*s->image_height*3);
return -1;
}
res = encode_bitstream(s, p, buf, buf_size, opt_w*16, opt_h*16, s->previous_frame, &I_frame);
#endif
memcpy(s->previous_frame, p->data[0], s->image_height*p->linesize[0]);
if (I_frame) {
p->pict_type = FF_I_TYPE;
p->key_frame = 1;
s->last_key_frame = avctx->frame_number;
av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n",avctx->frame_number);
} else {
p->pict_type = FF_P_TYPE;
p->key_frame = 0;
}
avctx->coded_frame = p;
return res;
}
| 1threat
|
need help on java swing frame : i'm VERY new to swing, i need to build a frame that:
-has an image on top.
-below the image has 16 little images divided in 4 groups (4 "panels"), on the same "row".
-below those 16 images i need 4 "panels"on the same "row". Every panel contains some horizontal scrollable images (of the same size).
-below those 4 "panels" i need two "panels" on the same "row". The left one contains some hoizontal scrollable images (of the same size), the right one a "JList" (or something like that:scrollable text rows).
-below those 2 "panel" i need 4 "panels" on the same "row". Everyone contains 4 rows of text.
How can I realize a frame like this? I tried using only BorderedLayouts and GridLayouts, but i don't know how to divide the "GridLayouts" in others "GridLayouts" (don't even know if it is possible).
| 0debug
|
void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
const uint8_t *flags)
{
int i, shift, sp1, sp2;
const int32_t *src;
int32_t *dst;
int tmp[16];
int t0, t1, t2, t3, t4;
#define COMPENSATE(x) (x)
src = in;
dst = tmp;
for (i = 0; i < 4; i++) {
if (flags[i]) {
shift = !(i & 2);
sp1 = src[0] << shift;
sp2 = src[4] << shift;
INV_HAAR4( sp1, sp2, src[8], src[12],
dst[0], dst[4], dst[8], dst[12],
t0, t1, t2, t3, t4);
} else
dst[0] = dst[4] = dst[8] = dst[12] = 0;
src++;
dst++;
}
#undef COMPENSATE
#define COMPENSATE(x) (x)
src = tmp;
for (i = 0; i < 4; i++) {
if (!src[0] && !src[1] && !src[2] && !src[3]) {
memset(out, 0, 4 * sizeof(out[0]));
} else {
INV_HAAR4(src[0], src[1], src[2], src[3],
out[0], out[1], out[2], out[3],
t0, t1, t2, t3, t4);
}
src += 4;
out += pitch;
}
#undef COMPENSATE
}
| 1threat
|
How I can comment this line ? : How I can comment this line.
I've php inside html.
<div class="check" data-product="<?php echo $product->id; ?>">PRICE AND
AVAILABILITY</div>
thanks
| 0debug
|
static void memory_region_prepare_ram_addr(MemoryRegion *mr)
{
if (mr->backend_registered) {
return;
}
mr->destructor = memory_region_destructor_iomem;
mr->ram_addr = cpu_register_io_memory(memory_region_read_thunk,
memory_region_write_thunk,
mr);
mr->backend_registered = true;
}
| 1threat
|
ASP.net wepage using spotify : <p>I am very new to ASP.net. I am trying to build a webform that searches an artist and displays their top 5 songs from spotify. My biggest problem as of now is figuring out where to put the code and what code to use so that I can receive this data from spotify. I have already made a spotify developer account with an app. I have the client ID and Client Secret. I think I need to figure out a way to authenticate. Any help or websites that could point me in the right direction would be greatly appreciated. </p>
| 0debug
|
Objective C Method : Trying to first have a user enter credit card information than agree to terms and conditions. Currently, the app is forcing a user to check terms and conditions than enter credit card information. What is a better method or better way to do this? I am not strong in Objective C.
-(void)textFieldDidBeginEditing:(UITextField *)textField{
if(_agreedToTerms){
if(!_canceledScan){
CardIOPaymentViewController *cardV = [[CardIOPaymentViewController alloc]initWithPaymentDelegate:self];
[cardV setCollectCVV:NO];
//CardIOPaymentViewController *cardV = [[CardIOPaymentViewController alloc]initWithPaymentDelegate:self];
[cardV setCollectExpiry:YES];
// [cardV setCollectPostalCode:YES];
[self presentViewController:cardV animated:YES completion:nil];
}
}else{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Error" message:@"Please agree to terms" preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action)
{
}]];
[self presentViewController:alertController animated:YES completion:nil];
}
}
| 0debug
|
static int encode_individual_channel(AVCodecContext *avctx, AACEncContext *s,
SingleChannelElement *sce,
int common_window)
{
put_bits(&s->pb, 8, sce->sf_idx[0]);
if (!common_window) {
put_ics_info(s, &sce->ics);
if (s->coder->encode_main_pred)
s->coder->encode_main_pred(s, sce);
}
encode_band_info(s, sce);
encode_scale_factors(avctx, s, sce);
encode_pulses(s, &sce->pulse);
if (s->coder->encode_tns_info)
s->coder->encode_tns_info(s, sce);
else
put_bits(&s->pb, 1, 0);
put_bits(&s->pb, 1, 0);
encode_spectral_coeffs(s, sce);
return 0;
}
| 1threat
|
static void vga_invalidate_display(void *opaque)
{
VGAState *s = (VGAState *)opaque;
s->last_width = -1;
s->last_height = -1;
}
| 1threat
|
In Flutter, How can I change TextFormField validation error message style? : <p>I want to set a bigger font size for error message validation in TextFormField but I don't know how.</p>
| 0debug
|
PHP mysql error deleting row : <p>I keep getting the following error:</p>
<blockquote>
<p>You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'order WHERE id = '49'' at line 1</p>
</blockquote>
<p>I don't understand what is causing this. I've checked for any syntax errors, reviewed mysqli documentation, and looked up similar posts here on Stack Overflow with no luck. What the heck am I doing wrong?</p>
<p>This is the code that I am using:</p>
<pre><code><?php
if (isset($_GET['order_id']) && $_GET['order_id'] != "")
{
$delete_id = $_GET['order_id'];
echo "<p>$order_id</p>";
$conn = new mysqli($server, $user, $password, $database);
$sql = "DELETE FROM order WHERE id = '" . $delete_id . "';";
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
mysqli_close($conn);
}
?>
</code></pre>
| 0debug
|
when i try to make a call for this method "setupWithViewPager" i didn't found it : in parent class because parent class are extends from LinearLayout and This function is in class HorizontalScrollView how can i fix this problem
tabLayout.setupWithViewPager(viewPager);
| 0debug
|
In excel ,on the click of command button, i want to save that data in sql server 2008 : I want to create a excel file in which i will enter the data row by row.
Then, on the click of command button, i want to save that data in sql server 2008 .
Is it possible ?
If yes, Please somebody help with with the complete procedure.
Thanks in Advance.
Bhushan
| 0debug
|
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
AVIContext *avi = s->priv_data;
AVStream *st;
int i, index;
int64_t pos;
AVIStream *ast;
if (!avi->index_loaded) {
avi_load_index(s);
avi->index_loaded = 1;
}
assert(stream_index>= 0);
st = s->streams[stream_index];
ast= st->priv_data;
index= av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags);
if(index<0)
return -1;
pos = st->index_entries[index].pos;
timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
av_dlog(s, "XX %"PRId64" %d %"PRId64"\n",
timestamp, index, st->index_entries[index].timestamp);
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
assert(stream_index == 0);
ff_dv_offset_reset(avi->dv_demux, timestamp);
avio_seek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
return 0;
}
for(i = 0; i < s->nb_streams; i++) {
AVStream *st2 = s->streams[i];
AVIStream *ast2 = st2->priv_data;
ast2->packet_size=
ast2->remaining= 0;
if (ast2->sub_ctx) {
seek_subtitle(st, st2, timestamp);
continue;
}
if (st2->nb_index_entries <= 0)
continue;
assert((int64_t)st2->time_base.num*ast2->rate == (int64_t)st2->time_base.den*ast2->scale);
index = av_index_search_timestamp(
st2,
av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1),
flags | AVSEEK_FLAG_BACKWARD);
if(index<0)
index=0;
if(!avi->non_interleaved){
while(index>0 && st2->index_entries[index].pos > pos)
index--;
while(index+1 < st2->nb_index_entries && st2->index_entries[index].pos < pos)
index++;
}
av_dlog(s, "%"PRId64" %d %"PRId64"\n",
timestamp, index, st2->index_entries[index].timestamp);
ast2->frame_offset = st2->index_entries[index].timestamp;
}
avio_seek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
return 0;
}
| 1threat
|
Pls Help Me With This!--- Android Studio : <!-- What are you trying to accomplish? (Please include sample data.) -->
Can someone help me fix the error seen in the editor ? I'm new to Android Studio and would love to see a fully explained answer.
<!-- Paste the part of the code that shows the problem. (Please indent 4 spaces.) -->Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
<a href="openFile:C:/Users/MAHE/AndroidStudioProjects/Dork_1/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.">Show Details</a>
Pls Help me fix this
[enter image description here][1]
I got an error![enter image description here][1]
[enter image description here][2]
These are the images...Pls help me!! I am using **Android Studio 3.0**
Error Code---
Error:FAILURE: Build failed with an exception.
* What went wrong:
Task '~offline' not found in root project 'Dork_1'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
| 0debug
|
void cpu_check_irqs(CPUSPARCState *env)
{
uint32_t pil = env->pil_in |
(env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER));
if (env->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) {
pil |= 1 << 14;
}
if (pil < (2 << env->psrpil)){
if (env->interrupt_request & CPU_INTERRUPT_HARD) {
CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n",
env->interrupt_index);
env->interrupt_index = 0;
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
}
return;
}
if (cpu_interrupts_enabled(env)) {
unsigned int i;
for (i = 15; i > env->psrpil; i--) {
if (pil & (1 << i)) {
int old_interrupt = env->interrupt_index;
int new_interrupt = TT_EXTINT | i;
if (env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt) {
CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d "
"current %x >= pending %x\n",
env->tl, cpu_tsptr(env)->tt, new_interrupt);
} else if (old_interrupt != new_interrupt) {
env->interrupt_index = new_interrupt;
CPUIRQ_DPRINTF("Set CPU IRQ %d old=%x new=%x\n", i,
old_interrupt, new_interrupt);
cpu_interrupt(env, CPU_INTERRUPT_HARD);
}
break;
}
}
} else if (env->interrupt_request & CPU_INTERRUPT_HARD) {
CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x "
"current interrupt %x\n",
pil, env->pil_in, env->softint, env->interrupt_index);
env->interrupt_index = 0;
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
}
}
| 1threat
|
alert('Hello ' + user_input);
| 1threat
|
How To Add SimpleAdapter In a ListView : How To Add SimpleAdapter In a Listview With Checkbox.i am using arrayadaptr how to use simpleadapter throw arrayadapter.how can i use simple adapter in a my listview .How To Add SimpleAdapter In a Listview With Checkbox.i am using arrayadaptr how to use simpleadapter throw arrayadapter.how can i use simple adapter in a my listview .
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class main extends Activity {
ListView myList;
Button getChoice, clearAll;
SharedPreferences sharedpreferences;
public static final String MyPREFERENCES = "MyUserChoice";
ArrayList<String> selectedItems = new ArrayList<String>();
String json_string;
String JSON_STRING;
JSONObject JO;
JSONObject jsonObject;
JSONArray jsonArray;
int count = 0;
ArrayList<String> list = new ArrayList<String>();
ArrayList<String> list2 = new ArrayList<String>();
ArrayAdapter<String> adapter;
Spinner current,new_class;
String cur,nc;
List<Map<String, String>> data4 = new ArrayList<Map<String, String>>();
ProgressDialog pDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//new current().execute();
new current2().execute();
new new_class().execute();
current = (Spinner) findViewById(R.id.current_class);
new_class = (Spinner)findViewById(R.id.new_class);
myList = (ListView) findViewById(R.id.list);
getChoice = (Button) findViewById(R.id.getchoice);
clearAll = (Button) findViewById(R.id.clearall);
current.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
cur = current.getSelectedItem().toString();
HttpWebCall(cur);
//data4.clear();
list.clear();
list2.clear();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
new_class.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
nc = new_class.getSelectedItem().toString();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
getChoice.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
String selected = "";
int cntChoice = myList.getCount();
SparseBooleanArray sparseBooleanArray = myList.getCheckedItemPositions();
for(int i = 0; i < cntChoice; i++){
if(sparseBooleanArray.get(i)) {
selected += myList.getItemAtPosition(i).toString() + "\n";
System.out.println("Checking list while adding:" + myList.getItemAtPosition(i).toString());
SaveSelections();
}
}
Toast.makeText(main.this, selected, Toast.LENGTH_LONG).show();
}});
clearAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ClearSelections();
}
});
}
private void SaveSelections() {
// save the selections in the shared preference in private mode for the user
SharedPreferences.Editor prefEditor = sharedpreferences.edit();
String savedItems = getSavedItems();
prefEditor.putString(MyPREFERENCES.toString(), savedItems);
prefEditor.commit();
}
private String getSavedItems() {
String savedItems = "";
int count = this.myList.getAdapter().getCount();
for (int i = 0; i < count; i++) {
if (this.myList.isItemChecked(i)) {
if (savedItems.length() > 0) {
savedItems += "," + this.myList.getItemAtPosition(i);
} else {
savedItems += this.myList.getItemAtPosition(i);
}
}
}
return savedItems;
}
private void ClearSelections() {
// user has clicked clear button so uncheck all the items
int count = this.myList.getAdapter().getCount();
for (int i = 0; i < count; i++) {
this.myList.setItemChecked(i, false);
}
// also clear the saved selections
SaveSelections();
}
class current2 extends AsyncTask<String, String, String> {
ProgressDialog pdLoading = new ProgressDialog(main.this);
String json_url;
@Override
protected void onPreExecute() {
json_url = "http://192.168.1.10:8081/sms/GetClass.php";
pdLoading.setMessage("\tLoading...");
pdLoading.isIndeterminate();
pdLoading.setIndeterminate(true);
pdLoading.setCancelable(false);
pdLoading.show();
}
@Override
protected String doInBackground(String... params) {
try {
URL url = new URL(json_url);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder = new StringBuilder();
while ((JSON_STRING = bufferedReader.readLine()).equals("null")) ;
{
stringBuilder.append(JSON_STRING + "\n");
}
bufferedReader.close();
inputStream.close();
httpURLConnection.disconnect();
return stringBuilder.toString().trim();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
List<Map<String, String>> data = null;
data = new ArrayList<Map<String, String>>();
json_string = result;
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
if (jsonArray.length() != 0) {
String[] s_name = new String[jsonArray.length()];
for (count = 0; count < jsonArray.length(); count++) {
JO = jsonArray.getJSONObject(count);
s_name[count] = JO.getString("Class");
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(main.this, R.layout.spinner_values,s_name);
current.setAdapter(adapter);
}
} catch (JSONException e) {
e.printStackTrace();
}
pdLoading.dismiss();
}
}
class new_class extends AsyncTask<String, String, String> {
ProgressDialog pdLoading = new ProgressDialog(main.this);
String json_url;
@Override
protected void onPreExecute() {
json_url = "http://192.168.1.10:8081/sms/GetClass.php";
pdLoading.setMessage("\tLoading...");
pdLoading.isIndeterminate();
pdLoading.setIndeterminate(true);
pdLoading.setCancelable(false);
pdLoading.show();
}
@Override
protected String doInBackground(String... params) {
try {
URL url = new URL(json_url);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder = new StringBuilder();
while ((JSON_STRING = bufferedReader.readLine()).equals("null")) ;
{
stringBuilder.append(JSON_STRING + "\n");
}
bufferedReader.close();
inputStream.close();
httpURLConnection.disconnect();
return stringBuilder.toString().trim();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
List<Map<String, String>> data = null;
data = new ArrayList<Map<String, String>>();
json_string = result;
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
if (jsonArray.length() != 0) {
String[] s_name = new String[jsonArray.length()];
for (count = 0; count < jsonArray.length(); count++) {
JO = jsonArray.getJSONObject(count);
s_name[count] = JO.getString("Class");
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(main.this, R.layout.spinner_values,s_name);
new_class.setAdapter(adapter);
}
} catch (JSONException e) {
e.printStackTrace();
}
pdLoading.dismiss();
}
}
HttpParse httpParse = new HttpParse();
String HttpURL = "http://192.168.1.10:8081/sms/select_class.php";
String ParseResult;
String FinalJSonObject;
HashMap<String, String> ResultHash = new HashMap<>();
public void HttpWebCall(final String PreviousListViewClickedItem) {
class HttpWebCallFunction extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = ProgressDialog.show(main.this, "Loading Data", null, true, true);
}
@Override
protected void onPostExecute(String httpResponseMsg) {
super.onPostExecute(httpResponseMsg);
pDialog.dismiss();
//Storing Complete JSon Object into String Variable.
FinalJSonObject = httpResponseMsg;
//Parsing the Stored JSOn String to GetHttpResponse Method.
new GetHttpResponse(main.this).execute();
}
@Override
protected String doInBackground(String... params) {
ResultHash.put("Class", params[0]);
ParseResult = httpParse.postRequest(ResultHash, HttpURL);
return ParseResult;
}
}
HttpWebCallFunction httpWebCallFunction = new HttpWebCallFunction();
httpWebCallFunction.execute(PreviousListViewClickedItem);
}
private class GetHttpResponse extends AsyncTask<Void, Void, Void> {
public Context context;
public GetHttpResponse(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = ProgressDialog.show(main.this, "Loading Data", null, true, true);
}
@Override
protected Void doInBackground(Void... arg0) {
try {
if (FinalJSonObject != null) {
JSONArray jsonArray = null;
try {
jsonArray = new JSONArray(FinalJSonObject);
JSONObject jsonObject;
for (int i = 0; i < jsonArray.length(); i++) {
jsonObject = jsonArray.getJSONObject(i);
list.add(jsonObject.getString("Student_Name"));
list2.add(jsonObject.getString("Student_Roll_No"));
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
pDialog.dismiss();
adapter = new ArrayAdapter<String>(main.this, android.R.layout.simple_list_item_multiple_choice, list);
myList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
myList.setAdapter(adapter);
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
if(sharedpreferences.contains(MyPREFERENCES)){
if (sharedpreferences.contains(MyPREFERENCES.toString())) {
String savedItems = sharedpreferences.getString(MyPREFERENCES.toString(), "");
selectedItems.addAll(Arrays.asList(savedItems.split(",")));
int count = main.this.myList.getAdapter().getCount();
for (int i = 0; i < count; i++) {
String currentItem = (String) myList.getAdapter().getItem(i);
if (selectedItems.contains(currentItem)) {
myList.setItemChecked(i, true);
Toast.makeText(getApplicationContext(),
"Curren Item: " + currentItem,
Toast.LENGTH_LONG).show();
} else {
myList.setItemChecked(i, false);
}
}
}
}
}
}
}
How To Add SimpleAdapter In a Listview With Checkbox.i am using arrayadaptr how to use simpleadapter throw arrayadapter.how can i use simple adapter in a my listview .How To Add SimpleAdapter In a Listview With Checkbox.i am using arrayadaptr how to use simpleadapter throw arrayadapter.how can i use simple adapter in a my listview .
| 0debug
|
Blockchain security : <p>My question is about blockchain security. If l make any change in data in a blockchain,the hash value changes according to the blockchain algorithm. But how other members can identify that it is a tampered block?</p>
| 0debug
|
What are the reasons and cases that cause git merge conflicts? : <ol>
<li><p>What are </p>
<ul>
<li><p>the necessary and sufficient conditions, and/or</p></li>
<li><p>all the cases or some common cases </p></li>
</ul>
<p>that can cause <code>git merge</code> report merge conflict?</p>
<p>How does <code>git merge</code> determine whether a line or some lines contain
merge conflict(s)?</p></li>
<li><p>For example, I sometimes see cases like the following, where either
<code>Part 1</code> or <code>Part 2</code> is empty in </p>
<pre><code><<<<<<< HEAD
(Part 1)
=======
(Part 2)
>>>>>>> some-other-branch
</code></pre>
<p>It looks unlikely to have a merge conflict to me. So what are some possible reasons that
cases like that have merge conflicts?</p></li>
<li><p>Comparing the merge conflicts reported by <code>git merge</code> and the
differences reported by <code>git diff</code>, is it correct that </p>
<ul>
<li><p>the differences reported by <code>git diff</code> might not necessarily be in the places of the merge conflicts reported by <code>git merge</code>, and</p></li>
<li><p>the merge conflicts reported by <code>git merge</code> might not necessarily be in the places of the differences reported by <code>git
diff</code>?</p></li>
</ul></li>
</ol>
<p>Thanks.</p>
| 0debug
|
iter without map with iterator : I am starting in the hard way of learning Rust, and I have a probably newbie's question : How to improve this function :
fn get_grid() -> [[u8; 9]; 9]
{
let mut grid: [[u8; 9]; 9] = Default::default();
let mut args: Vec<String> = env::args().collect();
if args.len() != 10 {
eprintln!("This program need 9 strings of 9 numbers between 0 and 9");
exit(1);
}
args.remove(0);
let _: Vec<_> = args.iter().enumerate().map(|(i, arg)| {
let _line: Vec<_> = arg.split(' ').enumerate().map(|(j, value)| {
match value.parse() {
Ok(x) => {
grid[i][j] = x;
x
},
Err(e) => {
eprintln!("Value {} is not a valid integer [{}]", value, e);
exit(1);
},
}
}).collect();
}).collect();
return grid;
}
( Sorry for the indentation, SO's indentation is not my friend ).
As far as I understand ".map()", it will, when collecting, build a new iterable ( Vector atm ), and return it. Actually I don't need to have this iterable, I just want to modify an external array, and not have anything built from this iteration.
In javascript, there is .map, but also a .forEach that iter on map and returns nothing. Is there any equivalent in Rust ??
I could probably just use a `for (index, value) in args.iter().enumerate()` but I am searching a way to avoid explicit loop, if there is one.
Any criticism is welcome.
Thanks
| 0debug
|
SQL How do I pull data from events that happen on a single day? EX. List all engagements that start and end on the same day? : SQL How do I pull data from events that happen on a single day? EX. List all engagements that start and end on the same day?
| 0debug
|
static int ehci_state_fetchentry(EHCIState *ehci, int async)
{
int again = 0;
uint32_t entry = ehci_get_fetch_addr(ehci, async);
if (entry < 0x1000) {
DPRINTF("fetchentry: entry invalid (0x%08x)\n", entry);
ehci_set_state(ehci, async, EST_ACTIVE);
goto out;
}
if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) {
fprintf(stderr, "non queue head request in async schedule\n");
return -1;
}
switch (NLPTR_TYPE_GET(entry)) {
case NLPTR_TYPE_QH:
ehci_set_state(ehci, async, EST_FETCHQH);
again = 1;
break;
case NLPTR_TYPE_ITD:
ehci_set_state(ehci, async, EST_FETCHITD);
again = 1;
break;
case NLPTR_TYPE_STITD:
ehci_set_state(ehci, async, EST_FETCHSITD);
again = 1;
break;
default:
fprintf(stderr, "FETCHENTRY: entry at %X is of type %d "
"which is not supported yet\n", entry, NLPTR_TYPE_GET(entry));
return -1;
}
out:
return again;
}
| 1threat
|
static bool is_zero_cluster(BlockDriverState *bs, int64_t start)
{
BDRVQcow2State *s = bs->opaque;
int nr;
BlockDriverState *file;
int64_t res = bdrv_get_block_status_above(bs, NULL, start,
s->cluster_sectors, &nr, &file);
return res >= 0 && (res & BDRV_BLOCK_ZERO);
}
| 1threat
|
int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
{
BDRVQcowState *s = bs->opaque;
int64_t offset;
size_t free_in_cluster;
int ret;
BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC_BYTES);
assert(size > 0 && size <= s->cluster_size);
assert(!s->free_byte_offset || offset_into_cluster(s, s->free_byte_offset));
offset = s->free_byte_offset;
if (offset) {
uint64_t refcount;
ret = qcow2_get_refcount(bs, offset >> s->cluster_bits, &refcount);
if (ret < 0) {
return ret;
}
if (refcount == s->refcount_max) {
offset = 0;
}
}
free_in_cluster = s->cluster_size - offset_into_cluster(s, offset);
if (!offset || free_in_cluster < size) {
int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size);
if (new_cluster < 0) {
return new_cluster;
}
if (!offset || ROUND_UP(offset, s->cluster_size) != new_cluster) {
offset = new_cluster;
}
}
assert(offset);
ret = update_refcount(bs, offset, size, 1, false, QCOW2_DISCARD_NEVER);
if (ret < 0) {
return ret;
}
qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache);
s->free_byte_offset = offset + size;
if (!offset_into_cluster(s, s->free_byte_offset)) {
s->free_byte_offset = 0;
}
return offset;
}
| 1threat
|
static void slavio_timer_reset(DeviceState *d)
{
SLAVIO_TIMERState *s = container_of(d, SLAVIO_TIMERState, busdev.qdev);
unsigned int i;
CPUTimerState *curr_timer;
for (i = 0; i <= MAX_CPUS; i++) {
curr_timer = &s->cputimer[i];
curr_timer->limit = 0;
curr_timer->count = 0;
curr_timer->reached = 0;
if (i < s->num_cpus) {
ptimer_set_limit(curr_timer->timer,
LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 1);
ptimer_run(curr_timer->timer, 0);
}
curr_timer->running = 1;
}
s->cputimer_mode = 0;
}
| 1threat
|
Access appsettings.json from .NET 4.5.2 project : <p>I have two projects, a 1.1.0 ASP.NET Core project and a reference to a 4.5.2 project.</p>
<p>I want to get values from the appsettings.json file to my 4.5.2 project. The appsettings.json file is in the core project.</p>
<p>Tried this from my 4.5.2 project with no luck:</p>
<pre><code>var mailServer = ConfigurationManager.AppSettings["MailServer"];
</code></pre>
<p>How can I access the values from my 4.5.2 project?</p>
| 0debug
|
Convert an existing Flutter Kotlin project to Flutter Java project : <p>I created a Flutter project using default values, which are Kotlin for Android and Swift for iOS. Halfway through the project I needed to integrate a 3rd party Android SDK that requires Java. Can I convert a Flutter project to Java for Android after creation?</p>
<p>I know I will need yo use Platform Channels to integrate native code with my Flutter app, this is not my concern.</p>
| 0debug
|
Azure load from file storage to blob : I am very new to Azure, basically I need to load some files in a file storage in Azure to a blob storage. what connector to use to access the file storage in Azure? I have tried some e.g. file systems but that seems works for windows file share. What i want to do is simple if there is a new file in the file storage then load it to the blob.
And also what action to use to load the file into the blob?
I know how to do these in SSIS, but need some pointers here for logic App.
| 0debug
|
How to put indexes of characters in a string in an array in java : <p>I want to make a method that returns an ArrayList and takes two arguments, one is a string and other is a character. I want to put in ArrayList all the indexes of the characters if they appear in string argument. For example, if a first parameter is a String "hello" and other is 'l' the Array should contain 2 and 3</p>
| 0debug
|
Is there a "JOIN" query to show the first name and last name of the employees who do not work in the same locations with their manager : <p>I am stuck on a query to find employees who do not work at the same location as their manager based on the attached schema.</p>
<p><a href="https://i.stack.imgur.com/tfYWm.png" rel="nofollow noreferrer">DB schema</a></p>
| 0debug
|
i am getting very good output in training set and very bad output in test set : <p>i am training a model using keras with 4500 image belong to a seven classes, i build a neural network with one input layer and one hidden layer and one output layer then when a training started i am getting high accuracy and low loss in the training test but in the validation test the val_loss is increasing with high percentage from the beginning, and val_acc is increasing slowly.
i am using softmax activation function and catgorical_crossintroby for the loss
can you help me to find the problem please?</p>
| 0debug
|
int scsi_req_parse(SCSIRequest *req, uint8_t *buf)
{
int rc;
if (req->dev->type == TYPE_TAPE) {
rc = scsi_req_stream_length(&req->cmd, req->dev, buf);
} else {
rc = scsi_req_length(&req->cmd, req->dev, buf);
}
if (rc != 0)
return rc;
assert(buf == req->cmd.buf);
scsi_cmd_xfer_mode(&req->cmd);
req->cmd.lba = scsi_cmd_lba(&req->cmd);
trace_scsi_req_parsed(req->dev->id, req->lun, req->tag, buf[0],
req->cmd.mode, req->cmd.xfer);
if (req->cmd.lba != -1) {
trace_scsi_req_parsed_lba(req->dev->id, req->lun, req->tag, buf[0],
req->cmd.lba);
}
return 0;
}
| 1threat
|
static void synthfilt_build_sb_samples(QDM2Context *q, GetBitContext *gb,
int length, int sb_min, int sb_max)
{
int sb, j, k, n, ch, run, channels;
int joined_stereo, zero_encoding, chs;
int type34_first;
float type34_div = 0;
float type34_predictor;
float samples[10], sign_bits[16];
if (length == 0) {
for (sb=sb_min; sb < sb_max; sb++)
build_sb_samples_from_noise (q, sb);
return;
}
for (sb = sb_min; sb < sb_max; sb++) {
FIX_NOISE_IDX(q->noise_idx);
channels = q->nb_channels;
if (q->nb_channels <= 1 || sb < 12)
joined_stereo = 0;
else if (sb >= 24)
joined_stereo = 1;
else
joined_stereo = (get_bits_left(gb) >= 1) ? get_bits1 (gb) : 0;
if (joined_stereo) {
if (get_bits_left(gb) >= 16)
for (j = 0; j < 16; j++)
sign_bits[j] = get_bits1 (gb);
for (j = 0; j < 64; j++)
if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j])
q->coding_method[0][sb][j] = q->coding_method[1][sb][j];
fix_coding_method_array(sb, q->nb_channels, q->coding_method);
channels = 1;
}
for (ch = 0; ch < channels; ch++) {
zero_encoding = (get_bits_left(gb) >= 1) ? get_bits1(gb) : 0;
type34_predictor = 0.0;
type34_first = 1;
for (j = 0; j < 128; ) {
switch (q->coding_method[ch][sb][j / 2]) {
case 8:
if (get_bits_left(gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + 2 * k) >= 128)
break;
samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0;
}
} else {
n = get_bits(gb, 8);
for (k = 0; k < 5; k++)
samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]];
}
for (k = 0; k < 5; k++)
samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx);
} else {
for (k = 0; k < 10; k++)
samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 10;
break;
case 10:
if (get_bits_left(gb) >= 1) {
float f = 0.81;
if (get_bits1(gb))
f = -f;
f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0;
samples[0] = f;
} else {
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 1;
break;
case 16:
if (get_bits_left(gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + k) >= 128)
break;
samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)];
}
} else {
n = get_bits (gb, 8);
for (k = 0; k < 5; k++)
samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]];
}
} else {
for (k = 0; k < 5; k++)
samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 5;
break;
case 24:
if (get_bits_left(gb) >= 7) {
n = get_bits(gb, 7);
for (k = 0; k < 3; k++)
samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5;
} else {
for (k = 0; k < 3; k++)
samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 3;
break;
case 30:
if (get_bits_left(gb) >= 4) {
unsigned index = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1);
if (index < FF_ARRAY_ELEMS(type30_dequant)) {
samples[0] = type30_dequant[index];
} else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
} else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
run = 1;
break;
case 34:
if (get_bits_left(gb) >= 7) {
if (type34_first) {
type34_div = (float)(1 << get_bits(gb, 2));
samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0;
type34_predictor = samples[0];
type34_first = 0;
} else {
unsigned index = qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1);
if (index < FF_ARRAY_ELEMS(type34_delta)) {
samples[0] = type34_delta[index] / type34_div + type34_predictor;
type34_predictor = samples[0];
} else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
} else {
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 1;
break;
default:
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
run = 1;
break;
}
if (joined_stereo) {
float tmp[10][MPA_MAX_CHANNELS];
for (k = 0; k < run; k++) {
tmp[k][0] = samples[k];
tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k];
}
for (chs = 0; chs < q->nb_channels; chs++)
for (k = 0; k < run; k++)
if ((j + k) < 128)
q->sb_samples[chs][j + k][sb] = q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs];
} else {
for (k = 0; k < run; k++)
if ((j + k) < 128)
q->sb_samples[ch][j + k][sb] = q->tone_level[ch][sb][(j + k)/2] * samples[k];
}
j += run;
}
}
}
}
| 1threat
|
inline expansion compiles into a function call [c++] : <h2>Introduction:</h2>
<p>I have been creating a simple wrapper classes. I randomly found out that <em>(or it appears to be)</em> an inline function still compiled into a function call. I created an example class to test things out and this is what I found:</p>
<p><strong>Consider the following class:</strong> </p>
<pre><code>//compile with MSVC
class InlineTestClass
{
public:
int InternalInt;
int GetInt() {return InternalInt;}
inline int GetInt_Inl() {return InternalInt;}
//__forceinline -Forces the compiler to implement the function as inline
__forceinline int GetInt_ForceInl() {return InternalInt;}
};
</code></pre>
<p><strong>This class has 3 functions for reference.</strong> </p>
<ul>
<li>The <strong>GetInt</strong> function is a standard function. </li>
<li>The <strong>GetInt_Inl</strong> function is an inline function.</li>
<li>The <strong>GetInt_ForceInl</strong> function is an ensured inline function in case of the
compiler deciding not to implement <strong>GetInt_Inl</strong> as inline function</li>
</ul>
<p>Implemented like so:</p>
<pre><code>InlineTestClass itc;
itc.InternalInt = 3;
int myInt;
myInt = itc.InternalInt; //No function
myInt = itc.GetInt(); //Normal function
myInt = itc.GetInt_Inl(); //Inline function
myInt = itc.GetInt_ForceInl(); //Forced inline function
</code></pre>
<p>The resulting assembler code of the setting of myInt (taken from dissassembler):</p>
<pre><code> 451 myInt = itc.InternalInt;
0x7ff6fe0d4cae <+0x003e> mov eax,dword ptr [rsp+20h]
0x7ff6fe0d4cb2 <+0x0042> mov dword ptr [rsp+38h],eax
452 myInt = itc.GetInt();
0x7ff6fe0d4cb6 <+0x0046> lea rcx,[rsp+20h]
0x7ff6fe0d4cbb <+0x004b> call nD_Render!ILT+2125(?GetIntInlineTestClassQEAAHXZ) (00007ff6`fe0d1852)
0x7ff6fe0d4cc0 <+0x0050> mov dword ptr [rsp+38h],eax
453 myInt = itc.GetInt_Inl();
0x7ff6fe0d4cc4 <+0x0054> lea rcx,[rsp+20h]
0x7ff6fe0d4cc9 <+0x0059> call nD_Render!ILT+1885(?GetInt_InlInlineTestClassQEAAHXZ) (00007ff6`fe0d1762)
0x7ff6fe0d4cce <+0x005e> mov dword ptr [rsp+38h],eax
454 myInt = itc.GetInt_ForceInl();
0x7ff6fe0d4cd2 <+0x0062> lea rcx,[rsp+20h]
0x7ff6fe0d4cd7 <+0x0067> call nD_Render!ILT+715(?GetInt_ForceInlInlineTestClassQEAAHXZ) (00007ff6`fe0d12d0)
0x7ff6fe0d4cdc <+0x006c> mov dword ptr [rsp+38h],eax
</code></pre>
<p>As shown above the setting (of myInt) from the <strong>member</strong> of InlineTestClass directly is <em>(as expected)</em> 2 mov instructions long.
Setting from the <strong>GetInt</strong> function results in a function call <em>(as expected)</em>, however both of the <strong>GetInt_Inl</strong> and <strong>GetInt_ForceInl</strong> (inline functions) also result in a function call. </p>
<p>It appears as if the inline function has been compiled as a normal function ignoring the inlining completely <em>(correct me if I am wrong)</em>.</p>
<p>This is strange cause according to <a href="https://msdn.microsoft.com/en-us/library/bw1hbe6y.aspx" rel="nofollow noreferrer">MSVC documentation</a>:</p>
<blockquote>
<p>The inline and __inline specifiers instruct the compiler to insert a
copy of the function body into each place the function is called.</p>
</blockquote>
<p>Which <em>(I think)</em> would result in:</p>
<pre><code>inline int GetInt_Inl() {return InternalInt; //Is the function body}
myInt = itc.GetInt_Inl(); //Call site
//Should result in
myInt = itc.InternalInt; //Identical to setting from the member directly
</code></pre>
<p>Which means that the assembler code should be also identical to the one of setting from the class member directly but it isn't.</p>
<h2>Questions:</h2>
<ol>
<li>Am I missing something or implementing the functions incorrectly?</li>
<li>Am I interpreting the function of the inline keyword? What is it?</li>
<li>Why do these inline functions result in a function call?</li>
</ol>
| 0debug
|
how to find mod of large numbers in python? : how to find (a^(b^c))% (10^9 + 7) in python for large inputs ?
my code just get terminated after few test case
[referred question][1]
[1]: https://www.hackerrank.com/contests/programming-camp-smvdu/challenges/multiple-powers/problem
| 0debug
|
int load_elf(const char *filename, int64_t address_offset,
uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr,
int big_endian, int elf_machine, int clear_lsb)
{
int fd, data_order, target_data_order, must_swab, ret;
uint8_t e_ident[EI_NIDENT];
fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0) {
perror(filename);
return -1;
}
if (read(fd, e_ident, sizeof(e_ident)) != sizeof(e_ident))
goto fail;
if (e_ident[0] != ELFMAG0 ||
e_ident[1] != ELFMAG1 ||
e_ident[2] != ELFMAG2 ||
e_ident[3] != ELFMAG3)
goto fail;
#ifdef HOST_WORDS_BIGENDIAN
data_order = ELFDATA2MSB;
#else
data_order = ELFDATA2LSB;
#endif
must_swab = data_order != e_ident[EI_DATA];
if (big_endian) {
target_data_order = ELFDATA2MSB;
} else {
target_data_order = ELFDATA2LSB;
}
if (target_data_order != e_ident[EI_DATA])
return -1;
lseek(fd, 0, SEEK_SET);
if (e_ident[EI_CLASS] == ELFCLASS64) {
ret = load_elf64(fd, address_offset, must_swab, pentry,
lowaddr, highaddr, elf_machine, clear_lsb);
} else {
ret = load_elf32(fd, address_offset, must_swab, pentry,
lowaddr, highaddr, elf_machine, clear_lsb);
}
close(fd);
return ret;
fail:
close(fd);
return -1;
}
| 1threat
|
Top 10 sql query list : <p>Good morning, I need assistance with generating a top 10 list. below is the created query however i'm unsure how to correctly implement the <em>ROWNUM</em> function.</p>
<pre><code>SELECT * FROM
( SELECT CON_NAME, HIGHEST_QUAL FROM temp2 ORDER BY HIGHEST_QUAL DESC )
WHERE ROWNUM = 10;
</code></pre>
<p>As when the query is run no data is produced however when i omit the <em>ROWNUM</em> all the rows are produced showing the data is there. Also when the <em>ROWNUM</em> is set to 1 only one row is produced.</p>
<p>Thanks in advance!</p>
| 0debug
|
C# cannot implicitly convert type string to int, enum : im trying to do an enum of Morse like so:
public enum Morse : String
{
medzera = " ",
a=".-",
b="-...",
c="-.-.",
d="-..",
e=".",
f="..-.",
g="--.",
h="....",
i="..",
j=".---",
k="-.-",
l=".-..",
m="--",
n="-.",
o="---",
p=".--.",
q="--.-",
r=".-.",
s="...",
t="-",
u="..-",
v=...-",
w=".--",
x="-..-",
y="-.--",
z="--..",
}
C# throws an error, can someone help please? im guessing it will be trivial.
| 0debug
|
static inline int dmg_read_chunk(BlockDriverState *bs, int sector_num)
{
BDRVDMGState *s = bs->opaque;
if(!is_sector_in_chunk(s,s->current_chunk,sector_num)) {
int ret;
uint32_t chunk = search_chunk(s,sector_num);
if(chunk>=s->n_chunks)
return -1;
s->current_chunk = s->n_chunks;
switch(s->types[chunk]) {
case 0x80000005: {
int i;
i=0;
do {
ret = bdrv_pread(bs->file, s->offsets[chunk] + i,
s->compressed_chunk+i, s->lengths[chunk]-i);
if(ret<0 && errno==EINTR)
ret=0;
i+=ret;
} while(ret>=0 && ret+i<s->lengths[chunk]);
if (ret != s->lengths[chunk])
return -1;
s->zstream.next_in = s->compressed_chunk;
s->zstream.avail_in = s->lengths[chunk];
s->zstream.next_out = s->uncompressed_chunk;
s->zstream.avail_out = 512*s->sectorcounts[chunk];
ret = inflateReset(&s->zstream);
if(ret != Z_OK)
return -1;
ret = inflate(&s->zstream, Z_FINISH);
if(ret != Z_STREAM_END || s->zstream.total_out != 512*s->sectorcounts[chunk])
return -1;
break; }
case 1:
ret = bdrv_pread(bs->file, s->offsets[chunk],
s->uncompressed_chunk, s->lengths[chunk]);
if (ret != s->lengths[chunk])
return -1;
break;
case 2:
memset(s->uncompressed_chunk, 0, 512*s->sectorcounts[chunk]);
break;
}
s->current_chunk = chunk;
}
return 0;
}
| 1threat
|
static ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src,
size_t srclen)
{
z_stream s;
ssize_t dstbytes;
int r, i, flags;
i = 10;
flags = src[3];
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
puts ("Error: Bad gzipped data\n");
return -1;
}
if ((flags & EXTRA_FIELD) != 0)
i = 12 + src[10] + (src[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (src[i++] != 0)
;
if ((flags & COMMENT) != 0)
while (src[i++] != 0)
;
if ((flags & HEAD_CRC) != 0)
i += 2;
if (i >= srclen) {
puts ("Error: gunzip out of data in header\n");
return -1;
}
s.zalloc = zalloc;
s.zfree = zfree;
r = inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
printf ("Error: inflateInit2() returned %d\n", r);
return (-1);
}
s.next_in = src + i;
s.avail_in = srclen - i;
s.next_out = dst;
s.avail_out = dstlen;
r = inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
printf ("Error: inflate() returned %d\n", r);
return -1;
}
dstbytes = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
return dstbytes;
}
| 1threat
|
Can I use Jinja2 `map` filter in an Ansible play to get values from an array of objects? : <p>I have a playbook for creating some EC2 instances and then doing some stuff with them. The relevant pieces are approximately like:</p>
<pre><code>- name: create ec2 instances
ec2:
id: '{{ item.name }}'
instance_type: '{{ item.type }}'
register: ec2
with_items: '{{ my_instance_defs }}'
- name: wait for SSH
wait_for:
host: '{{ item.instances[0].private_ip }}'
port: 22
with_items: '{{ ec2.results }}'
</code></pre>
<p>This works as intended, but I am not especially happy with the <code>item.instances[0].private_ip</code> expression, partly because it shows really large objects in the play summary. I would love to have the <code>with_items</code> part just be an array of IP addresses, rather than an array of objects with arrays of objects inside them. In Python, I would just do something like:</p>
<pre><code>ips = [r['instances'][0]['private_ip'] for r in ec2['results']]
</code></pre>
<p>And then I would use <code>with_items: '{{ ips }}'</code> in the second task.</p>
<p>Is there a way I can do the same thing using a J2 filter in the YAML of the play? Seems like <a href="http://docs.ansible.com/ansible/playbooks_filters.html#extracting-values-from-containers" rel="noreferrer">http://docs.ansible.com/ansible/playbooks_filters.html#extracting-values-from-containers</a> might be helpful, but I think that presupposes I have an array of keys/indices/whatever.</p>
| 0debug
|
How to resolve "Warning: debug info can be unavailable. Please close other application using ADB: Restart ADB integration and try again" : <p>I am having a slight issue when trying to debug and android app via usb to external device. I keep getting the error "Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
Restart ADB integration and try again
Waiting for process:"</p>
<p>I have tried stopping adb.exe in task manager , closing android studio and restarting , taking out the cable and putting it back and going to tools => android uncheck adb intergration then recheck it . All to no avail </p>
| 0debug
|
static uint32_t dp8393x_readw(void *opaque, target_phys_addr_t addr)
{
dp8393xState *s = opaque;
int reg;
if ((addr & ((1 << s->it_shift) - 1)) != 0) {
return 0;
}
reg = addr >> s->it_shift;
return read_register(s, reg);
}
| 1threat
|
remove all elements from a list matching a string : <p>I am trying to remove all the elements from a list that contains the string "abc" from my list.</p>
<pre><code>list_a=['abc-123','abc-000','345-abc','1-abc-b','aaa','ab','xyz']
</code></pre>
<p>i am using the below method: </p>
<pre><code>for i in list_a:
if not "abc" in list_a: list_a.remove(i)
</code></pre>
<p>when i do <code>print list_a</code> i see the response does not remove all the elements in the list that matched the criteria. I get the below response:</p>
<p><code>['abc-000', '1-abc-b', 'ab']</code></p>
<p>My Expected response is: <code>['aaa','ab','xyz']</code></p>
| 0debug
|
Python 3 Conversion program elif syntax error : I'm running this in python 3 and it keeps telling me there's a traceback. elif is a syntax error. I've tried to troubleshoot but I just can't fix it. When helping me could you please fix the code directly since i'm not good with implementing foreign code. It's meant to return back the please select your conversion if the following options are not selected but obviously not working. Thank You!
from turtle import Screen, Turtle
print("Please select your conversion:")
conversion = (input("metric to metric type mm, metric to imperial type mi, units of water type w, for physics equations type p, for math equations type m and for quick facts type q:"))
if conversion == "mm":
#selection = "metric to metric conversions!"
elif conversion == "mi":
#selection = "metric to imperial conversions!"
elif conversion == "w":
#selection = "water conversions!"
elif conversion == "p":
#selection = "physics equations!"
elif conversion == "m":
#selection = "maths equations!"
elif conversion == "q":
#selection = "quick facts!"
else:
print("\n")
print("Invalid! Please try again.")
print("\n")
print("You have selected", #selection + "!")
invalid_input = True
def start() :
decision = input ("Is this correct? If correct type y, if incorrect type
n.")
if decision == "y":
#stuff
invalid_input = False
while invalid_input : # this will loop until invalid_input is set to be True
start()
#decision = (input("Is this correct? If correct type y, if incorrect type
n"))
| 0debug
|
Some questions about PDO, safety and correct syntax : <p>I apologize if this may be a ready-made topic, but I need an answer in detail. I would like to learn to program in PDO, but I have lots of bases being self-taught.</p>
<p>I have a few simple questions:</p>
<p>1) Program in PDO is equally satisfying to create your own scripts or is an old and unsafe method? Schedule in OOP when I get quite complex.</p>
<p>2) programming in PDO, what are the correct Prepared Statement to be written? Pass the data-bind?</p>
<p>3) As an example of security, this script for login and user registration using a library to encrypt your password, so it is quite safe against attacks? </p>
<p><a href="http://thisinterestsme.com/php-user-registration-form/" rel="nofollow">http://thisinterestsme.com/php-user-registration-form/</a></p>
<p>I repeat, I know that I would find some answers to my questions, but I need answers to my details, thanks.</p>
| 0debug
|
Realm migrations in Swift : <p>I have a Realm Object modeled as so</p>
<pre><code>class WorkoutSet: Object {
// Schema 0
dynamic var exerciseName: String = ""
dynamic var reps: Int = 0
// Schema 0 + 1
dynamic var setCount: Int = 0
}
</code></pre>
<p>I am trying to perform a migration.</p>
<p>Within my <code>AppDelegate</code> I have imported <code>RealmSwift</code>.</p>
<p>Within the function <code>didFinishLaunchWithOptions</code> I call </p>
<pre><code>Migrations().checkSchema()
</code></pre>
<p><em>Migrations</em> is a class declared in another file.</p>
<p>Within that file there is a struct declared as so.</p>
<pre><code>func checkSchema() {
Realm.Configuration(
// Set the new schema version. This must be greater than the previously used
// version (if you've never set a schema version before, the version is 0).
schemaVersion: 1,
// Set the block which will be called automatically when opening a Realm with
// a schema version lower than the one set above
migrationBlock: { migration, oldSchemaVersion in
// We haven’t migrated anything yet, so oldSchemaVersion == 0
switch oldSchemaVersion {
case 1:
break
default:
// Nothing to do!
// Realm will automatically detect new properties and removed properties
// And will update the schema on disk automatically
self.zeroToOne(migration)
}
})
}
func zeroToOne(migration: Migration) {
migration.enumerate(WorkoutSet.className()) {
oldObject, newObject in
let setCount = 1
newObject!["setCount"] = setCount
}
}
</code></pre>
<p>I am getting an error for adding <code>setCount</code> to the model</p>
| 0debug
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
how to derive cluster properties : I have clustered ~40000 points into 79 clusters. Each point is a vector of 18 features. I want to 'derive' the characteristics of each cluster - the prominent features/characteristics of the clusters. Are there machine-learning algorithms to derive this?
Thanks.
| 0debug
|
Can a Kafka producer create topics and partitions? : <p>currently I am evaluating different Messaging Systems.
There is a question related to Apache Kafka which I could not answer myself.</p>
<p>Is it possible for a Kafka producer to create topics and partitions (on existing topics aswell) dynamically?
If yes, is there any disadvantage that comes with it?</p>
<p>Thanks in Advance</p>
| 0debug
|
document.getElementId not working : document.getElementById('r'+a.toString()).innerHTML+="<td><tr>"+a+"</tr>X<tr>"+n+"</tr>=<tr>"+a*n+"</tr></td>";
not working to make table using getElementById().innerHTML and <table><td
r+a></td></table>
| 0debug
|
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
| 1threat
|
Copy cell value between excel workbooks based on criteria : I have two excels workbooks, let's say, wb01 and wb02.
I need to synchronize them by copying some cell values from wb01 to wb02 based on a criteria: cell values for name and surname must be copied from wb01 to wb02 when Ids match.
**Example**
**wb01**
Id | name | surname | Dept
10 | John | McCoy | Logistics
21 | Liam | Alloy | Administration
40 | Peter | Gregor | Finance
42 | Albert | Kein | Business
50 | Kelly | Braxton | Logistics
60 | Isabella | O'Neill | Finance
**wb02**
Id | name | surname | ext.
10 | David | McCoy | 1004
23 | Bren | Summer | 1230
40 | George | Brown | 2400
42 | Astrid | Anderson | 3312
50 | Kelly | Braxton | 1139
51 | Evelyn | Connor | 4532
The changes go in one direction from wb01 to wb02 ONLY when Ids match.
Also if Id exists on wb01 but not in wb02, cell values for name and surname should be copied to wb02 as a new row and the rest of fields must be kept empty/blank in wb02.
After synchronize, wb02 must be as below:
Id | name | surname | ext.
10 | John | McCoy | 1004
21 | Liam | Alloy |
23 | Bren | Summer | 1230
40 | Peter | Gregor | 2400
42 | Albert | Kein | 3312
50 | Kelly | Braxton | 1139
51 | Evelyn | Connor | 4532
60 | Isabella | O'Neill |
I want synchronization to be ONLY done on demand when user clicks a button in a sheet on wb02. On button click it will execute a macro to start the synchronization process from wb01 to wb02.
| 0debug
|
Using Angular-CLI build to copy a file / directory : <p>Is there a way to make angular-cli's <code>ng buil --prod</code> command to also copy a file/directory to the dist folder?</p>
<p>My project includes a "server" folder, and a "config.js" file at root, and I need them to be copied to "dist" such that when building, I don't need to remember to copy those directories</p>
| 0debug
|
A list of all mat-icons -- Angular : <p>I started using <code><mat-icon></code> of angular-material and I wonder if there is any collection of the names of all the included icons. Past a few months, I used this already and I think, back then, I found a homepage where a bunch of them were listed. But this site is not findable anymore. </p>
<p>Is there any list of this icons out there or something else to look for these?</p>
| 0debug
|
Angular2 HTTP GET - Cast response into full object : <p>I have this simple Component</p>
<pre><code>import {Component} from 'angular2/core';
import {RouterLink, RouteParams} from 'angular2/router';
import {Http, Response, Headers} from 'angular2/http';
import {User} from '../../models/user';
import 'rxjs/add/operator/map';
@Component({
template: `
<h1>{{user.name}} {{user.surname}}</h1>
`,
directives: [RouterLink],
})
export class UserComponent {
user: User;
constructor(private routeParams: RouteParams,
public http: Http) {
this.user = new User();
this.http.get('http://localhost:3000/user/' + this.routeParams.get('id'))
.map((res: Response) => res.json())
.subscribe((user: User) => this.user = user);
console.log(this.user);
}
}
</code></pre>
<p>Why does <code>subscribe</code> not cast the response into a full <code>User</code> object. When I am logging the <code>user</code> variable my console say <code>User {_id: undefined, name: undefined, surname: undefined, email: undefined}</code>. But nevertheless binding to <code>.name</code> and <code>.surname</code> in the view is working..</p>
<p>What happens here? Where is the user actually stored? </p>
| 0debug
|
static void panicked_mon_event(const char *action)
{
QObject *data;
data = qobject_from_jsonf("{ 'action': %s }", action);
monitor_protocol_event(QEVENT_GUEST_PANICKED, data);
qobject_decref(data);
}
| 1threat
|
Firebase Cloud Firestore : Invalid collection reference. Collection references must have an odd number of segments : <p>I have the following code and getting an error : </p>
<pre><code>Invalid collection reference. Collection references must have an odd number of segments
</code></pre>
<p><strong>And the code :</strong></p>
<pre><code>private void setAdapter() {
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("app/users/" + uid + "/notifications").get().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
for (DocumentSnapshot document : task.getResult()) {
Log.d("FragmentNotifications", document.getId() + " => " + document.getData());
}
} else {
Log.w("FragmentNotifications", "Error getting notifications.", task.getException());
}
});
}
</code></pre>
| 0debug
|
Plz explain working of this part of code: BigInteger.valueOf(counter).testBit(j) : for (int counter = 1; counter < opsize; counter++)`
`
{
`
` for (int j = 0; j < n; j++)
{
`
` if (BigInteger.valueOf(counter).testBit(j))
`
` System.out.print(arr[j]+" ");
}
`
` System.out.println();
}
}
| 0debug
|
Which private key file in private-keys-v1.d directory belongs to which key? : <p>Since GnuPG 2.1 (<a href="https://www.gnupg.org/faq/whats-new-in-2.1.html" rel="noreferrer">https://www.gnupg.org/faq/whats-new-in-2.1.html</a>), private keys of GnuPG are stored in the <code>private-keys-v1.d</code> subdirectory. After experimenting with key creation etc., I found that I have several <code>*.key</code> files in this directory:</p>
<pre><code>$ ls .gnupg/private-keys-v1.d
xxxxxxxxxxxxxxxxxxxxxxxxxxxx.key
yyyyyyyyyyyyyyyyyyyyyyyyyyyy.key
zzzzzzzzzzzzzzzzzzzzzzzzzzzz.key
...
</code></pre>
<p>The file names (x+, y+ and z+) looks like fingerprints etc., but are not equal to any of my existing public keys. How can I find which key file in this directory belongs to which key visible with <code>gpg --list-keys</code>?</p>
| 0debug
|
Have an "'Resource.Attribute' does not contain a definition for 'actionBarSize'" error : <p>Was trying to debug an empty app and got "'Resource.Attribute' does not contain a definition for 'actionBarSize'" error. I have reinstalled android SDK's.</p>
<pre><code> public static void UpdateIdValues()
{
global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::L1NQ.Droid.Resource.Attribute.actionBarSize;
}
public partial class Attribute
{
static Attribute()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Attribute()
{
}
}
</code></pre>
| 0debug
|
cannot train Keras convolution network on GPU : <p>I can train a Keras network with <code>Dense</code> layer using <code>keras.datasets.fashion_mnist</code> dataset. However, when I tried to train a convolutional network, I got an error.</p>
<p>Here is some part of the code:</p>
<pre><code>from tensorflow.keras.layers import *
model = keras.Sequential([
Convolution2D(16, (3,3), activation='relu', input_shape=(28,28,1)),
MaxPooling2D(pool_size=(2,2)),
Flatten(),
Dense(16, activation='relu'),
Dense(10, activation='softmax')
])
model.compile(optimizer=tf.train.AdamOptimizer(),
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(train_images, train_labels, epochs=5)
</code></pre>
<p>and its error when I tried to fit.</p>
<blockquote>
<p>UnknownError: Failed to get convolution algorithm. This is probably
because cuDNN failed to initialize, so try looking to see if a warning
log message was printed above. [[{{node conv2d/Conv2D}} =
Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1],
padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true,
_device="/job:localhost/replica:0/task:0/device:GPU:0"](training/TFOptimizer/gradients/conv2d/Conv2D_grad/Conv2DBackpropFilter-0-TransposeNHWCToNCHW-LayoutOptimizer,
conv2d/Conv2D/ReadVariableOp)]] [[{{node
loss/dense_1_loss/broadcast_weights/assert_broadcastable/AssertGuard/Assert/Switch_2/_69}}
= _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0",
send_device="/job:localhost/replica:0/task:0/device:GPU:0",
send_device_incarnation=1, tensor_name="edge_112_l...t/Switch_2",
tensor_type=DT_INT32,
_device="/job:localhost/replica:0/task:0/device:CPU:0"]]</p>
</blockquote>
<p>I have <code>cudnn64_7.dll</code> in <code>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin</code> and the <code>PATH</code> is already contain that folder.</p>
| 0debug
|
Culture is suddenly not supported anymore on Azure web app : <p>Out of the blue our Azure web app is spewing out errors regarding a Culture that is not supported. We load up a list of countries to show on the front page but this is suddenly giving errors. The same code is used on other various web apps as well and they aren't having the problem.</p>
<p>The following code gives a problem.</p>
<pre><code> private List<SelectListItem> Countries()
{
RegionInfo country = new RegionInfo(new CultureInfo("nl-BE", false).LCID);
List<SelectListItem> countryNames = new List<SelectListItem>();
foreach (CultureInfo cul in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
country = new RegionInfo(new CultureInfo(cul.Name, false).LCID);
countryNames.Add(new SelectListItem() { Text = country.DisplayName, Value = country.DisplayName });
}
return countryNames.GroupBy(x => x.Text).Select(x => x.FirstOrDefault()).ToList<SelectListItem>().OrderBy(x => x.Text).ToList();
}
</code></pre>
<p>I placed a try-catch in the for-each so I can pinpoint the cultures that are giving errors. The following cultures are suddenly returning errors:</p>
<pre><code><errors>
<LCID>4096</LCID>
<Name>ar-001</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>el-CY</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-BB</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-BS</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-HK</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-NL</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>en-SE</Name>
</errors>
<errors>
<LCID>4096</LCID>
<Name>es-419</Name>
</errors>
</code></pre>
<p>Can someone help me with this issue? I can't seem to make sense on why this web app is suddenly giving these errors.</p>
| 0debug
|
Oracle how to combination and count two columns : i need help
my table like this;
A.........................B
1.......................100
1.......................102
1.......................105
2.......................100
2.......................105
3.......................100
3.......................102
i want output like this:
A......................Count(B)
1...................... 3
1,2.................... 2
1,2,3.................. 3
2...................... 2
3...................... 2
how can i do this?
i try to use listagg but it didnt work. sorry for my english
| 0debug
|
static av_cold void movie_uninit(AVFilterContext *ctx)
{
MovieContext *movie = ctx->priv;
int i;
for (i = 0; i < ctx->nb_outputs; i++) {
av_freep(&ctx->output_pads[i].name);
if (movie->st[i].st)
avcodec_close(movie->st[i].st->codec);
}
av_freep(&movie->st);
av_freep(&movie->out_index);
av_frame_free(&movie->frame);
if (movie->format_ctx)
avformat_close_input(&movie->format_ctx);
}
| 1threat
|
static int qio_channel_buffer_close(QIOChannel *ioc,
Error **errp)
{
QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc);
g_free(bioc->data);
bioc->capacity = bioc->usage = bioc->offset = 0;
return 0;
}
| 1threat
|
static int mp_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MotionPixelsContext *mp = avctx->priv_data;
GetBitContext gb;
int i, count1, count2, sz;
mp->frame.reference = 1;
mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &mp->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!mp->bswapbuf)
return AVERROR(ENOMEM);
mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);
if (buf_size & 3)
memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
memset(mp->changes_map, 0, avctx->width * avctx->height);
for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
count1 = get_bits(&gb, 12);
count2 = get_bits(&gb, 12);
mp_read_changes_map(mp, &gb, count1, 8, i);
mp_read_changes_map(mp, &gb, count2, 4, i);
}
mp->codes_count = get_bits(&gb, 4);
if (mp->codes_count == 0)
goto end;
if (mp->changes_map[0] == 0) {
*(uint16_t *)mp->frame.data[0] = get_bits(&gb, 15);
mp->changes_map[0] = 1;
}
mp_read_codes_table(mp, &gb);
sz = get_bits(&gb, 18);
if (avctx->extradata[0] != 5)
sz += get_bits(&gb, 18);
if (sz == 0)
goto end;
init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0);
mp_decode_frame_helper(mp, &gb);
free_vlc(&mp->vlc);
end:
*data_size = sizeof(AVFrame);
*(AVFrame *)data = mp->frame;
return buf_size;
}
| 1threat
|
How to change permission recursively to folder with AWS s3 or AWS s3api : <p>I am trying to grant permissions to an existing account in s3.</p>
<p>The bucket is owned by the account, but the data was copied from another account's bucket.</p>
<p>When I try to grant permissions with the command:</p>
<pre><code>aws s3api put-object-acl --bucket <bucket_name> --key <folder_name> --profile <original_account_profile> --grant-full-control emailaddress=<destination_account_email>
</code></pre>
<p>I receive the error:</p>
<pre><code>An error occurred (NoSuchKey) when calling the PutObjectAcl operation: The specified key does not exist.
</code></pre>
<p>while if I do it on a single file the command is successful.</p>
<p>How can I make it work for a full folder?</p>
| 0debug
|
How can I determine if a variable is an array? [JS NG TS CS JQ] : <p>Sometimes it is necessary to determine what type of data a variable contains, in this specific case we are talking about the <code>Array</code> type.</p>
<p>How can I end in the different scenarios if the variable is <code>Array</code> type?
I'm talking about scenarios, I'm talking about <code>jQuery</code>, <code>Angular</code>, <code>TypeScript</code>, <code>CoffeeScript</code>, etc.</p>
<p>Thank you!</p>
| 0debug
|
How can we use loop to take multiple input in php? What is wrong with this program? : <pre><code><html>
<head></head>
<body>
<form method="post">
<input type="number" name="x" value="0"/>
<input type="number" name="y"/>
<input type="number" name="z"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
<?php
$x=$POST_['x'];
$y=$POST_['y'];
$z=$POST_['z'];
echo $x;
echo $y;
echo $z;
?>
</code></pre>
<p>Can anyone tell me how to do this?
I'm trying to take input from user and print it. I have done this manually but this is also not running.</p>
| 0debug
|
static inline void drawbox(AVFilterBufferRef *picref, unsigned int x, unsigned int y,
unsigned int width, unsigned int height,
uint8_t *line[4], int pixel_step[4], uint8_t color[4],
int hsub, int vsub, int is_rgba_packed, uint8_t rgba_map[4])
{
int i, j, alpha;
if (color[3] != 0xFF) {
if (is_rgba_packed) {
uint8_t *p;
for (j = 0; j < height; j++)
for (i = 0; i < width; i++)
SET_PIXEL_RGB(picref, color, 255, i+x, y+j, pixel_step[0],
rgba_map[0], rgba_map[1], rgba_map[2], rgba_map[3]);
} else {
unsigned int luma_pos, chroma_pos1, chroma_pos2;
for (j = 0; j < height; j++)
for (i = 0; i < width; i++)
SET_PIXEL_YUV(picref, color, 255, i+x, y+j, hsub, vsub);
}
} else {
ff_draw_rectangle(picref->data, picref->linesize,
line, pixel_step, hsub, vsub,
x, y, width, height);
}
}
| 1threat
|
static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
if (s->ctx) {
virtio_scsi_dataplane_start(s);
if (!s->dataplane_fenced) {
return;
}
}
virtio_scsi_handle_event_vq(s, vq);
}
| 1threat
|
Is it possible to keep track of a random character in swift? : <p>I created a project and I added that swipe gesture thing, my ViewController has a label when I swipe left👈 It replaces my label with random string from my array (It works ok),However when I swipe right👉 I want to see the previous string from my array the problem is that it is a random string so I can’t keep track of it, any ideas how to do it?</p>
| 0debug
|
i am trying to get FACEBOOK COVER via graph API, but i cant. My code is : ` `` try {
` `$requestCover = $fb->get('me?fields=cover'); //getting user Cover
$requestProfileCover=$fb->get('/me');
// $cover = $requestCover->getGraphUser();
// $profile = $requestProfileCover->getGraphUser();
}
catch(Facebook\Exceptions\FacebookResponseException $e) {
echo ' error: ' . $e->getMessage();
exit;
}
catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK error: ' . $e->getMessage();
exit;
}
print_r($requestCover); // showing cover details on the screen
echo "<img src='".$requestCover['source']."'/>";
| 0debug
|
Windows 10 Boot Linux without BIOS menu or USB stick : <p>I have Linux both command line linux, and Ubuntu, but my computer is Windows 10 based. Also the hardware is not what it used to be. I.e... No working USB port, No DVD slot (But I do have a Micro SD slot if I can boot it from there) but I was wondering if I can install and boot linux directly in Windows? And I was wondering if Windows 10 would be active still, and if I an switch in between the two? I have never worked with Linux or booted it. How can I boot linux in windows without anything but a micro sd card? </p>
| 0debug
|
How do I translate my code from C# to C++ for a CRC function? : <p>I have the following code in C# to calculate a CRC and it works like I want it to.</p>
<pre><code> public byte crc_8(byte[] byteArray)
{
ushort reg_crc = 0;
for(int i = 0; i<byteArray.Length; i++)
{
reg_crc ^= byteArray[i];
for(int j = 0; j < 8; j++)
{
if((reg_crc & 0x01) == 1)
{
reg_crc = (ushort)((reg_crc >> 1) ^ 0xE5);
}
else
{
reg_crc = (ushort)(reg_crc >> 1);
}
}
}
reg_crc = (byte)(reg_crc & 0xFF);
return (byte)reg_crc;
}
</code></pre>
<p>I also need to add this same function to a code project that is in C++, but I am brand new to C++. This is as far as I have gotten, and I am not sure with how to proceed with the code inside of the for loop. Also note that <code>RX_PACKET_SIZE</code> is equivalent to <code>byteArray.Length</code> in that it can be used for the same purpose. I know that is okay.</p>
<pre><code>static uint8_t crc_8(unit8_t array_to_process [])
{
uint16_t reg_crc = 0;
for(int i = 0; i < RX_PACKET_SIZE; i++)
{
}
}
</code></pre>
| 0debug
|
static int check_opts(QemuOptsList *opts_list, QDict *args)
{
assert(!opts_list->desc->name);
return 0;
}
| 1threat
|
Angular2 FileSaver.js - Cannot find module 'file-saver' : <p>I am working on moving an angular 1.x site to a new angular 2.0 site I created the site using angular-cli 1.0.0-beta.15. </p>
<p>I have a button to export some data to a CSV file. When the page first loads I get an error message "Cannot find module 'file-saver'", but when I click the button everything works perfectly. </p>
<p>I have the FileSaver.js component installed:</p>
<p>package.json</p>
<pre><code>...
"dependencies": {
...
"@types/filesaver": "0.0.30",
"file-saver": "^1.3.2"
...
}
...
</code></pre>
<p>in my export.service.ts:</p>
<pre><code>import { saveAs } from 'file-saver';
...
let file = new Blob(['hello world'], { type: 'text/csv;charset=utf-8' });
saveAs(file, 'helloworld.csv');
...
</code></pre>
<p>Does anyone know how to resolve this error?</p>
| 0debug
|
Python: wordcloud, repetitve words : <p>In the word cloud I have repetitive words and I do not understand why they are not counted together and are shown then as one word.</p>
<pre><code>from wordcloud import WordCloud
word_string = 'oh oh oh oh oh oh verse wrote book stand title book would life superman thats make feel count privilege love ideal honored know feel see everyday things things say rock baby truth rock love rock rock everything need rock baby rock wanna kiss ya feel ya please ya right wanna touch ya love ya baby night reward ya things rock love rock love rock oh oh oh verse try count ways make smile id run fingers run timeless things talk sugar keeps going make wanna keep lovin strong make wanna try best give want need give whole heart little piece minimum talking everything single wish talking every dream rock baby truth rock love rock rock everything need rock baby rock wanna kiss ya feel ya please ya right wanna touch ya love ya baby night reward ya things rock love rock wanna rock bridge theres options dont want theyre worth time cause oh thank like us fine rock sand smile cry joy pain truth lies matter know count oh oh oh oh oh oh rock baby truth rock love rock rock everything need rock baby rock wanna kiss ya feel ya please ya right wanna touch ya love ya baby night reward ya things rock love rock love rock oh oh oh oh oh oh wanna kiss ya feel ya please ya right wanna touch ya love ya baby night reward ya things rock love rock wanna rock party people people party popping sitting around see looking looking see look started lets hook little one one come give stuff let freshin ruff lets go lets hook start wont stop baby baby dont stop come give stuff lets go black culture black culture black culture black culture party people people party popping sitting around see looking looking see look started lets hook come one give stuff let freshin little one one ruff lets go lets hook start wont stop baby baby dont stop come give stuff lets go black culture black culture black culture black culture lets hook come give stuff let freshin little one one ruff lets go lets hook start wont stop baby baby dont stop come give stuff lets go lets hook come give stuff let freshin little one one ruff lets go lets hook start wont stop baby baby dont stop come give stuff lets go black culture black culture black culture black culture black culture black culture black culture black culture'
wordcloud = WordCloud(background_color="white",
width=1200, height=1000,
stopwords=STOPWORDS
).generate(word_string)
plt.imshow(wordcloud)
</code></pre>
<p>As you see words like love, oh, rock, black, culture appear several times and it seems that they are not counted together. What am I doing wrong?</p>
<p><a href="https://i.stack.imgur.com/FtDGW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FtDGW.png" alt="enter image description here"></a></p>
| 0debug
|
How to pass 'this' into a Promise without caching outside? : <p>I have a variable called <code>LangDataService.isDataReady</code> that is a Promise wawiting to be resolved. Upon resolve some logic will happen. How can I pass this into that Promise?</p>
<pre><code>LangDataService.isDataReady.then(function () {
this.modalOn()
});
</code></pre>
<p>I know i can cache <code>var self_ = this;</code> but I'm curious of other alternatives? </p>
| 0debug
|
how to get min or max dates from a list of dates using moment.js? : <p>I want to have the max date from the list of dates given in the <strong>handleClick</strong> function.
How to find the max date from the list of dates using <strong>moment.js</strong>?</p>
<p>I have the following code:</p>
<pre><code>import React, {Component} from 'react';
import moment from 'moment';
class Getdate extends Component
{
constructor() {
super();
this.state = {
dates = []
}
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.state.dates = ['2017-11-12', '2017-10-22', '2015-01-10', '2018-01-01', '2014-10-10'];
console.log(this.state.dates);
}
render{
return (
<button onClick={this.handleClick}>Get Max Date</button>
)
}
}
export default Getdate
</code></pre>
| 0debug
|
Is there a way to understand documentation? Android Studio : I am simply trying to read documentation for TimeUnit in android studio. Here is the link
https://developer.android.com/reference/java/util/concurrent/TimeUnit.html
However I am slightly confused on how to read and understand it correctly.
For example, the following code will timeout in 50 milliseconds if the lock is not available:
Lock lock = ...;
if (lock.tryLock(50L, TimeUnit.MILLISECONDS)) ...
How do I initialize this?
I have tried Lock lock = new Lock(); ---but this makes me implement all of the methods. I am simply trying to use it how the documentation describes it.
Summary: I find documentation very ambiguous, and hard to understand without it being explained step by step. Is there a way to read and understand documentation in a simpler way that I can understand? I feel if I can learn to read the documentation better I will spend less time searching for answers all over the web. Thank you!
| 0debug
|
static void read_ttag(AVFormatContext *s, int taglen, const char *key)
{
char *q, dst[512];
int len, dstlen = sizeof(dst) - 1;
unsigned genre;
dst[0] = 0;
if (taglen < 1)
return;
taglen--;
switch (get_byte(s->pb)) {
case 0:
q = dst;
while (taglen--) {
uint8_t tmp;
PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
}
*q = '\0';
break;
case 3:
len = FFMIN(taglen, dstlen - 1);
get_buffer(s->pb, dst, len);
dst[len] = 0;
break;
}
if (!strcmp(key, "genre")
&& (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)
&& genre <= ID3v1_GENRE_MAX)
av_strlcpy(dst, ff_id3v1_genre_str[genre], sizeof(dst));
if (*dst)
av_metadata_set(&s->metadata, key, dst);
}
| 1threat
|
python3 syntax: * before variable : <pre><code>g = dominoes.Game.new()
for _ in range(fixed_moves):
g.make_move(*g.valid_moves[0])
</code></pre>
<p>In the last line, what does the <code>*</code> before object <code>g</code> mean?</p>
| 0debug
|
Filter with a condition : <pre><code>df <- data.frame(month_key = c(rep(201504, 2), rep(201505, 3)),
id = c(1, 2, 1, 2, 3))
</code></pre>
<p>I have a dataframe like df, for each month ID are not necessary distinct.
I want to filter my dataframe and keep only the ID with appears in the first month_key (in my exemple id = 1 and 2).
I don't want to select my id for the first month and inner_join with the other month ...
Thank you</p>
| 0debug
|
Guidance on basic python assignment : <p>Need to create a python code to provide a list of tuples (searched words, list of occurrences).
the searched words are listed in a Thesaurus which need to be searched in a series of documents in a Corpus.</p>
<p>Any suggestion/guidance?</p>
| 0debug
|
C# get windows list from primary screen only : How can I get list of windows from primary screen only on multi-monitor configuration?
| 0debug
|
json-server cannot access via local IP : <p>I'm using <code>npm json-server</code> from <a href="https://www.npmjs.com/package/json-server" rel="noreferrer">here</a>. It used to work great for my needs: run a server on my PC and do <code>GET</code> requests to local IP (192.168.1.XX). I reinstalled it and now I can do requests only to <em>localhost</em> or <em>127.0.0.1</em>. Can't do requests to local IP (cmd ipconfig) anymore. I'm getting this error:</p>
<p><a href="https://i.stack.imgur.com/V9gVG.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/V9gVG.jpg" alt="enter image description here"></a></p>
<p>As @fvu mentioned <a href="https://stackoverflow.com/a/38175246/3595288">here</a> </p>
<blockquote>
<p>this means that the server software is configured to listen on the localhost interface only. This is a configuration item and to avoid exposing a potentially unsecure server many server programs come preconfigured to listen on localhost only.</p>
</blockquote>
<p>So is there a way to access this server via local IP as long as json-server doesn't have some extra parameters to enable/disable it?</p>
| 0debug
|
static void load_module(const char *filename)
{
void *dll;
void (*init_func)(void);
dll = dlopen(filename, RTLD_NOW);
if (!dll) {
fprintf(stderr, "Could not load module '%s' - %s\n",
filename, dlerror());
}
init_func = dlsym(dll, "ffserver_module_init");
if (!init_func) {
fprintf(stderr,
"%s: init function 'ffserver_module_init()' not found\n",
filename);
dlclose(dll);
}
init_func();
}
| 1threat
|
def volume_cube(l):
volume = l * l * l
return volume
| 0debug
|
Airflow Python Script with execution_date in op_kwargs : <p>With assistance from this answer <a href="https://stackoverflow.com/a/41730510/4200352">https://stackoverflow.com/a/41730510/4200352</a> I am executing a python file.</p>
<p>I use PythonOperator and am trying to include the execution date as an argument passed to the script.</p>
<p>I believe I can access it somehow through kwargs['execution_date'].</p>
<p>The below fails</p>
<p><strong>DAG.py</strong></p>
<pre><code>from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
import sys
import os
sys.path.append(os.path.abspath("/home/glsam/OmegaAPI/airflow/scripts/PyPer_ogi_simple"))
from update_benchmarks import *
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2018, 4, 23),
'email': ['airflow@example.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),
}
dag = DAG('run_pyPer', default_args=default_args)
update_BM_G027 = PythonOperator(
task_id='update_BM_G027',
python_callable=update_bmk,
dag=dag,
op_kwargs={
'bmk_code': 'G027',
'is_hedged': False,
'from_date': kwargs['execution_date'],
})
</code></pre>
<p>Do maybe i need to use this answer to get the date then XCOM it to the task? <a href="https://stackoverflow.com/a/36754930/4200352">https://stackoverflow.com/a/36754930/4200352</a></p>
| 0debug
|
How can iterate json string in java : <p>how can iterate folliwng string using json in java?
please help me to resolve</p>
<pre><code>{
"doc": {
"info": {
"calaisRequestID": "99bb6d1b-4cd4-f707-15a1-21d5b7e5fe06",
"id": "http://id.opencalais.com/PtEjIbIEZJnsbQ6Dg7FxDg",
"docDate": "2017-02-06 06:29:58.538"
},
"meta": {
"contentType": "text/raw",
"signature": "digestalg-1|FQYcf/+Yws22W7+jhh+/DXJkVVw=|Gq8H8eU8ouqthpHXVjEqNRPesF1Kqh1SVB0SColRFoxQ2t5cxU9NyA==",
"language": "English"
}
},
"http://d.opencalais.com/dochash-1/089ef2a6-c33e-32b7-bbd4-cb078da19bd8/cat/1": {
"_typeGroup": "topics",
"name": "Business_Finance"
},
}
</code></pre>
| 0debug
|
How can I enter text into the button to display the square root : <p>How can I achieve this effect on the button?</p>
<p><a href="https://i.stack.imgur.com/hqRL9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hqRL9.png" alt="enter image description here"></a></p>
| 0debug
|
static ssize_t drop_sync(QIOChannel *ioc, size_t size)
{
ssize_t ret, dropped = size;
char small[1024];
char *buffer;
buffer = sizeof(small) < size ? small : g_malloc(MIN(65536, size));
while (size > 0) {
ret = read_sync(ioc, buffer, MIN(65536, size));
if (ret < 0) {
goto cleanup;
}
assert(ret <= size);
size -= ret;
}
ret = dropped;
cleanup:
if (buffer != small) {
g_free(buffer);
}
return ret;
}
| 1threat
|
type_init(boston_register_types)
static void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr,
bool is_64b)
{
const uint32_t cm_base = 0x16100000;
const uint32_t gic_base = 0x16120000;
const uint32_t cpc_base = 0x16200000;
if (is_64b) {
stl_p(p++, 0x40287803);
stl_p(p++, 0x00084138);
} else {
stl_p(p++, 0x40087803);
stl_p(p++, 0x00084100);
}
stl_p(p++, 0x3c09a000);
stl_p(p++, 0x01094025);
stl_p(p++, 0x3c0a0000 | (cm_base >> 16));
if (is_64b) {
stl_p(p++, 0xfd0a0008);
} else {
stl_p(p++, 0xad0a0008);
}
stl_p(p++, 0x012a4025);
stl_p(p++, 0x3c090000 | (gic_base >> 16));
stl_p(p++, 0x35290001);
if (is_64b) {
stl_p(p++, 0xfd090080);
} else {
stl_p(p++, 0xad090080);
}
stl_p(p++, 0x3c090000 | (cpc_base >> 16));
stl_p(p++, 0x35290001);
if (is_64b) {
stl_p(p++, 0xfd090088);
} else {
stl_p(p++, 0xad090088);
}
stl_p(p++, 0x2404fffe);
stl_p(p++, 0x3c050000 | ((fdt_addr >> 16) & 0xffff));
if (fdt_addr & 0xffff) {
stl_p(p++, 0x34a50000 | (fdt_addr & 0xffff));
}
stl_p(p++, 0x34060000);
stl_p(p++, 0x34070000);
stl_p(p++, 0x3c190000 | ((kernel_entry >> 16) & 0xffff));
stl_p(p++, 0x37390000 | (kernel_entry & 0xffff));
stl_p(p++, 0x03200009);
}
| 1threat
|
Recursive division for a maze : <p>I understand the basic principles of the idea behind traversing a maze. I have looked at numerous websites on how to go about making my maze recursive. </p>
<pre><code>private static void makeMazeRecursive(char[][]level, int startX, int startY, int endX, int endY)
{
}
</code></pre>
<p>This is what I have to work with. How do I go about dividing the walls I was given (height = 25, width = 80)? Any help is very appreciated.
Basically, I am given the blank slate of the maze, now my job is to make a recursive method for it. </p>
| 0debug
|
Javascript onClick get element : <p>I want to have multiple elements calling one function with onClick, is there anyway to get what element called it though?</p>
<p>I thought about giving each on an id and doing function(1) and then doing it based of that but is there anyway to dynamically do this?</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.