[Solved] Pointer array and structure in C

[ad_1] struct a s1={“Hyderabad”,”Bangalore”}; assigns “Hyderabad” to ch and “Bangalore” to str. printf(“\n%c%c”,s1.ch[0],*s1.str); prints the first character of the strings. Since ch is an array, ch[0] represents its first character. Since str is a character pointer, it points to the first character of a string here. So, *s1.str will have value ‘B’ printf(“\n%s%s”,s1.ch,s1.str); simply prints … Read more

[Solved] JavaScript get event with closure function?

[ad_1] Why not directly access e inside the function <script> a[i].addEventListener(“keydown”,(function(){ var index=i; return function(e){ if (e.keyCode == 13 && !e.shiftKey){ console.log(this); console.log(e); console.log(index); } }; })(), false); Working 16 [ad_2] solved JavaScript get event with closure function?

[Solved] Confusion regarding Handling of Different Pointers by Compiler

[ad_1] Maybe a concrete example would help. Try this: #include <stdio.h> const double step_size = 5.0; // degrees of arc struct Location { double latitude; double longitude; }; void go_north(struct Location *const loc) { loc->latitude += step_size; } int main() { struct Location there; there.latitude = 41.0; there.longitude = -101.5; go_north(&there); printf(“Lat. %6.1f, long. %6.1f.\n”, … Read more

[Solved] easiest way to connect paypal to my own shopping kart [closed]

[ad_1] Paypal express is the cheapest & easiest solution, particularly if you want to store information in your database about whether or not the transaction was successful. If all you need is button functionality, you can use the paypal api to generate dynamic buttons. Just see – https://www.x.com/developers/paypal/products/button-manager [ad_2] solved easiest way to connect paypal … Read more

[Solved] How to format isoDateTime to dd/m/yyyy

[ad_1] You could use this: var str=”2012-03-23 00:00:00″; function convert(a){ a=a.split(‘ ‘)[0].split(‘-‘); var ret=[]; for(var i=a.length;0<=–i;){ ret.push(1===i?parseInt(a[i],10):a[i]) } return ret.join(“https://stackoverflow.com/”); } alert(convert(str)); Demo: http://jsfiddle.net/ehaCv/ 0 [ad_2] solved How to format isoDateTime to dd/m/yyyy

[Solved] What Perl variables are used for the positions of the start and end of last successful regex match? [closed]

[ad_1] As the perlvar man-page explains: $+[0] is the offset into the string of the end of the entire [last successful] match. This is the same value as what the pos function returns when called on the variable that was matched against. $-[0] is the offset of the start of the last successful match. [ad_2] … Read more

[Solved] JS, how to stop process execution if it’s beeing executed …?

[ad_1] Try this little constructor: function MyForm() { this.check = false; this.form = function(){ var f = this; $(‘#form’).submit(function(e){ e.preventDefault if( f.check === false ) { f.check = true; $.ajax({ …blah blah success: function( data ) { //if you want to let them send again, uncomment this next line //f.check = false; } }) } … Read more

[Solved] Get a webpage ‘object’ in Javascript [closed]

[ad_1] Have a look at PhantomJS Here is an example, getting some elements from a webpage: var page = new WebPage(), url=”http://lite.yelp.com/search?find_desc=pizza&find_loc=94040&find_submit=Search”; page.open(url, function (status) { if (status !== ‘success’) { console.log(‘Unable to access network’); } else { var results = page.evaluate(function() { var list = document.querySelectorAll(‘span.address’), pizza = [], i; for (i = 0; … Read more

[Solved] Testing a quadratic equation

[ad_1] Not sure what trouble you’re having. I wrote: public class Quad { public static void main(String[] args) { double a = Double.parseDouble(args[0]); double b = Double.parseDouble(args[1]); System.out.println(Math.abs(b/a – 200.0)); if (Math.abs(b/a – 200.0) < 1.0e-4) { System.out.println(“first one”); } else { System.out.println(“second one”); } } } And some output: animato:~/src/Java/SO$ java Quad 1 200 … Read more

[Solved] how to get sum(col2) as somename,(col2*col3)/Sum(col2) as somename1 for the some date

[ad_1] You can achieve what you’re after like below: CREATE TABLE SampleTable ([col1] varchar(1), [col2] int, [col3] int, [date] varchar(16)) ; INSERT INTO SampleTable ([col1], [col2], [col3], [date]) VALUES (‘a’, 11, 0, ‘3/6/2015:0:00:00’), (‘b’, 5, 4, ‘3/6/2015:0:00:00’), (‘c’, 5, 5, ‘3/6/2015:0:00:00’), (‘d’, 3, 0, ‘3/6/2015:0:00:00’), (‘e’, 21, 21, ‘3/6/2015:0:00:00’) ; SELECT t2.SumCol2, sum(t1.col2 * t1.col3) … Read more

[Solved] Why does the testing condition has no effect

[ad_1] The problem is that you are taking sloppy English and translating it literally to create broken C++. When you say: the character is not ‘N’ or ‘n’ this, while commonplace, is wrong. For the same reason, your C++ code is wrong. You are comparing getche() to ‘N’ || ‘n’, an expression which applies boolean-OR … Read more

[Solved] Javascript multiple loop with reference

[ad_1] JavaScript passes arguments by reference, so whenever you pass the array to your function you pass the same instance and add it to the result array. Hence they are all the same. An easy solution would be to build a new array inside of b and return that. var ss = []; var a … Read more

[Solved] Linked list program for student average

[ad_1] Heading Hi, I have not looked thoroughly in the code . But , in a quick look I spotted the following basic problem nextPtr should be a pointer, you are creating an instance and copying the contents of the next structure. This is not efficient. I will declare it as below struct listNode *nextPtr; … Read more