Vote count: 0 I have to write a program that writes a program that uses the heap to store an array. I have a problem where the program will crash after successfully ruing it... I also have some small aesthetic problems, the element needs to start at 1 and no comma on the last number that is printed. Can anyone help? #include #include int main() { int size = 0; int* num_elements; num_elements = (int*)malloc(sizeof(int)* 3); printf("How many int elements will you enter?"); scanf("%d", &size); prin...
ادامه مطلبVote count: 0 I have a byte array which i want to compress.(Size 400 byte on avg).I have two options.I keep an array of 400 byte and stuff bits in it.Finally say the compressed size is 300 byte so I use memcpy to copy those bytes to an array of size 300 and send. Else I can keep a vector and reserve 400 byte and use push_back.(Here i can avoid the memcpy). I get a huge number of arrays per second. So in a performance critical scenario which choice will give better performance? asked 1 min agoSay...
ادامه مطلبVote count: 0 This code is from osTicket, https://github.com/osTicket/osTicket/blob/1.9.x/main.inc.php, /**** static functions ****/ function start() { // Prep basic translation support Inteationalization::bootstrap(); if(!($ost = new osTicket())) retu null; //Set default time zone... user/staff settting will override it (on login). $_SESSION['TZ_OFFSET'] = $ost->getConfig()->getTZoffset(); $_SESSION['TZ_DST'] = $ost->getConfig()->observeDaylightSaving(); // Bootstrap installed plugins $ost->plu...
ادامه مطلبVote count: 0 I am new in PHP and now i'm facing a problem with arrays. I have two sets of arrays.I want to form a result array which contains all the mismatched elements in both the array. eg: array1=Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) array2=Array ( [0] => 1 [1] => 2 [2]=>9) result array what i'm expecting should be result array=Array([0] => 3 [1] => 4 [2] => 5 [3] => 9 ) edited 2 mins agoThamilan asked 3 mins agoofficial Let's block ads!...
ادامه مطلبVote count: 0 My Json response data is, [{"user_id":697,"provider":"Manual","user_image":"dummy_image.png"}] The JSONModel extended class looks like, @interface CILoginModel : JSONModel @property (assign, nonatomic)int user_id; @property (strong, nonatomic)NSString *provider; @property (strong, nonatomic)NSString *user_image; @end And the code, which I used to assign the JSONResponse values automatically to the CILoginModel's objects is, dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PR...
ادامه مطلبVote count: 0 I had a Program in c# which would run queries using a dynamically created string which would be used as a query. Now due to possibility of SQL injection, I want to use parameterized queries to generate the same. Was looking at Parameterized dynamic sql query and that is mostly what I want, but then I want multiple parameters in the same sequence and not in different sequences. i.e I want something like (Where value in ({0}, {1}, {2}), param0 , param1, param2 ) The answer in that th...
ادامه مطلبVote count: -1 I am trying to construct function which can retu array with at least 2 double values. Now, I have no idea to make it. asked 2 mins agoสุเมธ คุ้มภัยรัญ 1 Answer Vote count: 0 f is an automatic local variable, it will no longer exist once function retu. answered 9 secs agohaccks Let's block ads!...
ادامه مطلبVote count: 0 I am trying to create a new array from existing array. Condition is that if element is duplicate then sum those elements. Please see below example for details as may be I am not able to explain clearly: Input: var arrayA = ["2", "1", "4", "2", "5", "1", "3", "2"]; Output: var arrayB = ["6", "2", "4", "5", "3"]; here arrayB[0] = sum of 2s (2+2+2), arrayB[1] = sum of 1s (1+1) I tried a lot but not able to figure out how I can achieve this. Please help! asked 41 secs agoVicJordan Let'...
ادامه مطلبVote count: 0 Working on an ASP.NET website. I have a page where there are alot of dynamically created textboxes. In addition to these textboxes I link dynamic javascript calculations to certain textboxes as well. This is all database driven. For example.... (pseudo-code) textbox1 = "10" textbox2 = "4" textbox3 = textbox 1 + textbox 2 (displays "14") All of the textboxes are working great, dynamically calculating correctly, etc.... BUT, I need to format them with commas, if applicable. All of th...
ادامه مطلبVote count: 0 I have 2 files - first.html & second.html first.html - here the user will input a few fields: Name, Organization, JobTitle,... second.html - this will output only the fields that were typed by the user using a textarea field Purposer: My purpose is to (1) dynamically store all siblings of a particular span (id="spanBox") in an array and (2) to output all the element of that array using text area field in the second.html Clarifications: Let me just clarify what do I mean by "dynamic...
ادامه مطلبVote count: 0 While I was playing with PureScript, I found that I wanted to write a typeclass Sync that would wait for arbitrary asynchronous values to resolve in the Aff monad. The typeclass I wrote looked like this: class Sync s eff a where sync :: s -> Aff eff a Now I wanted to create Sync instance for a websocket coection, which would wait until the coection was open and available for reading/writing. The instance I wrote looked like this: instance syncCoection :: Sync Coection (ws :: WEBSOC...
ادامه مطلبVote count: 0 I have an old classic ASP application which I want to debug in Visual Studio 2012 in order to fix some issues. I am ruing on Windows 10 with IIS Version 10 (at least thats what I can see in the about window.) To enable debugging in the Properties Window->Start Option of Vs 2012 I have made it "Use Custom Server. Base Url:http://localhot". Here is the screen shot: At IIS level I have made sure I have ASP enabled as well as the server/client script debugging for the same. WindowsFeat...
ادامه مطلبVote count: 0 So I'm working on making an advanced delete script. The idea is the user inputs a grep regex for what needs to be deleted, and the script does an rm operation for all of it. Basically eliminates the need to write all the code directly in the command line each time. Here is my script so far: #!/bin/bash # Script to delete files passed to it if [ $# -ne 1 ]; then echo "Error! Script needs to be run with a single argument that is the regex for the files to delete" exit 1 fi IFS=$'n' f...
ادامه مطلبVote count: 0 I have one application , where I am using one jar called "A" which inteally refers to classes from another jar called "B", where jar "B" refers to classes from jar "C". how to execute java application while setting class path to A.jar and add classpath dependency of B.jar and C.jar in manifest file of A.jar. Thanks in advance asked 1 min agoRama Krishna Let's block ads!...
ادامه مطلبVote count: 0 I'm trying to get my sidebar ng-class to correctly see when the AppState service's state has changed. I change it be calling $scope.appState.toggleTips() from the one controller which should (and does) update the AppState.state.showTips property. What's strange is at this point BOTH the {'show-prism': appState.state.showPrism} and {'show-tips': appState.state.showTips} should be updated as they are both bound to the service AppState's values. They appear to be updated when I log th...
ادامه مطلبVote count: 0 I have 3 classes I need to write in Java. They are called Task1, Task2, and Task3, for arguments sake. The three tasks are exactly the same except that they are different "types" of tasks. So the field type for Task1 will be "Task1" and so on. Originally I wrote three classes with this one difference. But I think it would be better to write a base class Task and just extend this class in three subclasses [I am obviously somewhat new to Java]. However, I caot figure out how to do th...
ادامه مطلبVote count: 0 How would the scope work with Auth Tokens? I caot create my Retrofit instance until I can add an interceptor that signs it with my auth token. Therefore, I would like to create Retrofit when the auth tokens are available (after sign-in). How do I get scope working correctly in this situation? Thanks a lot! asked 2 mins agoChema Let's block ads!...
ادامه مطلبVote count: 0 After a recent upgrade in Idea I now get a ClassNotFoundException in code that just a day ago was working perfectly. I've googled the problem and it seems that others have similar issues, but the solutions proposed for them don't seem to work for me. I get that it's probably a classpath and/or gradle issue with the latest version of Idea, but I caot see exactly what the issue would be since I've only recently moved over to both Idea and Gradle from Eclipse and Maven. My general Jav...
ادامه مطلبVote count: 0 I am writing a Google form using a script so that I can pull the data from a Google spreadsheet and generate a page for each event based on a list of events which are of unknown length. I have worked out that I can create the pages I need using this loop, with my list of events, eventvalues : for (var i = 2; i < eventvalues.length; i+=1){ var page = form.addPageBreakItem().setTitle(eventvalues[i][0]);} I would like to end up with variables Page1 Page2 Page3 Etc all the way to event...
ادامه مطلبVote count: 0 I have a two dimensional array of string, called Words[ ][ ] Words[0][0] = compare [0][1] = view Words[1][0] = search [1][1] = gather Words[2][0] = input [2][1] = put Words[3][0] = specify [3][1] = direct Words[4][0] = select [4][1] = take Words[5][0] = take [5][1] = retu Words[6][0] = take [6][1] = direct Words[7][0] = take [7][1] = choose Words[8][0] = view [8][1] = print Words[9][0] = select [9][1] = take Words[10][0] = select [10][1] = choose Words[11][0] = take [11][1] = retu ...
ادامه مطلب