Science topic
C - Science topic
Explore the latest questions and answers in C, and find C experts.
Questions related to C
Right now, in 2022, we can read with perfect understanding mathematical articles and books
written a century ago. It is indeed remarkable how the way we do mathematics has stabilised.
The difference between the mathematics of 1922 and 2022 is small compared to that between the mathematics of 1922 and 1822.
Looking beyond classical ZFC-based mathematics, a tremendous amount of effort has been put
into formalising all areas of mathematics within the framework of program-language implementations (for instance Coq, Agda) of the univalent extension of dependent type theory (homotopy type theory).
But Coq and Agda are complex programs which depend on other programs (OCaml and Haskell) and frameworks (for instance operating systems and C libraries) to function. In the future if we have new CPU architectures then
Coq and Agda would have to be compiled again. OCaml and Haskell would have to be compiled again.
Both software and operating systems are rapidly changing and have always been so. What is here today is deprecated tomorrow.
My question is: what guarantee do we have that the huge libraries of the current formal mathematics projects in Agda, Coq or other languages will still be relevant or even "runnable" (for instance type-checkable) without having to resort to emulators and computer archaeology 10, 20, 50 or 100 years from now ?
10 years from now will Agda be backwards compatible enough to still recognise
current Agda files ?
Have there been any organised efforts to guarantee permanent backward compatibility for all future versions of Agda and Coq ? Or OCaml and Haskell ?
Perhaps the formal mathematics project should be carried out within a meta-programing language, a simpler more abstract framework (with a uniform syntax) comprehensible at once to logicians, mathematicians and programers and which can be converted automatically into the latest version of Agda or Coq ?
Animations are known to be a fast and very efficient way of dissemination of knowledge, insights, and understanding of complex systems. Through the animations, quite complicated research can be easily shared among all scientific disciplines.
While starting with complex systems descriptions of Dynamic Recrystallization in metals about almost 30 years ago, it had become very obvious almost instantly that animations carry with themselves a huge expressive power.
This recently led to development of the GoL-N24 open-source Python software that enables to create animations effortlessly. The user just defines the input parameters and the rest is done automatically. Share your software too.
This question is dedicated to all such animations and open-source-source software, which are producing them, in the area of complex systems.
Everyone is welcomed to share their own research in the form of animations with the relevant description.
the repellent activity is different than the excito-repellent (landing is differ than sucking)
when we use the repellent, we can calculate their repellent activity by using the percentage of protection P= (C-T)/C x 100
when we use excito repellent, how can we calculate the percentage of bitting.
Thank you
Hello,
I've successfully simulated the closure of a flapper non-return valve as illustrated.
The inlet velocity increases gradually with a specific acceleration.
The following UDF is used to specify the motion of the flapper:
#include "udf.h"
DEFINE_SDOF_PROPERTIES(flappers_motion, sdof_prop, dt, time, dtime)
{
Six_DOF_Object *sdof_obj = NULL;
sdof_prop[SDOF_MASS] = 2.73e-3; /* flapper's submerged weight */
sdof_prop[SDOF_IXX] = 2161.86e-9; /* around the hinge */
sdof_prop[SDOF_IYY] = 367.96e-9;
sdof_prop[SDOF_IZZ] = 2471.27e-9;
real m= sdof_prop[SDOF_MASS];
real L= 0.024479 ;
sdof_prop[SDOF_LOAD_M_X] = 0 ;
sdof_prop[SDOF_LOAD_M_Y] = 0.0;
sdof_prop[SDOF_LOAD_M_Z] = 0.0;
real th_deg = theta * 180 * 7 / 22 ; /* valve opening angle, in degree */
sdof_obj = Get_SDOF_Object(DT_PU_NAME(dt));
if (NULLP(sdof_obj))
{
/* Allocate_SDOF_Object must be called with the same name as the udf */
sdof_obj = Allocate_SDOF_Object(DT_PU_NAME(dt));
SDOFO_1DOF_R_P(sdof_obj) = TRUE; /*1DOF rotation*/
SDOFO_DIR(sdof_obj)[0] = 1.0;
SDOFO_DIR(sdof_obj)[1] = 0.0;
SDOFO_DIR(sdof_obj)[2] = 0.0;
SDOFO_CENTER_ROT(sdof_obj)[0] = 0.0;
SDOFO_CENTER_ROT(sdof_obj)[1] = 0.0;
SDOFO_CENTER_ROT(sdof_obj)[2] = 0.0;
SDOFO_CONS_P(sdof_obj) = TRUE; /* constrained motion */
if (SDOFO_CONS_P(sdof_obj))
{
SDOFO_LOC(sdof_obj) = 0.0;
SDOFO_MIN(sdof_obj) = -0.0349 ; /* min allowable angle */
SDOFO_MAX(sdof_obj) = 1.0471 ; /* max allowable angle */
SDOFO_INIT(sdof_obj) = SDOFO_LOC(sdof_obj);
SDOFO_LOC_N(sdof_obj) = SDOFO_LOC(sdof_obj);
}
}
}
But now I want to simulate the closure of the flapper, taking into account the friction at the flapper's hinge.
I tried to just assign the friction value to "sdof_prop[SDOF_LOAD_M_X]" ,but the flapper started to move backwards (opening) until the flow increases, which is not correct.
So I want to get the value of the hydrodynamic torque of the flapper, and compare it to the friction with some kind of "if statement" that may look like this:
real static_friction= 50;
real kinetic_friction=40;
real hydraulic_torque =??? ;
If (hydraulic_torque<static_friction)
{
sdof_prop[SDOF_LOAD_M_X]=0
}
else
{
sdof_prop[SDOF_LOAD_M_X]=-1*kinetic_friction;
}
BUT THE PROBLEM IS :
I don't know the udf code that can get the actual value of the hydraulic_torque on the flapper to compare it to the friction value.
Your help is highly appreciated.
Thanks a lot in advance.

Hello experts,
I hope you're good.
I am trying to generate non binary (optimized) lfrs sequence on the fly with c.
But I am missing something, I don't get what ...
attached is the code ....
can anyone suggest the best way to find the accurate execution time of math.h library functions such as sqrt(), log(), log10(), sin(), cos() e.t.c?
If so, why should we neglect the effect of gravitational potential from remote masses of the universe which is about 106 times larger than the additional gravitational potential at the Sun's surface ??
How could we profile a c program in order to obtain detailed information related to its executed instructions (Dynamic Instructions)? I'm looking for a tool with which I can use it to obtain information per dynamic instruction, for example
The 1st Instruction is executed 10 times
The 2nd Instruction is executed 5 times
The 3rd Instruction is executed 7 times and so on.
Moreover, taking into account arithmetic instructions, is it possible to determine the results that those instructions produce for each time they are being executed (the partial results produced by a dynamic instruction at an arbitrary clock cycle)?
By doing so, we can state that instruction 1 is going to execute 10 times and the results it produces are the same as across these 10 times. Therefore, we can ignore 9 dynamic instructions of instruction 1, and only consider one instance.
I Still haven't found what I'm looking for!
Hello everyone, I’m wondering if anyone can help me in using the finite element analysis code “FEMIX.4”. As i want to simulate the non-linear behaviour of concrete utilizing 3D multi directional fixed smeared crack model using FEMIX. And i’m not very familiar with such computer codes.
thanks in advance.
Hello everyone,
I'm trying to model the motion of a cylinder in both CF and IL directions, but the UDF code that I have only can move the cylinder in the CF direction. Sadly I have never had the chance to learn to code UDF. Can someone please help me?
I will share the code below.
I really appreciate any help you can provide or at least promote this question to find the best answer to my issue.
FYI, this code is for Vortex-Induced Vibration of cylinders
####################################################
#include "udf.h"
#include "dynamesh_tools.h"
#include "unsteady.h"
FILE *fout;
static real v_prev;
DEFINE_SDOF_PROPERTIES(stage,prop,dt,time,dtime)
{
Thread *t;
Domain *d=Get_Domain(1);
real x_cg[3],force[2],moment[3];
real cg; /*Center of gravity position*/
real vel; /*Cylinder velocity*/
real Fy; /*Lift Force*/
real mass=8.88; /*Cylinder mass*/
real fn=1.06; /*System frequancy*/
real wn=2*M_PI*fn; /*System angular velocity*/
real z=0.002; /*Damping coefficeint*/
real k=mass*wn*wn; /*System stiffness*/
real c=2*mass*wn*z; /*System damping*/
/*Get the thread pointer for this which motion is define*/
t=DT_THREAD(dt);
prop[SDOF_MASS]=8.88; /*System mass of the 6DFOF*/
prop[SDOF_ZERO_TRANS_X]=TRUE;
prop[SDOF_ZERO_TRANS_Z]=TRUE;
prop[SDOF_ZERO_ROT_X]=TRUE;
prop[SDOF_ZERO_ROT_Y]=TRUE;
prop[SDOF_ZERO_ROT_Z]=TRUE;
cg=DT_CG(dt)[1];
vel=DT_VEL_CG(dt)[1];
prop[SDOF_LOAD_F_Y]=-k*cg-vel*c;
fout=fopen("results.txt", "a"); /*Open file*/
/*Wrtie data into file*/
fprintf(fout, "%g %g %g\n",time,DT_CG(dt)[1],DT_VEL_CG(dt)[1]);
fclose(fout);
}
Hello;
I am currently working on a UDFusing the DEFINE_HET_RXN_RATE for Heterogeneous reactions. My idea is to use VOF to describe a simple method of VLE using the vapor pressure of condensable components (in my case water and methanol). I am using the Evaporation-Condensation UDF provided by Ansys in their manual UDF book as a baseline.
By now, I am having trouble with filtering the rate of the reaction based on their names. I was trying to use STREQ and !strcmp command, but every time I compile it gave me the following message:
- error: member reference base type 'real' (aka 'double') is not a structure or union
Besides a problem with an exponent where its values depend on the temperature, it is the only problem I have so I can test the UDF.
I want to understand C5.0 algorithm for data classification , is there any one have the steps for it or the original paper that this is algorithm was presented in ?
I'm working on the simulation of thermal behavior of Ionanofluids, which is an ionic liquid-based-fluid in which nanoparticles were suspended to enhance the thermal performance. Multiple researches in the matter are taking in consideration more physical propreties to help predict these newly introduced fluids' thermal performance. Despite the rarety of experimental studies, they are credible and have very convincing models based on experimental observations and interpretations. In most cases a model for the thermal conductivity or for heat capacity was introduced to help predict the thermal performance. So in order for me to carry on a sophisticated numerical study i'm trying to introduce these models into Ansys Fluent as UDFs in order to compare or confirm with the experimental studies. This will enable me also, throw parametric studies to try multiple combinations of the ionic liquids+nanoparticles and compare their performance and cost effectiveness.
Thank you so much for your help and any advice in the matter will be helpful also.
Could you please explain the differentiation of aninal to meat with percentage wise distribution.
Carcass yield, bone %(live wt, carcass wt), meat%
I have Pandas DataFrame and Numpy.ndArray
I want to select DataFrame elements based on values contained in Numpy.ndArray
Eg:
L is Numpy.ndArray values
`L=array([2,2,2,1,1,1])`
P is Pandas dataFrame which has many columns of type Numpy.ndArray
P's 1st columns is
`array(['A','B','C','D','E','F'])`
Result expected
two different columns
`['A','B','C']` which is corresponding to 2 value
`['D','E','F']` which is corresponding to 1 value
Hi there. Im writing a program in C to solve the viscous burgers equation in 1D using the finite volume method. I am currently using a structured uniform cartesian grid as my computational grid. However i want to implement adaptive mesh refinement in my program. Could anyone tell me the steps i should take in order to do this. Would i have to make i have to make an additional function like say Adapt_Mesh() as well as my Init_Mesh() function and call the Adapt_Mesh() function in the main time loop every time the mesh needs refinement and how could i go about determining if my mesh needs refinement or how would i go about this. Im relatively new to the realm of CFD hence im struggling a lot by thinking how to go implementing this. Could anyone help me. Id be willing to share my current code if anyone could point me in the right direction in regards with how to get started.
*EDIT: Also i have a current gird with 100 cells. If was to adapt the mesh would it refine the mesh so that NX is always 100 ie. by making areas of less density and areas of higher density so that the total points add up to 100 or does the adaptive mesh increase the number of total cells everytime the mesh is refined. This is something im unsure of.
If anyone is curiosus i have attached my program below just incase anyone wanted to take a look
I have already tried alternatives with meat and gave us marvelous results as the meat stayed intact for 15 days at 4 C.
I want to know more about their papers through the program, can someone write them in C or JAVA or Python?
A colleague just does not understand how come I can be sure about c-global retrieved (which is traditionally thought to have been disproved in 1907).
My best pertinent paper (http://www.ptep-online.com/2015/PP-43-09.PDF) does not convince him.
Who has any advice to offer?
March 21, 2020
Example : Variable B & C together form A. To measure B we have reflective scale but C can be measured only with formative scale.
Please provide any reference, if you have
For the model refer to the attachment
If table is like can we draw venn diagram by this input?
variable value r1 value r2
a 20 45
b 10
c 39 1
d 37
e 98 27
Hello everyone,
which ways could I use for obtaining data about colour of every pixel in image which has .jpg or .png formats? In the end I want to get .txt file with numerical values of colours in the RGB palette to download it to FPGA by UART. If you know better methods to do this, I will be glad to learn them.
Thank you in advance.
Sometimes in order to gain better performance in terms of execution time, inline assembly within source code is used. For example, it is possible to write assembly code inside C code to manipulating values stored in registers. Is there a way to avoid using inline assembly inside source code? or an alternative way in this context?
While working on matlab to C conversion, I have encountered a problem which involves result mismatch. The function I've been trying to validate is an SVD function with its corresponding matlab built-in function. The result that is obtained from the vector of singular values (the last n by n matrix) in C implementation produces a result with column mismatch as compared to its corresponding matlab built-in function. In some of the cases the obtained result produces opposite signed values as well.
I have attached the c implementation, I kindly ask for your cooperation in pinpointing the problem which could help me find a solution.
Dear all,
This forum has been created to provide a scientific environment in Researchgate for all of those who are interested in doing research on the context of RPL in Internet of Things (IoT) networks. Through this forum, the members could discuss about their previous RPL related studies and introduce them to others, and also to share their latest discoveries, papers, and probable ideas and more importantly to provide their experience to the newly students who want to spend time on studying the existing challenges in RPL. The students who have decided to work on this topic can join this forum and ask their questions and also to get others' opinion on their current work. There exist different types of challenges for publishing a paper from getting the raw idea, and its implementation via off-the-shelf simulation tools, to submitting the final manuscript. Here in this forum, the members will try to solve these challenges as much as possible and also try to answer the questions and help each other to enhance the observability of the existing studies. Further more, members can inform others about the up coming conferences, events, and journal special issues to further provide a comfort zone for those who are attracted to this field of study.
I hope this forum will make the research on this field more interesting and easily.
I am attempting to implement an atmospheric boundary layer in a 3D fluent simulation using a UDF. The UDF is proven to work in a 2D simulation, however approximately 10 hours into a transient 3D solution using 16 cores, fluent crashes with the only log give being a segmentation fault. I am suspicious that something is going wrong with the parallel nature of the solver, however I can't see any issues with my code - nor can I see any issues that would result in a crash 10 hours in, where the code is not time dependent.
For somebody who already knows some programming skills and languages, what are the best and fastest strategies to master other programming languages?
I read that Tiny OS uses nesC language to build an application whereas Contiki OS uses C-language.
I am just starting to make a project utilizing IRIS motes and my application require multiple arithmetic operations and looping statements. I am familiar with C-language but nesC would be completely new for me (I guess) as its an extension to C-language.
So which platform will be more suitable for such application.
Hi,
For compiling a C code, I am using MinGW64 compiler(c) and made following code in command line.
mex asamin.c asa.c -DUSER_ACCEPTANCE_TEST -DUSER_ASA_OUT -DDBL_MIN=2.2250738585072014e-308
The error is presented in attached picture.
Can anyone help me for understanding the problem?
Any suggestion will be very appreciated.
The Best,
Azade
I am looking for different questionnaires based on Bloom Taxonomy (Affective, Cognitive and Social domains) to assess the learning of computer science student in CS1 courses(such as intro to programming class with java or c or python).
Hello,
I have a strange bug in my code involving the use of FFTW3. I already wrote the qeustion on Stackoverflow: https://stackoverflow.com/questions/53518451/why-is-fft-of-ab-different-from-ffta-fftb
Please, if anybody have some time to spare, could you have a look?
Thank you very much!
I am a researcher of materials science and metallurgical engineering. I am interested to work with atomic level and electronic modeling of the structure and properties of materials,materials informatics and simulation in future. Currently i am learning Python. I have basics of C and MATLAB . What will be the useful programming languages to learn for me?
As we know, the ptrace system call is the most powerful system call in all unix-like systems. All debugging software use ptrace for monitoring and manipulating another process, i.e. tracee. Using ptrace, we can track read/write system call in the tracee process. I ask, can we use ptrace in order to monitor the tracee and notify the tracer only when the tracee executes a branch instruction? Is this possible? if not, can we notify the tracer when a specific instruction at a specific address is executed?
Advance thanks
The possibility of sequencing of short primers
temperature is affecting on the mechanical properties such as strength
Hi
Please, how can we make a new operating system ?
Is the method to bring some developers with strong background in theoretical operating system operations and then they should learn from the source codes from another operating systems such as Linux various versions. Then, you can write your operating system and then testing it with ethical hackers to fix the security issues. Then, you can deploy it for some users as testing version. Then, it is validated to be used.
Please, any help for developers to do this than talking alot in useless things.
Thanks
Osman
I was asked to supervise my junior in a small project about Chick hematology, because I am new to the topic I have several questions to ask :
1. My juniors are planning to see the garlic oil effect on the chick's white blood cell counts, is it possible to apply oral gavage on chick as the enteral administration method?
2. Is there any suggestion on substance that affect overall blood cell count that doesn't need oral gavage administration like syringe usage ? we are prohibited from using heavy metal
3. If you have any reference about chick hematology-related research please let me know
Thank you
I am working on finding visualized flow graph of c program for that I want to get basic block form llvm and Clang.
I used 27F and 1492R primers to amplify bacterial 16S rDNA from intestinal digesta, cycling conditions include 1) 94 C for 3 mins; 2) 40 cycles of 94 C for 30s, 55 C for 30s, and 72 C for 1 min; 3) 72 C for 10 mins
After the PCR, the Nanodrop concentration of those PCR products were around 750 ng/ul. But after purification using the Invitrogen PCR purification kit, the product concentration was down to only 50 ng/ul. Is this normal? When I used the Qubit to quantify dsDNA, the concentration became around 15 ng/ul. Was this concentration too low?
I want to use the purified PCR product as my standard to build standard curves to quantify other bacteria (eg, Lactobacillus) concentration from gut content.
Thanks for sharing your thoughts or suggestions in advance!
If we take C*C on same time iteration we have penta-diagonal matrix where each and every element of matrix is penta-diagonal matrix ? and If we consider C(j)*C(j-1).it's become linear ?
If we have two inputs x1 increases linearly from 0 to 10 and x2 from 0 to 1, and we need the output x3=x2 for x1<5, and for x1> 5 we need x3 to keep the last value at x1=5. All this in C-block.
If I put a counter and a matrix to keep the values of x3, C-block starts counting every time step.
If you could help, I appreciate your time and effort,
Is there any source code in C/C++ to evaluate strings like eval() in Matlab and Python?
I have introduced a Triangular slot on patch... i have got the eq. ckt of triangular patch ( R L C in parallel)..but not getting of triangular slot. can anyone suggest the equivalent (in terms of RLC) for slot.
Thanks
Nitin
Hi there,
Is there any scientists who are doing some researches on exosomes and know a good way to store the isolated exosomes? Basically, we store the exosomes with PBS in -80°C, but we are afraid that the exosomes will be distroyed if stored in -80°C. Therefore, I am wondering if there are some good ways for the storage of exosomes, such as a specific buffer or something like that?
Many thanks!
Hi,
I have the Thermo Scientific HAAKE viscotester C, L-Version spindles, Type 399-0301, Serial No. 1110301006. I used it to measure the viscosity of different liquids using different spindles but at the same rpm. What is the conversion factor to calculate the viscosity of the different fluids since I used different spindle for different liquids. Kindly assist me with the conversion factors to calculate the viscosity depending on the spindle used.
Thank you for your anticipated assistance.
I have an instrument for which I colect data for the scales A and B. My final score it will be the scale C, which is a difference between A and B.
For the validation process, shoud I include the scales A and B, or only scale C?
If you have any examples for this, please let me know.
Thank you!
What is the funtion of C/N ratio or organic matter conent in determing the presence of a plant?
I need to assign a structure that has a Cl but my 1D and 2D aren't helping much.
Polymerase X has a half time of y hours at 95°C and z hours at 99°C
Hi all
During hot press I am facing major problems in EPDM composites fabrication. Mixing temperature: 190 degree C for 15 minutes and hot press 200 degree C,. After the hot press, the EPDM cross composite material is sticking with the PI sheets placed up and down of the mould. How to get rid of this problem?. Does anybody have any suggestion?. I haven't added DCP. Is it because of absence of DCP in the cross composites? if yes, Can let me know what is right time to add DCP during mixing and at what temperature?
Regards
I call on the assistant of all researcher in the site to help out with the article of "Jones, M. C. (2000). on A skew t distribution."
I have a complex metallic Alloy (Al-Cu-Fe) sample that is amorphous (solid and liquid) at 800'C which crystallization happens during the cooling process at 650'C. Can anyone help me to explain what is the reason behind this phenomena?
How can i calculate the thermal limit capacity of transmission line (data known with me (R, L, C ) and voltage rate in my work?
Unfortunately, I had to stope expression process for about 5 months and after this delay time I had to again to do some change in expression conditions I mean against before I used 25◦C to participate bacterial suspension. But after purification step, there was no band in SDS PAGE. I don’t know what is the wrong? Is this possible that this change in centrifugation temperature caused I lost my protein? My protein is HIV-1 Tat and Expression temperature is 37◦C for 4 hours and I use BL21DE3 and PET28(a).
do you have any idea? Please?
Unfortunately, I had to stope expression process for about 5 months and after this delay time I had to again to do some change in expression conditions I mean against before I used 25◦C to participate bacterial suspension. But after purification step, there was no band in SDS PAGE. I don’t know what is the wrong? Is this possible that this change in centrifugation temperature caused I lost my protein? My protein is HIV-1 Tat and Expression temperature is 37◦C for 4 hours and I use BL21DE3 and PET28(a).
Hello,
Did anyone ever asses adipogenesis using the adiponectin ELISA kit from thermo fisher?How does it work?
Is it ok to store the cell supernatant inside eppendorf at -80°C until use?
Thanks
Benedetta
I'm looking for this article, THOM, E. C. The discomfort index, Weatherwise, v.12, v.2, p.57-61, 1959, however I didn't find it.
Does anyone can help me?
Thanks
Separation of epoxides using a B-bex column with acetonitrile as solvent and deterctor FID. The conditions are: oven temperature-max 70 ° C, injector 280 ° C, detector 220 ° C, pressure 38 psi. I used the method around 30 injections, all normal, when finishing one of them, the baseline jumps and generates a lot of noise, from there, in all the chromatograms the baseline shows the temperature ramp that I use. What happened to the column?
Blue line - normal chromatogram. Green line - first time it appears.
Purple line and aquamarine - chromatograms after the jump

So i have values of L and C here. And I need to length and width. Expressions are there in the file. But i am not able to understand how they calculated. So can someone please explain me how they got length and width of L and C using that root-searching program developed in this paper?
By default if we use command graycomatrix the resultant we get is 8*8 matrix, But depending upon the problem this matrix should be changed
I would like to know how to implement the basic concept of LBP operator with uniform patterns. I have implemented the basic concept of LBP operator in MATLAB. Now I am using the concept of uniform pattern.
The problem is that I am not able to understand the basic concept of LBP with uniform patterns. How exactly should it be done? Is there any documentation available which can help me?
One of the most challenging aspects of developing the previous version of ForTrilinos was devising a reference-counting scheme to ensure safe type finalization in Fortran and corresponding object destruction in C++. It's interesting to see that the SWIG-generated file forepetra.f90 on the new develop branch contains an Epetra_Object derived type with a type(c_ptr) component. Will that component become associated with the C++ object that the Fortran object shadows? Given that there's no final subroutine on the type, is there a strategy to avoid memory leaks and dangling pointers? How will the C++ code get notified when the Fortran object goes out of scope so that C++ knows its safe to destroy the object? How will the Fortran code get notified if C++ destroys the object?
What will happen with an expression such as
type(Epetra_Object) :: a,b,c
a = f(b) + g(c)
where f and g are functions that have Epetra_Object results containing c_ptr components that presumably are associated with C++ objects that were instantiated at the direction of Fortran inside each function. After the above assignment completes, the Fortran code no longer has a name associated with the two function results so the Fortran program has no way to direct C++ to destroy the corresponding C++ objects.
Damian
Shaft speed is 3000 rpm and should carry 400 hp.
Hello everyone,
I want to measure the total nitric oxide in a serum sample using Total Nitric Oxide Assay Kit (enzo life sciences) and my question is about the proper storage procedure for the samples; do I have first to dilute and deproteinize the samples before storing them at -80 C ? or can I store serum samples at -80 C and perform the dilution and deproteinization step directly before the assay ?
Thanks in advance!
In POSIX multithreading, how can I provide high priority to my c program executable among other system processes? I have assigned priority to the threads using "pthread_attr_setschedparam()" by FIFO & RR, but I have failed to reduce scheduling delays while executing the algorithm. When the execution(performance) of the program is analyzed using perf tool the CPU idle time is high compared to its non-threaded counterpart of the algorithm. I am using Ubuntu on Intel i5 processor based system. Is there any other solution to overcome this problem? Whether using an RTOS will help? Is there an RTOS suitable for multicore system and what kind of development environment is required?
Hello,
I am using TriLink's Mutagenesis dNTP mix to perform EPR on a 1.3 kb fragment. I have been unable to observe a PCR product when following their recommended cycling parameters. I am able to successfully amplify my product using Phusion so my template and primers seem to be fine.
Cycling Conditions:
95 C - 3 min - Initial denaturation
92C- 1 min/53 C - 1.5 min/72 C - 5 min x 30
72 C - 10 min - Final extension
Components: 10x PCR buffer, 500 nM Forward/Reverse Primer, 10 fmol template, Mutagenesis dNTP mix, 2 mM MgCl2, Taq (5U/uL), water up to 25 uL
Any troubleshooting tips?
Let $M$ be a totally real submanifolds of product Kaehler manifold
$\overline{M}(c_{1}, c_{2}) = \overline{M}^{n}(c_{1}) \times \overline{M}^{p}(c_{2})$
with $c_{1}$, c_{2} > 0 and tr(P - Q) = 0, where $P$ and $Q$ are the projection operators of the tangent space of $\overline{M}(c_{1}, c_{2})$ to the tangent spaces of $\overline{M}^{n}(c_{1})$ and $\overline{M}^{p}(c_{2})$ respectively. Can $M$ be a totally geodesic in $\overline{M}(c_{1}, c_{2})$ ?
OR
Can $M$ be a totally geodesic submanifold of $\overline{M}(c_{1}, c_{2})$ under certain other conditions ?
I wanna to find the modulus from ultrasonic pulse velocity or (ASTM C 597)
I am working on Processor-Pool model for a project. Here are some assumptions:
1. Users have a low-end system.
2. They want to use an application which requires high-end workstations.
3. They need real-time graphic(visual) updates.
I was wondering if it is possible to do this without screen capture or TeamViewer, or RealVNC, or Red5 like software. I came across an idea to develop a network display model through the following method:
a. The user has a small software installed on their system which is connected via sockets to the server. Each user input is sent to the server(This is where Processor Pool model come into play).
b. Like cloud gaming services, the input is processed and the display is generated. But instead of sending video output we generate a file which is sent to the user.
c. The user receives this file and the small software installed on his system generates the final display output.
Now my question is what might be the extension of file highlighted above. Conventionally we have the file with extensions like JPG/ AAC/ H.265 codec/ etc.
Is it possible to generate a JSON for the file and which when received by the software at the user end generates the desired display output?
Please post your queries, if you have any. I am looking forward to discussing with all the great people out there.
Note: I am not looking for Screen Capture solutions. And a big TIA
in the link of github sha transform has two arguments ctx and byte data[], what is data[] meant for and in the next line wat is i and j and why shifts are done of 24,16,8 and why j added with 3
next step what states mean here and according to what i know that first 16 rounds would be copying the m[16] and next 48 that computations of sigma and all would be done but in this program why direct 64 rounds that are done and iteration starting from 0 to 64
what are bitlen and bitdata referring too...whybilen added with 512 in if part
and atlast final is completely a grrek for me i could understand is somewhere padding is done but why if and else part are done with 56 and 64 i donno
and why memset has been used . at last step appending to padding tha message in bits and transform and last steps are completely out of my head now....sorry to ask the question mant times but need some guidance to understand and to work on because im not so strong in c
i have gone through all this links..but im not understanding the link which i have uploaded..i have to make changes in opencl code thta is implemented in sha256.for that proper undestanding of sha256 is needed..in the link which i uploaded can anyone help in explaing me wat happens in the program.
Do x,y,z values defined in UDF take the same x,y,z values of the main geometry in Fluent or does it depend on some flow like x is always for fluid flow etc?
Also, how to know if the UDF follows the origin of the required boundary surface ?
Attached is the UDF I have tried to code.
#include "udf.h"
DEFINE_PROFILE(inlet_temp,thread,position)
{ float x[ND_ND]; /*hold position vector*/
float y;
float r;
float x2;
float y2;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
y=x[1];
x2=pow(x[0],2);
y2=pow(x[1],2);
r=pow(x2+y2,0.5);
F_PROFILE(f,thread,position)=/*..r*/;
}
end_f_loop(f, thread)
}
I want to know if there is any IDE for C/C++ which could help in easy debugging of a large C/C++ project in Mac.
I have tried Netbeans but it doesn't help although there is debugging process there but as it encounters any error it stops all of a sudden without giving any details about the line number where error is occurring.
I would like to emulate various n-bit binary floating-point formats, each with a specified e_max and e_min, with p bits of precision. I would like these formats to emulate subnormal numbers, faithful to the IEEE-754 standard.
Naturally, my search has lead me to the MPFR library, being IEEE-754 compliant and able to support subnormals with the mpfr_subnormalize() function. However, I've ran into some confusion using mpfr_set_emin() and mpfr_set_emax() to correctly set up a subnormal-enabled environment. I will use IEEE double-precision as an example format, since this is the example used in the MPFR manual:
mpfr_set_default_prec (53);
mpfr_set_emin (-1073); mpfr_set_emax (1024);
The above code is from the MPFR manual in the above link - note that neither *e_max* nor *e_min* are equal to the expected values for `double`. Here, p is set to 53, as expected of the double type, but e_max is set to 1024, rather than the correct value of 1023, and e_min is set to -1073; well below the correct value of -1022. I understand that setting the exponent bounds too tightly results in overflow/underflow in intermediate computations in MPFR, but I have found that setting e_min exactly is critical for ensuring correct subnormal numbers; too high or too low causes a subnormal MPFR result (updated with mprf_subnormalize()) to differ from the corresponding double result.
My question is how should one decide which values to pass to mpfr_set_emax() and (especially) mpfr_set_emin(), in order to guarantee correct subnormal behaviour for a floating-point format with exponent bounds e_max and e_min? There doesn't seem to be any detailed documentation or discussion on the matter.
Here is a small program which demonstrates the choice of e_max and e_min for single-precision numbers.
#include <iostream>
#include <cmath>
#include <float.h>
#include <mpfr.h>
using namespace std;
int main (int argc, char *argv[]) {
cout.precision(120);
// Actual float emin and emax values don't work at all
//mpfr_set_emin (-126);
//mpfr_set_emin (127);
// Not quite
//mpfr_set_emin (-147);
//mpfr_set_emax (127);
// Not quite
//mpfr_set_emin (-149);
//mpfr_set_emax (127);
// These float emin and emax values work in subnormal range
mpfr_set_emin (-148);
mpfr_set_emax (127);
cout << "emin: " << mpfr_get_emin() << " emax: " << mpfr_get_emax() << endl;
float f = FLT_MIN;
for (int i = 0; i < 3; i++) f = nextafterf(f, INFINITY);
mpfr_t m;
mpfr_init2 (m, 24);
mpfr_set_flt (m, f, MPFR_RNDN);
for (int i = 0; i < 6; i++) {
f = nextafterf(f, 0);
mpfr_nextbelow(m);
cout << i << ": float: " << f << endl;
//cout << i << ": mpfr: " << mpfr_get_flt (m, MPFR_RNDN) << endl;
mpfr_subnormalize (m, 1, MPFR_RNDN);
cout << i << ": mpfr: " << mpfr_get_flt (m, MPFR_RNDN) << endl;
}
mpfr_clear (m);
return 0;
}
With thanks,
James
Hi
I have a problem in my transformation part of project
after preparation of competent cells and transformation nothing growth in plates
protocol of competent cell is this
5ml of renewed bacteria in LB broth in certain OD
centrifuge 3000rpm 3min - remove liquid part
add 1ml of CaCl2 and re suspend .incubate 30 mins on ice
centrifuge 3000rpm 3min - remove liquid part
add 670 MicL CaCl2 and re suspend . incubate 30 mins on ice
centrifuge 3000rpm 3min - remove liquid part
add 300 MicL of CaCl2
incubate on ice 30mins
heat shock 45sec in 42`C
immediately transfer tube on ice 2mins
add 900 MicL LB medium
incubate 4 hours in falcon tube in 37`C shaking 190 rpm
then culture in this medium :
LB Agar + Kana(50Micg/Ml) + tetra (10Micg/Ml)+ 100micg/ML X-Gal)+7micg/Ml gentamycin + 40 micg/ml IPTG
but nothing growth after 48hour in 37`C
what is your advise or where is the problem
I have been looking at the "convolutionSeparable" code sample provided with CUDA 7.5, for the implementation of a 2-D FIR filter for image processing.
The rationale behind the design is discussed in the link.
Has anybody else looked closely at this code and found possible improvements or have any other comments/thoughts?
Let f be an involutive (f(f(x)) = x) function from R>0 to R>0 such that f(1) = c, (then f(c) = 1).
I have obtained the following f(f(x)f(y))/xy = f(xy)/f(x)f(y), by setting f(y) = 1, we get f(xy) = f(x)/y. How to prove that this is valid for all y>0?
I have used the injectivity of f. Note that f is a bijection, and f(y) = 1 for y = c.
The function in the question is f(x) = c/x.
Hello Everyone,
I want to scale down a 16 bit unsigned data into a range of 0 to 255 in C.
Can any body guide me how i can achieve this?
Looking forward for reply!
Best Regards
Awais
I need to import residual stress field into my model using the Predefined filed option and output database file. Everythin is ok until I need to start the calculation when it says; The following file(s) could not be located: "C:/....." . But file is there of course. Do you know maybe where is the poblem?
Best,
Darko
I have designed a testing approach to test integration fault of embedded system. I have already created the test criteria. But now i need to go for experimentation but i do have any sample code. I need some real C code which i can execute with test cases. I tried to search in many sites but did not get suitable code.
What should i do now? Because without execution i cannot collect the test result. Please share your idea.
Thank you.
In many articles, the transmitter sends data with a rate (R)<the outage capacity(C), and then the receiver can correctly decode the codewords.
If there is only 5 bits, and these bits are all destroyed by the noise. So, how the receiver recovers them? Because the noise is randomly.
Hello Everyone,
I want to implement elliptical low pass filter in C.
But i am finding difficulty in it.
Can any one please guide me how i can implement it?
Looking forward for your reply.
Best regards
Awais
I want to extract data directly from LIRT/HRIT data received from GOES Satellites and be able to process the fields in it. Maybe a reference of the standard data codification in LRIT/HRIT files will be also helpful for me.
I found bouncy castle, is that preferable?
Vibation analyzer in Measurement, Diagnosis and Speech Recognition use a state machine for event-driven control. Which programming language is the best for a software-state-machine in event-driven audiosignalprocessor?
I work on CORDIC-based DCT Structures and I want to know the main difference between Unfolded CORDIC and Lookahead CORDIC structures. Is there any difference between these structures?. These structures have been described in the following references.
[1] M.-W. Lee, J.-H. Yoon, and J. Park, "Reconfigurable CORDICbased low-power DCT architecture based on data priority," VeryLarge Scale Integration (VLSI) Systems, IEEE Transactions on, vol. 22, pp. 1060-1068, 2014.
[2] C.-C. Sun, S.-J. Ruan, B. Heyne, and J. Goetze, "Low-power and high-quality Cordic-based Loeffler DCT for signal processing,"Circuits, Devices & Systems, IET, vol. 1, pp. 453-461, 2007.
I'm looking for Linux command-line tools (or, even better, routine libraries in C/Fortran/Pascal) calculating knowledge-based protein structure quality scores. I know procheck - that'll suit me well, but I do not need the multitude of PostScript plots it creates, because I am looking forward to process millions of protein conformations and to obtain a robust ranking by this knowledge-based "goodness" score, in complement to classical force field energies. Do you have any knowledge of a way to switch .ps file generation off in procheck? Do you know other similar tools which just focus on scoring, not on detailed reporting?
I am optimizing an organic molecule on a CdSe cluster with Gaussian. However, the organic molecule is completely dissociated to its atoms in the final geometry. I am not sure about the basis set of Se. I have also tried the 6-31G basis for Se but I have the same result.
here is the input file
1 1
Cd 0.44201800 3.32548000 -0.38103700
Se 1.77943700 5.41809200 0.42354100
Se 1.57838900 1.12282200 0.43872800
Se -2.04088600 3.44451900 0.41648100
Cd 4.26234600 5.29905600 -0.37396700
Cd 4.06129800 1.00378400 -0.35878100
Cd 0.24097100 -0.96978900 -0.36585100
Cd -3.17725700 5.64717800 -0.40328400
Cd -3.37830600 1.35190600 -0.38809900
Se 5.39873800 3.09639500 0.44576500
Cd 7.88157800 2.97736200 -0.35171600
Se 5.19767900 -1.19887200 0.46095700
Cd 7.68055000 -1.31791100 -0.33653900
Cd 3.86024800 -3.29148700 -0.34360200
Se 1.37734100 -3.17244900 0.45391100
Se -2.24193600 -0.85075400 0.43166700
Cd 0.03992200 -5.26506000 -0.35066500
Cd -3.57935300 -2.94336500 -0.37291300
Se -5.66016200 5.76621400 0.39423300
Cd -6.99758400 3.67360100 -0.41034400
Se -5.86120900 1.47094200 0.40942100
Cd -7.19863200 -0.62166800 -0.39516000
Se 9.21905900 5.06997500 0.45285000
Se 9.01801000 0.77469500 0.46803600
Se 8.81695100 -3.52057400 0.48322500
Cd 7.47951900 -5.61318300 -0.32135800
Se 4.99662400 -5.49414400 0.47615900
Se -2.44298400 -5.14602400 0.44685400
Se -6.06225900 -2.82432900 0.42460600
Cd -7.39968100 -4.91693900 -0.37997300
Se -9.48048900 3.79263900 0.38717400
Se -9.68153800 -0.50263100 0.40235900
Se -9.88258500 -4.79790300 0.41754500
H 10.53166000 4.79103000 -0.22125300
H 10.31229300 0.73905500 -0.27810300
H 10.17197100 -3.50791000 -0.15120800
H -10.44276800 -6.08635800 -0.11884900
H -10.18311300 -1.79294200 -0.18051200
H -9.79474600 2.33395800 0.20839800
C -4.54000088 -1.38915111 -2.57307321
C -3.27539888 -1.91048011 -2.57303221
C -2.10958788 -1.07805311 -2.57304621
C -2.32662788 0.34240089 -2.57308921
C -3.59697288 0.88197689 -2.57312421
C -4.74684188 0.03606289 -2.57313321
C 0.49572012 0.34240089 -2.57307621
C 0.27868012 -1.07805311 -2.57302921
C 1.44449012 -1.91048011 -2.57298921
H 1.27521112 -2.98067111 -2.57292121
C 2.70909212 -1.38915211 -2.57301421
C 2.91593412 0.03606189 -2.57309321
C 1.76606512 0.88197689 -2.57309721
H -5.38856388 -2.05818911 -2.57301021
H -3.10611888 -2.98067011 -2.57296921
H -3.71511288 1.95693089 -2.57318421
H 3.55765512 -2.05819011 -2.57293521
H 1.88420512 1.95692989 -2.57313321
S -0.91545388 1.48302789 -2.57310821
N -0.91545388 -1.69791411 -2.57301221
C -7.18936988 -0.31836711 -2.57341621
C -6.20880388 2.01966989 -2.57289821
H -7.21172088 -0.95315611 -1.68118021
H -8.08499788 0.30027589 -2.57407021
H -7.21088288 -0.95374111 -3.46524321
H -5.76981188 2.48001089 -1.68069621
H -5.77021388 2.48032089 -3.46514321
H -7.27720988 2.22744389 -2.57261121
C 5.35846212 -0.31836611 -2.57321721
C 4.37789512 2.01966989 -2.57294621
H 5.38006512 -0.95378711 -3.46500821
H 6.25409012 0.30027789 -2.57381321
H 5.38072612 -0.95310711 -1.68094521
H 3.93908312 2.48028989 -3.46509621
H 3.93912312 2.48004089 -1.68064921
H 5.44630112 2.22744489 -2.57294521
N -6.00221388 0.55965989 -2.57318121
N 4.17130612 0.55965989 -2.57314521
X 1 F
X 2 F
X 3 F
X 4 F
X 5 F
X 6 F
X 7 F
X 8 F
X 9 F
X 10 F
X 11 F
X 12 F
X 13 F
X 14 F
X 15 F
X 16 F
X 17 F
X 18 F
X 19 F
X 20 F
X 21 F
X 22 F
X 23 F
X 24 F
X 25 F
X 26 F
X 27 F
X 28 F
X 29 F
X 30 F
X 31 F
X 32 F
X 33 F
X 34 F
X 35 F
X 36 F
X 37 F
X 38 F
X 39 F
H N S 0
6-31+G*
****
Cd Se 0
LANL2DZ
****
Cd Se 0
LANL2DZ
Hi, I am working on sliding mode controller in robotic manipulators. Does anybody know how to write the code in c language? Please help me.
Do you know any open source tool to migrate C to Java?
Please give an opinion for my question, thank you.
How to implement abstraction mechanism in c++ , what are the different types of abstraction mechanisms? I need some examples to understand.
Result: The number of compositions of 2n, say c_1+c_2+...c_k=2n, satisfy that Sum_(i=1..j) c_i <2j for all j=1..k is equal to C(2n-1, n), i.e., the number 2n-1 choose n.
E.g., when n=2, C(3, 2)=3 because we can write 4=1+1+1+1=1+1+2=1+2+1.
Is there an easy way to prove it directly?
close all
clear all
clc
a= rand(1e6,1);
b= rand(1e6,1);
c= zeros(size(a));
tic
tstart=tic;
for i=1:length(a)
c(i)=a(i)+b(i);
d(i)=c(i)+b(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
e(i)=d(i)+c(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
c(i)=a(i)+b(i);
d(i)=c(i)+b(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
e(i)=d(i)+c(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
c(i)=a(i)+b(i);
d(i)=c(i)+b(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
e(i)=d(i)+c(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
end
t_normal_for=toc(tstart)
tstart=tic;
parfor i=1:length(a)
c(i)=a(i)+b(i);
d(i)=c(i)+b(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
e(i)=d(i)+c(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
c(i)=a(i)+b(i);
d(i)=c(i)+b(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
e(i)=d(i)+c(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
c(i)=a(i)+b(i);
d(i)=c(i)+b(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
e(i)=d(i)+c(i)*a(i)+b(i)/a(i)+b(i)*a(i)+b(i);
end
t_parfor=toc(tstart)
How can I locate and distinguish between the N and C terminal in a Xray crystallographic structure of a protein in pdb?
Theses days, I am doing literature review about the new trends in control of nonlinear systems, but it looks like this is a very broad subject. What are the new research areas in the control of such systems?
SupposeIi have a server program which is written in java, and the client program in C. How can I establish a communication link between them using TCP connection?
Here are my codes:
if i want to do this addition 11+22 upon clicking on = button it should give me 33 but it does not work. the calculator must be able to perform addition correctly please help?
ActivityMain <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
tools:context=".MainActivity" />
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/editText1"
android:layout_marginTop="36dp"
android:text="1"
android:onClick="btn1Click"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btn1"
android:layout_alignBottom="@+id/btn1"
android:layout_toRightOf="@+id/btn1"
android:text="2"
android:onClick="btn2Click" />
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btn2"
android:layout_alignBottom="@+id/btn2"
android:layout_toRightOf="@+id/btn2"
android:text="3"
android:onClick="btn3Click"/>
<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/btn1"
android:layout_marginTop="15dp"
android:text="4" />
<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btn4"
android:layout_alignBottom="@+id/btn4"
android:layout_toRightOf="@+id/btn4"
android:text="5" />
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn3"
android:layout_alignParentRight="true"
android:text="+"
android:onClick="btnAddClick"/>
<Button
android:id="@+id/btnSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn5"
android:layout_alignParentRight="true"
android:text="-"
android:onClick="btnSubClick"/>
<Button
android:id="@+id/btnDiv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView1"
android:layout_alignParentRight="true"
android:text="/" />
<Button
android:id="@+id/btnMul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/btnDiv"
android:layout_marginTop="14dp"
android:text="*" />
<Button
android:id="@+id/btnEqual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/btnMul"
android:layout_marginTop="15dp"
android:text="="
android:onClick="btnEq"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/editText1"
android:gravity="right"
android:textAppearance="?android:attr/textAppearanceLarge" />
public class MainActivity extends Activity {
Button btn1;
Button btn2;
Button btn3;
Button btnAdd;
Button btnSub;
String btn_val1;
String btn_val2;
String btn_val3;
String btn_valAdd;
String btn_valSub;
EditText edit_text;
TextView textview;
int res;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void btn1Click(View view)
{
btn1 = (Button) findViewById(R.id.btn1);
btn_val1 = btn1.getText().toString();
textview = (TextView) findViewById(R.id.textView2);
textview .append(btn_val1);
}
public void btn2Click(View view)
{
btn2 = (Button) findViewById(R.id.btn2);
btn_val2 = btn2.getText().toString();
textview = (TextView) findViewById(R.id.textView2);
textview .append(btn_val2);
}
public void btn3Click(View view)
{
btn3 = (Button) findViewById(R.id.btn3);
btn_val3 = btn3.getText().toString();
textview = (TextView) findViewById(R.id.textView2);
textview.append(btn_val3);
}
public void btnAddClick(View view)
{
btnAdd = (Button) findViewById(R.id.btnAdd);
//res = Integer.parseInt(btn_val1) + Integer.parseInt(btn_val2) + Integer.parseInt(btn_val3);
btn_valAdd = btnAdd.getText().toString();
textview = (TextView) findViewById(R.id.textView2);
textview.append(btn_valAdd);
}
public void btnSubClick(View view)
{
btnSub = (Button) findViewById(R.id.btnSub);
//res = Integer.parseInt(btn_val1) - Integer.parseInt(btn_val2) - Integer.parseInt(btn_val3);
btn_valSub = btnSub.getText().toString();
textview = (TextView) findViewById(R.id.textView2);
textview.append(btn_valSub);
}
public void btnEq(View view)
{
textview = (TextView) findViewById(R.id.textView2);
if(btnAdd != null)
{
if(btn_val1 != null && btn_val2 != null )
{
res = Integer.parseInt(btn_val1) + Integer.parseInt(btn_val2);
textview.setText(String.valueOf(res));
}
else if(btn_val1 != null && btn_val3 != null)
{
res = Integer.parseInt(btn_val1) + Integer.parseInt(btn_val3);
textview.setText(String.valueOf(res));
}
else if(btn_val2 != null && btn_val3 != null)
{
res = Integer.parseInt(btn_val2) + Integer.parseInt(btn_val3);
textview.setText(String.valueOf(res));
}
else if(btn_val1 != null && btn_val2 != null && btn_val3 != null)
{
res = Integer.parseInt(btn_val1) + Integer.parseInt(btn_val2) + Integer.parseInt(btn_val3);
textview.setText(String.valueOf(res));
}
}
else if(btnSub != null)
{
res = Integer.parseInt(btn_val1) - Integer.parseInt(btn_val2) - Integer.parseInt(btn_val3);
textview.setText(String.valueOf(res));
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}