ashim

0

votes
0

answer
6

views

how to support all screen sizes when using more than one spinner?

I am making a new app and I am a beginner so kindly help me with this, my layout is working great if I run without any java code for layout but when I use Java code, my layout is going beyond the screen I have tried to make different layout folders such as layout-sw320dp.... public class Main2Activi...
ashim
1

votes
1

answer
245

views

web2py, How to do SELECT … FOR UPDATE?

I am learning web2py framework and Database Abstraction Level. I need to do SELECT ... FOR UPDATE statement. Is there way to it in web2py? I have not found answer in the manual
ashim
1

votes
2

answer
888

views

Push commit to 2 different remote branches?

I have two remote branches, branch A and branch B. Consider the case where I checkout branch A, made a commit and pushed. Now, I want to push the same commit to branch B. These two branches are pretty different so I cannot user rebase, can I? Because if I do git rebase then I will rebase all changes...
ashim
1

votes
3

answer
1.7k

views

python re, extract values between commas

Why next regular expression returns empty strings among 'a' and 'b'? In [48]: pat = re.compile(".*?(?=,|$)") In [49]: it = pat.findall('a,b') In [50]: it Out[50]: ['a', '', 'b', ''] How can I extract substrings between commas? EDIT: I am curious how to do it using regular expressions. EDIT: Regular...
ashim
16

votes
9

answer
40.8k

views

Modeling infinity for the largest double value

The question is about modeling infinity in C++ for the double data type. I need it in a header file, so we cannot use functions like numeric_limits. Is there a defined constant that represents the largest value?
ashim
18

votes
1

answer
9.7k

views

python: library for generalized suffix trees [closed]

I need python library that can construct suffix trees and especially generalised suffix trees. Could you suggest me some libraries. Thanks.
ashim
6

votes
2

answer
160

views

Get start and stop indexes of overlapping matches?

I need to know start and end indexes of matches from next regular expression: pat = re.compile("(?=(ATG(?:(?!TAA|TGA|TAG)\w\w\w)*))") Example string is s='GATGDTATGDTAAAA' pat.findall(s) returns desired matches ['ATGDTATGD', 'ATGDTAAAA']. How to extract start and end indexes? I tried: iters = pat.fi...
ashim
1

votes
1

answer
282

views

How to make aliases in c++ (on assembly level)?

The question sounds stupid. Surely, just type: int i = 1; int &k = i; But after I compile it with llvm ( optimization flag is -O0 ) I have next intermediate interpretation: %i = alloca i32, align 4 ; [#uses=2] %k = alloca i32*, align 8 ; [#uses=2] It me...
ashim
20

votes
2

answer
40.6k

views

Define the size of a grid on a plot using Matplotlib

I am plotting using Matplotlib in Python. I want create plot with grid, and here is an example from a plotting tutorial. In my plot range if the y axis is from 0 to 14 and if I use pylab.grid(True) then it makes a grid with the size of square of two, but I want the size to be 1. How can I force it?
ashim
20

votes
2

answer
27.3k

views

python bindings, how does it work?

I am exploring python. I curious about python bindings. Could anybody explain, how it is possible that you can have access to C libraries from Python.
ashim
2

votes
2

answer
2.6k

views

In azure datafactory how to copy data from blob to sql without duplication?

In azure datafactory how to copy data from blob to sql without duplication ie if the pipeline runs at the slice of every 15 min then how to avoid getting duplicate data
Ashim Sinha
2

votes
2

answer
183

views

What is the object owner referred to in the Google C++ Style Guide?

The Google Style Guide for C++ says, in the section about smart pointers: We prefer designs in which objects have single, fixed owners. I don't fully understand the sentence. What is the object owner? Is it just the pointer?
ashim
2

votes
4

answer
6.2k

views

c++, creating vector of vectors?

Question is about what is the best way to create vector of vectors. I have several vector coordinates; and I want pass them to function. How I should combine them, vector? Is there more elegant way?
ashim
2

votes
1

answer
808

views

graphviz, how stick nodes position on the image

I have question about how visualise trees . Now I use graphviz or dot language and have some problems. Briefly about my context. I have series of trees. Tree on step T is obtained from tree on step T-1 by adding some edges. I want to create image for each tree. Wile viewing these images in Image vi...
ashim
5

votes
3

answer
30.5k

views

How can I reduce the number of digits after decimal point when writing floats to file?

In my program I am printing float numbers to file. There is high precision of these numbers so there are many digits after decimal point, i.e number 0.0433896882981. How can I reduce number of digits that I print into file? So I would print, say, 0.043 instead of 0.0433896882981.
ashim
2

votes
3

answer
3.3k

views

R. how to make matrix which have equal rows

I have row f. I want create matrix R such that every row of it is equal f. What is the most efficient way to do it in R?
ashim
2

votes
0

answer
384

views

Camera freezes in some devices

I'm using custom camera in my app. It works fine in most of the devices but the camera freezes in some of the newer devices (Note 8, OnePlus 5). Works fine in S7 and OnePlus3(with Android O). Camera freezes but the app does not crash until the capture button is pressed. It is not the issue of wrong...
Ashim Neupane
2

votes
0

answer
27

views

android google heat maps is not showing locations more than 1000

I implemented the google heat maps in my app and heat maps is showing my locations but if my locations count crossed 1000 then heat maps is showing only 1000 points and left the remaining points. I use below code to implement heat maps. mProvider = new HeatmapTileProvider.Builder() .data(list) .radi...
Ashim Kansal
2

votes
2

answer
469

views

PySpark DataFrame: Custom Explode Function

How to implement a custom explode function using udfs, so we can have extra information on items? For example, along with items, I want to have items' indices. The part I do not know how to do is when a udf returns multiple values and we should place those values as separate rows.
ashim
2

votes
1

answer
283

views

using curl with authentication

I am running a local node.js server. I need to make a POST request with curl. It this request a user should be authenticated. So I specify user name and password in the request. The problem is that I get an error that the token cannot be found, even though login credentials are correct (I can login...
ashim
1

votes
3

answer
5.7k

views

In hive how to insert data into a single file

INSERT OVERWRITE DIRECTORY 'wasb:///hiveblob/' SELECT * from table1; This work but when we give command like INSERT OVERWRITE DIRECTORY 'wasb:///hiveblob/sample.csv' SELECT * from table1; Failed with exception Unable to rename: wasb://[email protected]/hive/scratch/hive...
Ashim Sinha
3

votes
3

answer
16.5k

views

MySQL, how update string field by concatenating to it?

Question is how to update string field by concatenating to it? Here is code for creating database and adding one row: CREATE DATABASE my_db; USE my_db; CREATE TABLE IF NOT EXISTS my_table( article_id INTEGER unsigned, revision_ids VARCHAR(10...
ashim
2

votes
1

answer
969

views

web2py. no such table error

I have an error no such table: mytable, even though it is defined in models/tables.py. I use sqlite. Interesting enough, if I go to admin panel -> my app -> database administration then I see a link mytable, however when I click on it then I get no such table: mytable. I don't know how to debug such...
ashim
3

votes
1

answer
623

views

llvm, load poolalloc to opt

I want to run alias analysis in llvm, particularly I want to run -ds-aa which is in module poolalloc. According to poolalloc documentation I need to load it's module to opt. What I do is : opt -load /usr/local/lib/LLVMDataStructure.so -load /usr/local/lib/poolalloc.so -ds-aa -aa-eval hello.bc -disab...
ashim
22

votes
10

answer
2.3k

views

Dereferencing a pointer to constant

Let's say we have a class called object. int main(){ object a; const object* b = &a; (*b); } Question: b is a pointer to const, but the object it is pointing to is actually not a constant object. My question is, when we dereference the pointer "b" why do we get a constant object instead of what it...
Ashim
3

votes
1

answer
4k

views

How to generate LLVM bitcode

I want to generate bitcode file (.bc) as it is written in documentation: hello.c #include int main() { printf("hello world\n"); return 0; } then % clang -O3 -emit-llvm hello.c -c -o hello.bc and % lli hello.bc to run the code, but I have weird output: lli: Attributes.cpp:367: static llvm::AttrListP...
ashim
1

votes
1

answer
1.6k

views

insert json into mysql. json string is obtained from json.dumps

The problem is with inserting json strings into MySQL database. In my python program I obtain json as a result of json.dumps(d) where d is a dictionary. Inserting code is: query = ("INSERT INTO bm_triesJsons VALUES (%s, %s, %s);"% (article_id, revision_number, jsn)) print query cur.execute(query) It...
ashim
12

votes
3

answer
20k

views

Socket, BufferedReader hangs at readLine()

I have a server which initially does this:- BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); for (;;) { String cmdLine = br.readLine(); if (cmdLine == null || cmdLine.length() == 0) break; ... } later it passes the socket to another class "foo" This class wait for...
ashim
6

votes
3

answer
109

views

vim copy and paste via a shared file

How to augment vim yank and paste, so when I yank, vim writes the content to a file. When I paste, it uses the content from the file. I want to have a system wide file which serves as a global buffer. Context: I run vim in different tmux splits on a remote server (over ssh). I want seamlessly copy a...
ashim
4

votes
1

answer
1.5k

views

how to read row by row in a dataframe using a loop and return each value or pop out each value

How can I read row by row in a Dataframe using a loop and return each value or pop out each value? Example: id name 1 abc 2 vbs 2 askj
Ashim Sinha
4

votes
3

answer
4.9k

views

octave(matlab), how create plots without displaying?

The problem with octave(matlab). In the program I have loop where I plot data. In the end of each loop I save plots to disc. During this process octave draw each plot. It slows down the process. I need only plots to be saved on disc. If I could not display them,but just save, it would considerably a...
ashim
2

votes
2

answer
410

views

driver ODBC does not work with MySQL

I want use MySQL database in R environment. I am using Ubuntu OS. To do this I should install unixODBC or iodbc and install odbc driver for MySQL. I encounter with error in R when I want connect to database: file /usr/lib/odbc/libmyodbc.so not found. But of course that file is in that directory. I g...
ashim
7

votes
1

answer
10.6k

views

Plot two graphs on one plot. function lines does not work

I want to plot two graphs on one plot. I read this post, but function lines does not work, nothing happens. I don't know what can be the problem. Any ideas? Edit. reproducible example: > tr_error [1] 0.2314984 0.2314990 0.2314981 0.2314955 0.2314955 0.2314943 0.2314912 [8] 0.2314924 > tst_error [1]...
ashim
4

votes
3

answer
84

views

Date difference based on yyymm in unix

#####DATE1=201609 #### DATE2=201508 How to calculate the difference between these two date and get output as count of no of month ie 201609-201508=13month
Ashim Sinha
2

votes
2

answer
2.5k

views

php, proc_open how pass multiple arguments

I am writing php code which will work under *nix systems. I need to call a python script with 5 arguments inside php code. Some of arguments are user input so there could be any characters. I cannot figure out how pass arguments to a script. How would I separate arguments?. For example in this quest...
ashim
4

votes
6

answer
591

views

Is it possible to write asynchronous Node.js code “cleaner”?

While coding in Node.js, I encountered many situations when it is so hard to implement some elaborated logic mixed with database queries (I/O). Consider an example written in python. We need to iterate over an array of values, for each value we query the database, then, based on the results, we nee...
ashim
7

votes
1

answer
6.6k

views

matplotlib, can plot but not scatter

I have weird behaviour of matplotlib.pyplot. I have two array x and y. I want scatter these point. so I use scatter function: ax.scatter(x, y, 'r') plt.xlabel('average revsion size') plt.ylabel('time (seconds)') plt.savefig('time.png', format='png') this piece of code give me error otImplementedErro...
ashim
1

votes
4

answer
1.1k

views

How to save user's input in UITextField?

I wanted to know how can I save a user's input when the user enters something from his mobile phone in the UITextField? If I just use the text field and run the app I can enter data in the text field but when I close the application the data is gone. So how can I store that data permanently and show...
Ashim
3

votes
2

answer
12.1k

views

cursor.fetchone() returns None but row in the database exists

I am writing program on python which interacts with MySQL database. For for sql queries I use MySQLdb. The problem is that fetchone() returns None but with database browser I can see that row exists. This piece of code: query = "SELECT * FROM revision WHERE rev_id=%s;" cursor.execute(query % revi...
ashim
33

votes
3

answer
43.6k

views

byte string vs. unicode string. Python

Could you explain in detail what the difference is between byte string and Unicode string in Python. I have read this: Byte code is simply the converted source code into arrays of bytes Does it mean that Python has its own coding/encoding format? Or does it use the operation system settings? I don't...
ashim

View additional