problem
stringlengths
26
131k
labels
class label
2 classes
How to count the number of rows in condition? : <p>I want to count the number of rows of a selected result.</p> <p>E.g., SELECT * FROM TABLE1 WHERE [the number of rows of a (SELECT QUERY)] = 1;</p>
0debug
could not resolve recyclerview-v7 : I am working on Android since 2 years. I never faced issue like this. After updating Android Studio and `com.android.tools.build:gradle:3.1.3`, i am facing this issue. **Issue:** **`Could not resolve RecyclerView-v7`** This is a silly issue which make me stuck for 1 hour. This only happens in `com.android.tools.build:gradle:3.1.3`. **Project level build.gradle** // Top-level build file where you can add configuration options common to all sub-projects/modules. apply from: rootProject.file('dependencies.gradle') buildscript { repositories { jcenter() maven { url 'https://maven.google.com/' name 'Google' } google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' } } allprojects { repositories { maven { url 'https://jitpack.io' } jcenter() maven { url 'https://maven.google.com' } maven { url 'https://maven.google.com/' name 'Google' } } } task clean(type: Delete) { delete rootProject.buildDir } **App level build.gradle** apply plugin: 'com.android.application' android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { applicationId "in.kpis.upkeep" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")") } dataBinding { enabled = true } buildTypes { debug { versionNameSuffix "-T" } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' versionNameSuffix "-R" } } useLibrary 'org.apache.http.legacy' packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } compileOptions { targetCompatibility rootProject.ext.targetCompatibilityVersion sourceCompatibility rootProject.ext.sourceCompatibilityVersion } } def SUPPORT_LIB_VER = '27.1.1' def SDP_VERSION = '1.0.5' def BUTTER_KNIFE_VER = '8.8.1' dependencies { implementation 'com.android.support.constraint:constraint-layout:1.1.0' compile fileTree(include: ['*.jar'], dir: 'libs') implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VER" implementation "com.android.support:design:${SUPPORT_LIB_VER}" implementation "com.android.support:cardview-v7:$SUPPORT_LIB_VER" implementation "com.android.support:recyclerview-v7:${SUPPORT_LIB_VER}" implementation 'com.googlecode.libphonenumber:libphonenumber:8.0.1' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.google.code.gson:gson:2.8.4' implementation "com.jakewharton:butterknife:${BUTTER_KNIFE_VER}" annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTER_KNIFE_VER}" implementation 'com.wdullaer:materialdatetimepicker:3.6.0' implementation "com.intuit.sdp:sdp-android:$SDP_VERSION" implementation "com.intuit.ssp:ssp-android:$SDP_VERSION" implementation group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1' implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3' implementation 'com.android.volley:volley:1.1.0' implementation 'com.github.esafirm.android-image-picker:imagepicker:1.13.0' implementation 'com.github.bumptech.glide:glide:4.5.0' } I downgraded `build.gradle` to make this working but that's not a solution. Someone know this issue?
0debug
How would I go about having a chat update after loading? : <p>I've tried searching on here for a bit to try and find someone with a similar question. I haven't quite yet gotten into implementing the actual retrieval and insertion into the database for the chat messages but I would like to know ahead of time what I'll need to do. You see, on several websites there is updates done to the page after its already been loaded, such as with chat rooms where you're actively given new messages after the page has already loaded. I'm really just posting this as a quick question to see whether this is done through forcing all clients to reload when a new message is posted or what. I would also like to know, if this is done a different way, what language relates to it so I can learn it ahead of time. Thank you.</p>
0debug
Angular 2 with CLI - build for production : <p>I have freshly installed angular-cli 1.0.0.beta.17 (latest one), start new project, able to serve project on port 4200 with no problems - just standard "app works!" message.</p> <p>However when I try to build for production this empty and generic application by using command <code>ng build --prod</code> I do not have main.*.js file created at all and have a few screens of warnings like:</p> <ul> <li>Dropping unused function...</li> <li>Site effects in initialization...</li> <li>etc</li> </ul> <p>This is a brand new empty project - I did not have a chance to break anything yet...</p> <p>How to build production version ?</p>
0debug
how i can start with this problem and fix my code? : the question : write a program that gets a list of numbers ( lets say 4 numbers ) and an extra number and checks if the extra number equals to the multiplying of two numbers from the list , if yes return true else return false , for example a number list is ( 2,4,8,16) an extra number is 32 , the program checks if 32 is equal to two numbers of the numbers from the list , and return true , in this example it will , because 32 equals to , my solution is below but its not correct , any help appreciated :- [code below][1] [1]: https://i.stack.imgur.com/MyRoy.png
0debug
Return a varchar from database using dapper : <p>I need to retrieve a single word/varchar from the database ( it can be an empty string or a null value sometimes ). I'm using dapper and I can't retrieve anything at all. The many tutorials and questions on the Web refer only to retrieve an <strong>Integer</strong> value, but never a <strong>String</strong>.</p> <p>This is what I got so far:</p> <pre><code> using (var db = new FbConnection(csb.ToString())) { await db.OpenAsync(); result = db.ExecuteScalarAsync&lt;string&gt;("SELECT NOME from NACION WHERE NOME = @nacion", new { nacion }).ToString(); db.Close(); } </code></pre> <p>That <code>result</code> variable should be a string, like <strong>"Word"</strong> or an empty/null string, depending on the result of the query.</p> <p>Right now, it's returning something weird like this: <code>System.Threading.Tasks.Task'1[System.String]</code></p> <p>What am I doing wrong? </p>
0debug
static void bitband_writew(void *opaque, target_phys_addr_t offset, uint32_t value) { uint32_t addr; uint16_t mask; uint16_t v; addr = bitband_addr(opaque, offset) & ~1; mask = (1 << ((offset >> 2) & 15)); mask = tswap16(mask); cpu_physical_memory_read(addr, (uint8_t *)&v, 2); if (value & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, (uint8_t *)&v, 2); }
1threat
int register_savevm_live(const char *idstr, int instance_id, int version_id, SaveLiveStateHandler *save_live_state, SaveStateHandler *save_state, LoadStateHandler *load_state, void *opaque) { SaveStateEntry *se; se = qemu_malloc(sizeof(SaveStateEntry)); pstrcpy(se->idstr, sizeof(se->idstr), idstr); se->version_id = version_id; se->section_id = global_section_id++; se->save_live_state = save_live_state; se->save_state = save_state; se->load_state = load_state; se->opaque = opaque; se->vmsd = NULL; if (instance_id == -1) { se->instance_id = calculate_new_instance_id(idstr); } else { se->instance_id = instance_id; } TAILQ_INSERT_TAIL(&savevm_handlers, se, entry); return 0; }
1threat
Parent element selector using pure CSS : <p>What is the way of getting parent element using pure CSS. Am using VS 2013, So it must be css3. I have seen in google about has() and &lt; selectors. Unfortunately they do not work. </p>
0debug
Best way to achieve custom ui layout in Visual Studio (c#) : <p>I have a simple layout <a href="https://i.stack.imgur.com/c76CQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c76CQ.png" alt="enter image description here"></a></p> <p>What would the best way to achieve this? using WPF or Win forms with a custom list view?</p>
0debug
How to clear Flutter's Build cache? : <p>There seems to be a problem with flutter's build.</p> <p>I always need to perform <strong>RUN</strong> > <strong>Flutter Full Restart</strong> everytime I run the app to an emulator or device.</p> <p>Otherwise, the app loads a scaffold body which my code had from 2 weeks ago when I first started coding it.</p> <p><a href="https://pastebin.com/m62M7TTy" rel="noreferrer">Here's the current source on pastebin</a></p> <pre><code>children: &lt;Widget&gt;[ new Opacity( opacity: loader_visible ? 1.0 : 0.0, child: new Container( padding: const EdgeInsets.all(32.0), child: new CircularProgressIndicator() ) ), </code></pre> <p>while here is the resulting render tree: <a href="https://i.stack.imgur.com/aLnrg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aLnrg.png" alt="while here is the resulting render tree"></a></p> <p>I'm guessing flutter has cached the old code and never bothered replacing it with the new one, but I am not sure how it's Hot Reload was implemented. Anyways, I don't think that it is necessary to load the old cache when we have already performed a full rebuild.</p>
0debug
void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *type = qdict_get_str(qdict, "type"); const char *opts = qdict_get_try_str(qdict, "opts"); if (!strncmp(pci_addr, "pci_addr=", 9)) { pci_addr += 9; } if (!opts) { opts = ""; } if (!strcmp(pci_addr, "auto")) pci_addr = NULL; if (strcmp(type, "nic") == 0) dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); else if (strcmp(type, "storage") == 0) dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); else monitor_printf(mon, "invalid type: %s\n", type); if (dev) { *ret_data = qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, " "'function': %d }", pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); assert(*ret_data != NULL); } else monitor_printf(mon, "failed to add %s\n", opts); }
1threat
Eliminating multiple server calls | MS SQL Server : There is a stored procedure which needs to be modified to eliminate a call to another server. What is the easiest and feasible way to do this so that the final SP's execution time is faster and also preference to solutions which does not involve much change to the application. Eg:``` select * from dbo.table1 a inner join server2.dbo.table2 b on a.id=b.id```
0debug
I need such type of matrix output in MS SQL server ...please help me with the query : I need count of customers who got subscribed to channels. Where channel =telugu and channel = hindi Where channel =telugu and channel = English Where channel = hindi and channel = English
0debug
different hover colors required for different sections of a single image : <p>Good day everyone, I'm having difficulty with applying hover styles for an image. The image is having an irregular shape plus each section when hovered needs to have a different hover color.<a href="https://i.stack.imgur.com/nQWri.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nQWri.jpg" alt="enter image description here"></a> Many thanks.</p>
0debug
MySQL - Join multiple rows from other table as array : <p>I have trouble figuring out how to join multiple rows from a second table. I have tried using <code>GROUP_CONCAT</code> but I want to display them as an array <em>(see green box in the picture below)</em></p> <p>The main issue here is the <code>1,2,4</code> from the airways-column. I really want to avoid having a third table just to connect the two tables together. I understand arrays are difficult to store in MySQL, but is there some magical way of getting the desired info from the tables below? </p> <p>I wish I had some code, but I am lost here. Very thankful for pointers!</p> <p><a href="https://i.stack.imgur.com/bhtzL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bhtzL.png" alt="enter image description here"></a></p>
0debug
static int mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size, UINT8 *buf, int buf_size) { MJpegDecodeContext *s = avctx->priv_data; UINT8 *buf_end, *buf_ptr; int i, start_code; AVPicture *picture = data; *data_size = 0; if (buf_size == 0) return 0; buf_ptr = buf; buf_end = buf + buf_size; while (buf_ptr < buf_end) { start_code = find_marker(&buf_ptr, buf_end); { if (start_code < 0) { goto the_end; } else { dprintf("marker=%x avail_size_in_buf=%d\n", start_code, buf_end - buf_ptr); if ((buf_end - buf_ptr) > s->buffer_size) { av_free(s->buffer); s->buffer_size = buf_end-buf_ptr; s->buffer = av_malloc(s->buffer_size); dprintf("buffer too small, expanding to %d bytes\n", s->buffer_size); } if (start_code == SOS) { UINT8 *src = buf_ptr; UINT8 *dst = s->buffer; while (src<buf_end) { UINT8 x = *(src++); *(dst++) = x; if (x == 0xff) { while(*src == 0xff) src++; x = *(src++); if (x >= 0xd0 && x <= 0xd7) *(dst++) = x; else if (x) break; } } init_get_bits(&s->gb, s->buffer, dst - s->buffer); dprintf("escaping removed %d bytes\n", (buf_end - buf_ptr) - (dst - s->buffer)); } else init_get_bits(&s->gb, buf_ptr, buf_end - buf_ptr); s->start_code = start_code; if (start_code >= 0xd0 && start_code <= 0xd7) { dprintf("restart marker: %d\n", start_code&0x0f); } else if (s->first_picture) { if (start_code >= 0xe0 && start_code <= 0xef) mjpeg_decode_app(s); else if (start_code == COM) mjpeg_decode_com(s); } switch(start_code) { case SOI: s->restart_interval = 0; break; case DQT: mjpeg_decode_dqt(s); break; case DHT: mjpeg_decode_dht(s); break; case SOF0: if (mjpeg_decode_sof0(s) < 0) return -1; break; case EOI: eoi_parser: { if (s->interlaced) { s->bottom_field ^= 1; if (s->bottom_field) goto not_the_end; } for(i=0;i<3;i++) { picture->data[i] = s->current_picture[i]; picture->linesize[i] = (s->interlaced) ? s->linesize[i] >> 1 : s->linesize[i]; } *data_size = sizeof(AVPicture); avctx->height = s->height; if (s->interlaced) avctx->height *= 2; avctx->width = s->width; switch((s->h_count[0] << 4) | s->v_count[0]) { case 0x11: avctx->pix_fmt = PIX_FMT_YUV444P; break; case 0x21: avctx->pix_fmt = PIX_FMT_YUV422P; break; default: case 0x22: avctx->pix_fmt = PIX_FMT_YUV420P; break; } goto the_end; } break; case SOS: mjpeg_decode_sos(s); if ((s->buggy_avid && !s->interlaced) || s->restart_interval) goto eoi_parser; break; case DRI: mjpeg_decode_dri(s); break; case SOF1: case SOF2: case SOF3: case SOF5: case SOF6: case SOF7: case SOF9: case SOF10: case SOF11: case SOF13: case SOF14: case SOF15: case JPG: printf("mjpeg: unsupported coding type (%x)\n", start_code); break; } not_the_end: buf_ptr += (get_bits_count(&s->gb)+7)/8; dprintf("marker parser used %d bytes (%d bits)\n", (get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb)); } } } the_end: dprintf("mjpeg decode frame unused %d bytes\n", buf_end - buf_ptr); return buf_ptr - buf; }
1threat
How to extract all the values of one array and assign those values to another array : <p>if array1 = [1, 2, 3, 4];</p> <p>then array2 = [5, 6, 7];</p> <p>In the end i want all these values to be in one array as</p> <p>array3 = [1, 2, 3, 4, 5, 6, 7]</p>
0debug
Searches for books whose title contains the keyword and returns them ordered by titles (in alphabet order) : <p>I dont know how to search by keywords after some research im guessing i have to use the contain method but i dont know how thanks</p> <pre><code> import javax.swing.JOptionPane; /** * A collection of {@link Book}. */ public class BookStorage { private Book[] books = new Book[100]; public BookStorage() { } /** * Initializes the book storage with some arbitrary book objects. */ public void initBooks() { books[0] = new Book("Crickey", "Mahmoud", 200, Book.BookCategory.Design ); books[1] = new Book("Thinking in Java", "Bruce Eckel", 1520, Book.BookCategory.Programming ); books[2] = new Book("Easy Life", "Jeff Bezos", 10, Book.BookCategory.Database ); books[3] = new Book("Soccer Star", "Ronaldo", 1000, Book.BookCategory.Design ); books[4] = new Book("Hells Kitchen", "Gordon Ramsay", 500, Book.BookCategory.Programming ); books[5] = new Book("York Itec", "John", 1600, Book.BookCategory.Database ); books[6] = new Book("Gaming Designer", "Rebecca", 1100, Book.BookCategory.Design ); books[7] = new Book("Computer Science", "Mahmoud", 200, Book.BookCategory.Programming ); books[8] = new Book("Google", "Jason", 333, Book.BookCategory.Database ); books[9] = new Book("York Soccer", "Carmine", 777, Book.BookCategory.Design ); } /** * Uses the given book to update the existing book with the same title. */ public void update(Book book) { for(int i = 0; i&lt;books.length;i++) { if(books[i].getTitle().equals(book.getTitle())) { books[i].setAuthors(book.getAuthors()); books[i].setPages(book.getPages()); books[i].setCategory(book.getCategory()); } } } /** * Removes a book by title. */ public void remove(String bookTitle) { // TODO Add your code here... for(int i=0; i&lt;books.length;i++) { if(books[i].getTitle().equals(bookTitle)){ books[i]= null; } } } /** * Adds a new book. */ public void add(Book book) { // TODO Add your code here... int index = 0; int counter = 0; boolean invalidArg; if(books[index].getTitle().equals(book.getTitle())) { invalidArg = false; } else { invalidArg = true; } if (!invalidArg) { JOptionPane.showMessageDialog(null, "The book has been added"); } else { int tempCounter = counter; for (int i = 0; i&lt;tempCounter+1;i++) { if (books[i] !=null) { continue; }else { books[i] = book; } } } } /** * Gets a book by title. */ public Book getByTitle(String title) { // TODO Add your code here... for(int i=0; i&lt;books.length;i++) { if(books[i].getTitle() == title){ return books[i] ; } } return null; } /** * Searches for books whose title contains the keyword and returns them ordered by titles (in alphabet order). */ public Book[] titleSearch(String keyword) { // TODO Add your code here... return new Book[0]; } /** * Returns all books sorted by their titles (in alphabet order). */ public Book[] getAll() { // TODO Add your code here... return new Book[0]; } /** * Sorts an array of books by their titles in alphabet order. */ private Book[] sortByTitle(Book[] bookArray) { // TODO Add your code here... Book temp; for (int i = 0; i &lt; books.length; i++) { for (int j = i + 1; j &lt; books.length; j++) { if (books[i].getTitle().compareTo(books[j].getTitle())&gt;0) { temp = books[i]; books[i] = books[j]; books[j] = temp; } } } return bookArray; } </code></pre> <p>}</p> <p>the code im looking for help is the titlesearch() the rest is for another time haha the goal is to search on the textfield a title and it will appear on the list and i will call this method to provide it</p>
0debug
converting multiple functions to a single function in Python 3 : <p>I have been using the wikipedia API to create some code that trnslates outlinks of wikipedia pages across languages back to english and then creates a data frame with the information. I have all of the code working except it's in multiple cells. My advisor wants to have all of this as a single function so I basically only have to input a page title and get all of this information back. I have been incredibly unsucessful in getting any code to work when I try to nest functions. </p> <p>Here is a link to my code:</p> <p><a href="https://github.com/empo0270/Interlanguage-links-Wiki/blob/master/translation%20function.ipynb" rel="nofollow noreferrer">https://github.com/empo0270/Interlanguage-links-Wiki/blob/master/translation%20function.ipynb</a></p> <p>Is there anyway to sit this mess in a single function without having to overly chop and redo all of the code structure?</p>
0debug
int opt_codec_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(AV_LOG_DEBUG); return opt_default(NULL, opt, arg); }
1threat
R: List of named, numeric Columns of unequal size to data frame by name : <p>I got a list of Variables of unequal size</p> <pre><code>List of 61 $ AMGN: Named num [1:2982] 58.1 60.6 60.8 60.3 60.6 ... ..- attr(*, "names")= chr [1:2982] "2007-01-03" "2007-01-04" "2007-01-05" "2007-01-08" ... $ ANIK: Named num [1:2982] 13.2 13.3 13.3 13.2 13.1 ... ..- attr(*, "names")= chr [1:2982] "2007-01-03" "2007-01-04" "2007-01-05" "2007-01-08" ... $ ADMA: Named num [1:1272] 8.55 8.53 8.4 8.45 8.49 8.4 8.4 8.5 8.4 8.4 ... ..- attr(*, "names")= chr [1:1272] "2013-10-17" "2013-10-18" "2013-10-21" "2013-10-22" ... $ ILMN: Named num [1:2982] 19.2 19.5 19.3 19.3 19.7 ... ..- attr(*, "names")= chr [1:2982] "2007-01-03" "2007-01-04" "2007-01-05" "2007-01-08" ... </code></pre> <p>which I want to merge into a data frame based on each elements name, which is a date, that should overlap but not always , therefor essentially a full join.</p> <p>As it is a list I tried ldply(list,rbind) and it seems to be doing something in this direction, yet it comes along with an .id field and column names are the dates, which is why I transposed, but the structure seems to be very broken and I cannot retain a nice data frame in which:</p> <p>each Variable (AMGN, ANIK, ...) is one column, all dates are represented either as rownames or as additional column date, each value assigned correctly and for missing values at dates NA is imputed.</p> <p>For anynone wanting to code along I am putting down the Code</p> <pre><code>library(quantmod) library(quantstrat) library(stringdist) library(plyr) library(dplyr) companies&lt;-c("4SC AG", "aap Implantate AG", "ACADIA Pharmaceuticals Inc.", "Acorda Therapeutics, Inc.", "Acusphere Inc", "Agennix AG", "Agenus Inc", "Alexion Pharmaceuticals Inc.", "Alnylam Pharmaceuticals Inc.", "Amgen Inc.", "Anika Therapeutics Inc.", "Apricus Biosciences Inc Registered Shs", "ArQule Inc.", "Array BioPharma Inc.", "B.R.A.I.N. Biotechnology Research and Information Network AG", "Bachem AG", "Bausch Health", "Bavarian Nordic A/S", "Bayer", "BB BIOTECH AG", "Biofrontera AG", "Biogen Inc", "Biomarin Pharmaceutical Inc.", "Biosearch S.A.", "Biotest AG", "Cambrex Corp.", "Celgene Corp.", "Celldex Therapeutics Inc", "Cerus Corp.", "co.don AG", "Compugen Ltd.", "curasan AG", "Curetis", "DAIICHI SANKYO CO LTD (spons. ADRs)", "DowDuPont Inc.", "Dr. Reddy's Laboratories Ltd. (Spons. ADRS)", "Emergent BioSolutions Inc.", "Emisphere Technologies Inc.", "Enzo Biochem Inc.", "Enzon Pharmaceuticals Inc.", "Eurofins Scientific Group S.A.", "EVOTEC AG", "EXACT Sciences Corp.", "Exelixis Inc.", "General Electric Co.", "Genmab A-S", "Genus plc", "Geron Corp.", "Gilead Sciences Inc.", "Halozyme Therapeutics Inc.", "Heidelberg Pharma AG", "Helix Biopharma Corp.", "IDEXX Laboratories", "Illumina Inc.", "ImmunoGen Inc.", "Immunomedics Inc.", "Incyte Corp.", "Insys Therapeutics Inc", "Integra LifeSciences Holdings Corp.", "Ionis Pharmaceuticals Inc", "Johnson &amp; Johnson", "La Jolla Pharmaceutical Co", "Ligand Pharmaceuticals Inc", "Lonza AG (N)", "Medigene AG", "Medivir AB", "Merck KGaA", "Meridian Bioscience Inc.", "Meridian Waste Solutions Inc Registered Shs", "MOLOGEN AG", "Momenta Pharmaceuticals Inc.", "Myriad Genetics Inc.", "Nektar Therapeutics", "Neurocrine Biosciences Inc.", "NewLink Genetics Corp.", "Novartis AG", "Novozymes A-S (B)", "PAION AG", "Palatin Technologies Inc", "PDL BioPharma Inc.", "Pfizer Inc.", "PledPharma AB", "Progenics Pharmaceuticals Inc.", "Proteo Inc.", "QIAGEN N.V.", "Regeneron Pharmaceuticals Inc.", "Repligen Corp.", "RTI Biologics Inc", "Sangamo Therapeutics Inc", "Sangui Biotech International Inc.", "Sanofi S.A.", "Sartorius AG St.", "Sartorius AG Vz.", "Seattle Genetics Inc.", "Shire PLC", "SIGA Technologies Inc.", "Spectrum Pharmaceuticals IncShs", "Takara Holdings Inc.", "Teva Pharmaceutical Industries Ltd. (spons. ADRs)", "Transgene S.A.", "Trinity Biotech plc (Spons. ADRs)", "United Therapeutics Corp.", "Valneva", "Vertex Pharmaceuticals Inc.", "Vical Inc") ref&lt;-stockSymbols() cf&lt;-data.frame(Name="Company",Ref="Company",Symbol="Code") for(i in companies){ if(!(i %in% ref$Name)){ flag=T for(j in 1:(round(nchar(i)/4)+1)){ if(flag){ dist=j hit&lt;-amatch(i,ref$Name,maxDist=dist) #print(paste("matches:",hit,"distance",dist,"item",i,"length",nchar(i))) if(!is.na(hit)){ cf&lt;-rbind(cf,data.frame(Name=i,Ref=ref$Name[hit],Symbol=ref$Symbol[hit])) flag=F}}}}} cf&lt;-rbind(cf,data.frame(Name=ref$Name[ref$Name %in% companies],Ref=ref$Name[ref$Name %in% companies],Symbol=ref$Symbol[ref$Name %in% companies])) cf&lt;-cf[-1,] cf$Symbol&lt;-as.character(cf$Symbol) gitgat&lt;-function(x) { tf&lt;-setNames(coredata(x)[,ncol(coredata(x))], as.character(index(x))) } Data &lt;- new.env() getSymbols(cf$Symbol,src="yahoo", env=Data) Freq &lt;- eapply(Data, function(s) gitgat(s)) keys &lt;- unique(unlist(lapply(Freq, names))) kal&lt;-ldply(Freq,rbind) kol&lt;-as.data.frame(t(kal)) </code></pre>
0debug
after upgrade to 2.7 ClassNotFoundException: org.mockito.exceptions.Reporter when run test : <p>I try to set up junit, mokito and powermock together but when I ran a test I get ClassNotFoundException :(</p> <pre><code>testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.7.22' androidTestCompile 'org.mockito:mockito-core:2.7.22' androidTestCompile "org.mockito:mockito-android:2.7.22" testCompile 'org.robolectric:robolectric:3.3.2' testCompile 'org.hamcrest:hamcrest-core:1.3' testCompile 'org.powermock:powermock-core:1.6.6' testCompile 'org.powermock:powermock-module-junit4:1.6.6' testCompile 'org.powermock:powermock-module-junit4-rule:1.6.6' testCompile 'org.powermock:powermock-api-mockito:1.6.6' testCompile 'org.powermock:powermock-classloading-xstream:1.6.6'` </code></pre> <p>I also tried adding cglib by adding:</p> <pre><code>testCompile 'cglib:cglib:3.1' testCompile 'cglib:cglib-nodep:3.1' </code></pre> <p>but without of lack.</p> <p>could any one share working configuration or point me out what is wrong.</p> <p>My stacktrace when I ran a test:</p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/mockito/exceptions/Reporter at sun.reflect.GeneratedSerializationConstructorAccessor5.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48) at org.powermock.reflect.internal.WhiteboxImpl.newInstance(WhiteboxImpl.java:251) at org.powermock.reflect.Whitebox.newInstance(Whitebox.java:139) at org.powermock.api.extension.reporter.AbstractMockingFrameworkReporterFactory.getInstanceForClassLoader(AbstractMockingFrameworkReporterFactory.java:41) at org.powermock.api.extension.reporter.AbstractMockingFrameworkReporterFactory.create(AbstractMockingFrameworkReporterFactory.java:35) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.getMockingFrameworkReporter(JUnit4TestSuiteChunkerImpl.java:140) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:119) at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53) at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.lang.ClassNotFoundException: org.mockito.exceptions.Reporter at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:190) at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass1(DeferSupportingClassLoader.java:77) at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:67) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 21 more </code></pre>
0debug
A property that is read-only outside of the class, but read-write for class members : <p>I'd like to have a property in my class that is readable, but not directly modifiable by code external to the class. Basically, equivalent of returning a const reference to member from a method in C++.</p> <p>Writing something along those lines:</p> <pre><code>class test { private readonly x_ = new Uint8Array([0, 1, 2]); public x() { return this.x_;} } </code></pre> <p>does not work, because code like the following still compiles:</p> <pre><code>let a = new test(); a.x()[0] = 1; </code></pre> <p>What's the correct way of achieving this?</p>
0debug
void qemu_notify_event(void) { static const uint64_t val = 1; ssize_t ret; if (io_thread_fd == -1) { return; } do { ret = write(io_thread_fd, &val, sizeof(val)); } while (ret < 0 && errno == EINTR); if (ret < 0 && errno != EAGAIN) { fprintf(stderr, "qemu_notify_event: write() failed: %s\n", strerror(errno)); exit(1); } }
1threat
Run a script every few secconds : <p>I have a php script that i need to run every 4 seconds for one hour a day, what is the best way to do this. I look up a way of using cron and sleep and also watch but what would be the best way of doing this over all?</p> <p>Watch </p> <pre><code>watch -n10 command args </code></pre> <p>cron:</p> <pre><code>* * * * * /foo/bar/your_script * * * * * sleep 4; /foo/bar/your_script * * * * * sleep 8; /foo/bar/your_script * * * * * sleep 12; /foo/bar/your_script </code></pre>
0debug
static void omap_timer_clk_setup(struct omap_mpu_timer_s *timer) { omap_clk_adduser(timer->clk, qemu_allocate_irqs(omap_timer_clk_update, timer, 1)[0]); timer->rate = omap_clk_getrate(timer->clk); }
1threat
static ssize_t local_readlink(FsContext *fs_ctx, const char *path, char *buf, size_t bufsz) { ssize_t tsize = -1; if (fs_ctx->fs_sm == SM_MAPPED) { int fd; fd = open(rpath(fs_ctx, path), O_RDONLY); if (fd == -1) { return -1; } do { tsize = read(fd, (void *)buf, bufsz); } while (tsize == -1 && errno == EINTR); close(fd); return tsize; } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { tsize = readlink(rpath(fs_ctx, path), buf, bufsz); } return tsize; }
1threat