dynamic

Is character array in C dynamic?

a 夏天 提交于 2019-12-31 04:42:06
问题 I have written a simple program in C. A program to input a String and display it along with the length. #include<stdio.h> int main() { char a[4]; printf("Enter the name : "); gets(a); printf("\nThe name enterd is : %s",a); printf("\nLength of string is : %d",strlen(a)); getch(); return 0; } The program do not contain warning or error. At run-time I entered the value " melwinsunny " as input. There was no error and the result displayed was : Enter the name : melwinsunny The name entered is :

SQL Server : Pivot Multiple Aggregates

不羁岁月 提交于 2019-12-31 04:19:04
问题 I have been looking for an answer for a few hours about my problem. My current table: StudentName Course Correct Wrong Blank Score ------------------------------------------------- Student1 Math 38 2 0 95 Student1 English 45 5 0 90 ... Student2 Math 38 2 0 95 Student2 English 45 5 0 90 What I want is: Math English StudentName Correct Wrong Blank Score Correct Wrong Blank Score Student1 38 2 0 95 45 5 0 90 Student2 38 2 0 95 45 5 0 90` ... SELECT dbo.tbl_Students.StudentName, dbo.tbl

How would I dynamically create input boxes on the fly?

浪子不回头ぞ 提交于 2019-12-31 04:09:06
问题 I want to use the value of a HTML dropdown box and create that number of input boxes underneath. I'm hoping I can achieve this on the fly. Also if the value changes it should add or remove appropriately. What programming language would I need to do this in? I'm using PHP for the overall website. 回答1: Here is an example that uses jQuery to achieve your goals: Assume you have following html: <div> <select id="input_count"> <option value="1">1 input</option> <option value="2">2 inputs</option>

UNIX Script - setting dynamic variables (indirect variable reference)

[亡魂溺海] 提交于 2019-12-31 04:06:13
问题 How to set shell variables from an input file ? hello, I need to set dynamic variable from an .ini file in a shell script. Assume the input file is input.ini : var1=val1 var2=val2 var3=val3 In a script I want to set var1, var & var3 respectively to their val1, val2 & val3 to get echo $var1 val1 echo $var2 val2 ... I've tryed : file="input.ini" while IFS== read -r f1 f2 do eval dynvar=$f1 dynvar=$f2 done <"$file" echo $var1 echo $var2 echo $var3 the echo $varx commands give no output. How can

Issues with storage of facts in Prolog

喜夏-厌秋 提交于 2019-12-31 03:59:10
问题 I'm kinda new in Prolog and I'm using SWI-Prolog v6.6 to storage asserts in my *.pl file. :- dynamic fact/2. assert(fact(fact1,fact2)). With the code above I can make asserts and it works fine, but the problem is when I close SWI-Prolog and I open the *.pl file again, the asserts i've made are gone... There is a way to make asserts and those get stored even if I close the SWI-Prolog? Sorry about my bad english and Thanks! (: 回答1: Saving state has certain limitations, also see the recent

Can I use Jquery to insert a closing </tr> tag and an opening <tr> tag inside a dynamic table?

非 Y 不嫁゛ 提交于 2019-12-31 03:48:09
问题 I'm trying to use the code below to dynamically add closing tag followed by opening so that i creates a new row every three cells. Almost working, DOM inspector shows a TR node, problem is, something happens tr isn't closing the tr tag. I'm new to Jquery, is there anything I'm doing wrong with this code? <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('td:nth-child(3n)')

Dynamic Memory Allocation

人盡茶涼 提交于 2019-12-31 03:11:06
问题 I'm having trouble dynamically allocating memory for an array. I've been debugging for hours, any pointers? I posted the rest of the code. It is simply supposed to exchange the swap the first row with the second, and the third with the forth. I am getting strange results like: Enter string: hello Enter string: how are you Enter string: i'm good thanks Enter string: bye Enter string: bai Enter string: xx ========================= how are you !i'm good thanks hello !how are you bye !bai i'm

Grails using dynamic finders with 3x+ logical arguments

主宰稳场 提交于 2019-12-31 01:58:11
问题 I sucessfully managed to search in the database using this dynamic finder from Hibernate: def temp = User.findByNameAndStreet("name", "street") Although, i need a tripple logical argument like this: def temp = User.findByNameAndStreetAndCity("name", "street", "city") Any simple way to do it ? 回答1: The Grails dynamic finders don't support more than two predicates. This is because it's not clear whether User.findByNameAndAgeOrGender('foo', 12, 'm') means this: (name == 'foo' && age == 12) ||

dynamically creating tablelayout (android)

半城伤御伤魂 提交于 2019-12-30 21:35:41
问题 I want to create inner tablelayout and add there 1 row with 2 columns, following code shows nothing, why? Here's main activity: public class TestActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); TextView tv1 = new TextView(this); TextView tv2=new TextView(this); tv1.setLayoutParams

Very simple Java Dynamic Casting

人走茶凉 提交于 2019-12-30 20:32:49
问题 Simple question but I have spent over an hour with this. My code is below. I need to make SomeClass sc dynamic. So you pass the class name as a string in a function and use that class in place of static someClass. How to go about it? SomeClass sc; if (someOtherClassObject instanceof SomeClass){ sc=(SomeClass) someOtherClassObject; What I want is public void castDynamic (String strClassName){ //cast the classname referred by strClassName to SomeClass //if it is the instance of SomeClass } EDIT