problem
stringlengths
26
131k
labels
class label
2 classes
C# - What does passing by ref do? : I know what passing by ref is and what it means but what exactly does it do with the objects passed by ref? Does it guarantee the objects to stay at their current position in memory while the reference is being used? Does the behavior change between local objects and global objects? I'm mostly interested with what happens in memory. **A bit of background information:** I have written a simple test program that stores the memory address of objects passed by ref and noticed how C# likes to move objects around in memory. But what I think is odd was that the objects being used were locals of a function. This automatically makes me think that the object's reference can't move in memory because it is on the stack. But clearly I'm missing something. What kind of memory was I receiving when using the ref?
0debug
Creating game, currently using SQL Server to store data, looking for better alternatives : <p>I have been using SQL Server 2014 to store a DB for the game to use with multiple tables...it's a football game so there are quite a few tables...players, coaches, owners, GMs, scouts, teams, etc...</p> <p>The question I have is will end users need to have SQL server installed to utilize the DBs in the game? If so, I need to switch to a different option and am wondering what the best option would be for storing large amounts of data which will not require end users to have something special installed to utilize them? </p> <p>CSV seems the obvious easy answer but I think that would be too much data for a CSV file to handle well.</p>
0debug
HTML5 Multiple File Upload. Return lastinsertid through jQuery AJAX and PHP? : <p>I have an html multiple file upload:</p> <pre><code>&lt;input type="file" multiple="multiple"&gt; </code></pre> <p>I'm successfully uploading files, and writing to my db table:</p> <p><strong>jQuery</strong></p> <pre><code>function uploadFile() { //some other stuff done here... var ajaxRequest = $.ajax({ url: '../inc/ajax-upload.php', type: 'POST', cache: false, processData: false, // important contentType: false, // important data: formData, }); ajaxRequest.done(function(data) { console.log(data); lastid = 'this comes from data'; $.each(files, function(i, file) { $('div#files').append('&lt;div class="file-name" id="'+ file['name'] +'"&gt;'+file['name']+'&lt;button class="file-delete" id="' + lastid +'"&gt;delete&lt;/button&gt;'); }); }) ajaxRequest.fail(function(jqXHR) { console.log(jqXHR); }) } </code></pre> <p><strong>php</strong></p> <pre><code>//CRUD stuff in another file function pdoInsert($sql, $args) { $pdo = dbConnect(); $stmt = $pdo-&gt;prepare($sql); $stmt-&gt;execute($args); echo $pdo-&gt;lastInsertId(); } function addFile($filename){ $sql = 'INSERT INTO tbl_files (filename) VALUES (?)'; $args = array($filename); echo pdoInsert($sql, $args); } //ajax.php file $lastid = array(); foreach($_FILES as $file) { //do filesystem stuff //insert to db, get last insert id $lastid[] = addFile($filename); } echo json_encode($lastid); </code></pre> <p>I want the <code>$lastid</code> from my PHP to be in JSON format like, however, it's returning a concatenated string of the insert id's, e.g. <code>123124[null,null]</code> or something like that. What could be wrong here?</p>
0debug
google maps your timeline api : <p>google maps' new feature your timeline <a href="https://www.google.com/maps/timeline">https://www.google.com/maps/timeline</a> seems to be useful to retrieve location history for a given user, my question is how to use google maps to retrieve this timeline ? it is possible ? sorry am new to google world and i have looked for this information on their site but no news.</p> <p>Thanks !</p>
0debug
Split up single JSON object into multiple objects : I have a single JSON object that I would like to split up into multiple JSON objects. I'm not sure how to go about splitting up the array with either `filter`, `map` or `reduce`. I couldn't figure out a pattern to break up the single object if there's an absent key, i.e. meal1, meal2, etc. I appreciate any help or pointers in the right direction! Before { "fullName1" : "John Doe", "attendance1" : 1, "meal1" : "salmon", "fullName2" : "Jane Doe", "attendance2" : 0 } Desired result { "fullName" : "John Doe", "attendance" : 1, "meal" : "salmon" }, { "fullName" : "Jane Doe" "attendance" : 0 }
0debug
Why do not SQLite work in my Android Studio? : I am make app in nadroid studio with sqlite and it doesnt work. So i make new project to test sqlite, but it again dont work. So i create most simple app with sqlite without mistake, but it doesnt work. It write application keep stopping. Does anyone know why it doesn't work? Logcat: > 2019-01-19 16:52:48.127 1605-1605/? E/AudioFlinger: not enough memory for AudioTrack size=131296 > 2019-01-19 16:52:48.127 1605-1605/? E/AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block? 2019-01-19 16:52:48.141 1605-18287/? I/AudioFlinger: AudioFlinger's thread 0xdf9836c0 tid=18287 ready to run 2019-01-19 16:52:48.143 3235-17962/com.google.android.googlequicksearchbox:search E/IAudioFlinger: createRecord returned error -12 2019-01-19 16:52:48.144 3235-17962/com.google.android.googlequicksearchbox:search E/AudioRecord: AudioFlinger could not create record track, status: -12 2019-01-19 16:52:48.156 3235-17962/com.google.android.googlequicksearchbox:search E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -12. 2019-01-19 16:52:48.160 3235-17962/com.google.android.googlequicksearchbox:search E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object. > com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream at com.google.android.apps.gsa.staticplugins.microdetection.d.k.a(SourceFile:91) at com.google.android.apps.gsa.staticplugins.microdetection.d.l.run(Unknown Source:14) at com.google.android.libraries.gsa.runner.a.a.b(SourceFile:32) at com.google.android.libraries.gsa.runner.a.c.call(Unknown Source:4) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.google.android.apps.gsa.shared.util.concurrent.b.g.run(Unknown Source:4) at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4) at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) at com.google.android.apps.gsa.shared.util.concurrent.b.i.run(SourceFile:6) Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space. at com.google.android.apps.gsa.speech.audio.Tee.j(SourceFile:103) at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2) at java.io.InputStream.read(InputStream.java:101) at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:17) at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) And many more lines. If you want i can send you screens of logcat. MainActivity: public class MainActivity extends Activity { EditText studentid = (EditText) findViewById(R.id.id); EditText studentname = (EditText) findViewById(R.id.name); TextView first = (TextView) findViewById(R.id.first); @Override public void onCreate(Bundle save) { super.onCreate(save); } public void loadStudents(View view) { MyDBHandler dbHandler = new MyDBHandler(this, null, null, 1); first.setText(dbHandler.loadHandler()); studentid.setText(""); studentname.setText(""); } public void addStudent(View view) { MyDBHandler dbHandler = new MyDBHandler(this, null, null, 1); int id = Integer.parseInt(studentid.getText().toString()); String name = studentname.getText().toString(); Student student = new Student(id, name); dbHandler.addHandler(student); studentid.setText(""); studentname.setText(""); } } Student: public class Student { // fields private int studentID; private String studentName; // constructors public Student() {} public Student(int id, String studentname) { this.studentID = id; this.studentName = studentname; } // properties public void setID(int id) { this.studentID = id; } public int getID() { return this.studentID; } public void setStudentName(String studentname) { this.studentName = studentname; } public String getStudentName() { return this.studentName; } } MyDBHandler: public class MyDBHandler extends SQLiteOpenHelper { //information of database private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "studentDB.db"; public static final String TABLE_NAME = "Student"; public static final String COLUMN_ID = "StudentID"; public static final String COLUMN_NAME = "StudentName"; //initialize the database public MyDBHandler(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { super(context, DATABASE_NAME, factory, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String CREATE_TABLE = "CREATE TABLE" + TABLE_NAME + "(" + COLUMN_ID + "INTEGER PRIMARYKEY," + COLUMN_NAME + "TEXT )"; db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int i, int i1) {} public String loadHandler() { String result = ""; String query = "SELECT * FROM " + TABLE_NAME; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(query, null); while (cursor.moveToNext()) { int result_0 = cursor.getInt(0); String result_1 = cursor.getString(1); result += String.valueOf(result_0) + " " + result_1 + System.getProperty("line.separator"); } cursor.close(); db.close(); return result; } public void addHandler(Student student) { ContentValues values = new ContentValues(); values.put(COLUMN_ID, student.getID()); values.put(COLUMN_NAME, student.getStudentName()); SQLiteDatabase db = this.getWritableDatabase(); db.insert(TABLE_NAME, null, values); db.close(); } public Student findHandler(String studentname) { String query = "Select * FROM " + TABLE_NAME + " WHERE " + COLUMN_NAME + " = " + "'" + studentname + "'"; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(query, null); Student student = new Student(); if (cursor.moveToFirst()) { cursor.moveToFirst(); student.setID(Integer.parseInt(cursor.getString(0))); student.setStudentName(cursor.getString(1)); cursor.close(); } else { student = null; } db.close(); return student; } public boolean deleteHandler(int ID) { boolean result = false; String query = "Select * FROM " + TABLE_NAME + " WHERE " + COLUMN_ID + " = '" + String.valueOf(ID) + "'"; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(query, null); Student student = new Student(); if (cursor.moveToFirst()) { student.setID(Integer.parseInt(cursor.getString(0))); db.delete(TABLE_NAME, COLUMN_ID + "=?", new String[] { String.valueOf(student.getID()) }); cursor.close(); result = true; } db.close(); return result; } public boolean updateHandler(int ID, String name) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues args = new ContentValues(); args.put(COLUMN_ID, ID); args.put(COLUMN_NAME, name); return db.update(TABLE_NAME, args, COLUMN_ID + "=" + ID, null) > 0; } } activity_main: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.testovanisql.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/first" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"/> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="50dp" android:layout_centerHorizontal="true" android:ems="15" android:id="@+id/id"/> <EditText android:layout_width="wrap_content" android:layout_centerHorizontal="true" android:layout_height="wrap_content" android:ems="15" android:paddingTop="90dp" android:id="@+id/name"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="save" android:layout_below="@+id/name" android:id="@+id/save" android:layout_centerHorizontal="true" android:onClick="addStudent"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="load" android:layout_below="@+id/save" android:id="@+id/load" android:layout_centerHorizontal="true" android:onClick="loadStudents"/> </RelativeLayout>
0debug
static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst, int width, int height, int stride, const uint8_t *src, int src_size) { int i = 0; int read = 0; uint32_t length; uint32_t offset = 1; int esc_count = src[0]; GetBitContext gb; lag_rac rac; rac.avctx = l->avctx; l->zeros = 0; if (esc_count < 4) { length = width * height; if (esc_count && AV_RL32(src + 1) < length) { length = AV_RL32(src + 1); offset += 4; } init_get_bits(&gb, src + offset, src_size * 8); if (lag_read_prob_header(&rac, &gb) < 0) return -1; ff_lag_rac_init(&rac, &gb, length - stride); for (i = 0; i < height; i++) read += lag_decode_line(l, &rac, dst + (i * stride), width, stride, esc_count); if (read > length) av_log(l->avctx, AV_LOG_WARNING, "Output more bytes than length (%d of %d)\n", read, length); } else if (esc_count < 8) { esc_count -= 4; if (esc_count > 0) { for (i = 0; i < height; i++) src += lag_decode_zero_run_line(l, dst + (i * stride), src, width, esc_count); } else { for (i = 0; i < height; i++) { memcpy(dst + (i * stride), src, width); src += width; } } } else if (esc_count == 0xff) { for (i = 0; i < height; i++) memset(dst + i * stride, src[1], width); return 0; } else { av_log(l->avctx, AV_LOG_ERROR, "Invalid zero run escape code! (%#x)\n", esc_count); return -1; } for (i = 0; i < height; i++) { lag_pred_line(l, dst, width, stride, i); dst += stride; } return 0; }
1threat
Unable to echo class variable! Can't find what is wrong. : > <?php > > class userDetails { private $usersEmail; private $firstName; > private $lastName; > > // check if it's returned // echo $usersEmail.' '.$firstName.' > '.$lastName; //setter for class properties public function > __constructor($email,$fname,$lname) { > > $this->usersEmail = $email; $this->firstName = $fname; > $this->lastName = $lname; } > > //getter for class properties function getPropertyEmail() { > return $this->usersEmail; } function getPropertyFName() { > > return ($this->firstName); } function getPropertyLName() { > return ($this->lastName); } } $something = "something"; > //$something is actually a $_GET['id']; sent from xhrobject > $createdUser = new userDetails($something,$something,$something); > echo $createdUser->getPropertyEmail();
0debug
Sendgrid change href of link : <p>I am using Nodejs with Express and I am sending an email through Sendgrid, but Sendgrid is changing the href link</p> <pre><code>var emailText = '&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset="UTF-8"&gt;&lt;/head&gt;&lt;body&gt;&lt;a href="https://www.google.com"&gt;Here&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;' var from_email = new helper.Email('contact@test.com'); var to_email = new helper.Email('contact@test2.com'); var subject = 'Test'; var content = new helper.Content("text/html", emailText) var mail = new helper.Mail(from_email, subject, to_email, content); var request = sg.emptyRequest({ method: 'POST', path: '/v3/mail/send', body: mail.toJSON(), }); sg.API(request, function(error, response) { if (error) { console.log('Error response received'); } console.log(response.statusCode); console.log(response.body); console.log(response.headers); }); </code></pre> <p>When the email arrives the following link appears:</p> <p><code>https://u4006412.ct.sendgrid.net/wf/click?upn=rOQ9fjZGp5r0JyNfoC02LbL.....</code></p> <p>Could someone help me solve this problem?</p>
0debug
static uint64_t escc_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { SerialState *serial = opaque; ChannelState *s; uint32_t saddr; uint32_t ret; int channel; saddr = (addr >> serial->it_shift) & 1; channel = (addr >> (serial->it_shift + 1)) & 1; s = &serial->chn[channel]; switch (saddr) { case SERIAL_CTRL: trace_escc_mem_readb_ctrl(CHN_C(s), s->reg, s->rregs[s->reg]); ret = s->rregs[s->reg]; s->reg = 0; return ret; case SERIAL_DATA: s->rregs[R_STATUS] &= ~STATUS_RXAV; clr_rxint(s); if (s->type == kbd || s->type == mouse) ret = get_queue(s); else ret = s->rx; trace_escc_mem_readb_data(CHN_C(s), ret); if (s->chr) qemu_chr_accept_input(s->chr); return ret; default: break; } return 0; }
1threat
target_ulong helper_msub32_suov(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { int64_t t1 = extract64(r1, 0, 32); int64_t t2 = extract64(r2, 0, 32); int64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 - (t1 * t3); return suov32_neg(env, result); }
1threat
PHP convert date to DD-M-YY : <p>I'm trying to validate a date like 17-JAN-1985 in my code.</p> <p>Here is the function I'm using:</p> <pre><code>function fncDate($date){ $d = DateTime::createFromFormat('DD-M-YY', $date); $result = $d &amp;&amp; $d-&gt;format('DD-M-YY') == $date; if(!$result){ return "Date should be in the following format: DD-MMM-YYYY"; } } </code></pre> <p>This returns always false: <code>fncDate("17-JAN-1985");</code></p> <p>Am I doing something wrong?</p> <p>Thanks</p>
0debug
void ff_init_block_index(MpegEncContext *s){ const int linesize = s->current_picture.f->linesize[0]; const int uvlinesize = s->current_picture.f->linesize[1]; const int mb_size= 4; s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2; s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2; s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2; s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2; s->block_index[4]= s->mb_stride*(s->mb_y + 1) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; s->dest[0] = s->current_picture.f->data[0] + ((s->mb_x - 1) << mb_size); s->dest[1] = s->current_picture.f->data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift)); s->dest[2] = s->current_picture.f->data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift)); if(!(s->pict_type==AV_PICTURE_TYPE_B && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME)) { if(s->picture_structure==PICT_FRAME){ s->dest[0] += s->mb_y * linesize << mb_size; s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift); s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift); }else{ s->dest[0] += (s->mb_y>>1) * linesize << mb_size; s->dest[1] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift); s->dest[2] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift); assert((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD)); } } }
1threat
Can't use forEach with Filelist : <p>I'm trying to loop through a <code>Filelist</code>:</p> <pre><code>console.log('field:', field.photo.files) field.photo.files.forEach(file =&gt; { // looping code }) </code></pre> <p>As you can see <code>field.photo.files</code> has a <code>Filelist</code>:</p> <p><a href="https://i.stack.imgur.com/ci9Er.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ci9Er.png" alt="enter image description here"></a></p> <p>How to properly loop through <code>field.photo.files</code>?</p>
0debug
Set timezone React-Datepicker : <p>I'm using the <a href="https://www.npmjs.com/package/react-datepicker" rel="noreferrer">react-datepicker</a> to let user select a date. However, right now it uses local time (PDT), but I want to hardcode it to use a specific timezone (PST).</p> <p>I tried using <code>utcOffset</code> prop but it doesn't seem to be doing anything. Does anyone know how to accomplish this? </p>
0debug
case statement not working with numeric values in oracle : my requirement is to write a case statement something like mentioned below.but I am not getting the correct data. SELECT DIRECCION ,CASE WHEN DIRECCION like'%PISO [^0-9]%' THEN 'PISO [0-9]' ELSE 'PISO 1' END FROM TBL_SAR_SALAS. I think My attempt to find the numeric characters is not working ...moreover ISNUMERIC is also not supported. KIndly help
0debug
i need find the instace of an attribute that the objet is into an array : i dont know how i find the intance Motorola in the array clientes that is in a swich into a for. the exercise is this: Name and identification of de first cliente in buy a Motorola celphone. Maybe i need a condition like an if or a while in case 2 but i dont know how to do it. Again, sorry for my english, thanks!!! package principal1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import recursos.Cliente; public class Principal1 { public static void main(String[] args) throws IOException{ BufferedReader in =new BufferedReader(new InputStreamReader(System.in)); int opc=0; double ventasLG=0.0; int ventasKyocera=0; String nombre=""; Cliente clientes[]=new Cliente[5]; for (int i = 0; i < clientes.length; i++) { clientes[i] = new Cliente(nombre); String marcaCelular=""; int celular=0; System.out.println("Ingrese marca del celular:\n1.-Nokia\n2.-Motorola" + "\n3.-LG\n4.-Kyocera"); celular=Integer.parseInt(in.readLine()); switch(celular){ case 1: clientes[i].setMarcaCelular("Nokia"); System.out.println("Ingrese nombre del cliente"); nombre=in.readLine(); System.out.println("Ingrese cedula de identidad"); int cedulaIdentidad=Integer.parseInt(in.readLine()); System.out.println("Ingrese precio del celular"); int precioCelular=Integer.parseInt(in.readLine()); clientes[i]=new Cliente(nombre, cedulaIdentidad, marcaCelular, precioCelular); break; case 2: clientes[i].setMarcaCelular("Motorola"); System.out.println("Ingrese nombre del cliente"); nombre=in.readLine(); System.out.println("Ingrese cedula de identidad"); cedulaIdentidad=Integer.parseInt(in.readLine()); System.out.println("Ingrese precio del celular"); precioCelular=Integer.parseInt(in.readLine()); clientes[i]=new Cliente(nombre, cedulaIdentidad, marcaCelular, precioCelular); break; case 3: clientes[i].setMarcaCelular("LG"); System.out.println("Ingrese nombre del cliente"); nombre=in.readLine(); System.out.println("Ingrese cedula de identidad"); cedulaIdentidad=Integer.parseInt(in.readLine()); System.out.println("Ingrese precio del celular"); precioCelular=Integer.parseInt(in.readLine()); clientes[i]=new Cliente(nombre, cedulaIdentidad, marcaCelular, precioCelular); //2 ventasLG++; break; case 4: clientes[i].setMarcaCelular("Kyocera"); System.out.println("Ingrese nombre del cliente"); nombre=in.readLine(); System.out.println("Ingrese cedula de identidad"); cedulaIdentidad=Integer.parseInt(in.readLine()); System.out.println("Ingrese precio del celular"); precioCelular=Integer.parseInt(in.readLine()); if(precioCelular>=300000){ ventasKyocera++; } clientes[i]=new Cliente(nombre, cedulaIdentidad, marcaCelular, precioCelular); break; default: System.out.println("Opcion incorrecta"); }
0debug
int avpriv_dca_parse_core_frame_header(DCACoreFrameHeader *h, const uint8_t *buf, int size) { GetBitContext gb; if (init_get_bits8(&gb, buf, size) < 0) return DCA_PARSE_ERROR_INVALIDDATA; return ff_dca_parse_core_frame_header(h, &gb); }
1threat
How to convert DateTime of type DateTimeKind.Unspecified to DateTime.Kind.Utc in C# (.NET) : <p>I've inherited C# code that has an awful lot of DateTimes where the Kind property is DateTimeKind.Unspecified. These are fed into Datetime.ToUniversalTime() which gives back a UTC datetime (it adds 7 hours in my case). This is how ToUniversalTime() works; see MSDN. The problem is that these DateTimes are in fact already in UTC time. They are pulled out of a SQL Server Compact 4.0 database. They were stored there in UTC. My main question is:</p> <ol> <li>How do I modify the Kind property of a DateTime so that it's UTC and not Unspecified? I don't want to change the time or date. So for example, a date of April 1st 2013, 9:05 am with its Kind property of "Unspecified" should become a datetime of April 1st 2013, 9:05 UTC. </li> </ol> <p>If I could be indulged with a follow up question(s), it would be:</p> <ol start="2"> <li>Are values necessarily returned from Sql Server Compact as "Unspecified"? Inside Sql Server Compact, they are being stored as type (datetime, not null). Looking at the code, it appears they are just put in the database, but there are no provisions to mark them as UTC or anything. Is there a better way to handle things? Is there a slick way to ensure the DateTimes come out of SQL Compact as UTC?</li> </ol> <p>Please let me know if I can provide more details. I'm new to this code base and still getting my brain around it, so I'm having trouble describing the problem perfectly.</p> <p>Dave</p>
0debug
C++: Accessing specific value from single key-multiple value containers : So, it happens that I'm working on the task. So I was trying to implement a multi-value containers using C++ and to freely access each of the values inside. I have int key; values like X, Y, Width, Height as input. I was trying to extract the values from each key. But obviously, the code doesn't work in this case. Would like some advice whether this can be done or any predefined container libraries with better flexibility in terms of accessing multiple values. tried with independent single-key, single-value 'multimap' containers, but it consume too much memory space and drag performance multimap<int, multimap <multimap<int, int>, multimap<int, int>>> BlobPos = {}; //[<1,{(2,3),(4,5)}>,<2,{(6,7),(8,9)}> for (auto it = BlobPos.begin();it != BlobPos.end(); it++) { auto X = it->second-> first->first; auto Y = it->second->first->second; auto H = it->second->second->first; auto W = it->second-second->second; cout << X << Y << H << W; 2 3 4 5 6 7 8 9
0debug
Python with...as for custom context manager : <p>I wrote a simple context manager in Python for handling unit tests (and to try to learn context managers):</p> <pre><code>class TestContext(object): test_count=1 def __init__(self): self.test_number = TestContext.test_count TestContext.test_count += 1 def __enter__(self): pass def __exit__(self, exc_type, exc_value, exc_traceback): if exc_value == None: print 'Test %d passed' %self.test_number else: print 'Test %d failed: %s' %(self.test_number, exc_value) return True </code></pre> <p>If I write a test as follows, everything works okay.</p> <pre><code>test = TestContext() with test: print 'running test %d....' %test.test_number raise Exception('this test failed') </code></pre> <p>However, if I try to use with...as, I don't get a reference to the TestContext() object. Running this:</p> <pre><code>with TestContext() as t: print t.test_number </code></pre> <p>Raises the exception <code>'NoneType' object has no attribute 'test_number'</code>.</p> <p>Where am I going wrong?</p>
0debug
int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt, SchroFrameFormat *schro_frame_fmt) { unsigned int num_formats = sizeof(schro_pixel_format_map) / sizeof(schro_pixel_format_map[0]); int idx; for (idx = 0; idx < num_formats; ++idx) { if (schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) { *schro_frame_fmt = schro_pixel_format_map[idx].schro_frame_fmt; return 0; } } return -1; }
1threat
Why is scanf executed before printf in eclipse? : <p>While i execute any program in Eclipse C, Scanf stmt is execured first and then at the end of execution of program all printf stmts are printed on the console. How to fix this problem in eclipse 2.0 oxygen.</p>
0debug
when i try to compile code i get following errors if somebody can help me to get rid of compiling errors? : --- here are the errors I am getting.--- PS C:\toolbox\intern-page> tsc C:\toolbox\intern-page\src\app\homepage\homepage.component.ts node_modules/@types/core-js/index.d.ts:829:20 - error TS2304: Cannot find name 'PromiseConstructor'. 829 const Promise: PromiseConstructor; node_modules/@types/core-js/index.d.ts:1486:36 - error TS2339: Property 'for' does not exist on type 'SymbolConstructor'. 1486 const _for: typeof core.Symbol.for; node_modules/@types/core-js/index.d.ts:1490:43 - error TS2339: Property 'hasInstance' does not exist on type 'SymbolConstructor'. 1490 const hasInstance: typeof core.Symbol.hasInstance; node_modules/@types/core-js/index.d.ts:1494:50 - error TS2339: Property 'isConcatSpreadable' does not exist on type 'SymbolConstructor'. 1494 const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; node_modules/@types/core-js/index.d.ts:1502:38 - error TS2339: Property 'keyFor' does not exist on type 'SymbolConstructor'. 1502 const keyFor: typeof core.Symbol.keyFor; node_modules/@types/core-js/index.d.ts:1506:37 - error TS2339: Property 'match' does not exist on type 'SymbolConstructor'. 1506 const match: typeof core.Symbol.match; node_modules/@types/core-js/index.d.ts:1510:39 - error TS2339: Property 'replace' does not exist on type 'SymbolConstructor'. 1510 const replace: typeof core.Symbol.replace; node_modules/@types/core-js/index.d.ts:1514:38 - error TS2339: Property 'search' does not exist on type 'SymbolConstructor'. 1514 const search: typeof core.Symbol.search; node_modules/@types/core-js/index.d.ts:1518:39 - error TS2339: Property 'species' does not exist on type 'SymbolConstructor'. 1518 const species: typeof core.Symbol.species; node_modules/@types/core-js/index.d.ts:1522:37 - error TS2339: Property 'split' does not exist on type 'SymbolConstructor'. 1522 const split: typeof core.Symbol.split; node_modules/@types/core-js/index.d.ts:1526:43 - error TS2339: Property 'toPrimitive' does not exist on type 'SymbolConstructor'. 1526 const toPrimitive: typeof core.Symbol.toPrimitive; node_modules/@types/core-js/index.d.ts:1530:43 - error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'. 1530 const toStringTag: typeof core.Symbol.toStringTag; node_modules/@types/core-js/index.d.ts:1534:43 - error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'. 1534 const unscopables: typeof core.Symbol.unscopables; node_modules/@types/core-js/index.d.ts:2305:36 - error TS2339: Property 'for' does not exist on type 'SymbolConstructor'. 2305 const _for: typeof core.Symbol.for; node_modules/@types/core-js/index.d.ts:2309:43 - error TS2339: Property 'hasInstance' does not exist on type 'SymbolConstructor'. 2309 const hasInstance: typeof core.Symbol.hasInstance; node_modules/@types/core-js/index.d.ts:2313:50 - error TS2339: Property 'isConcatSpreadable' does not exist on type 'SymbolConstructor'. 2313 const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; node_modules/@types/core-js/index.d.ts:2321:38 - error TS2339: Property 'keyFor' does not exist on type 'SymbolConstructor'. 2321 const keyFor: typeof core.Symbol.keyFor; node_modules/@types/core-js/index.d.ts:2325:37 - error TS2339: Property 'match' does not exist on type 'SymbolConstructor'. 2325 const match: typeof core.Symbol.match; node_modules/@types/core-js/index.d.ts:2329:39 - error TS2339: Property 'replace' does not exist on type 'SymbolConstructor'. 2329 const replace: typeof core.Symbol.replace; node_modules/@types/core-js/index.d.ts:2333:38 - error TS2339: Property 'search' does not exist on type 'SymbolConstructor'. 2333 const search: typeof core.Symbol.search; node_modules/@types/core-js/index.d.ts:2337:39 - error TS2339: Property 'species' does not exist on type 'SymbolConstructor'. 2337 const species: typeof core.Symbol.species; node_modules/@types/core-js/index.d.ts:2341:37 - error TS2339: Property 'split' does not exist on type 'SymbolConstructor'. 2341 const split: typeof core.Symbol.split; node_modules/@types/core-js/index.d.ts:2345:43 - error TS2339: Property 'toPrimitive' does not exist on type 'SymbolConstructor'. 2345 const toPrimitive: typeof core.Symbol.toPrimitive; node_modules/@types/core-js/index.d.ts:2349:43 - error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'. 2349 const toStringTag: typeof core.Symbol.toStringTag; node_modules/@types/core-js/index.d.ts:2353:43 - error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'. 2353 const unscopables: typeof core.Symbol.unscopables; node_modules/rxjs/internal/Observable.d.ts:82:59 - error TS2693: 'Promise' only refers to a type, but is being used as a value here. 82 toPromise<T>(this: Observable<T>, PromiseCtor: typeof Promise): Promise<T>; src/app/homepage/homepage.component.ts:9:14 - error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. 9 export class HomepageComponent implements OnInit {
0debug
Execute python script from visual basic project in Visual Studio 2013/2017 : <p>I am trying to use a visual basic project to run a python code, I have little to no experience in VB &amp; Visual Studio and can find little of use online. Any help appreciated. </p> <p>Thanks</p>
0debug
static void visitor_output_setup(TestOutputVisitorData *data, const void *unused) { data->qov = qmp_output_visitor_new(); g_assert(data->qov != NULL); data->ov = qmp_output_get_visitor(data->qov); g_assert(data->ov != NULL); }
1threat
Need a regex expert : That string \[\color{Blue}{4} \times 2 \times 5 \times \color{Blue}{25} = \underbrace{\color{Blue}{4} \times \color{Blue}{25}}_{100} \times 5 \times 2 = \underbrace{100 \times 5}_{500} \times 2 = 500 \times 2 = 1\ 000\] I want to match remove all string like `\color{*}` I think I am not very far... https://regex101.com/r/gM1uW3/1
0debug
C vs C++ compilation incompatibility - does not name a type : <p>I am trying to use a supplier's library in combination with my C++ application. The library is largely based on C, which is normally not a problem with the <code>extern "C"</code> option, but I ran into an issue that the C++ compiler does not accept. </p> <p>I simplified my code into the following example files. header.h represents a header from the suppier library, main.c/cpp are my own files. My real application is a C++ application, so I want to get it to work with main.cpp. </p> <p>header.h (note the line <code>u64 u64;</code>):</p> <pre><code>#ifndef HEADER_H #define HEADER_H #include &lt;stdint.h&gt; typedef uint64_t u64; union teststruct { u64 u64; struct { u64 x:32; u64 y:32; } s; }; #endif </code></pre> <p>main.c:</p> <pre><code>#include &lt;stdio.h&gt; #include "header.h" int main() { union teststruct a; a.u64=5; printf("%x\n", a.u64); return 0; } </code></pre> <p>main.cpp (same as main.c but with an extra <code>extern "C"</code> statement): </p> <pre><code>#include &lt;stdio.h&gt; extern "C" { #include "header.h" } int main() { union teststruct a; a.u64=5; printf("%x\n", a.u64); return 0; } </code></pre> <p>Compiling main.c using the line</p> <pre><code>gcc -o test main.c </code></pre> <p>compiles without problems. However, compiling the C++ version using the g++ compiler with the command </p> <pre><code>g++ -o test main.cpp </code></pre> <p>gives the following compiler errors:</p> <pre><code>In file included from main.cpp:12:0: header.h:11:9: error: ‘u64’ does not name a type u64 x:32; ^ header.h:12:9: error: ‘u64’ does not name a type u64 y:32; ^ </code></pre> <p>The issue is that the supplier used the same name (u64) for both the type and the variable name, which seems like a bad idea to begin with, but gcc apparently accepts it. I do not want to change the library (i.e. header.h) as it is very large,this occurs a lot in the code, and I occasionally get updates for it. Is there a way to make g++ accept this combination, or a way to modify main.cpp to make it compile <em>without</em> changing header.h?</p>
0debug
static void pci_edu_realize(PCIDevice *pdev, Error **errp) { EduState *edu = DO_UPCAST(EduState, pdev, pdev); uint8_t *pci_conf = pdev->config; timer_init_ms(&edu->dma_timer, QEMU_CLOCK_VIRTUAL, edu_dma_timer, edu); qemu_mutex_init(&edu->thr_mutex); qemu_cond_init(&edu->thr_cond); qemu_thread_create(&edu->thread, "edu", edu_fact_thread, edu, QEMU_THREAD_JOINABLE); pci_config_set_interrupt_pin(pci_conf, 1); if (msi_init(pdev, 0, 1, true, false, errp)) { return; } memory_region_init_io(&edu->mmio, OBJECT(edu), &edu_mmio_ops, edu, "edu-mmio", 1 << 20); pci_register_bar(pdev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &edu->mmio); }
1threat
Responsive Web not work on Mobile : <p>I am using Chrome and I can just pull the edge of window to reduce the width. It is working fine with media query width</p> <p>but if I use my mobile or chrome F12 view as mobile function It only zoom out the whole view port and does not have media query applied.</p> <p>How to solve this problem?</p>
0debug
Can i use open source libraries in my paid version of my library? : <p>So i am building a JavaScript game engine. Could i use the html canvas render library called PixiJS and JQuery? I mean,if i sell my product,is there any problem with that?</p>
0debug
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; int ret = 0, probe_size; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size > PROBE_BUF_MAX) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size < PROBE_BUF_MIN) { return AVERROR(EINVAL); } if (offset >= max_probe_size) { return AVERROR(EINVAL); } for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { int score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1; void *buftmp; if (probe_size < offset) { continue; } buftmp = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); if(!buftmp){ av_free(buf); return AVERROR(ENOMEM); } buf=buftmp; if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { if (ret != AVERROR_EOF) { av_free(buf); return ret; } score = 0; ret = 0; } pd.buf_size += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); *fmt = av_probe_input_format2(&pd, 1, &score); if(*fmt){ if(score <= AVPROBE_SCORE_RETRY){ av_log(logctx, AV_LOG_WARNING, "Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score); }else av_log(logctx, AV_LOG_DEBUG, "Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score); } } if (!*fmt) { av_free(buf); return AVERROR_INVALIDDATA; } if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; }
1threat
Having a Null pointer exception while coding my first GUI and I can't figure out where it's going wrong : <pre><code>import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class JFrameTest { private MyListener listener = new MyListener(); private JButton clear = null; private JButton addOne = null; private static JFrame frame = null; private JTextField text1 = null; private JTextField text2 = null; private JTextField text3 = null; private JTextField text4 = null; private JTextField text5 = null; private JTextField text6 = null; public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { //Create and set up the window. frame = new JFrame("Button &amp; Listener Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JFrameTest().createGUI()); //Display the window. frame.setSize(800, 500); frame.setVisible(true); } public JTabbedPane createGUI(){ JTabbedPane tabbedPane = new JTabbedPane(); JPanel one = new JPanel(); one.setLayout(new BorderLayout()); JPanel test = new JPanel(); JPanel test2 = new JPanel(); JLabel label1 = new JLabel ("Pound"); JLabel label2 = new JLabel("Ounce :" ); JLabel label3 = new JLabel("Ton :"); JLabel label4 = new JLabel("Tonne :"); JLabel label5 = new JLabel("Kilogram :"); JLabel label6 = new JLabel("Gram :"); text1 = new JTextField(5); text2 = new JTextField(5); text3 = new JTextField(5); text4 = new JTextField(5); text5 = new JTextField(5); text6 = new JTextField(5); JButton button = new JButton(); clear = new JButton("Clear"); clear.addActionListener(listener); text1.setText("0"); text2.setText("0"); text3.setText("0"); text4.setText("0"); text5.setText("0"); text6.setText("0"); test.add(label1); test.add(text1); test.add(label2); test.add(text2); test.add(label3); test.add(text3); test2.add(label4); test2.add(text4); test2.add(label5); test2.add(text5); test2.add(label6); test2.add(text6); one.add(test, BorderLayout.NORTH); one.add(test2, BorderLayout.CENTER); one.add(clear, BorderLayout.SOUTH); tabbedPane.addTab("Tab 1", one); JPanel two = new JPanel(); tabbedPane.addTab("Tab 2", two); return tabbedPane; } public class MyListener implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { JButton source = (JButton)e.getSource(); String sourceName = source.getName(); if(sourceName.equals("Clear")) { System.out.println("yeet"); text1.setText("00"); text2.setText("00"); text3.setText("00"); text4.setText("00"); text5.setText("00"); text6.setText("00"); } else { System.out.println("nah"); } } } } </code></pre> <blockquote> <p>And my error code is:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at jframetest.JFrameTest$MyListener.actionPerformed(JFrameTest.java:123) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)</p> </blockquote>
0debug
int coroutine_fn bdrv_co_flush(BlockDriverState *bs) { int ret; if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) { return 0; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS); if (bs->drv->bdrv_co_flush_to_os) { ret = bs->drv->bdrv_co_flush_to_os(bs); if (ret < 0) { return ret; } } if (bs->open_flags & BDRV_O_NO_FLUSH) { goto flush_parent; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK); if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; } } else { ret = 0; } if (ret < 0) { return ret; } flush_parent: return bdrv_co_flush(bs->file); }
1threat
How to display the value of a javascript variable in html? : <p>I want to display the input value entered on click of button "Go". The input value is stored in the variable named "value" and made visible in id="show".</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;input type="text" id="input" /&gt; &lt;button onclick="go()"&gt;Click&lt;/button&gt; &lt;/div&gt; &lt;div id="show" style="display: none;"&gt; &lt;p&gt;${value}&lt;/p&gt; &lt;/div&gt; &lt;script&gt; function go() { document.getElementById('show').style.display = "block"; let value = document.getElementById('input').value; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
0debug
Given a birth date, how can I calculate the current age? : <p><code>birthDate</code>'s type is <code>java.util.Date</code> . What is the best way to calculate the current age? I want a <code>java.util.Date</code> variable storing TODAY - <code>birthDate</code>.</p>
0debug
Jupyter Shortcut not working : <p>I am working my code on Jupyter(Python). Normally, the shortcut to insert cell below is 'b' and for above is 'a', but when I do that search bar opens instead of insertion of cell.<a href="https://i.stack.imgur.com/HlUJt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HlUJt.png" alt="Jupyter shortcut problem"></a></p>
0debug
SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, uint8_t *buf, void *hba_private) { SCSIRequest *req; req = d->info->alloc_req(d, tag, lun, hba_private); memcpy(req->cmd.buf, buf, 16); return req; }
1threat
static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; int run_diff, i; int16_t *dc_val; int16_t *ac_val, *ac_val2; int dcdiff; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int a_avail = v->a_avail, c_avail = v->c_avail; int use_pred = s->ac_pred; int scale; int q1, q2 = 0; mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant ); s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; if (n < 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0){ av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { if (dcdiff == 119 ) { if (mquant == 1) dcdiff = get_bits(gb, 10); else if (mquant == 2) dcdiff = get_bits(gb, 9); else dcdiff = get_bits(gb, 8); } else { if (mquant == 1) dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; else if (mquant == 2) dcdiff = (dcdiff<<1) + get_bits(gb, 1) - 1; } if (get_bits(gb, 1)) dcdiff = -dcdiff; } dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, a_avail, c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; if (n < 4) { block[0] = dcdiff * s->y_dc_scale; } else { block[0] = dcdiff * s->c_dc_scale; } run_diff = 0; i = 0; i = 1; if(!a_avail) dc_pred_dir = 1; if(!c_avail) dc_pred_dir = 0; if(!a_avail && !c_avail) use_pred = 0; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; scale = mquant * 2 + v->halfpq; if(dc_pred_dir) ac_val -= 16; else ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.qscale_table[mb_pos]; if(dc_pred_dir && c_avail) q2 = s->current_picture.qscale_table[mb_pos - 1]; if(!dc_pred_dir && a_avail) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; if(n && n<4) q2 = q1; if(coded) { int last = 0, skip, value; const int8_t *zz_table; int k; zz_table = vc1_simple_progressive_8x8_zz; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; if(i > 63) break; block[zz_table[i++]] = value; } if(use_pred) { if(q2 && q1!=q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; if(dc_pred_dir) { for(k = 1; k < 8; k++) block[k << 3] += (ac_val[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for(k = 1; k < 8; k++) block[k] += (ac_val[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { for(k = 1; k < 8; k++) block[k << 3] += ac_val[k]; } else { for(k = 1; k < 8; k++) block[k] += ac_val[k + 8]; } } } for(k = 1; k < 8; k++) { ac_val2[k] = block[k << 3]; ac_val2[k + 8] = block[k]; } for(k = 1; k < 64; k++) if(block[k]) { block[k] *= scale; if(!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } if(use_pred) i = 63; } else { int k; memset(ac_val2, 0, 16 * 2); if(dc_pred_dir) { if(use_pred) { memcpy(ac_val2, ac_val, 8 * 2); if(q2 && q1!=q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; for(k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } else { if(use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); if(q2 && q1!=q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; for(k = 1; k < 8; k++) ac_val2[k + 8] = (ac_val2[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } if(use_pred) { if(dc_pred_dir) { for(k = 1; k < 8; k++) { block[k << 3] = ac_val2[k] * scale; if(!v->pquantizer && block[k << 3]) block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } else { for(k = 1; k < 8; k++) { block[k] = ac_val2[k + 8] * scale; if(!v->pquantizer && block[k]) block[k] += (block[k] < 0) ? -mquant : mquant; } } i = 63; } } s->block_last_index[n] = i; return 0; }
1threat
Nested For Loop in C# to print below mentioned pattern : I wanting to print 1 23 456 78910 in C# Console application, Can any one help in doing it for me
0debug
path with a dot in web.config <location> : <p>I need to add a location element in my web.config file, but the path starts with a dot (and I don't think I can change that path, it's for <a href="http://letsencrypt.org">letsencrypt</a> automation).</p> <p>If I let the dot, like in <code>&lt;location path=".well-known/acme-challenge"&gt;&lt;/location&gt;</code>, the site doesn't start at all (I think the web.config file is not parsed at all because I get the page asking me to configure customErrors, but it is already configured and usually works fine)</p> <p>If I remove the dot, like in <code>&lt;location path="well-known/acme-challenge"&gt;&lt;/location&gt;</code> the web.config file is correctly loaded, but of course that doesn't help me to configure anything at the location I wish.</p> <p>The final goal is to disable basic authentication (which I need for the rest of the site) on this path only ; I don't even know if I'll be able to set this up in a <code>&lt;location&gt;</code> element.</p>
0debug
List munipulation in python : How could I get to result and abResult? Please guide me through, I really appreciate it! x=[1,2] y=[3,4,5] result= [3,9] <=== the sum of result determine by x =============OR========== a=[1,3,2] b= [4,2,3,4,5,10] abResult= [4,9,15]
0debug
static void fdctrl_raise_irq(FDCtrl *fdctrl, uint8_t status0) { if (fdctrl->sun4m && (fdctrl->msr & FD_MSR_CMDBUSY)) { fdctrl->msr &= ~FD_MSR_CMDBUSY; fdctrl->msr |= FD_MSR_RQM | FD_MSR_DIO; fdctrl->status0 = status0; return; } if (!(fdctrl->sra & FD_SRA_INTPEND)) { qemu_set_irq(fdctrl->irq, 1); fdctrl->sra |= FD_SRA_INTPEND; } if (status0 & FD_SR0_SEEK) { FDrive *cur_drv; cur_drv = get_cur_drv(fdctrl); if (cur_drv->max_track) { cur_drv->media_changed = 0; } } fdctrl->reset_sensei = 0; fdctrl->status0 = status0; FLOPPY_DPRINTF("Set interrupt status to 0x%02x\n", fdctrl->status0); }
1threat
Conda install and update do not work also solving environment get errors : <p>I am using anaconda as below:</p> <pre><code>(base) C:\Users\xxx&gt;conda info active environment : base active env location : C:\Users\xxx\Documents\ANACONDA shell level : 1 user config file : C:\Users\xxx\.condarc populated config files : C:\Users\xxx\.condarc conda version : 4.7.11 conda-build version : 3.18.9 python version : 3.6.9.final.0 virtual packages : base environment : C:\Users\xxx\Documents\ANACONDA (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\xxx\Documents\ANACONDA\pkgs C:\Users\xxx\.conda\pkgs C:\Users\xxx\AppData\Local\conda\conda\pkgs envs directories : C:\Users\xxx\Documents\ANACONDA\envs C:\Users\xxx\.conda\envs C:\Users\xxx\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.7.11 requests/2.22.0 CPython/3.6.9 Windows/10 Windows/10.0.16299 administrator : False netrc file : None offline mode : False </code></pre> <p>Now I have 2 issues that stop my work. 1) I cannot use <code>conda install</code> for any package. It will give me the error in <code>solving environment</code> list this:</p> <pre><code>failed with initial frozen solve. Retrying with flexible solve. </code></pre> <p>then it will fail again and give message like this:</p> <pre><code>Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. </code></pre> <p>Even after the checking for incompatible packages, it didn't give me the solution.</p> <p>2) When I want to upgrade or downgrade conda by the command:</p> <pre><code>conda update -n base conda </code></pre> <p>or</p> <pre><code>conda install conda = 4.6.11 </code></pre> <p>It will give me errors again in the <code>solving environment</code>, and I think this is related to the first issue.</p> <p>Now I cannot use conda for anything, please advise and thank you!</p>
0debug
Is there a function to extract image patches in PyTorch? : <p>Given a batch of images, I'd like to extract all possible image patches, similar to a convolution. In TensorFlow, we can use <a href="https://www.tensorflow.org/api_docs/python/tf/extract_image_patches" rel="noreferrer"><code>tf.extract_image_patches</code></a> to achieve this. Is there an equivalent function in PyTorch?</p> <p>Thank you.</p>
0debug
vmhgfs-fuse at boot with VMware Windows 8.1 host and Ubuntu 16.04 guest : <p>I am using the VMware Player with a Windows 8.1 host and an Ubuntu 16.04 guest and I have a shared folder <code>shared_folder</code> that I want to mount to a specific location at boot: <code>/shared_folder</code>. I can manually do that using the command</p> <p><code>vmhgfs-fuse .host:/shared_folder /shared_folder</code></p> <p>Now I would like to do that automatically during boot. Since I am a beginner with Ubuntu, maybe someone can point me to the solution of my problem. Thanks</p>
0debug
static void v9fs_link(void *opaque) { V9fsPDU *pdu = opaque; int32_t dfid, oldfid; V9fsFidState *dfidp, *oldfidp; V9fsString name; size_t offset = 7; int err = 0; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name); if (err < 0) { trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data); if (name_is_illegal(name.data)) { err = -ENOENT; dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -ENOENT; oldfidp = get_fid(pdu, oldfid); if (oldfidp == NULL) { err = -ENOENT; goto out; err = v9fs_co_link(pdu, oldfidp, dfidp, &name); if (!err) { err = offset; out: put_fid(pdu, dfidp); out_nofid: v9fs_string_free(&name); pdu_complete(pdu, err);
1threat
parent parent children children etc : Im trying to target a div outside of my Jquery button element. The way I'm doing it right now is $(this).parent().parent().parent().parent().parent().parent().parent().children(":nth-child(3)").children().children().children(":nth-child(4)"); There must be and easier way? The element has a class but there are more identical elements I also need to adjust individually. Thanks.
0debug
Keyboard overlaying action sheet in iOS 13.1 on CNContactViewController : <p>This seems to be specific to iOS 13.1, as it works as expected on iOS 13.0 and earlier versions to add a contact in CNContactViewController, if I 'Cancel', the action sheet is overlapping by keyboard. No actions getting performed and keyboard is not dismissing.</p>
0debug
Display different Vuejs components for mobile browsers : <p>I am developing an SPA using Vue 2.0. The components developed so far are for the "desktop" browsers, for example, I have</p> <p>Main.vue, ProductList.vue, ProductDetail.vue,</p> <p>I want another set of components for the mobile browsers, such as MainMobile.vue, ProductListMobile.vue, ProductDetailMobile.vue,</p> <p>My question is, where and how do I make my SPA render the mobile version of components when viewing in a mobile browser?</p> <p>Please note that I explicitly want to <strong>avoid</strong> making my components responsive. I want to keep two separate versions of them.</p> <p>Thanks, </p>
0debug
Is it possible to have a popup when clicing on the menu with angularJs? : I actually have this menu and i want to add a popup authentification when clicing on the "Dashboard" word... is it possible? Here is the code of the index page and i don't know what to change...`<div ng-include="'views/templates/custom-styles.html'"></div> <ng-include src="'views/layout/header.html'"></ng-include> <nav id="headernav" class="navbar ng-hide" role="navigation" ng-show="getLayoutOption('layoutHorizontal') && !layoutLoading"> <div class="nav"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <i class="fa fa-reorder"></i> </button> </div> <div class="collapse navbar-collapse navbar-ex1-collapse" ng-class="{'large-icons-nav': getLayoutOption('layoutHorizontalLargeIcons')}" id="horizontal-navbar"> <ul ng-controller="NavigationController" id="top-nav" class="nav navbar-nav"> <li ng-repeat="item in menu" ng-if="!item.hideOnHorizontal" ng-class="{ hasChild: (item.children!==undefined), active: item.selected, open: (item.children!==undefined) && item.open, 'nav-separator': item.separator==true }" ng-include="'templates/nav_renderer_horizontal.html'" ></li> </ul> </div> </nav> <div id="wrapper"> <div id="layout-static"> <div class="static-sidebar-wrapper" ng-show="!layoutLoading"> <nav class="static-sidebar" role="navigation"> <ul ng-controller="NavigationController" id="sidebar" sticky-scroll="50"> <li id="search" ng-cloak> <a href=""> <i class="fa fa-binoculars opacity-control"></i> </a> <form ng-click="$event.stopPropagation()" ng-submit="goToSearch()"> <input type="text" ng-model="searchQuery" class="search-query" placeholder="Type to filter..." /> <button type="submit" ng-click="goToSearch()"><i class="fa fa-binoculars"></i></button> </form> </li> <li ng-repeat="item in menu" ng-class="{ hasChild: (item.children!==undefined), active: item.selected, open: (item.children!==undefined) && item.open, 'nav-separator': item.separator==true, 'search-focus': (searchQuery.length>0 && item.selected) }" ng-show="!(searchQuery.length && !item.selected)" ng-include="'templates/nav_renderer.html'" ></li> </ul> </nav> <!-- #sidebar--> </div> <div class="static-content-wrapper"> <div class="static-content"> <div id="wrap" ng-view="" class="mainview-animation animated"> </div> <!--wrap --> </div> <footer role="contentinfo" ng-show="!layoutLoading" ng-cloak> <div class="clearfix"> <ul class="list-unstyled list-inline pull-left"> <li></li> </ul> <button class="pull-right btn btn-default btn-sm hidden-print" back-to-top style="padding: 1px 10px;"><i class="fa fa-angle-up"></i></button> </div> </footer> </div> </div> </div> ` [HERE IS A PICTURE] [HERE IS A PICTURE]: http://i.stack.imgur.com/aQelz.png
0debug
System can't find the python folder : <p>Before you say anything,yes i have python path set.Everytime when i type 'cd Python37' it says that the system can't find the path specified.Is it because im using the python 3.7.2 or is the path set wrong (i accidentaly installed in the non-default folder,still im a beginner).</p>
0debug
static void h261_decode_init_vlc(H261Context *h){ static int done = 0; if(!done){ done = 1; init_vlc(&h261_mba_vlc, H261_MBA_VLC_BITS, 35, h261_mba_bits, 1, 1, h261_mba_code, 1, 1); init_vlc(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10, h261_mtype_bits, 1, 1, h261_mtype_code, 1, 1); init_vlc(&h261_mv_vlc, H261_MV_VLC_BITS, 17, &h261_mv_tab[0][1], 2, 1, &h261_mv_tab[0][0], 2, 1); init_vlc(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63, &h261_cbp_tab[0][1], 2, 1, &h261_cbp_tab[0][0], 2, 1); init_rl(&h261_rl_tcoeff); init_vlc_rl(&h261_rl_tcoeff); } }
1threat
Can bootstrap dropdown slide out from left to right instead of top to bottom? : <p>I understand that this can be done on submenus but is there a way or workaround to open the main dropdown to the right?</p> <p>Ideal result: <a href="https://i.stack.imgur.com/qgqRg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qgqRg.jpg" alt="enter image description here"></a></p>
0debug
Windows Subsystem for Linux not recognizing JAVA_HOME Environmental Variable : <p>I'm trying to get WSL to recognize my windows installed environmental variable of JAVA_HOME. I attached of what I have in my bashrc and what I have in my windows environmental variables along with outputs from cmd and bash. <a href="https://i.stack.imgur.com/Y2hcZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Y2hcZ.png" alt="JAVA_HOME Env. Var."></a></p> <p><a href="https://i.stack.imgur.com/i7j86.png" rel="noreferrer"><img src="https://i.stack.imgur.com/i7j86.png" alt="&lt;code&gt;enter image description here&lt;/code&gt;"></a></p> <p>What's at the end of my bashrc:</p> <pre><code>export JAVA_HOME="/mnt/d/Program Files/Java/jdk-11.0.1" export PATH="/mnt/d/Program Files/Java/jdk-11.0.1/bin:$PATH" </code></pre> <p>CMD INPUT/OUTPUT:</p> <pre><code>C:\Users\jaall&gt;javac --version javac 11.0.1 </code></pre> <p>BASH INPUT/OUTPUT:</p> <pre><code>myubuntu_name@DESKTOP-LUK3BII:~$ javac --version Command 'javac' not found, but can be installed with: sudo apt install default-jdk sudo apt install openjdk-11-jdk-headless sudo apt install ecj sudo apt install openjdk-8-jdk-headless </code></pre> <p>I've been stuck on this for awhile and can't figure it out or find a working solution online. Thanks!</p>
0debug
Update console without flickering - c++ : <p>I'm attempting to make a console side scrolling shooter, I know this isn't the ideal medium for it but I set myself a bit of a challenge.</p> <p>The problem is that whenever it updates the frame, the entire console is flickering. Is there any way to get around this?</p> <p>I have used an array to hold all of the necessary characters to be output, here is my <code>updateFrame</code> function. Yes, I know <code>system("cls")</code> is lazy, but unless that's the cause of problem I'm not fussed for this purpose. </p> <pre><code>void updateFrame() { system("cls"); updateBattleField(); std::this_thread::sleep_for(std::chrono::milliseconds(33)); for (int y = 0; y &lt; MAX_Y; y++) { for (int x = 0; x &lt; MAX_X; x++) { std::cout &lt;&lt; battleField[x][y]; } std::cout &lt;&lt; std::endl; } } </code></pre>
0debug
static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path, char *name, void *value, size_t osize) { ssize_t len = sizeof(ACL_DEFAULT); if (!value) { return len; } if (osize < len) { errno = ERANGE; return -1; } memcpy(value, ACL_ACCESS, len); return 0; }
1threat
Get rest of string | Javascript : <p>I need to check the head section specifically within the scripts for a specific number which is a string - <code>"/150185454/"</code>.</p> <p>Currently I'm doing this like so which works well: </p> <pre><code>var headContent = document.getElementsByTagName('head')[0].innerHTML; </code></pre> <p>So <code>"/150185454/"</code> will have something like <code>"Home/Sports"</code> on the end of that. </p> <p>If this is true or within the DOM return me the rest of the string. </p> <p>How do I access the rest of the string to return me <code>"/150185454/Home/Sports"</code>? </p>
0debug
Google Cloud Functions to only Ack Pub/Sub on success : <p>We are using a cloud function triggered by Pub/Sub to ensure delivery of an e-mail. Sometimes the e-mail service takes a long time to respond and our cloud function terminates before we get an error back. Since the message has already been acknowledged our e-mail gets lost.</p> <p>The cloud function appears to be sending an ACK the Pub/Sub message automatically when we are called. Is there a way to delay the ACK until the successful completion of our code? Alternatively is there a way to catch timeouts and requeue the message for delivery? Something else we could try? </p>
0debug
static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); qobject_incref(qobj); *obj = qobj;
1threat
How to avoid using allow_any_instance_of? : <p>Imagine we have following piece of code:</p> <pre><code>class A def create_server options = { name: NameBuilder.new.build_name } do_some_operations(options) end end </code></pre> <p>To test such methods, I've used to use <code>allow_any_instance_of</code>:</p> <pre><code>it 'does operations' do allow_any_instance_of(NameBuilder).to receive(:build_name) # test body end </code></pre> <p>But docs advise us not to use it <a href="https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/any-instance" rel="noreferrer">because of several reasons</a>. How then avoid <code>allow_any_instance_of</code>? I've came to only one solution: </p> <pre><code>class A def create_server options = { name: builder.build_name } do_some_operations end private def builder NameBuilder.new end end </code></pre> <p>But with such approach code quickly becomes full of almost useless methods (especially when you actively using composition of different objects in described class).</p>
0debug
static void exynos4210_fimd_reset(DeviceState *d) { Exynos4210fimdState *s = EXYNOS4210_FIMD(d); unsigned w; DPRINT_TRACE("Display controller reset\n"); memset(&s->vidcon, 0, (uint8_t *)&s->window - (uint8_t *)&s->vidcon); for (w = 0; w < NUM_OF_WINDOWS; w++) { memset(&s->window[w], 0, sizeof(Exynos4210fimdWindow)); s->window[w].blendeq = 0xC2; exynos4210_fimd_update_win_bppmode(s, w); exynos4210_fimd_trace_bppmode(s, w, 0xFFFFFFFF); fimd_update_get_alpha(s, w); } if (s->ifb != NULL) { g_free(s->ifb); } s->ifb = NULL; exynos4210_fimd_invalidate(s); exynos4210_fimd_enable(s, false); s->winchmap = 0x7D517D51; s->colorgaincon = 0x10040100; s->huecoef_cr[0] = s->huecoef_cr[3] = 0x01000100; s->huecoef_cb[0] = s->huecoef_cb[3] = 0x01000100; s->hueoffset = 0x01800080; }
1threat
static av_cold int hevc_decode_init(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; int ret; avctx->internal->allocate_progress = 1; ret = hevc_init_context(avctx); if (ret < 0) return ret; s->enable_parallel_tiles = 0; s->sei.picture_timing.picture_struct = 0; s->eos = 1; atomic_init(&s->wpp_err, 0); if(avctx->active_thread_type & FF_THREAD_SLICE) s->threads_number = avctx->thread_count; else s->threads_number = 1; if (avctx->extradata_size > 0 && avctx->extradata) { ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size); if (ret < 0) { hevc_decode_free(avctx); return ret; } } if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1) s->threads_type = FF_THREAD_FRAME; else s->threads_type = FF_THREAD_SLICE; return 0; }
1threat
Realm - Property cannot be marked dynamic because its type cannot be represented in Objective-C : <p>I am trying to implement below scenario, but i am facing the issue</p> <pre><code>class CommentsModel: Object { dynamic var commentId = "" dynamic var ownerId: UserModel? dynamic var treeLevel = 0 dynamic var message = "" dynamic var modifiedTs = NSDate() dynamic var createdTs = NSDate() //facing issue here dynamic var childComments = List&lt;CommentsModel&gt;() } </code></pre> <p>I have a comments model which has non optional properties in which childComments is List of same Comments model class. In this when i declare <code>dynamic var childComments = List&lt;CommentsModel&gt;()</code> </p> <blockquote> <p>it shows me Property cannot be marked dynamic because its type cannot be represented in Objective-C.</p> </blockquote> <p>Please help me how to achieve my requirement</p>
0debug
Check whether CSS style is true : >HTML <div id="divtemp-sc" class="container-fluid tab-pane active tab-padding" role="tabpanel" aria-labelledby="divtemp-sc"> <div class="col-md-4"> <div class="popup-temp-entry"> <div class="entry-header">Title 1</div> <div class="entry-body">Description 1</div> <div class="entry-footer"><a href="#" class="entry-footer-include-btn" template-include="false">Include</a></div> </div> </div> <div class="col-md-4"> <div class="popup-temp-entry"> <div class="entry-header">Title 2</div> <div class="entry-body">Description 2</div> <div class="entry-footer"><a href="#" class="entry-footer-include-btn" template-include="true">Include</a></div> </div> </div> <div class="col-md-4"> <div class="popup-temp-entry"> <div class="entry-header">Title 3</div> <div class="entry-body">Description 3</div> <div class="entry-footer"><a href="#" class="entry-footer-include-btn" template-include="false">Include</a></div> </div> </div> </div> I have this `div` block and I'm wondering how can I check each `col-md-4` div which has a nested div of `entry-footer`. Checking the `template-include="false"` if its true or false. I was demanded to write it in javascript/jquery. However, I'm still very new to web programming and Javascript. I've been googling and searching references and I still cant figure it out how.
0debug
java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference : <p>Everything working fine i got this error at the end please give solution. I have tried each and every solution, I don't know what to do.. please give the exact solution trying from past 2 days but i can't solve the problem..</p> <p>Thanks in advance</p> <pre><code>public double calculatedDistance(DataSnapshot dataSnapshot ) { HashMap&lt;String, Object&gt; values = (HashMap&lt;String, Object&gt;) dataSnapshot.getValue(); double lati = Double.parseDouble(values.get("latitude").toString()); double longi = Double.parseDouble(values.get("longitude").toString()); double xSquare = Math.pow(lat-lati, 2); double ySquare = Math.pow(lng-longi, 2); double distance = Math.sqrt(xSquare + ySquare); //double dist = distance; textViewdistance.setText(String.valueOf(""+distance+""+"km")); return distance; } </code></pre> <pre><code>Error in Logcat E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.ambulance, PID: 17399 java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference at com.example.ambulance.MapsActivity.calculatedDistance(MapsActivity.java:451) at com.example.ambulance.MapsActivity$2$1.onChildAdded(MapsActivity.java:178) at com.google.firebase.database.core.ChildEventRegistration.fireEvent(com.google.firebase:firebase-database@@19.2.0:79) at com.google.firebase.database.core.view.DataEvent.fire(com.google.firebase:firebase-database@@19.2.0:63) at com.google.firebase.database.core.view.EventRaiser$1.run(com.google.firebase:firebase-database@@19.2.0:55) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7625) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987) </code></pre>
0debug
Using webkitdirectory to upload a directory, is it possible to filter out certain files prior to uploading? : <p>I'm using <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory" rel="noreferrer">webkitdirectory</a> to create an input that allows uploading an entire folder (rather than selecting individual files). I know it's non-standard and shouldn't be used in production.</p> <p>I'm uploading a specific type of folder where there is one very large file that isn't needed, and many other small files. The upload takes a long time because there's a large file, but because coincidentally that's also the one file I don't actually need on the server side, I'm wondering if there's any way to filter it out prior to being uploaded?</p>
0debug
How to download packages/modules to pyton 3.6.0 : Im trying to download packages and modules to python. I have never used it before and alot of videos say you need to have a scripts folder which i do not have. Any help?
0debug
Angular 4: reactive form control is stuck in pending state with a custom async validator : <p>I am building an Angular 4 app that requires the BriteVerify email validation on form fields in several components. I am trying to implement this validation as a custom async validator that I can use with reactive forms. Currently, I can get the API response, but the control status is stuck in pending state. I get no errors so I am a bit confused. Please tell me what I am doing wrong. Here is my code. </p> <h2>Component</h2> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { EmailValidationService } from '../services/email-validation.service'; import { CustomValidators } from '../utilities/custom-validators/custom-validators'; @Component({ templateUrl: './email-form.component.html', styleUrls: ['./email-form.component.sass'] }) export class EmailFormComponent implements OnInit { public emailForm: FormGroup; public formSubmitted: Boolean; public emailSent: Boolean; constructor( private router: Router, private builder: FormBuilder, private service: EmailValidationService ) { } ngOnInit() { this.formSubmitted = false; this.emailForm = this.builder.group({ email: [ '', [ Validators.required ], [ CustomValidators.briteVerifyValidator(this.service) ] ] }); } get email() { return this.emailForm.get('email'); } // rest of logic }</code></pre> </div> </div> </p> <h2>Validator class</h2> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>import { AbstractControl } from '@angular/forms'; import { EmailValidationService } from '../../services/email-validation.service'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/switchMap'; import 'rxjs/add/operator/debounceTime'; import 'rxjs/add/operator/distinctUntilChanged'; export class CustomValidators { static briteVerifyValidator(service: EmailValidationService) { return (control: AbstractControl) =&gt; { if (!control.valueChanges) { return Observable.of(null); } else { return control.valueChanges .debounceTime(1000) .distinctUntilChanged() .switchMap(value =&gt; service.validateEmail(value)) .map(data =&gt; { return data.status === 'invalid' ? { invalid: true } : null; }); } } } }</code></pre> </div> </div> </p> <h2>Service</h2> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>import { Injectable } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; interface EmailValidationResponse { address: string, account: string, domain: string, status: string, connected: string, disposable: boolean, role_address: boolean, error_code?: string, error?: string, duration: number } @Injectable() export class EmailValidationService { public emailValidationUrl = 'https://briteverifyendpoint.com'; constructor( private http: HttpClient ) { } validateEmail(value) { let params = new HttpParams(); params = params.append('address', value); return this.http.get&lt;EmailValidationResponse&gt;(this.emailValidationUrl, { params: params }); } }</code></pre> </div> </div> </p> <h2>Template (just form)</h2> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form class="email-form" [formGroup]="emailForm" (ngSubmit)="sendEmail()"&gt; &lt;div class="row"&gt; &lt;div class="col-md-12 col-sm-12 col-xs-12"&gt; &lt;fieldset class="form-group required" [ngClass]="{ 'has-error': email.invalid &amp;&amp; formSubmitted }"&gt; &lt;div&gt;{{ email.status }}&lt;/div&gt; &lt;label class="control-label" for="email"&gt;Email&lt;/label&gt; &lt;input class="form-control input-lg" name="email" id="email" formControlName="email"&gt; &lt;ng-container *ngIf="email.invalid &amp;&amp; formSubmitted"&gt; &lt;i class="fa fa-exclamation-triangle" aria-hidden="true"&gt;&lt;/i&gt;&amp;nbsp;Please enter valid email address. &lt;/ng-container&gt; &lt;/fieldset&gt; &lt;button type="submit" class="btn btn-primary btn-lg btn-block"&gt;Send&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt;</code></pre> </div> </div> </p>
0debug
comparing table records and return the extra : <p>Table1 has 10001 records and table2 has 10000 records. How do I get the extra record in table1 ?</p>
0debug
static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) { char *buffer; int ret = -1; char *path = fs_path->data; if (fs_ctx->export_flags & V9FS_SM_MAPPED) { buffer = rpath(fs_ctx, path); ret = local_set_xattr(buffer, credp); g_free(buffer); } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { return local_set_mapped_file_attr(fs_ctx, path, credp); } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { buffer = rpath(fs_ctx, path); ret = chmod(buffer, credp->fc_mode); g_free(buffer); } return ret; }
1threat
Making sinusoidal curve in image into straight line in output image Matlab : I have to make a sinusoidal curve in image to Output an equal straight line in the resulting image. [an example of input sinusoidal image is here][1]. What i think is one solution should be, Placing down the origin of x and y coordinates at the start of the curve, so we will have y=0 at starting point. then points on the upper limit will be counted as such that y= y-(delta_y) and for lower limits, y=y+(delta_y) so to make upper points a straight line, our resulting image will be O[x,y-delta_y]= I[x,y]; but how to calculate deltaY for each y on horizontal x axis(it is showing distance of curve points from horizontal axis) Another solution could be, to save all information of the curve in a variable and to plot it as a straight line, but how to do it? [1]: https://i.stack.imgur.com/kCiTx.jpg
0debug
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { if (!pkt) { ctx->internal->eof = 1; return 0; } if (ctx->internal->eof) { av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n"); return AVERROR(EINVAL); } if (ctx->internal->buffer_pkt->data || ctx->internal->buffer_pkt->side_data_elems) return AVERROR(EAGAIN); av_packet_move_ref(ctx->internal->buffer_pkt, pkt); return 0; }
1threat
static void bh_run_aio_completions(void *opaque) { QEMUBH **bh = opaque; qemu_bh_delete(*bh); qemu_free(bh); qemu_aio_process_queue(); }
1threat
Why my project can't launch : August 22, 2016 10:16:15 morning org.apache.catalina.core.AprLifecycleListener init info: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_92\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_92/bin/server;C:/Program Files/Java/jre1.8.0_92/bin;C:/Program Files/Java/jre1.8.0_92/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\Doctrine extensions for PHP\;C:\Program Files\MySQL\MySQL Workbench 6.2 CE\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files\MongoDB\Server\3.2\bin;C:\Ruby23-x64\bin;C:\Users\MuteKen\AppData\Local\Microsoft\WindowsApps;C:\Users\MuteKen\AppData\Roaming\npm;C:\Users\MuteKen\Downloads\Programs;;. August 22, 2016 10:16:15 morning org.apache.tomcat.util.digester.SetPropertiesRule begin warning: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ife_service' did not find a matching property. August 22, 2016 10:16:17 morning org.apache.coyote.AbstractProtocol init info: Initializing ProtocolHandler ["http-bio-8080"] August 22, 2016 10:16:17 morning org.apache.coyote.AbstractProtocol init info: Initializing ProtocolHandler ["ajp-bio-8009"] August 22, 2016 10:16:17 morning org.apache.catalina.startup.Catalina load info: Initialization processed in 2895 ms August 22, 2016 10:16:17 morning org.apache.catalina.core.StandardService startInternal info: Starting service Catalina August 22, 2016 10:16:17 morning org.apache.catalina.core.StandardEngine startInternal info: Starting Servlet Engine: Apache Tomcat/7.0.56 August 22, 2016 10:16:18 morning org.apache.catalina.util.SessionIdGenerator createSecureRandom info: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [468] milliseconds. August 22, 2016 10:16:18 morning org.apache.catalina.loader.WebappClassLoader validateJarFile info: validateJarFile(C:\Users\MuteKen\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ife_service\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class August 22, 2016 10:16:23 morning org.apache.catalina.core.ApplicationContext log info: No Spring WebApplicationInitializer types detected on classpath August 22, 2016 10:16:23 morning org.apache.catalina.core.ApplicationContext log info: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. It's the console display when I launched tomcat7.X, so what should I do now?? Please give a more detail response because I am a new here...
0debug
explanation for simple "saving file " code : **Hello everyone** i am new in _Android studio_ i just want to learn more in android apps . So, i want an explanation the **out=context.openFileOutput** arguments . **Thanks in advance** public void saveImage(Context context, Bitmap b,String name,String extension){ name=name+"."+extension; FileOutputStream out; try { out = context.openFileOutput(name, Context.MODE_PRIVATE); b.compress(Bitmap.CompressFormat.JPEG, 90, out); out.close(); } catch (Exception e) { e.printStackTrace(); } }
0debug
regex to replace contend of second <p>-tag : <p>Output (var $DESC)</p> <pre><code> &lt;p&gt;erster Absatz&lt;/p&gt; &lt;p&gt;zweiter Absatz&lt;/p&gt; </code></pre> <p>Regex (PHP)</p> <pre><code> preg_replace("&lt;([a-z][a-z0-9]*)\b[^&gt;]*&gt;(.*?)&lt;/\1&gt;{2}", '', $DESC) </code></pre> <p>I would like to delete only the second p but this regex finds both. Thanks for any help.</p>
0debug
] ^ SyntaxError: invalid syntax : from django.contrib import admin from django.urls import path from webexample import views from django.conf.urls import url, includes urlpatterns = [ path('admin/', admin.site.urls), path('webexample/', include(webexample.views.index), ] ] ^ SyntaxError: invalid syntax File "C:\Users\admin\Desktop\ccc\mysite\mysite\urls.py", line 23
0debug
problem in understanding axises in clustering : what is these two axis (Dim1(30.3%) & Dim2(19.7%)) mean? [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/vJvnX.png
0debug
Laravel Homestead hangs at SSH auth method: private key on mac : <p>I can't seem to get Homestead running. It hangs at SSH auth method: private key.</p> <p>The Homestead VM starts. I can go to VirtualBox and open the terminal window and login with vagrant:vagrant.</p> <p>I can't vagrant ssh, ssh vagrant@127.0.0.1:2204 or ssh vagrant@127.0.0.1 -p 2204.</p> <p>None of my folders show up in the VM, but the VirtualBox says they are mapped.</p> <p>Every time I vagrant up, I get:</p> <pre><code>vagrant up Bringing machine 'homestead-7' up with 'virtualbox' provider... ==&gt; homestead-7: Checking if box 'laravel/homestead' is up to date... ==&gt; homestead-7: Clearing any previously set forwarded ports... ==&gt; homestead-7: Fixed port collision for 80 =&gt; 8000. Now on port 2200. ==&gt; homestead-7: Fixed port collision for 443 =&gt; 44300. Now on port 2201. ==&gt; homestead-7: Fixed port collision for 3306 =&gt; 33060. Now on port 2202. ==&gt; homestead-7: Fixed port collision for 5432 =&gt; 54320. Now on port 2203. ==&gt; homestead-7: Fixed port collision for 22 =&gt; 2222. Now on port 2204. ==&gt; homestead-7: Clearing any previously set network interfaces... ==&gt; homestead-7: Preparing network interfaces based on configuration... homestead-7: Adapter 1: nat homestead-7: Adapter 2: hostonly ==&gt; homestead-7: Forwarding ports... homestead-7: 80 (guest) =&gt; 2200 (host) (adapter 1) homestead-7: 443 (guest) =&gt; 2201 (host) (adapter 1) homestead-7: 3306 (guest) =&gt; 2202 (host) (adapter 1) homestead-7: 5432 (guest) =&gt; 2203 (host) (adapter 1) homestead-7: 22 (guest) =&gt; 2204 (host) (adapter 1) ==&gt; homestead-7: Running 'pre-boot' VM customizations... ==&gt; homestead-7: Booting VM... ==&gt; homestead-7: Waiting for machine to boot. This may take a few minutes... homestead-7: SSH address: 127.0.0.1:2204 homestead-7: SSH username: vagrant homestead-7: SSH auth method: private key Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period. If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong. If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly, as well. If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value. </code></pre> <p>I replaced the homestead insecure private key with my key on my box. I see a lot of people get Warning: Connection timeout. Retrying..., but I don't get that far.</p> <p>I'm on a mac 10.11.6</p> <p>Any help would be greatly appreciated!</p>
0debug
static int device_open(AVFormatContext *ctx) { struct v4l2_capability cap; int fd; #if CONFIG_LIBV4L2 int fd_libv4l; #endif int res, err; int flags = O_RDWR; if (ctx->flags & AVFMT_FLAG_NONBLOCK) { flags |= O_NONBLOCK; } fd = v4l2_open(ctx->filename, flags, 0); if (fd < 0) { err = errno; av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n", ctx->filename, strerror(err)); return AVERROR(err); } #if CONFIG_LIBV4L2 fd_libv4l = v4l2_fd_open(fd, 0); if (fd < 0) { err = AVERROR(errno); av_log(ctx, AV_LOG_ERROR, "Cannot open video device with libv4l neither %s : %s\n", ctx->filename, strerror(errno)); return err; } fd = fd_libv4l; #endif res = v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap); if (res < 0) { err = errno; av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", strerror(err)); goto fail; } av_log(ctx, AV_LOG_VERBOSE, "[%d]Capabilities: %x\n", fd, cap.capabilities); if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { av_log(ctx, AV_LOG_ERROR, "Not a video capture device.\n"); err = ENODEV; goto fail; } if (!(cap.capabilities & V4L2_CAP_STREAMING)) { av_log(ctx, AV_LOG_ERROR, "The device does not support the streaming I/O method.\n"); err = ENOSYS; goto fail; } return fd; fail: v4l2_close(fd); return AVERROR(err); }
1threat
How to increase the width of the horizontal line using markdown git hub : <p>I am using below code for drawing the horizontal line </p> <p>"-----"</p> <p>"***"</p> <p>I want to change the color of the horizontal line plus change the height also.</p> <p>Any idea how to do this.</p> <p>Thanks in advance.</p> <p>BR, Mayur</p>
0debug
android: button click error (string array) : When I select an item with a spinner and click the button, I want to create a program that generates an array of choices with the spinner, such as 5 to add random numbers and float them in a textview. There are no errors, but when running, click the button to exit the program. Which part is the problem? The entire code is as follows: package ac.kr.kgu.esproject; import android.app.Activity; import android.os.Bundle; import android.provider.Settings.System; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public class ArrayAdderActivity extends Activity { static int numnum; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Spinner s = (Spinner) findViewById(R.id.spinner); final Button button1 = (Button) findViewById(R.id.button1); final TextView text1 = (TextView) findViewById(R.id.textv); ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.planets, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s.setAdapter(adapter); s.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String num=s.getSelectedItem().toString(); numnum = Integer.parseInt(num); } public void onNothingSelected(AdapterView<?> parent) { } }); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int array1[] = null; String string1[]; for (int i = 0; i<numnum; i++){ array1[i]=((int)(Math.random())); text1.setText("num #"+(i+1)+": "+array1[i]+"/n"); } } }); } }
0debug
How to correctly show a wxMessageBox with the value of "string01"? [C++, wxFormBuilder, wxWidgets] : How to correctly show a MessageBox with the value of "string01"? [C++, wxFormBuilder, wxWidgets] gui.h: /////////////////////////////////////////////////////////////////////////// // C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #pragma once #include <wx/artprov.h> #include <wx/xrc/xmlres.h> #include <wx/intl.h> #include <wx/string.h> #include <wx/stattext.h> #include <wx/gdicmn.h> #include <wx/font.h> #include <wx/colour.h> #include <wx/settings.h> #include <wx/textctrl.h> #include <wx/sizer.h> #include <wx/statline.h> #include <wx/bitmap.h> #include <wx/image.h> #include <wx/icon.h> #include <wx/button.h> #include <wx/dialog.h> #include <wx/msgdlg.h> /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// /// Class MainDialogBase /////////////////////////////////////////////////////////////////////////////// class MainDialogBase : public wxDialog { private: protected: wxStaticText* m_staticText3; wxStaticText* m_staticText1; wxTextCtrl* m_textCtrl1; wxStaticText* m_staticText4; wxTextCtrl* m_textCtrl2; wxStaticLine* m_staticLine; wxButton* m_button1; wxButton* m_button2; // Virtual event handlers, overide them in your derived class virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } virtual void m_button1OnButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void m_button2OnButtonClick( wxCommandEvent& event ) { event.Skip(); } public: MainDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 191,252 ), long style = wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE ); ~MainDialogBase(); }; gui.cpp: /////////////////////////////////////////////////////////////////////////// // C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "gui.h" /////////////////////////////////////////////////////////////////////////// MainDialogBase::MainDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); wxBoxSizer* mainSizer; mainSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bSizer2; bSizer2 = new wxBoxSizer( wxVERTICAL ); m_staticText3 = new wxStaticText( this, wxID_ANY, _("Patient's data"), wxDefaultPosition, wxSize( 105,-1 ), 0 ); m_staticText3->Wrap( -1 ); m_staticText3->SetFont( wxFont( 10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Sans") ) ); bSizer2->Add( m_staticText3, 0, wxALL, 5 ); wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxHORIZONTAL ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("First Name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); bSizer3->Add( m_staticText1, 0, wxALL, 5 ); m_textCtrl1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer3->Add( m_textCtrl1, 0, wxALL, 5 ); bSizer2->Add( bSizer3, 1, wxEXPAND, 5 ); wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxHORIZONTAL ); m_staticText4 = new wxStaticText( this, wxID_ANY, _("Last Name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText4->Wrap( -1 ); bSizer4->Add( m_staticText4, 0, wxALL, 5 ); m_textCtrl2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizer4->Add( m_textCtrl2, 0, wxALL, 5 ); bSizer2->Add( bSizer4, 1, wxEXPAND, 5 ); bSizer8->Add( bSizer2, 1, 0, 5 ); mainSizer->Add( bSizer8, 1, wxEXPAND, 5 ); m_staticLine = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); mainSizer->Add( m_staticLine, 0, wxEXPAND | wxALL, 5 ); m_button1 = new wxButton( this, wxID_ANY, _("Record Data"), wxDefaultPosition, wxDefaultSize, 0 ); mainSizer->Add( m_button1, 0, wxALL|wxEXPAND, 5 ); m_button2 = new wxButton( this, wxID_ANY, _("List"), wxDefaultPosition, wxDefaultSize, 0 ); mainSizer->Add( m_button2, 0, wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizer9; bSizer9 = new wxBoxSizer( wxHORIZONTAL ); mainSizer->Add( bSizer9, 1, wxEXPAND, 5 ); this->SetSizer( mainSizer ); this->Layout(); this->Centre( wxBOTH ); // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogBase::OnCloseDialog ) ); m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button1OnButtonClick ), NULL, this ); m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button2OnButtonClick ), NULL, this ); } MainDialogBase::~MainDialogBase() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogBase::OnCloseDialog ) ); m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button1OnButtonClick ), NULL, this ); m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button2OnButtonClick ), NULL, this ); } inheritedgui.h: #ifndef __inheritedgui__ #define __inheritedgui__ /** @file Subclass of MainDialogBase, which is generated by wxFormBuilder. */ #include "gui.h" //// end generated include /** Implementing MainDialogBase */ class inheritedgui : public MainDialogBase { protected: // Handlers for MainDialogBase events. void OnCloseDialog( wxCloseEvent& event ); void m_button1OnButtonClick(wxCommandEvent& event) override; void m_button2OnButtonClick(wxCommandEvent& event) override; public: /** Constructor */ inheritedgui( wxWindow* parent ); //// end generated class members }; #endif // __inheritedgui__ inheritedgui.cpp: #include "inheritedgui.h" inheritedgui::inheritedgui( wxWindow* parent ) : MainDialogBase( parent ) { } void inheritedgui::m_button1OnButtonClick(wxCommandEvent& event) { std::string string01 = m_textCtrl1->GetValue().ToStdString(); } void inheritedgui::m_button2OnButtonClick(wxCommandEvent& event) { wxMessageBox( wxT(string01), wxT("This is the title"), wxICON_INFORMATION); } void inheritedgui::OnCloseDialog( wxCloseEvent& event ) { // TODO: Implement OnCloseDialog } I'm trying to show the value of "string01" in a wxMessageBox (as seen in "inheritedgui.cpp"), however when I click "m_button2", nothing happens and I don't know why :/ https://i.postimg.cc/jd6WDc6z/Screenshot-20200227-040106.png What changes do I need to do so the wxMessageBox shows up when I click "m_button2" (is the one which says "List")? Thanks!
0debug
Apply a function to all the elements of a data frame : <p>I am trying to apply some transformations to all the elements in a dataframe.</p> <p>When using the regular apply functions, I get a matrix back and not a dataframe. Is there a way to get a dataframe directly without adding <code>as.data.frame</code> to each line?</p> <pre><code>df = data.frame(a = LETTERS[1:5], b = LETTERS[6:10]) apply(df, 1, tolower) #Matrix apply(df, 2, tolower) #Matrix sapply(df, tolower) #Matrix as.data.frame(sapply(df, tolower)) # Can I avoid "as.data.frame"? </code></pre>
0debug
static CharDriverState *qemu_chr_open_socket_fd(int fd, bool do_nodelay, bool is_listen, bool is_telnet, bool is_waitconnect, Error **errp) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; char host[NI_MAXHOST], serv[NI_MAXSERV]; const char *left = "", *right = ""; struct sockaddr_storage ss; socklen_t ss_len = sizeof(ss); memset(&ss, 0, ss_len); if (getsockname(fd, (struct sockaddr *) &ss, &ss_len) != 0) { error_setg_errno(errp, errno, "getsockname"); return NULL; } chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(TCPCharDriver)); s->connected = 0; s->fd = -1; s->listen_fd = -1; s->read_msgfds = 0; s->read_msgfds_num = 0; s->write_msgfds = 0; s->write_msgfds_num = 0; chr->filename = g_malloc(256); switch (ss.ss_family) { #ifndef _WIN32 case AF_UNIX: s->is_unix = 1; snprintf(chr->filename, 256, "unix:%s%s", ((struct sockaddr_un *)(&ss))->sun_path, is_listen ? ",server" : ""); break; #endif case AF_INET6: left = "["; right = "]"; case AF_INET: s->do_nodelay = do_nodelay; getnameinfo((struct sockaddr *) &ss, ss_len, host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV); snprintf(chr->filename, 256, "%s:%s%s%s:%s%s", is_telnet ? "telnet" : "tcp", left, host, right, serv, is_listen ? ",server" : ""); break; } chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_sync_read = tcp_chr_sync_read; chr->chr_close = tcp_chr_close; chr->get_msgfds = tcp_get_msgfds; chr->set_msgfds = tcp_set_msgfds; chr->chr_add_client = tcp_chr_add_client; chr->chr_add_watch = tcp_chr_add_watch; chr->chr_update_read_handler = tcp_chr_update_read_handler; chr->explicit_be_open = true; if (is_listen) { s->listen_fd = fd; s->listen_chan = io_channel_from_socket(s->listen_fd); s->listen_tag = g_io_add_watch(s->listen_chan, G_IO_IN, tcp_chr_accept, chr); if (is_telnet) { s->do_telnetopt = 1; } } else { s->connected = 1; s->fd = fd; socket_set_nodelay(fd); s->chan = io_channel_from_socket(s->fd); tcp_chr_connect(chr); } if (is_listen && is_waitconnect) { fprintf(stderr, "QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(s->listen_chan, G_IO_IN, chr); qemu_set_nonblock(s->listen_fd); } return chr; }
1threat
fasted way to read file in python : I made a python script to analyze logs. I have one observation to share, and two questions to ask. When I use gzip.open to open each file and go through every line, it takes around 200 seconds just to going through all the lines and files. with gzip.open(file) as fp: for line in fp: If using `zcat` and `grep` to do the work, it takes about 50 seconds. temp = commands.getstatusoutput("zcat file* | grep pattern") The performance difference is too huge to ignore. Is there a better way to reduce the gap? I also noticed that the `commands` module is made obsolete by the `subprocess` module, which seems always create a temporary file. But it wouldn't be convenient, what if it is not possible to create a temporary file from where the python script is running? Any suggestion?
0debug
¿ How to multiply thousands in JavaScript? : I am learning a bit of javascript, i want to make a a small mathematical operation using thousands. Example: 300,000,000 * 3% = 900,000 This is what you should be displayed to the user, and the user may be able to raise or lower the percentage or value as is as a calculator, and I cannot find how to do to multiply a number with thousands by the percentage in javascript.
0debug
object to string in Python : <p>I have some data objects on which I want to implement a to string and equals functions that go in depth. </p> <p>I implemented <strong>str</strong> and <strong>eq</strong> and although equality works fine I cannot make <strong>str</strong> behave in the same way:</p> <pre><code>class Bean(object): def __init__(self, attr1, attr2): self.attr1 = attr1 self.attr2 = attr2 def __str__(self): return str(self.__dict__) def __eq__(self, other): return self.__dict__ == other.__dict__ </code></pre> <p>When I run:</p> <pre><code>t1 = Bean("bean 1", [Bean("bean 1.1", "same"), Bean("bean 1.2", 42)]) t2 = Bean("bean 1", [Bean("bean 1.1", "same"), Bean("bean 1.2", 42)]) t3 = Bean("bean 1", [Bean("bean 1.1", "different"), Bean("bean 1.2", 42)]) print(t1) print(t2) print(t3) print(t1 == t2) print(t1 == t3) </code></pre> <p>I get:</p> <pre><code>{'attr2': [&lt;__main__.Bean object at 0x7fc092030f28&gt;, &lt;__main__.Bean object at 0x7fc092030f60&gt;], 'attr1': 'bean 1'} {'attr2': [&lt;__main__.Bean object at 0x7fc091faa588&gt;, &lt;__main__.Bean object at 0x7fc092045128&gt;], 'attr1': 'bean 1'} {'attr2': [&lt;__main__.Bean object at 0x7fc0920355c0&gt;, &lt;__main__.Bean object at 0x7fc092035668&gt;], 'attr1': 'bean 1'} True False </code></pre> <p>since t1 and t2 contain the same values the equals return true (as expected) while since t3 contains a different value in the list the result is false (also as expected). What I would like is to have the same behavior for the to string (basically to also go in depth also for the elements in list (or set or dict ...).</p> <p>For print(t1) I would like to obtain something like:</p> <pre><code>{'attr2': ["{'attr2': 'same', 'attr1': 'bean 1.1'}", "{'attr2': 42, 'attr1': 'bean 1.2'}"], 'attr1': 'bean 1'} </code></pre> <p>which is actually obtained if I do:</p> <pre><code>Bean("bean 1", [Bean("bean 1.1", "same").__str__(), Bean("bean 1.2", 42).__str__()]).__str__ </code></pre> <p>Since I do not know the types of the attributes attr1, attr2 in my Bean objects (they may be lists but also sets, dictionaries etc.) is would be nice to have a simple and elegant solution that would not require type checking ...</p> <p>Is this possible ?</p>
0debug
Why utilize using() when instantiating a class? : <p>I have been working with C# ASP.NET MVC5 for a while and I was wondering something. Why are we utilizing the using() to instantiate a class sometimes?</p> <p>For an example:</p> <pre><code>using (CyrptoStream cs = new CryptoStream(PARAMETERS) { //SOMETHING } </code></pre> <p>or</p> <pre><code>using (Aes encryptor = Aes.Create() { } </code></pre> <p>How is that different to <code>MyClass myClass = new MyClass()</code></p> <p>Thank you.</p>
0debug
static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) { CropContext *crop = link->dst->priv; AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0); int i; ref2->w = crop->w; ref2->h = crop->h; ref2->data[0] += crop->y * ref2->linesize[0]; ref2->data[0] += (crop->x * crop->bpp) >> 3; if (link->format != PIX_FMT_PAL8 && link->format != PIX_FMT_BGR4_BYTE && link->format != PIX_FMT_RGB4_BYTE && link->format != PIX_FMT_BGR8 && link->format != PIX_FMT_RGB8) { for (i = 1; i < 3; i ++) { if (ref2->data[i]) { ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i]; ref2->data[i] += ((crop->x * crop->bpp) >> 3) >> crop->hsub; } } } if (ref2->data[3]) { ref2->data[3] += crop->y * ref2->linesize[3]; ref2->data[3] += (crop->x * crop->bpp) >> 3; } avfilter_start_frame(link->dst->outputs[0], ref2); }
1threat
static void pc_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); PCMachineClass *pcmc = PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); pcmc->inter_dimm_gap = true; pcmc->get_hotplug_handler = mc->get_hotplug_handler; mc->get_hotplug_handler = pc_get_hotpug_handler; mc->cpu_index_to_socket_id = pc_cpu_index_to_socket_id; mc->default_boot_order = "cad"; mc->hot_add_cpu = pc_hot_add_cpu; mc->max_cpus = 255; mc->reset = pc_machine_reset; hc->plug = pc_machine_device_plug_cb; hc->unplug_request = pc_machine_device_unplug_request_cb; hc->unplug = pc_machine_device_unplug_cb; }
1threat
static av_cold void init_mv_table(MVTable *tab) { int i, x, y; tab->table_mv_index = av_malloc(sizeof(uint16_t) * 4096); for(i=0;i<4096;i++) tab->table_mv_index[i] = tab->n; for(i=0;i<tab->n;i++) { x = tab->table_mvx[i]; y = tab->table_mvy[i]; tab->table_mv_index[(x << 6) | y] = i; } }
1threat
Can you pattern match a non empty array in elixir? : <p>I have a <code>User</code> model with a <code>has_many</code> relationship to <code>other_model</code>. I have a function <code>Search</code> that searches the internet. What I would like to do is search the internet only if the <code>has_many</code> relationship is not an empty array. </p> <p>So I'm wondering if I can pattern match against a non-empty array? As you can see below, the extra <code>Search</code> results in nested branch and hence I use the <code>with</code> statement and am hoping for a clean solution. </p> <pre><code>query = from a in Model, where: a.id == ^id, preload: [:some_associations] with %{some_associations: some_associations} &lt;- Repo.one(query), {:ok, some_results} &lt;- Search.call(keywords, 1) do do_something_with(some_associations, some_results) else nil -&gt; IO.puts "query found nothing" {:error, reason} -&gt; IO.puts "Search or query returned error with reason #{reason}" end </code></pre>
0debug
Why we use Redis and what is the right way to implement Redis with MySql in PHP? : <p>I have large amount data in database, sometimes server not responding when execution of result is more than the server response time. So, is there any way to reduce the load of mysql server with redis and how to implement it with right way.</p>
0debug
static void read_vec_element_i32(DisasContext *s, TCGv_i32 tcg_dest, int srcidx, int element, TCGMemOp memop) { int vect_off = vec_reg_offset(srcidx, element, memop & MO_SIZE); switch (memop) { case MO_8: tcg_gen_ld8u_i32(tcg_dest, cpu_env, vect_off); break; case MO_16: tcg_gen_ld16u_i32(tcg_dest, cpu_env, vect_off); break; case MO_8|MO_SIGN: tcg_gen_ld8s_i32(tcg_dest, cpu_env, vect_off); break; case MO_16|MO_SIGN: tcg_gen_ld16s_i32(tcg_dest, cpu_env, vect_off); break; case MO_32: case MO_32|MO_SIGN: tcg_gen_ld_i32(tcg_dest, cpu_env, vect_off); break; default: g_assert_not_reached(); } }
1threat
Android dependency 'com.google.android.gms:play-services-stats' has different version for the compile (16.0.1) and runtime (17.0.0) classpath : <p>Yesterday my app was building correctly and today without changing anything I'm not able to build anymore, I'm getting this error:</p> <blockquote> <p>Android dependency 'com.google.android.gms:play-services-stats' has >different version for the compile (16.0.1) and runtime (17.0.0) >classpath. You should manually set the same version via >DependencyResolution</p> </blockquote> <p>I tried to bypass this with "com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true" and clean the project many times, but the error is still here.</p> <p>My app/build.gradle file :</p> <pre><code>apply plugin: "com.android.application" apply plugin: "com.android.application" apply plugin: "io.fabric" import com.android.build.OutputFile project.ext.react = [ entryFile: "index.js" ] apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.yapero" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled true versionCode 743 versionName "1.74" ndk { abiFilters "armeabi-v7a", "x86" } versionNameSuffix '3' } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } packagingOptions { exclude 'META-INF/main.kotlin_module' exclude 'META-INF/-no-jdk.kotlin_module' } dexOptions { javaMaxHeapSize "4g" } // applicationVariants are e.g. debug, release applicationVariants.all { variant -&gt; variant.outputs.each { output -&gt; // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation project(':@segment_analytics-react-native') implementation project(':react-native-webview') implementation project(':react-native-version-check') implementation project(':react-native-firebase') implementation(project(':react-native-firebase')) { transitive = false } implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {transitive = true} //implementation project(':react-native-version-check') implementation project(':react-native-maps') implementation project(':react-native-intercom') implementation 'io.intercom.android:intercom-sdk-base:5.+' implementation 'io.intercom.android:intercom-sdk-fcm:5.+' implementation project(':react-native-fbsdk') implementation project(':react-native-device-info') implementation project(':react-native-appsflyer') implementation project(':react-native-text-input-reset') implementation project(':react-native-linear-gradient') implementation project(':react-native-fast-image') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules implementation "com.google.android.gms:play-services-base:16.1.0" implementation "com.google.firebase:firebase-core:16.0.8" implementation "com.google.firebase:firebase-auth:16.2.1" implementation "com.google.firebase:firebase-firestore:17.1.5" implementation "com.google.firebase:firebase-messaging:17.5.0" implementation 'me.leolin:ShortcutBadger:1.1.21@aar' implementation 'com.android.support:multidex:1.0.0' } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: 'com.google.gms.google-services' </code></pre> <p>My build.gradle:</p> <pre><code>buildscript { ext { buildToolsVersion = "28.0.2" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 27 supportLibVersion = "28.0.0" } repositories { google() jcenter() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.google.gms:google-services:4.2.0' classpath 'io.fabric.tools:gradle:1.25.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() google() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } } task wrapper(type: Wrapper) { gradleVersion = '4.7' distributionUrl = distributionUrl.replace("bin", "all") } </code></pre> <p>Does someone know how to correct or bypass this version check ? Ask me if you need more informations.</p>
0debug
while in not working in nested list PYTHON : <p>The first section of code prints 1 but the second doesn't, why and how to produce the above effect?</p> <pre><code>while [1] in k: print(1) k=[[0],[1,1,1],[0]] while [1] in k: print(1) </code></pre>
0debug
static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); JUMPALIGN(); do { __asm__ volatile( "movq %1, %%mm0 \n\t" "movq 1%1, %%mm1 \n\t" "movq %0, %%mm3 \n\t" PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) PAVGB_MMX(%%mm3, %%mm2, %%mm0, %%mm6) "movq %%mm0, %0 \n\t" "movq 8%1, %%mm0 \n\t" "movq 9%1, %%mm1 \n\t" "movq 8%0, %%mm3 \n\t" PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) PAVGB_MMX(%%mm3, %%mm2, %%mm0, %%mm6) "movq %%mm0, 8%0 \n\t" :"+m"(*block) :"m"(*pixels) :"memory"); pixels += line_size; block += line_size; } while (--h); }
1threat
Android xml (drawable) shape : I want to draw a custom shape in the drawable xml file. So what would be code for it? [enter image description here][1] [1]: https://i.stack.imgur.com/40ohY.png
0debug