problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
How to create real time chat in mobile apps with attachment image/videos in socket io? The backend framework is rails,nginx,unicorn : <p>I have a mobile chat application that need to be real time and it has an attachment videos/images.The back end framework I have used is rails4 with nginx and unicorn. Anybody can help me or can give some examples to create a server and client in mobile and rails integration with socket io. Thank you.</p>
| 0debug
|
BroadcastReciever(To check internet connectivity) getting called at the start of activity : I am using BroadcastReciever to check internet connectivity but it is getting called at the start of activity.This is my BroadcastReceiver` public BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, Intent intent) {
connectivityManager = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE );
activeNwInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
boolean isWifiConnected = activeNwInfo != null && activeNwInfo.isConnectedOrConnecting();
activeNwInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
boolean isMobileNwConnected = activeNwInfo != null && activeNwInfo.isConnectedOrConnecting();
try {
if (isWifiConnected || isMobileNwConnected) {
Snackbar.make(cordinatorlayout, "Connection established", Snackbar.LENGTH_INDEFINITE)
.setAction("GO ONLINE", new View.OnClickListener() {
@Override
public void onClick(View view) {
//Toast.makeText(context, "clicked", Toast.LENGTH_SHORT).show();
finish();
startActivity(getIntent());
}
}).show();
}else {
Snackbar.make(cordinatorlayout, "You are Offline", Snackbar.LENGTH_INDEFINITE).show();
}
}catch (Exception e){
e.printStackTrace();
}
}
};
` and I have registered BroadcastReceiver inside oncreate() of MainActivity. My BroadcastReceiver is getting called but it is getting called at the start of activity.
| 0debug
|
sql fragmentation : I need **SQL FRAGMENTATION** with *examples*
| 0debug
|
in this code, i can't change parameters i & j . I Don't know why , i am a beginner. plz help me to figure this out . : #include <iostream>
using namespace std;
int rev(int& sourcenum)
{
int temp = sourcenum;
int sum = 0;
while (temp!=0)
{
sum*=10;
sum += temp%10;
temp/=10;
}
return sum;
};
int main() {
int i,j;
cin >> i >> j;
int add = rev(i)+rev(j);
cout<<i<<" "<<j<<endl;
cout<<add<<endl;
cout<<rev(add);
}
in this code, i can't change parameters i & j . I Don't know why , i am a beginner. plz help me to figure this out .
| 0debug
|
Return boolean before time.sleep finish when pressing a JButton in Java : <p>This is my code. I want to return true if the user press the button and false otherwise. The problem that I have is that when the button is press it still waits for the time.sleep to finish and then returns. How can I work around this?</p>
<pre><code> public boolean popConfirmation(String action) {
delete = false;
JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
JButton clickmeButton = new JButton("Click Me");
buttonPanel.add(clickmeButton);
frame.add(buttonPanel,BorderLayout.SOUTH);
frame.setSize(popUpWidth, popUpHeight);
frame.setLocation(popUpX, popUpY);
frame.setVisible(true);
frame.setAlwaysOnTop(ALWAYS_ON_TOP);
clickmeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
delete = true;
frame.setVisible(false);
frame.dispose();
}
});
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
logger.error("Error", e);
}
frame.setVisible(false);
frame.dispose();
return delete;
}
</code></pre>
| 0debug
|
static int add_metadata(const uint8_t **buf, int count, int type,
const char *name, const char *sep, TiffContext *s)
{
switch(type) {
case TIFF_DOUBLE: return add_doubles_metadata(buf, count, name, sep, s);
case TIFF_SHORT : return add_shorts_metadata(buf, count, name, sep, s);
default : return AVERROR_INVALIDDATA;
};
}
| 1threat
|
PayPal Checkout (javascript) with Smart Payment Buttons create order problem : <p>I'm trying to implement on my webpage the PayPal Checkout (javascript) following the manual: <a href="https://developer.paypal.com/docs/checkout/" rel="noreferrer">https://developer.paypal.com/docs/checkout/</a>
Everything is great with standard options. For example this works just fine:</p>
<pre><code>paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
currency_code: 'EUR',
value: '120.16'
},
description: 'Purchase Unit test description',
custom_id: '64735',
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name);
// Call your server to save the transaction
return fetch('/api/paypal-transaction-complete', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
});
});
}
}).render('#paypal-button-container');
</code></pre>
<p>But when I try to be more specific about the order details it gives me an error:</p>
<pre><code>Error: "Order Api response error:
{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "1ed03d18530c1",
"details": [
{
"location": "body",
"issue": "INVALID_SYNTAX",
"description": "Cannot deserialize instance of `com.paypal.api.platform.checkout.orders.v2.model.AmountBreakdown` out of START_ARRAY token line: 1, column: 82"
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_SYNTAX", "rel": "information_link", "encType": "application/json"
}
]
}"
}
</code></pre>
<p>This is my code:</p>
<pre><code>paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
currency_code: 'EUR',
value: '120.16',
breakdown: [{
item_total: {
unit_amount: 7,
currency_code: 'EUR',
value: '120.16'
}
}]
},
description: 'Purchase Unit test description',
custom_id: '64735',
items: [{
name: 'Test item 1',
unit_amount: {
currency_code: 'EUR',
value: '60.12'
},
quantity: 2,
description: 'Uaua item 1 description'
}, {
name: 'Test item 2',
unit_amount: {
currency_code: 'EUR',
value: '60.00'
},
quantity: 5,
description: 'Test item 2 description'
}]
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name);
// Call your server to save the transaction
return fetch('/api/paypal-transaction-complete', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
});
});
}
}).render('#paypal-button-container');
</code></pre>
<p>Anyone knows where is the problem? The PayPal documentation is not very informative...</p>
| 0debug
|
static void qcow2_invalidate_cache(BlockDriverState *bs)
{
BDRVQcowState *s = bs->opaque;
int flags = s->flags;
AES_KEY aes_encrypt_key;
AES_KEY aes_decrypt_key;
uint32_t crypt_method = 0;
QDict *options;
if (s->crypt_method) {
crypt_method = s->crypt_method;
memcpy(&aes_encrypt_key, &s->aes_encrypt_key, sizeof(aes_encrypt_key));
memcpy(&aes_decrypt_key, &s->aes_decrypt_key, sizeof(aes_decrypt_key));
}
qcow2_close(bs);
options = qdict_new();
qdict_put(options, QCOW2_OPT_LAZY_REFCOUNTS,
qbool_from_int(s->use_lazy_refcounts));
memset(s, 0, sizeof(BDRVQcowState));
qcow2_open(bs, options, flags, NULL);
QDECREF(options);
if (crypt_method) {
s->crypt_method = crypt_method;
memcpy(&s->aes_encrypt_key, &aes_encrypt_key, sizeof(aes_encrypt_key));
memcpy(&s->aes_decrypt_key, &aes_decrypt_key, sizeof(aes_decrypt_key));
}
}
| 1threat
|
Random word generator with a equal probability of occurrence of letters : <p>So I made a pretty simple word generator program in c# that works relatively well. My question is how to generate a words with a equal probability of occurrence of letters eg. aaaa, aabb or abab</p>
<p>My code:</p>
<pre><code>listView1.Items.Clear();
int num_letters = 4;
int num_words = 20;
char[] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
Random rand = new Random();
for (int i = 1; i <= num_words; i++)
{
string word = "";
for (int j = 1; j <= num_letters; j++)
{
int letter_num = rand.Next(0, letters.Length - 1);
word += letters[letter_num];
}
listView1.Items.Add(word);
</code></pre>
| 0debug
|
how to make app minimize with back button : I need to minimize app after user info input with back button.
What i do wrong
There's the back button code
backButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (sendThread != null) {
//sendThread.cancel();
}
if (receiveThread != null) {
//receiveThread.cancel();
}
//acceptThread = new AcceptConnection();
//acceptThread.start();
textsListAdapter.clear();
viewFlipper.showPrevious();
deviceArrayAdapter.clear();
}
});
| 0debug
|
In TensorFlow, how can I get nonzero values and their indices from a tensor with python? : <p>I want to do something like this.<br>
Let's say we have a tensor A. </p>
<pre><code>A = [[1,0],[0,4]]
</code></pre>
<p>And I want to get nonzero values and their indices from it. </p>
<pre><code>Nonzero values: [1,4]
Nonzero indices: [[0,0],[1,1]]
</code></pre>
<p>There are similar operations in Numpy.<br>
<code>np.flatnonzero(A)</code> return indices that are non-zero in the flattened A.<br>
<code>x.ravel()[np.flatnonzero(x)]</code> extract elements according to non-zero indices.<br>
Here's <a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.flatnonzero.html" rel="noreferrer">a link</a> for these operations.</p>
<p>How can I do somthing like above Numpy operations in Tensorflow with python?<br>
(Whether a matrix is flattened or not doesn't really matter.)</p>
| 0debug
|
Laravel Eloquent Many-to-Many query whereIn : <p>In my application I have updated a relationship from <code>one-to-many</code> to <code>many-to-many</code> and I'm trying to figure out a way to persist associated functionality.</p>
<p>Let's say I have two related tables, e.g. dogs and owners. If I have an array of owners and I'm trying to get a list of dogs id's for those owners, how should I do it eloquently?</p>
<p>Similar question was asked here:
<a href="https://laracasts.com/discuss/channels/laravel/getting-many-to-many-related-data-for-an-array-of-elements" rel="noreferrer">https://laracasts.com/discuss/channels/laravel/getting-many-to-many-related-data-for-an-array-of-elements</a></p>
<p>So, How would I get the <code>Dog</code> models where <code>Owner</code> is in an array ?</p>
<p>Same thing as <code>$associatedDogs = Dog::whereIn('owner_id',$ListOfOwners)->get();</code> is for a <code>One-To-Many</code> relationship, but for <code>Many-to-Many</code>.</p>
| 0debug
|
how to create an empty tuple in Scala : I want to create an empty tuple of size n and populate it according to n. For example;
val n = 3 ; val y = 15; val z = 10 , val e = 11
val x = Tuple3
// populate the tuple with 15
val x = (15,10,11)
Thanks
| 0debug
|
void framebuffer_update_display(
DisplaySurface *ds,
MemoryRegionSection *mem_section,
int cols,
int rows,
int src_width,
int dest_row_pitch,
int dest_col_pitch,
int invalidate,
drawfn fn,
void *opaque,
int *first_row,
int *last_row )
{
hwaddr src_len;
uint8_t *dest;
uint8_t *src;
int first, last = 0;
int dirty;
int i;
ram_addr_t addr;
MemoryRegion *mem;
i = *first_row;
*first_row = -1;
src_len = src_width * rows;
mem = mem_section->mr;
if (!mem) {
return;
}
memory_region_sync_dirty_bitmap(mem);
addr = mem_section->offset_within_region;
src = memory_region_get_ram_ptr(mem) + addr;
dest = surface_data(ds);
if (dest_col_pitch < 0) {
dest -= dest_col_pitch * (cols - 1);
}
if (dest_row_pitch < 0) {
dest -= dest_row_pitch * (rows - 1);
}
first = -1;
addr += i * src_width;
src += i * src_width;
dest += i * dest_row_pitch;
for (; i < rows; i++) {
dirty = memory_region_get_dirty(mem, addr, src_width,
DIRTY_MEMORY_VGA);
if (dirty || invalidate) {
fn(opaque, dest, src, cols, dest_col_pitch);
if (first == -1)
first = i;
last = i;
}
addr += src_width;
src += src_width;
dest += dest_row_pitch;
}
if (first < 0) {
return;
}
memory_region_reset_dirty(mem, mem_section->offset_within_region, src_len,
DIRTY_MEMORY_VGA);
*first_row = first;
*last_row = last;
}
| 1threat
|
Is it possible to develop iOS apps with Flutter on a Linux virtual machine? : <p>I am new to developing mobile apps and wanted to try Flutter but I use Windows. Because Flutter doesn't support Windows yet I had the idea to use a virtual machine running Linux to install Flutter. Does this work?</p>
<p>Also in the Flutter setup it says this:</p>
<blockquote>
<p>To develop Flutter apps for iOS, you need a Mac with Xcode 7.2 or newer.</p>
</blockquote>
<p>Is there a way to develop iOS apps without having a Mac?</p>
| 0debug
|
Regex get whole word email : <p>i'm having troubles to try to form a regex to make a match from a string to get the email only, the string would be like this: 'Hello we have sent an email to ***foo@hotmail.com check it"</p>
<p>I would like a match that only returns ***foor@hotmail.com and i have tried this with a being the string:</p>
<pre><code>a.match(/\b(?=\w*[@*.])\w+\b/g)
//expected ***foor@hotmail.com
</code></pre>
<p>But this only return [foo][hotmail] not even the .com.</p>
<p>Can you help me?</p>
<p>Thank you in advance!</p>
| 0debug
|
def Repeat(x):
_size = len(x)
repeated = []
for i in range(_size):
k = i + 1
for j in range(k, _size):
if x[i] == x[j] and x[i] not in repeated:
repeated.append(x[i])
return repeated
| 0debug
|
Python - How to create a program that will that will store 50 random numbers in a list, and find average? : How would I:
- Write a function that will take a single parameter of an integer, and return a list of that many random numbers between 1 and 100.
Using this function, write a program that will store 50 random numbers in a list, and then calculate and print out the average of all the numbers.
Thanks.
| 0debug
|
void vnc_display_init(const char *id)
{
VncDisplay *vs;
if (vnc_display_find(id) != NULL) {
return;
}
vs = g_malloc0(sizeof(*vs));
vs->id = strdup(id);
QTAILQ_INSERT_TAIL(&vnc_displays, vs, next);
vs->lsock = -1;
#ifdef CONFIG_VNC_WS
vs->lwebsock = -1;
#endif
QTAILQ_INIT(&vs->clients);
vs->expires = TIME_MAX;
if (keyboard_layout) {
trace_vnc_key_map_init(keyboard_layout);
vs->kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);
} else {
vs->kbd_layout = init_keyboard_layout(name2keysym, "en-us");
}
if (!vs->kbd_layout)
exit(1);
qemu_mutex_init(&vs->mutex);
vnc_start_worker_thread();
vs->dcl.ops = &dcl_ops;
register_displaychangelistener(&vs->dcl);
}
| 1threat
|
Why is a function literal returning an int not assignable to a function returning interface{}? : <p>I couldn't reason why this code does <a href="https://play.golang.org/p/yOzukoJhJ4N" rel="nofollow noreferrer">not</a> compile:</p>
<pre><code>package main
import "math/rand"
type ooThinAir func() interface{}
func Int() ooThinAir {
return func() int {
return rand.Intn(100)
}
}
func main() {
}
// fails with: cannot use func literal (type func() int) as type ooThinAir in return argument
</code></pre>
<p>given, according to the GoLang Spec, <a href="https://golang.org/ref/spec#Interface_types" rel="nofollow noreferrer">that</a> all types implement the empty interface <code>interface{}</code>. Why is the function literal <em>not</em> assignable to type <code>ooThinAir</code>? </p>
| 0debug
|
Ocaml turning a string to an array of chars without the blank spaces : so i am doing an assignment on Ocaml and i am kind of stuck in a part where i need to convert a String to an array.
The trick is that i dont want the array to have blank spaces.
Example:
let s = "This is a string test";;
and i want the outcome to be something like
y = [|'t'; 'h'; 'i'; 's'; 'i'; 's'; 'a';'s';'t';'r';'i';'n';'g';'t';'t';'e';'s';'t';|];
for this problem im using the following instruction
let test = Array.init (String.length y) (fun t -> y.[t]);;
but the value of test has the blank spaces (' ') in it.
If anyone could help i would appreciate it.
| 0debug
|
How do remove all Unicode from string, BUT keep lanauges such as: Japanese, Greek, Hindi etc : <p>How would I remove all Unicode from this string【Hello!】★ ああああ
I need to remove all the "weird" symbols (【, ★, 】) and keep "Hello!" and "ああああ". This needs to work for all languages not just Japanese. </p>
| 0debug
|
copy text what you want : i want a php code that can copy text after a selective text from string.
like string = hello my name is Nitesh
than my code can copy 6 character after "hello my name is "
it show only Nitesh
Can you help Me...
| 0debug
|
static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
{
InputStream *ist = s->opaque;
FrameBuffer *buf;
int ret, i;
if(av_image_check_size(s->width, s->height, 0, s))
return -1;
if (!ist->buffer_pool && (ret = alloc_buffer(s, ist, &ist->buffer_pool)) < 0)
return ret;
buf = ist->buffer_pool;
ist->buffer_pool = buf->next;
buf->next = NULL;
if (buf->w != s->width || buf->h != s->height || buf->pix_fmt != s->pix_fmt) {
av_freep(&buf->base[0]);
av_free(buf);
ist->dr1 = 0;
if ((ret = alloc_buffer(s, ist, &buf)) < 0)
return ret;
}
buf->refcount++;
frame->opaque = buf;
frame->type = FF_BUFFER_TYPE_USER;
frame->extended_data = frame->data;
frame->pkt_pts = s->pkt ? s->pkt->pts : AV_NOPTS_VALUE;
for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
frame->base[i] = buf->base[i];
frame->data[i] = buf->data[i];
frame->linesize[i] = buf->linesize[i];
}
return 0;
}
| 1threat
|
RegEx PHP: strange things with lookaheads : <p>Good day! I have the following pattern:</p>
<pre><code>/(?=test)(?=.*la).{8}/
</code></pre>
<p>to match this:</p>
<pre><code>testlaoo
</code></pre>
<p>And it is working correctly. But I can't understand why do I have to use .* here</p>
| 0debug
|
static av_cold int dvdsub_init(AVCodecContext *avctx)
{
DVDSubContext *ctx = avctx->priv_data;
char *data, *cur;
if (!avctx->extradata || !avctx->extradata_size)
return 0;
data = av_malloc(avctx->extradata_size + 1);
if (!data)
return AVERROR(ENOMEM);
memcpy(data, avctx->extradata, avctx->extradata_size);
data[avctx->extradata_size] = '\0';
cur = data;
while (*cur) {
if (strncmp("palette:", cur, 8) == 0) {
int i;
char *p = cur + 8;
ctx->has_palette = 1;
for (i = 0; i < 16; i++) {
ctx->palette[i] = strtoul(p, &p, 16);
while (*p == ',' || av_isspace(*p))
p++;
}
} else if (!strncmp("size:", cur, 5)) {
int w, h;
if (sscanf(cur + 5, "%dx%d", &w, &h) == 2) {
int ret = ff_set_dimensions(avctx, w, h);
if (ret < 0)
return ret;
}
}
cur += strcspn(cur, "\n\r");
cur += strspn(cur, "\n\r");
}
av_free(data);
return 0;
}
| 1threat
|
static always_inline void gen_qemu_ldg (TCGv t0, TCGv t1, int flags)
{
TCGv tmp = tcg_temp_new(TCG_TYPE_I64);
tcg_gen_qemu_ld64(tmp, t1, flags);
tcg_gen_helper_1_1(helper_memory_to_g, t0, tmp);
tcg_temp_free(tmp);
}
| 1threat
|
C# - Programmatically change content of xaml : So I'm wondering if it's possible to change xaml programmatically through c#
Basically what I'm trying to do is hide or replace a specific element, using a if statement within my class file.
The code I'm trying to manipulate is below, to be more specific I want to know how to replace Spin="True" with Spin="False" well atleast to get me in right the direction of programmatically editing xaml
<fa:ImageAwesome Icon="Refresh" Spin="True" Height="48" Width="48" Margin="0,350,0,0" />
So at the current state spin is equal to true so therefore the icon within the grid would spin, but I would like to set spin is equal to false during some form of if statement or simply within 5 seconds of the current form being active.
| 0debug
|
Implementing a mathematical formula in python 3 : I want to implement the followin mathematical formula in python:
optimal[i][s]=max{ optimal[i+1][s], optimal[i+1][s-J[i]] + V[i-1] (s>J[i])}, i try the following:
W={1:3,2:2,3:1,4:4,5:5,6:9,7:6,8:7}
V=[25,20,15,40,50,55,45,58]
optimal=[[]]
J=list(W.values())
s=12
for i in range(1,len(W)):
while J[i]<s:
optimal[i][s]=max(optimal[i+1][s],optimal[i+1][s-J[i]]+V[i-1])
print(optimal)
But i get an ERROR saying: list index out of range.
| 0debug
|
Delphi - Prime Numbers : <p>A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
What I'm doing is this to check if the number is prime or not :</p>
<pre><code>begin
writeln('give a number ');
readln(N); S := 0;
for I := 1 to N do
if N mod I = 0 then
S := S + 1 ;
if S = 2 then
writeln('Prime')
else
writeln('not prime');
sleep(50000);
end.
</code></pre>
<p>I'm now trying to get all the prime numbers between 1 and 100 (or any other number) using this :</p>
<pre><code>begin
writeln('give a number ');
readln(N);
for I := 1 to N do begin
S := 0;
for J := 1 to I do
begin
if I mod J = 0 then
S := S +1 ; if S = 2 then
writeln(I);
end;
end;
sleep(500000000000);
end.
</code></pre>
<p>But it's not reallyworking .</p>
| 0debug
|
vb.net bitmaps and picturebox : Please help. i need the hex. colour of pixel in an image. This works fine:
Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
PictureBox1.Image = Image.FromFile("c:\image.jpg")
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
Dim b As Bitmap = Me.PictureBox1.Image
Dim ver As String = b.GetPixel(e.X, e.Y).ToString
Dim veri As String = Hex(b.GetPixel(e.X, e.Y).ToArgb)
End Sub
Next code doesnt work as I expect:
Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
PictureBox1.Image = My.Resources.MyImage
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
Dim b As Bitmap = Me.PictureBox1.Image 'b is not streched..?
Dim ver As String = b.GetPixel(e.X, e.Y).ToString
Dim veri As String = Hex(b.GetPixel(e.X, e.Y).ToArgb)
End Sub
why? how to fix it?
| 0debug
|
Aligning bootstrap grids : My grid setup now is as follows
<div class='col-md-12 col-sm-12 col-xs-12'>
<div class='col-md-9 col-sm-9 col-xs-12'>
DIV 1
</div>
<div class='col-md-3 col-sm-3 col-xs-12'>
DIV 2
</div>
<div class='col-md-9 col-sm-9 col-xs-12'>
DIV 3
</div>
</div>
My current output is
[![enter image description here][1]][1]
I want to get rid of the white space between div 1 and div 3. I don't want to merge div 1 and div3 because in mobile mode div 2 goes below div 3.
My expected outcome is
[![enter image description here][2]][2]
[1]: https://i.stack.imgur.com/4Zzq1.png
[2]: https://i.stack.imgur.com/NNyoI.png
How can I achieve this in bootstrap?
| 0debug
|
How to remove CSS class inside the DIV tag in javascript? : <p>Please help how to remove css inside of div tag?</p>
<p>I tried with below code for removing css for the input type inside the div tag. but its now working. </p>
<pre><code><style>
.removeInputBorder {
border: none
}
</style>
</head>
<body>
<button onclick="myFunction()">Try it</button>
<div id="myDIV" >
This is a DIV element.
<input type="text" value="shakeer" class="removeInputBorder"/>
</div>
<script>
function myFunction() {
var element = document.getElementById("myDIV");
element.classList.remove("removeInputBorder");
}
</script>
</code></pre>
| 0debug
|
Display a visual at a certain position in the browser with javascript/jquery : is it possible for me to display some sort of visual at a certain position in the browser(firefox)? Let's say I have these offsets {left: 336, top: 378} which I am calculating dynamically, and I want to display a small line of some sort (either an `<hr>` or an image, depending on what is possible). Is this even possible? Any help is greatly appreciated. Ideally I don't want to intefere with the markup at all, I'd rather have some sort of overlay.
| 0debug
|
static inline void gen_evmergelohi(DisasContext *ctx)
{
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 32);
tcg_gen_shli_tl(t1, cpu_gpr[rA(ctx->opcode)], 32);
tcg_gen_or_tl(cpu_gpr[rD(ctx->opcode)], t0, t1);
tcg_temp_free(t0);
tcg_temp_free(t1);
#else
if (rD(ctx->opcode) == rA(ctx->opcode)) {
TCGv_i32 tmp = tcg_temp_new_i32();
tcg_gen_mov_i32(tmp, cpu_gpr[rA(ctx->opcode)]);
tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], tmp);
tcg_temp_free_i32(tmp);
} else {
tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
}
#endif
}
| 1threat
|
static inline bool migration_bitmap_test_and_reset_dirty(MemoryRegion *mr,
ram_addr_t offset)
{
bool ret;
int nr = (mr->ram_addr + offset) >> TARGET_PAGE_BITS;
ret = test_and_clear_bit(nr, migration_bitmap);
if (ret) {
migration_dirty_pages--;
}
return ret;
}
| 1threat
|
intptr_t (*checkasm_check_func(intptr_t (*func)(), const char *name, ...))()
{
char name_buf[256];
intptr_t (*ref)() = func;
CheckasmFuncVersion *v;
int name_length;
va_list arg;
va_start(arg, name);
name_length = vsnprintf(name_buf, sizeof(name_buf), name, arg);
va_end(arg);
if (!func || name_length <= 0 || name_length >= sizeof(name_buf))
return NULL;
state.current_func = get_func(name_buf, name_length);
v = &state.current_func->versions;
if (v->func) {
CheckasmFuncVersion *prev;
do {
if (v->func == func)
return NULL;
if (v->ok)
ref = v->func;
prev = v;
} while ((v = v->next));
v = prev->next = checkasm_malloc(sizeof(CheckasmFuncVersion));
}
v->func = func;
v->ok = 1;
v->cpu = state.cpu_flag;
state.current_func_ver = v;
if (state.cpu_flag)
state.num_checked++;
return ref;
}
| 1threat
|
How to get total time spend in Gitlab? : <p><strong>Is there a way to get the total time spend on all issues that a user have spend with the time tracking <code>/spend</code> <em>slash command</em>?</strong></p>
<p>Time tracking stats with the API gets just a small amount of data: <a href="https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats" rel="noreferrer">https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats</a></p>
<p><strong>Gitlab CE</strong> 9.1.4</p>
| 0debug
|
How do I make a CountDownTimer show at the same moment my Button gets enabled? : "How do I make a CountDownTimer show at the same moment my Button gets enabled ?"
Additional info regarding the button: the Buttons Job is it to click 5 times through a stringarray displayed in a Textview to then get disabled for 5 seconds to do the same task again.
so ..I would like a CountDownTimer to visually show those 5 seconds count down for the User to see.
sadly I dont have an idea how to connect my Button with the CountDownTimer to let it know its supposed to countdown at that particular time the Button is enabled.
Also I would like for the CountDownTimer to show everytime the Button gets enabled.
I looked into https://developer.android.com/reference/android/os/CountDownTimer
but it doesnt seem to have a solution for that particular case.
thats my Code for the Button as of now :
next_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentnumber == list.length) {
currentnumber = 0;
}
if (Curclicks == mod - 1) {
next_button.setEnabled(false);
display.setText(list[currentnumber]);
currentnumber++;
handler.postDelayed(new Runnable() {
@Override
public void run() {
//the button will unlock after the delay specified
next_button.setEnabled(true);
Curclicks = 0;
}
}, delay);
} else {
display.setText(list[currentnumber]);
currentnumber++;
}
Curclicks++;
}
});
I hope I was clear enough and u have a solution for me, thank you in advance.
| 0debug
|
How to convert Number into Words in yii2 : <p>I need to convert amount into words for example total = 5600 into five thousand six hundred only in yii2</p>
| 0debug
|
How do I parse a yaml string with python? : <p>I see an API and many examples on how to parse a yaml file but what about a string?</p>
| 0debug
|
void i2c_register_slave(I2CSlaveInfo *info)
{
assert(info->qdev.size >= sizeof(i2c_slave));
info->qdev.init = i2c_slave_qdev_init;
info->qdev.bus_type = BUS_TYPE_I2C;
qdev_register(&info->qdev);
}
| 1threat
|
target_ulong helper_emt(target_ulong arg1)
{
arg1 = 0;
return arg1;
}
| 1threat
|
static int qemu_event_init(void)
{
int err;
int fds[2];
err = qemu_eventfd(fds);
if (err == -1) {
return -errno;
}
err = fcntl_setfl(fds[0], O_NONBLOCK);
if (err < 0) {
goto fail;
}
err = fcntl_setfl(fds[1], O_NONBLOCK);
if (err < 0) {
goto fail;
}
qemu_set_fd_handler2(fds[0], NULL, qemu_event_read, NULL,
(void *)(intptr_t)fds[0]);
io_thread_fd = fds[1];
return 0;
fail:
close(fds[0]);
close(fds[1]);
return err;
}
| 1threat
|
C++ Erase not working as expected : <p>Consider this following program:</p>
<pre><code>#include <iostream>
#include <string>
#include <algorithm> // std::remove
int main ()
{
std::string str ("This is an example sentence blah");
std::remove(str.begin(), str.end(), '\t');
std::cout << str ;
return 0;
}
</code></pre>
<p>There is a tab between the words (is,an) and (an,example), others are spaces. </p>
<p>I expected the output to be :</p>
<blockquote>
<p>This isanexample sentence blah</p>
</blockquote>
<p>Instead, i am getting the following output:</p>
<blockquote>
<p>This isanexample sentence blahah</p>
</blockquote>
<p>Is there a buffer overrun somewhere for the extra '<strong>ah</strong>'?</p>
<p>More:
I noticed after several runs that, the number of trailing letters at the end is proportional to number of tabs being removed. In this case there are 2 tabs in the string, hence 2 extra trailing characters. I can take care of it by using erase, but why does it happen? I am not sure if it's a design flaw or am i missing something?</p>
| 0debug
|
static ExitStatus trans_fop_ded(DisasContext *ctx, uint32_t insn,
const DisasInsn *di)
{
unsigned rt = extract32(insn, 0, 5);
unsigned ra = extract32(insn, 21, 5);
return do_fop_ded(ctx, rt, ra, di->f_ded);
}
| 1threat
|
static void vnc_client_read(void *opaque)
{
VncState *vs = opaque;
long ret;
buffer_reserve(&vs->input, 4096);
#ifdef CONFIG_VNC_TLS
if (vs->tls_session) {
ret = gnutls_read(vs->tls_session, buffer_end(&vs->input), 4096);
if (ret < 0) {
if (ret == GNUTLS_E_AGAIN)
errno = EAGAIN;
else
errno = EIO;
ret = -1;
}
} else
#endif
ret = recv(vs->csock, buffer_end(&vs->input), 4096, 0);
ret = vnc_client_io_error(vs, ret, socket_error());
if (!ret)
return;
vs->input.offset += ret;
while (vs->read_handler && vs->input.offset >= vs->read_handler_expect) {
size_t len = vs->read_handler_expect;
int ret;
ret = vs->read_handler(vs, vs->input.buffer, len);
if (vs->csock == -1)
return;
if (!ret) {
memmove(vs->input.buffer, vs->input.buffer + len, (vs->input.offset - len));
vs->input.offset -= len;
} else {
vs->read_handler_expect = ret;
}
}
}
| 1threat
|
part of my html not displaying in Chrome : The top third of my page including a graphic and headline shows up just fine in firefox and explorer but does not appear in Chrome when accessed from my server. It does appear in Chrome when viewing the page as a file. The link to my page is: [http://donfiler.net/index2.html][1]
The graphic is defined in the CSS file as:
/** adbox **/
#adbox {
background: #020a13 url(../images/bg-adbox.jpg) no-repeat center top;
font-family: Georgia, "Times New Roman", Times, serif;
min-height: 433px;
margin: -56px 0 22px;
And the HTML file is:
<!DOCTYPE html>
<!-- Website template by freewebsitetemplates.com -->
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>donfiler.net - web design </title>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="header">
<div class="wrapper clearfix">
<div id="logo">
<a href="index.html"><img src="images/logo.png" alt="LOGO"></a>
</div>
<ul id="navigation">
<li class="selected">
<a href="index.html">Home</a>
</li>
<li>
<a href="about.html">About</a>
</li>
<li>
<a href="blog.html">Blog</a>
</li>
<li>
<a href="gallery.html">Gallery</a>
</li>
<li>
<a href="contact.html">Contact Us</a>
</li>
</ul>
</div>
</div>
<div id="contents">
<div id="adbox">
<div class="wrapper clearfix"><p></p><p></p>
<div class="info">
<h1>Web Design & Social Media Marketing</h1>
<p>
Proven Consultant, Author | Helping Companies Translate Their Business Goals to Reality.
</p>
</div>
</div>
<div class="highlight">
<h2>707-217-8457 if you want a mobile friendly web site.</h2>
</div>
</div>
<div class="body clearfix">
<div class="click-here">
<h1>Impact Marketing</h1>
<a href="https://donfiler.us/bootblog.html" class="btn1">Click Here!</a>
</div>
<p style="font-size:12px;">
Proven Consultant, Author | Helping Companies Translate Their Business Goals to Reality. We design web sites with dynamic database interaction; deliver computer based training; create comprehensive marketing campaigns; specialize in hand coding HTML, CSS, PHP, Mysql and JavaScript to customize web design and user interface.
</p>
</div>
</div>
<div id="footer">
<ul id="featured" class="wrapper clearfix">
<li>
<img src="images/THUMBNAIL_IMAGE4.jpg" alt="Img" height="204" width="180">
<h3><a href="https://www.createspace.com/6457547?ref=1147694&utm_id=6026">Order Now</a></h3>
<p>
Memories of growing up in Europe during the Cold War. The first book in a series about Don's life.
</p>
</li>
<li>
<img src="images/THUMBNAIL_IMAGE3.jpg" alt="Img" height="204" width="180">
<h3><a href="https://www.createspace.com/6419890">Order Now</a></h3>
<p>
A catchy tune by the Beach Boys in the mid-sixties, the lyrics of "Be True to Your School" hit many highlights of high school in that era.
</p>
</li>
<li>
<img src="images/THUMBNAIL_IMAGE2.jpg" alt="Img" height="204" width="180">
<h3><a href="https://www.createspace.com/6464083">Order Now</a></h3>
<p>
College Years and Rock Band Entrepreneur. The third book in a series about Don's life.
</p>
</li>
<li>
<img src="images/THUMBNAIL_IMAGE1.jpg" alt="Img" height="204" width="180">
<h3><a href="https://www.createspace.com/6634095?ref=1147694&utm_id=6026">Order Now</a></h3>
<p>
Contributing to others is the highest form of success you can achieve and I wanted to impart what I have learned over the years working for a living.
</p>
</li>
</ul>
<div class="body">
<div class="wrapper clearfix">
<div id="links">
<div>
<h4>Social</h4>
<ul>
<li>
<a href="https://plus.google.com/+DonFilerRohnertPark" target="_blank">Google +</a>
</li>
<li>
<a href="https://www.facebook.com/don.filer" target="_blank">Facebook</a>
</li>
<li>
<a href="https://www.youtube.com/user/donfiler1" target="_blank">Youtube</a>
</li>
</ul>
</div>
<div>
<h4>Blogs</h4>
<ul>
<li>
<a href="https://donfiler.blogspot.com/">Blogspot</a>
</li>
<li>
<a href="https://impactmarketingconsultant.wordpress.com/">Marketing Blog</a>
</li>
<li>
<a href="https://mobilefriendlywebdesign.wordpress.com/">Web Design Blog</a>
</li>
</ul>
</div>
</div>
<div id="newsletter">
<h4>Newsletter</h4>
<p>
Sign up for Our Newsletter
</p>
<form action="https://donfiler.us/newsletter" method="post">
<!--<input type="text" value="">-->
<input type="submit" value="Sign Up!">
</form>
</div>
<p class="footnote">
© Copyright © 2016 Don Filer all rights reserved.
</p>
</div>
</div>
</div>
</body>
</html>
[1]: http://donfiler.net/index2.html
| 0debug
|
static int vmd_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
VmdDemuxContext *vmd = (VmdDemuxContext *)s->priv_data;
ByteIOContext *pb = &s->pb;
int ret = 0;
vmd_frame_t *frame;
if (vmd->current_frame >= vmd->frame_count)
return -EIO;
frame = &vmd->frame_table[vmd->current_frame];
url_fseek(pb, frame->frame_offset, SEEK_SET);
if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
return AVERROR_NOMEM;
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD,
frame->frame_size);
if (ret != frame->frame_size)
ret = -EIO;
pkt->stream_index = frame->stream_index;
pkt->pts = frame->pts;
vmd->current_frame++;
return ret;
}
| 1threat
|
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
void *command_data, void *opaque)
{
struct IscsiTask *iTask = opaque;
struct scsi_task *task = command_data;
iTask->status = status;
iTask->do_retry = 0;
iTask->task = task;
if (status != SCSI_STATUS_GOOD) {
if (iTask->retries++ < ISCSI_CMD_RETRIES) {
if (status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_UNIT_ATTENTION) {
error_report("iSCSI CheckCondition: %s",
iscsi_get_error(iscsi));
iTask->do_retry = 1;
goto out;
}
if (status == SCSI_STATUS_BUSY || status == 0x28) {
unsigned retry_time =
exp_random(iscsi_retry_times[iTask->retries - 1]);
error_report("iSCSI Busy/TaskSetFull (retry #%u in %u ms): %s",
iTask->retries, retry_time,
iscsi_get_error(iscsi));
aio_timer_init(iTask->iscsilun->aio_context,
&iTask->retry_timer, QEMU_CLOCK_REALTIME,
SCALE_MS, iscsi_retry_timer_expired, iTask);
timer_mod(&iTask->retry_timer,
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + retry_time);
iTask->do_retry = 1;
return;
}
}
error_report("iSCSI Failure: %s", iscsi_get_error(iscsi));
} else {
iTask->iscsilun->force_next_flush |= iTask->force_next_flush;
}
out:
if (iTask->co) {
iTask->bh = aio_bh_new(iTask->iscsilun->aio_context,
iscsi_co_generic_bh_cb, iTask);
qemu_bh_schedule(iTask->bh);
} else {
iTask->complete = 1;
}
}
| 1threat
|
static int vorbis_parse_setup_hdr_residues(vorbis_context *vc){
GetBitContext *gb=&vc->gb;
uint_fast8_t i, j, k;
vc->residue_count=get_bits(gb, 6)+1;
vc->residues=av_mallocz(vc->residue_count * sizeof(vorbis_residue));
AV_DEBUG(" There are %d residues. \n", vc->residue_count);
for(i=0;i<vc->residue_count;++i) {
vorbis_residue *res_setup=&vc->residues[i];
uint_fast8_t cascade[64];
uint_fast8_t high_bits;
uint_fast8_t low_bits;
res_setup->type=get_bits(gb, 16);
AV_DEBUG(" %d. residue type %d \n", i, res_setup->type);
res_setup->begin=get_bits(gb, 24);
res_setup->end=get_bits(gb, 24);
res_setup->partition_size=get_bits(gb, 24)+1;
res_setup->classifications=get_bits(gb, 6)+1;
res_setup->classbook=get_bits(gb, 8);
if (res_setup->classbook>=vc->codebook_count) {
av_log(vc->avccontext, AV_LOG_ERROR, "classbook value %d out of range. \n", res_setup->classbook);
AV_DEBUG(" begin %d end %d part.size %d classif.s %d classbook %d \n", res_setup->begin, res_setup->end, res_setup->partition_size,
res_setup->classifications, res_setup->classbook);
for(j=0;j<res_setup->classifications;++j) {
high_bits=0;
low_bits=get_bits(gb, 3);
if (get_bits1(gb)) {
high_bits=get_bits(gb, 5);
cascade[j]=(high_bits<<3)+low_bits;
AV_DEBUG(" %d class casscade depth: %d \n", j, ilog(cascade[j]));
res_setup->maxpass=0;
for(j=0;j<res_setup->classifications;++j) {
for(k=0;k<8;++k) {
if (cascade[j]&(1<<k)) {
int bits=get_bits(gb, 8);
if (bits>=vc->codebook_count) {
av_log(vc->avccontext, AV_LOG_ERROR, "book value %d out of range. \n", bits);
res_setup->books[j][k]=bits;
AV_DEBUG(" %d class casscade depth %d book: %d \n", j, k, res_setup->books[j][k]);
if (k>res_setup->maxpass) {
res_setup->maxpass=k;
} else {
res_setup->books[j][k]=-1;
return 0;
| 1threat
|
Read strings from a file : <pre><code> FILE *fp;
char name[50];
fp=fopen("stu.txt","r");
while(fgets(name,50,fp)!=NULL)
{
printf(" %s",name);
fgets(name,50,fp);
}
fclose(fp);
</code></pre>
<p>In my file there are 4 names in 4 different lines but the output only displays the 1st and the 3rd name.What's wrong?I know it's very basic but this has taken up a lot of my time.</p>
| 0debug
|
Python - What is queue.task_done() used for? : <p>I wrote a script that has multiple threads (created with <code>threading.Thread</code>) fetching URLs from a <code>Queue</code> using <code>queue.get_nowait()</code>, and then processing the HTML. I am new to multi-threaded programming, and am having trouble understanding the purpose of the <code>queue.task_done()</code> function. </p>
<p>When the <code>Queue</code> is empty, it automatically returns the <code>queue.Empty</code> exception. So I don't understand the need for each thread to call the <code>task_done()</code> function. We know that we're done with the queue when its empty, so why do we need to notify it that the worker threads have finished their work (which has nothing to do with the queue, after they've gotten the URL from it)? </p>
<p>Could someone provide me with a code example (ideally using <code>urllib</code>, file I/O, or something other than fibonacci numbers and printing "Hello") that shows me how this function would be used in practical applications? </p>
| 0debug
|
How to assign a name to running container in docker? : <p>I have created container from particular image using command:</p>
<pre><code>$ docker run -d -P selenium/hub
</code></pre>
<p>running container status is below:</p>
<pre><code>$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
345df9ed5b47 selenium/hub "/opt/bin/entry_point" 5 seconds ago Up 4 seconds 0.0.0.0:32768->4444/tcp clever_williams
</code></pre>
<p>Here default name is "clever_williams" and I forgot to assign new name to it
I need to change default name to running container so how can I do that?</p>
| 0debug
|
Creating objects in bulk and prining the names of the objects : <p>I wanted to make a 100 objects from the same class and print the names of the objects each time they were created. Something like this:</p>
<pre><code>class Human():
def __init__(self):
#print the name of the object
human1 = Human()
human2 = Human()
human3 = Human()
human4 = Human()
human5 = Human()
.......
</code></pre>
<p>I was able to come this far:</p>
<pre><code>class Human():
def __init__(self):
#print the name of the object
for i in range(1,101):
#'human' + str(i) = Human()
</code></pre>
<p>But I got stuck since in python you cannot define objects as the way I tried to and I couldn't find a way to print the name of the object. Anything that could help?</p>
| 0debug
|
static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
const int data_size, AVCodecContext *avctx)
{
int hdr_size, width, height, flags;
int version;
const uint8_t *ptr;
hdr_size = AV_RB16(buf);
av_dlog(avctx, "header size %d\n", hdr_size);
if (hdr_size > data_size) {
av_log(avctx, AV_LOG_ERROR, "error, wrong header size\n");
version = AV_RB16(buf + 2);
av_dlog(avctx, "%.4s version %d\n", buf+4, version);
if (version > 1) {
av_log(avctx, AV_LOG_ERROR, "unsupported version: %d\n", version);
width = AV_RB16(buf + 8);
height = AV_RB16(buf + 10);
if (width != avctx->width || height != avctx->height) {
av_log(avctx, AV_LOG_ERROR, "picture resolution change: %dx%d -> %dx%d\n",
avctx->width, avctx->height, width, height);
ctx->frame_type = (buf[12] >> 2) & 3;
av_dlog(avctx, "frame type %d\n", ctx->frame_type);
if (ctx->frame_type == 0) {
ctx->scan = ctx->progressive_scan;
} else {
ctx->scan = ctx->interlaced_scan;
ctx->frame.interlaced_frame = 1;
ctx->frame.top_field_first = ctx->frame_type == 1;
avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10;
ptr = buf + 20;
flags = buf[19];
av_dlog(avctx, "flags %x\n", flags);
if (flags & 2) {
permute(ctx->qmat_luma, ctx->prodsp.idct_permutation, ptr);
ptr += 64;
} else {
memset(ctx->qmat_luma, 4, 64);
if (flags & 1) {
permute(ctx->qmat_chroma, ctx->prodsp.idct_permutation, ptr);
} else {
memset(ctx->qmat_chroma, 4, 64);
return hdr_size;
| 1threat
|
Plotting data R : <p>I have a simple tasks I would like to do. Using an RODBC connection I have connected R to a SQL server database. There are four tables in the database and they are tenors of Libor rates</p>
<pre><code>Libor_1_mos
Libor_3_mos
Libor_6_mos
Libor_12_mos
</code></pre>
<p>Each table has two columns. The first column shows dates and the second column shows rates. </p>
<p>I would like a simple chart that plots the rates based on the dates in column 1. Straightforward - that is all that needs to be done. The x-axis should be dates (column 1) and the y axis should be rates (column 2). Note it is 5 years worth of data so showing every possible date on the x-axis may not be feasible. </p>
<p>Here is my work so far I am using the Libor_3_mos as an example</p>
<pre><code>threemosdata <- sqlQuery(con,"select * from Libor_3_mos)
</code></pre>
<p>Using that line I can read the data from the table. So for instance </p>
<pre><code>colnames(threemosdata)
</code></pre>
<p>will give me the names of the column in the table.</p>
| 0debug
|
Is void() a valid C++ expression? : <p>Apparently, this ternary expression with <code>void()</code> as one argument compiles:</p>
<pre class="lang-cpp prettyprint-override"><code>void foo() {}
//...
a == b ? foo() : void();
</code></pre>
<p>Is <code>void()</code> a valid expression by the standard, or is it just a compiler thing? If it's valid, then what kind of expression is it?</p>
| 0debug
|
static int analyze(const uint8_t *buf, int size, int packet_size,
int probe)
{
int stat[TS_MAX_PACKET_SIZE];
int stat_all = 0;
int i;
int best_score = 0;
memset(stat, 0, packet_size * sizeof(*stat));
for (i = 0; i < size - 3; i++) {
if (buf[i] == 0x47 &&
(!probe || (buf[i + 3] & 0x30))) {
int x = i % packet_size;
stat[x]++;
stat_all++;
if (stat[x] > best_score) {
best_score = stat[x];
}
}
}
return best_score - FFMAX(stat_all - 10*best_score, 0)/10;
}
| 1threat
|
TypeScript version mismatch in Visual Studio 2019 : <p>I am thoroughly confused by Typescript versioning as it relates to Visual Studio 2019. I have a .NET Core 2.2.x project which utilizes Typescript. When I edit any .ts file, I get the following warning (in the error list):</p>
<blockquote>
<p>Your project is built using TypeScript 3.4, but the TypeScript language service version currently in use by Visual Studio is 3.4.3. Your project may be using TypeScript language features that will result in errors when compiling with this version of the TypeScript compiler. To remove this warning, install the TypeScript 3.4.3 SDK or update the TypeScript version in your project's properties.</p>
</blockquote>
<p>It claims that my project is built using TypeScript 3.4, but package.json specifically lists <code>"typescript": "3.4.3"</code>. </p>
<p><a href="https://i.stack.imgur.com/7WQoj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7WQoj.png" alt="enter image description here"></a></p>
<p>Then it asks to install TypeScript SDK 3.4.3, which I have from <a href="https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.typescript-343-vs2017" rel="noreferrer">here</a>. I also <code>npm install -g typescript</code> previously, so running <code>tsc -v</code> yields <code>Version 3.4.3</code>.</p>
<p>What am I missing?</p>
| 0debug
|
password_verify is not Matching the password on the db password : <p>Please tell me whats wrong i'm doing</p>
<p><a href="https://i.stack.imgur.com/dIhCd.png" rel="nofollow noreferrer">Its showing errorflase error </a></p>
| 0debug
|
Kubernetes cluster for docker image : i have docker image , i need to create a Kubernetes cluster from one node.
don't have knowledge in Kubernetes, this is the first time to create it.
how can i do it with the simplest way?
Thanks
| 0debug
|
batch replace command, i'm confused : <p>okay, so I tried this</p>
<pre><code>set x=12 &
set var=(x)
set var=%var:(=^%%
set var=%var:)=^%%
echo %var%
</code></pre>
<p>and I get x%%</p>
<p>then I did this</p>
<pre><code>setlocal enabledelayedexpansion
set var=!var:(=%!
set var=!var:)=%!
echo %var%
</code></pre>
<p>and I get !var:)=%!</p>
<p>both methods failed, so I need help.</p>
| 0debug
|
static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
int entries, i;
int64_t duration=0;
int64_t total_sample_count=0;
print_atom("stts", atom);
get_byte(pb);
get_byte(pb); get_byte(pb); get_byte(pb);
entries = get_be32(pb);
c->streams[c->fc->nb_streams-1]->stts_count = entries;
c->streams[c->fc->nb_streams-1]->stts_data = (uint64_t*) av_malloc(entries * sizeof(uint64_t));
#ifdef DEBUG
av_log(NULL, AV_LOG_DEBUG, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
#endif
for(i=0; i<entries; i++) {
int32_t sample_duration;
int32_t sample_count;
sample_count=get_be32(pb);
sample_duration = get_be32(pb);
c->streams[c->fc->nb_streams - 1]->stts_data[i] = (uint64_t)sample_count<<32 | (uint64_t)sample_duration;
#ifdef DEBUG
av_log(NULL, AV_LOG_DEBUG, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
#endif
duration+=sample_duration*sample_count;
total_sample_count+=sample_count;
#if 0
if (!i && st->codec.codec_type==CODEC_TYPE_VIDEO) {
st->codec.frame_rate_base = sample_duration ? sample_duration : 1;
st->codec.frame_rate = c->streams[c->fc->nb_streams-1]->time_scale;
#ifdef DEBUG
av_log(NULL, AV_LOG_DEBUG, "VIDEO FRAME RATE= %i (sd= %i)\n", st->codec.frame_rate, sample_duration);
#endif
}
#endif
}
if(duration>0)
{
av_reduce(
&st->codec.frame_rate,
&st->codec.frame_rate_base,
c->streams[c->fc->nb_streams-1]->time_scale * total_sample_count,
duration,
INT_MAX
);
#ifdef DEBUG
av_log(NULL, AV_LOG_DEBUG, "FRAME RATE average (video or audio)= %f (tot sample count= %i ,tot dur= %i timescale=%d)\n", (float)st->codec.frame_rate/st->codec.frame_rate_base,total_sample_count,duration,c->streams[c->fc->nb_streams-1]->time_scale);
#endif
}
else
{
st->codec.frame_rate_base = 1;
st->codec.frame_rate = c->streams[c->fc->nb_streams-1]->time_scale;
}
return 0;
}
| 1threat
|
Is there a reason that .str.split() will not work with '$_'? : <p>I am trying to split a string using .str.split('$_') but this is not working. </p>
<p>Other combinations like 'W_' or '$' work fine but not '$<em>'. I also tried .str.replace('$</em>') - which also does not work.</p>
<p>Initial string is '$<em>WA</em>:G_COUNTRY'</p>
<p>using
ClearanceUnq['Clearance'].str.split('$_')
results in [$<em>WA</em>:G_COUNTRY]
no split.... </p>
<p>whereas
ClearanceUnq['Clearance'].str.split('$')
results in [, <em>WA</em>:G_COUNTRY]
as expected</p>
| 0debug
|
void bdrv_io_plug(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
if (drv && drv->bdrv_io_plug) {
drv->bdrv_io_plug(bs);
} else if (bs->file) {
bdrv_io_plug(bs->file);
}
}
| 1threat
|
DOMException: Error processing ICE candidate : <p>I get this error <code>DOMException: Error processing ICE candidate</code> when I try to add an ice candidate. Here's the candidate:</p>
<blockquote>
<p>candidate:1278028030 1 udp 2122260223 10.0.18.123 62694 typ host
generation 0 ufrag eGOGlVCnFLZYKTsc network-id 1</p>
</blockquote>
<p>Moreover, it doesn't always happen - other time everything goes smoothly. I can't reproduce a consistent pattern where it would throw this error. Any ideas how to go about solving this / debugging it would be appreciated!</p>
| 0debug
|
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint)
{
CPUWatchpoint *wp;
if (len == 0 || (addr + len - 1) <= addr) {
error_report("tried to set invalid watchpoint at %"
VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);
return -EINVAL;
}
wp = g_malloc(sizeof(*wp));
wp->vaddr = addr;
wp->len = len;
wp->flags = flags;
if (flags & BP_GDB) {
QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry);
} else {
QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry);
}
tlb_flush_page(cpu, addr);
if (watchpoint)
*watchpoint = wp;
return 0;
}
| 1threat
|
delete user in SQL SERVER database : Hi I am executing this code to create user in my database.
CREATE LOGIN john WITH PASSWORD = 'john123';
GO
USE mytestdb;
GO
CREATE USER [john] FOR LOGIN [john]
GO
ALTER USER [john] WITH DEFAULT_SCHEMA=[dbo]
GO
ALTER ROLE [db_datareader] ADD MEMBER [john]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [john]
GO
GRANT EXECUTE ON SCHEMA::[dbo] TO [john]
GO
but I want to delete this my created user. how can I delete this.
Thank you in advance.
| 0debug
|
Sorting ArrayList based on number of duplicates? : <p>working here to sort an ArrayList in order with the highest number of duplicates at index 0. Can anyone help me out with what kind of loop to use or a method?</p>
| 0debug
|
static void usb_host_handle_reset(USBDevice *udev)
{
USBHostDevice *s = USB_HOST_DEVICE(udev);
trace_usb_host_reset(s->bus_num, s->addr);
if (udev->configuration == 0) {
return;
}
usb_host_release_interfaces(s);
libusb_reset_device(s->dh);
usb_host_claim_interfaces(s, 0);
usb_host_ep_update(s);
}
| 1threat
|
get item position List<Posts> : I have this to get recyclerview position click:
int position = getAdapterPosition();
and this function to return list in a position:
List<Posts> Posts;
public Posts getItem(int position) {
return Posts.get(position);
}
in this Posts lists I have:
public String getPid() {
return idp;
}
what I'd like to know is how I get this idp value from the position I want.
thank you friends
| 0debug
|
int show_bsfs(void *optctx, const char *opt, const char *arg)
{
AVBitStreamFilter *bsf = NULL;
printf("Bitstream filters:\n");
while ((bsf = av_bitstream_filter_next(bsf)))
printf("%s\n", bsf->name);
printf("\n");
return 0;
}
| 1threat
|
What is the difference between arr and *arr? : <p>What is the difference between these 2 prints, I got the same address in both of them : </p>
<pre><code>int main(void)
{
int arr[2][3] = {{1,2,3},{4,5,6}};
printf("%p\n", arr);
printf("%p\n", *(arr));
}
</code></pre>
| 0debug
|
Any advantage of using the s suffix in C++ : <p>My question is related to the use of the "s" suffix in C++?</p>
<p>Example of code using the "s" suffix:</p>
<pre><code>auto hello = "Hello!"s; // a std::string
</code></pre>
<p>The same could be written as:</p>
<pre><code>auto hello = std::string{"Hello!"};
</code></pre>
<p>I was able to find online that the "s" suffix should be used to minimizes mistakes and to clarify our intentions in the code.</p>
<p>Therefore, is the use of the "s" suffix only meant for the reader of the code? Or are there others advantages to its use?</p>
| 0debug
|
Unable to require directive in AngularJS 1.5 component : <p>I've created a directive which works perfectly fine. Now after bumping <code>angular</code> to <code>1.5.0</code>, I figured this directive is a typical example of what could be written using the new <code>.component()</code> notation.</p>
<p>For some reason, the <code>require</code> property no longer seems to work.</p>
<p>The following is a simplified example:</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>angular.module('myApp', [])
.component('mirror', {
template: '<p>{{$ctrl.modelValue}}</p>',
require: ['ngModel'],
controller: function() {
var vm = this;
var ngModel = vm.ngModel;
ngModel.$viewChangeListeners.push(onChange);
ngModel.$render = onChange;
function onChange() {
vm.modelValue = ngModel.$modelValue;
}
}
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
<div ng-app="myApp">
<input ng-model="someModel"/>
<mirror ng-model="someModel"></mirror>
</div></code></pre>
</div>
</div>
</p>
<p>I also tried using <code>require</code> as a simple string:</p>
<pre><code>...
require: 'ngModel'
...
</code></pre>
<p>and as an object:</p>
<pre><code>...
require: {
ngModel: 'ngModel'
}
...
</code></pre>
<p>I've looked at the docs for <a href="https://code.angularjs.org/1.5.0/docs/api/ng/service/$compile">$compile</a> and <a href="https://code.angularjs.org/1.5.0/docs/guide/component">component</a>, but I can't seem to get it to work.</p>
<p>How can I require other directive controllers in an AngularJS 1.5 component?</p>
| 0debug
|
I want Use Lag Function By Using Running Total in Another Column, But It is Not Work in SQL Server 2012??? : [enter image description here][1]
[enter image description here][2]
[1]: https://i.stack.imgur.com/64ke7.png
[2]: https://i.stack.imgur.com/nWQJV.png
I want Use Lag Function By Using Running Total in Another Column, But It is Not Work in SQL Server 2012???
| 0debug
|
getting a 200 statue useing refresh token : public async Task NewMethodAsync()
{
try
{
HttpClient objClient = new HttpClient();
Uri requestUri = new Uri("https://approvalbotbeta.azurewebsites.net/api/token");
Dictionary<string, string> pairs = new Dictionary<string, string>();
var client_ID = "ca647d7796c548209cdda9ed004c38aa5248171708028004628";
var client_secret = "QXBwcm92YWxCb3RfVE9H7auiwc6RhE6ldS6WGsqWh2NhNjQ3ZDc3OTZjNTQ4MjA5Y2RkYTllZDAwNGMzOGFhNTI0ODE3MTcwODAyODAwNDYyOA==";
pairs.Add("grant_type", "client_credentials");
pairs.Add("reply_url", "http://localhost");
FormUrlEncodedContent httpContent = new FormUrlEncodedContent(pairs);
var encordedString = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(client_ID + ":" + client_secret));
objClient.DefaultRequestHeaders.Add("Authorization", "Basic " + encordedString);
HttpResponseMessage respon = await objClient.PostAsync("https://approvalbotbeta.azurewebsites.net/api/token", httpContent);
if (respon.IsSuccessStatusCode)
{
Console.WriteLine(respon.Content.ReadAsStringAsync().Result);
var ww = respon.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<Response>(ww);
Console.WriteLine(response.access_token);
var acc_tkn = response.access_token;
// Uri requesturi = new Uri("https://approvalbotbeta.azurewebsites.net/api/send");
// Dictionary<string, string> pairs2 = new Dictionary<string, string>();
// pairs2.Add("Content-Type", "application/json");
// FormUrlEncodedContent httpContent2 = new FormUrlEncodedContent(pairs2);
// objClient.DefaultRequestHeaders.Add("Authorization", "Bearer",+ acc_tkn);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
i coded this for getting access token..then i got it.Now i want to get get 200 statues useing this token and my url.so what are the codeing line..plz help me
| 0debug
|
static void dump_json_image_info_list(ImageInfoList *list)
{
Error *local_err = NULL;
QString *str;
QmpOutputVisitor *ov = qmp_output_visitor_new();
QObject *obj;
visit_type_ImageInfoList(qmp_output_get_visitor(ov), NULL, &list,
&local_err);
obj = qmp_output_get_qobject(ov);
str = qobject_to_json_pretty(obj);
assert(str != NULL);
printf("%s\n", qstring_get_str(str));
qobject_decref(obj);
qmp_output_visitor_cleanup(ov);
QDECREF(str);
}
| 1threat
|
I want a table cell to completely cover up the entire screen in ios Swift? : The problem here is I want the UITable cell to fully take the view of the cell and once I swipe down the other cell has to appear. What I have here is the other cell also appears on the same UITable screen. As you can see the title of the other news also can be seen in the UITableView. I want the first data to cover up the entire screen and once I swipe down the next data(title,image,description) has to be added. [enter image description here][1]
[1]: https://i.stack.imgur.com/KtX0d.png
| 0debug
|
Directory comparision : path1 : /home/users/term/R1.0/test/mw & path2 : /home/users/term/R1.2/test/mw
I would like to compare the above two directory paths and output the path which has highest version.
output = /home/users/term/R1.2/test/mw
what is the best way to achieve it.
| 0debug
|
static QString *read_line(FILE *file, char *key)
{
char value[128];
if (fscanf(file, "%s%s", key, value) == EOF)
return NULL;
remove_dots(key);
return qstring_from_str(value);
}
| 1threat
|
issue in changing the dataframe schema from int to double : I have a dataframe label and i want to change the schema of the dataframe from integer to double
The schema of the data frame is
`label.printSchema`
`root
|-- value: integer (nullable = false)`
the command I am using is
`label = label.withColumn('value', label.value.cast('double'))`
the error i am receiving is:
`error: unclosed character literal`
| 0debug
|
How to write a program that prints a string a successive number of times (defined by user), in the same number of lines? : I am EXTREMELY new to programming. I am trying to write a function that prints the string '$' a number of times defined by the user, successively reaching that number in the same amount of lines. For instance, if the number is 5, then the output should be
$
$$
$$$
$$$$
$$$$$
I have already tried a for loop. I honestly don't even know what sort of function would accomplish the desired result. I know this isn't right, but am I at least on the right track?
def func():
number = int(input('Enter a positive integer: '))
for i in range(number):
print('$'*number)
number = number + int(input('Enter a positive integer: '))
print()
func()
All I can get it to do is print the string the specified number of times, in the same loop. And if the user inputs another integer, then it will print one line with the old value and the new added together.
| 0debug
|
How to rename multiple files in vscode (visual studio code)? : <p>I wonder, if there is way to rename multiple files in visual studio code? I have tried to use find and replace, no luck.</p>
| 0debug
|
Trying to figure out how to use "Date()"s for an assignment due friday : Basically, I need to make the closeDate = null and the openDate the current date. Using latest version of Java SDK and netbeans.
import java.util.Date;
public class Task {
Date openDate = new Date();
Date closeDate = new Date();
public int taskType;
public Task(int taskType)
{
this.taskType = taskType;
}
static void setOpenDate(Date openDate)
{
}
static void setCloseDate(Date closeDate)
{
}
static void setTaskType(int taskType)
{
}
static int getTaskType()
{
}
static Date getOpenDate()
{
return openDate;
}
static Date getCloseDate()
{
return closeDate;
}
}
This is what I have. I'm losing my mind on other parts of this painful assignment, but I just need some form of clarity for something. Thanks my dudes
| 0debug
|
how to make a batch file create a batch file that can still contain percentage values : i'm trying to create a batch file that creates a batch file, but as it seems i can't get the first batch file to also send over percentage value's (fx. %example%), so how do i make the first batch file create the second batch file but that file is still able to contain percentage value's? Also if you find any other errors in my script please correct it :)
Also while i'm here, as you can see I've put an "example, please help!" underneath the ":prep" I can't seem to figure out the ">nul" thing, no matter how many "^" i put it won't save to the last sector (which is "gnome.bat") it will however save to the "setup.bat" but not any further, so please also help me with that
The error is under ":Prep"
here's my full script: (not even close to being done with the script...)
@echo off
title Annoying Menu
mode 150
color a
:begin
cls
echo Welcome to "Annoying Menu"
echo This menu is made to prank your friends
echo All pranks that you make on your friends are completely your own responsibility
echo Please be aware that this menu contains what could be consideret "Virus"
echo No harm will however be done to either your, or your freinds pc
echo Please read through all the instructions before use, of the menu...
echo ---------------------------------------------------------------------------------------
echo 1. Please select a password to cancel the prank, by pressing "3" (only numbers)
echo 2. Please make sure that the setup files are ready to be transferred, by pressing "1"
echo 3. Now you are ready to send off the setup file to one of your freinds
echo ---------------------------------------------------------------------------------------
echo type "1" to create setup file
echo type "2" to prepare setup files for use
echo type "3" to download it on your own pc
echo type "4" to select password to cancel the prank (please only use numbers)
echo type "5" to test password
echo type "exit" to close the menu
echo ---------------------------------------------------------------------------------------
echo.
set /p opt= Option:
if %opt%==1 goto create
if %opt%==2 goto prep
if %opt%==3 goto UD
if %opt%==4 goto pass_select
if %opt%==5 goto testpass
if %opt%==exit goto end
cls
echo please enter a valid number to continue...
echo.
pause
goto begin
:create
break>"C:\Users\%Username%\Desktop\setup.bat"
echo.
echo setup file created, please prepare the setup file before use, by pressing "2" in the main menu
echo.
pause
goto begin
:prep
@echo @echo off> setup.bat
@echo title quick_setup>> setup.bat
@echo color a>> setup.bat
@echo mode 150>> setup.bat
@echo :begin>> setup.bat
@echo break^>"C:\Users\%Username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\gnome.bat">> setup.bat
@echo cd C:\Users\%Username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup>> setup.bat
(Example, please help!)
@echo @echo ping localhost -n 2 ^>nul^>^> gnome.bat>> setup.bat)
@echo @echo set /a time=%clock%-1^>^> gnome.bat>> setup.bat
@echo @echo if %clock% EQU 0 goto Timesup^>^> gnome.bat>> setup.bat
@echo @echo :Timesup^>^> gnome.bat>> setup.bat)
goto begin
(Not Done!)
:UD
(Not Done!)
:pass_select
cls
echo Please enter a password that will be used to cancel the prank (please only use numbers)
echo.
set /p pas= Set Password:
set /a pss=%pas%
cls
echo the password has now been set to %pss%
echo to enter a new password simply select "3" again and choose a new password
echo.
pause
goto begin
:testpass
cls
echo we are now ready to test your newly set password (if not you've set a password, please do so first)
echo.
echo type "1" to start the test
echo type "2" to set a password/new password
echo type "exit" to go back to the main menu
echo.
set /p lll= Option:
if %lll%==1 goto test
if %lll%==2 goto pass_select
if %lll%==exit goto begin
cls
echo please enter a valid number to continue...
echo.
pause
goto testpass
:test
cls
echo please enter password to continue...
echo type "exit" to go back to main menu
echo.
set /p tes= Password:
if %tes%==%pss% goto completetest
if %tes%==exit goto begin
cls
echo either you typed the wrong password or it didn't work, please try to set a new password if the same thing happens twice...
echo.
pause
goto test
:completetest
cls
echo The test was successful!
echo you're password works as intended
echo.
pause
goto begin
:end
| 0debug
|
What does 'ICU' stand for in Android SDK? : <p>Have seen new packages in Android SDK docs. All of them are available in API level 24 which corresponds to Android Nougat and seem to replace the '<em>java.xxx</em>' packages by '<em>android.icu.xxx</em>'. For example:</p>
<blockquote>
<p>The <em>java.text.DateFormat</em> package is duplicated in <em>android.icu.text.DateFormat</em> and so on</p>
</blockquote>
<p>Also, in some icu classes appears the following annotation: </p>
<blockquote>
<p>[icu enhancement] ICU's replacement for (class name). Methods, fields, and other functionality specific to ICU are labeled '[icu]'.</p>
</blockquote>
<p>So, what does ICU stand for? And what are differences between java and android.icu packages? Will java packages be deprecated soon?</p>
| 0debug
|
How to make random selection from a set of random numbers? : <ul>
<li>I have a series expressed as </li>
</ul>
<blockquote>
<p><code>y = a*np.exp(-t/T1) + a*np.exp(-t/T2) + a*np.exp(-t/T3) + a*np.exp(-t/T4) + a*np.exp(-t/T5)</code></p>
</blockquote>
<ul>
<li><p>I want to generate this series <code>n</code> number of times.</p></li>
<li><p>For each iteration, I want the T1-T5 values to be picked from another set of values.</p></li>
<li><p>These values are also ranges of random numbers-</p></li>
</ul>
<blockquote>
<pre><code>value1 = np.random.uniform(1,5)
value2 = np.random.uniform(6,10)
value3 = np.random.uniform(11,15)
value4 = np.random.uniform(16,20)
value5 = np.random.uniform(21,25)
value6 = np.random.uniform(26,30)
value7 = np.random.uniform(31,35)
value8 = np.random.uniform(36,40)
value9 = np.random.uniform(41,45)
value10 = np.random.uniform(46,50)
</code></pre>
</blockquote>
<p>What is the easiest way to do this task? can I use something like <code>np.random.choice</code> to pick from the set of values for each T?</p>
| 0debug
|
Newline Text Node : i have this code and i want to new line in Text Node. its now working :(
your help please.......
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
// Create a new list item when clicking on the "Add" button
function newElement() {
var li = document.createElement("li");
var inputText = document.getElementById("myInput").value + document.createElement("br") + "ddd" ;
var t = document.createTextNode(inputText);
li.appendChild(t);
li.value = document.getElementById("myValue").value;
if (inputText === '') {
alert("You must write something!");
} else {
updateLI(li);
document.getElementById("myUL").appendChild(li);
}
document.getElementById("myInput").value = "";
document.getElementById("myValue").value = "";
}
<!-- end snippet -->
| 0debug
|
Not use self in every class method and not use singleton model in ruby : <p>I'm having trouble with nice and beautiful code. Basically, if I define a class that won't be instantiated at all, I'd do something like this:</p>
<pre><code>class Foo
def self.bar
# Do something
end
end
</code></pre>
<p>but this syntax bothers me (having to put <code>self.</code> in every method), so singleton solves my problem:</p>
<pre><code>class Foo
class << self
def bar
# Do something, but in better code
end
end
end
</code></pre>
<p>In both ways I can do <code>Foo.bar</code> and it'll do something, but the first one doesn't look good and in the second one I still don't get how singleton works exactly, so better be careful and not to use it.</p>
<p>So, in the end... What I'd like to ask: is there a way to do <code>Foo.bar</code> other than the mentioned above?</p>
| 0debug
|
PHP cut text after find "," : <p>I want to cut text after find ","</p>
<blockquote>
<p>input text > 12223443,3532432</p>
<p>I want > 12223443</p>
</blockquote>
<p>**text length is no fixed</p>
| 0debug
|
How to add more data in access_token JWT : <p>I am trying to add new fields in JWT token which is actually <code>access_token</code> which is generated with <code>grant_type=password</code>. I want to add more fields if grant type is only <code>password</code>.</p>
<p>If I implement a custom token enhancer, it adds new fields in the response body of oauth login api. But I only need those new fields inside <code>access_token</code> JWT.</p>
<p>e.g.:</p>
<p>when decoding <code>access_token</code>, Object should be from </p>
<pre><code>{
"user_name": "uuid",
"scope": [
"trust"
],
"exp": 1522008499,
"authorities": [
"USER"
],
"jti": "9d827f63-99ba-4fc1-a838-bc74331cf660",
"client_id": "myClient"
}
</code></pre>
<p>to</p>
<pre><code>{
"user_name": "uuid",
"newField": [
{
"newFieldChild": "1",
},
{
"newFieldChild": "2",
}
],
"scope": [
"trust"
],
"exp": 1522008499,
"authorities": [
"USER"
],
"jti": "9d827f63-99ba-4fc1-a838-bc74331cf660",
"client_id": "myClient"
}
</code></pre>
<p>Implementing <code>CustomTokenEnhancer</code> adds <code>newField</code> list in the response body of login: </p>
<pre><code>{
"access_token": "jwt-access_token",
"token_type": "bearer",
"refresh_token": "jwt-refresh_token",
"expires_in": 299999,
"scope": "trust",
"jti": "b23affb3-39d3-408a-bedb-132g6de15d7",
"newField": [
{
"newFieldChild": "1",
},
{
"newFieldChild": "2",
}
]
}
</code></pre>
<p><code>CustomTokenEnhancer</code>:</p>
<pre><code>public class CustomTokenEnhancer implements TokenEnhancer {
@Override
public OAuth2AccessToken enhance(
OAuth2AccessToken accessToken,
OAuth2Authentication authentication) {
Map<String, Object> additionalInfo = new HashMap<>();
Map<String, String> newFields = ....;
additionalInfo.put("newField", newFields);
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
return accessToken;
}
}
</code></pre>
<p>is it possible to modify <code>access_token</code> JWT if <code>grant_type</code> is <code>password</code>?</p>
| 0debug
|
void qemu_register_clock_reset_notifier(QEMUClock *clock,
Notifier *notifier)
{
qemu_clock_register_reset_notifier(clock->type, notifier);
}
| 1threat
|
How to hide status bar in android in just one activity : <p>I want to hide status bar / notification bar in splash screen I am using
style:<code><style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"></code>
this dose not hide the status bar, how should i do this?</p>
| 0debug
|
void ff_free_stream(AVFormatContext *s, AVStream *st){
av_assert0(s->nb_streams>0);
av_assert0(s->streams[ s->nb_streams-1 ] == st);
if (st->codec) {
avcodec_close(st->codec);
}
if (st->parser) {
av_parser_close(st->parser);
}
if (st->attached_pic.data)
av_free_packet(&st->attached_pic);
av_dict_free(&st->metadata);
av_freep(&st->probe_data.buf);
av_freep(&st->index_entries);
av_freep(&st->codec->extradata);
av_freep(&st->codec->subtitle_header);
av_freep(&st->codec);
av_freep(&st->priv_data);
if (st->info)
av_freep(&st->info->duration_error);
av_freep(&st->info);
av_freep(&s->streams[ --s->nb_streams ]);
}
| 1threat
|
Why is tslint:recommended not allowing modules? : <p>We are using typescript v2.3.2 and TSLint v4.5.1 with VS Code to create a SPA. Codebase is growing and we need to modularize it someway.</p>
<p>I tried to do the modularization using typescript modules but found the following lint error when transpiling the app.</p>
<pre><code>[tslint] 'namespace' and 'module' are disallowed (no-namespace)
</code></pre>
<p>I'm using this configuration for the linter:</p>
<pre><code>{
"extends": "tslint:recommended",
"rules": {
"no-var-requires": false,
"no-console": ["error", false],
"max-line-length": [false]
}
}
</code></pre>
<p><a href="https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts" rel="noreferrer">The recommended rules file</a> at line 89 shows this rule:</p>
<pre><code>"no-namespace": true,
</code></pre>
<p>I wonder if there is something wrong and what would be the best way to modularize a SPA, following good practices that are not obsolete soon.</p>
<p>Examples of code will be welcomed. Thank you very much.</p>
| 0debug
|
Keeping track of a fragment in the activity : <p>in my app there's an Activity with a Navigation Drawer. The selection of the drawer's items brings to the instantiation of related List Fragments.
When I select an item in the List Fragment, a second Activity begins showing information about the item I clicked.
Navigating back to the first Activity, it gets created again, but I'd like to keep track of the last fragment showed, with the list from which I selected the item.
How could I achieve this? Thanks in advance.</p>
| 0debug
|
void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
{
long i;
for(i=0; 3*i<src_size; i++)
{
#ifdef WORDS_BIGENDIAN
dst[4*i + 0] = 0;
dst[4*i + 1] = src[3*i + 0];
dst[4*i + 2] = src[3*i + 1];
dst[4*i + 3] = src[3*i + 2];
#else
dst[4*i + 0] = src[3*i + 2];
dst[4*i + 1] = src[3*i + 1];
dst[4*i + 2] = src[3*i + 0];
dst[4*i + 3] = 0;
#endif
}
}
| 1threat
|
Single Linked List in reverse order Java : <p>How to write a code for printing Single linked list in reverse order?</p>
<pre><code>private class Elem {
private int data;
private Elem next;
public Elem(int data, Elem next) {
this.data = data;
this.next = next;
}
public Elem(int data) {
this(data, null);
}
}
private Elem first = null, last = null;
</code></pre>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.