Search Results

Search found 25343 results on 1014 pages for 'write protect'.

Page 99/1014 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • Without LIB And String file how can i write this code??

    - by muhammadlodhi
    #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct Node; typedef struct Node * PtrToNode; struct Node { char element; PtrToNode Next; }; PtrToNode MakeEmpty(PtrToNode L) { L= new(Node); L->Next=NULL; return L; } void Push(PtrToNode L,char x) { PtrToNode S; S= new(Node); S->element=x; S->Next=L->Next; L->Next=S; } char Pop(PtrToNode L) { PtrToNode P; P=L->Next; char x=P->element; L->Next=P->Next; free(P); return x; } int main() { PtrToNode L; L= MakeEmpty(NULL); char Input[1000]; int i; printf("please enter your equation:"); scanf("%s",Input); for (i = 0;i<strlen(Input);i++) { if (Input[i]=='(') { Push(L,Input[i]); } if (Input[i]==')') { if (L->Next==NULL) { printf("incorrect"); return 0; } else Pop(L); } } if (L->Next==NULL) printf("correct"); else printf("incorrect"); getch(); return 0; }

    Read the article

  • What is a better way to write this regular expression?

    - by rxgx
    I am converting XML children into the element parameters and have a dirty regex script I used in Textmate. I know that dot (.) doesn't search for newlines, so this is how I got it to resolve. Search language="(.*)" (.*)<education>(.*)(\n)?(.*)?(\n)?(.*)?(\n)?(.*)?</education> (.*)<years>(.*)</years> (.*)<grade>(.*)</grade> Replace grade="$13" language="$1" years="$11"> <education>$3$4$5$6$7$8$9</education> I know there's a better way to do this. Please help me build my regex skills further.

    Read the article

  • Java JTable, how to change cell data (write text in)?

    - by Bob Owuor
    Am looking to change a cell's data in a jtable. How can I do this? When I execute the following code I get errors. JFrame f= new JFrame(); final JTable table= new JTable(10,5); TableModelListener tl= new TableModelListener(){ public void tableChanged(TableModelEvent e){ table.setValueAt("hello world",2,2); } }; table.getModel().addTableModelListener(tl); f.add(table); f.pack(); f.setVisible(true); I have also tried this below but it still doesn't work. What gives? table.getModel().setValueAt("hello world",2,2);

    Read the article

  • Write a program for a report derived from the data in the data file JEWELRY. The data is to be input

    - by Taylor
    here is the JEWELRY file 0011 Money_Clip 2.000 50.00 Other 0035 Paperweight 1.625 175.00 Other 0457 Cuff_Bracelet 2.375 150.00 Bracelet 0465 Links_Bracelet 7.125 425.00 Bracelet 0585 Key_Chain 1.325 50.00 Other 0595 Cuff_Links 0.625 525.00 Other 0935 Royale_Pendant 0.625 975.00 Pendant 1092 Bordeaux_Cross 1.625 425.00 Cross 1105 Victory_Medallion 0.875 30.00 Pendant 1111 Marquis_Cross 1.375 70.00 Cross 1160 Christina_Ring 0.500 175.00 Ring 1511 French_Clips 0.687 375.00 Other 1717 Pebble_Pendant 1.250 45.00 Pendant 1725 Folded_Pendant 1.250 45.00 Pendant 1730 Curio_Pendant 1.063 275.00 Pendant this is the program i have used #include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; struct productJewelry { string name; double amount; int itemCode; double size; string group; }; int main() { // declare variables ifstream inFile; int count=0; int x=0; productJewelry product[50]; inFile.open("jewelry.txt"); // file must be in same folder if (inFile.fail()) cout << "failed"; cout << fixed << showpoint; // fixed format, two decimal places cout << setprecision(2); while (inFile.peek() != EOF) { // cout << count << " : "; count++; inFile>> product[x].itemCode; inFile>> product[x].name; inFile>> product[x].size; inFile>> product[x].amount; inFile>> product[x].group; // cout << product[x].itemCode << ", " << product[x].name << ", "<< product[x].size << ", " << product[x].amount << endl; x++; if (inFile.peek() == '\n') inFile.ignore(1, '\n'); } inFile.close(); string temp; bool swap; do { swap = false; for (int x=0; x<count;x++) { if (product[x].name>product[x+1].name) { //these 3 lines are to swap elements in array temp=product[x].name; product[x].name=product[x+1].name; product[x+1].name=temp; swap=true; } } } while (swap); for (x=0; x< count; x++) { //cout<< product[x].itemCode<<" "; //cout<< product[x].name <<" "; //cout<< product[x].size <<" "; //cout<< product[x].amount<<" "; //cout<< product[x].group<<" "<<endl; } system("pause"); // to freeze Dev-c++ output screen return 0; } // end main

    Read the article

  • Loading Unmanaged C++ in C#. Error Attempted to read or write protected memory

    - by Thatoneguy
    I have a C++ function that looks like this __declspec(dllexport) int ___stdcall RegisterPerson(char const * const szName) { std::string copyName( szName ); // Assign name to a google protocol buffer object // Psuedo code follows.. Protobuf::Person person; person->set_name(copyName); // Error Occurs here... std::cerr << person->DebugString() << std::endl; } The corresponding C# code looks like this... [DllImport(@"MyLibrary.dll", SetLastError = true)] public static unsafe extern int RegisterPerson([MarshalAs(UnmanagedType.LPTStr)]string szName) Not sure why this is not working. My C++ library is compiled as Multi Threaded DLL with MultiByte encoding. Any help would be appreciated. I saw this is a common problem online but no answers lead me to a solution for my problem.

    Read the article

  • How to read & write contents of a div from localstorage in chrome extensions?

    - by Minas Abovyan
    I am trying to build an extension that will allow users to put some parameters into a text box in the popup, generate a link using that information and add it to the said popup. I have all that working, but needless to say, it gets flushed every time the user opens the extension anew. I'd like the info that has been put in there to stay, but can't seem to get it to work. Here's what I have thus far: manifest.json { "manifest_version": 2, "name": "Test", "description": "Test Extension", "version": "1.0", "permissions": [ "http://*/*", "https://*/*" ], "browser_action": { "default_title": "This is a test", "default_popup": "popup.html" } } popup.html <!DOCTYPE html> <html> <head> </head> <body> <div id="linkContainer"/> <input type="text" id="catsList"/> <button type="button" id="addToList">Add</button> <script src="popup.js"></script> </body> </html> popup.js function addCats() { var a = document.createElement('a'); a.appendChild(document.createTextNode(document.getElementById('catsList').value)); a.setAttribute('href', 'http://google.com'); var p = document.createElement('p'); p.appendChild(a) document.getElementById('linkContainer').appendChild(p); indexLinks() } function indexLinks() { var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { (function () { var ln = links[i]; var location = ln.href; ln.onclick = function () { chrome.tabs.create({active: true, url: location}); }; })(); } }; document.getElementById('addToList').onclick = addCats; My guess is that I need something along the lines of localStorage['cointainer'] = document.getElementById('linkContainer'); at the end of addCats() and a call to something like function loadLocalStorage() { var container = document.getElementById('linkContainer'); container.innerHTML = localStorage['container']; } at the beginning, but doing that didn't work. Not sure what's going wrong. Also,if there is a different way to save users' additions, I'd be open to them.

    Read the article

  • Excel Shows "#########" when i try to write DateTime.Now.tostring() to one of the cell in Excel File

    - by user1209631
    I have created a application in c# , it reads excel file and after checking some conditions, it select a row to be written in another Excel File. Everything is working fine, but i need to end the file with the DateTime.Now.ToString(). string date = DateTime.Now.ToString(); ExcelWorkSheet2.Cells[newFileRow, 1] = date; When I see the file created, it shows "########" symbol instead of actual date. When I select that cell , it changes to correct date format. What may be going wrong?

    Read the article

  • Does certain tags we write in PHP affects the performance of the live server???

    - by Sachindra
    I have written some tags in PHP as <a href="<?php bloginfo('url'); ?>/?cat=<?php $cate_id ?>"><?php echo $resid->post_content ?></a> or even this one echo "<li><a href = '?cat=$cate_id'>".$resid->post_content."</a></li>";?> Does this in any case affect the performance on the live server. I am no getting the image to appear on the live server after upload but on my local system(on my side) , things are fine..

    Read the article

  • How to write UIWebView with default request address is like (192.168.1.1)..

    - by user323503
    i have implemented UIWebView in my application but i default address is "192.168.1.1" but it is not open default it and i have tried with "http://www.google.com" it is working fine. [iview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"192.168.1.1"]]]; it doesn't working and it is working with [iview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];

    Read the article

  • How do I write a bash script to replace words in files and then rename files?

    - by Jason
    Hi All, I have a folder structure, as shown below: I need to create a bash script that does 4 things: It searches all the files in the generic directory and finds the string 'generic' and makes it into 'something' As above, but changes "GENERIC" to "SOMETHING" As above, but changes "Generic" to "Something" Renames any filename that has "generic" in it with "something" Right now I am doing this process manually by using the search and replace in net beans. I dont know much about bash scripting, but i'm sure this can be done. I'm thinking of something that I would run and it would take "Something" as the input. Where would I start? what functions should I use? overall guidance would be great. thanks. I am using Ubuntu 10.5 desktop edition.

    Read the article

  • If I write a framework that gets information from the Internet, should I make a degelate or use blocks?

    - by Time Machine
    Say I'm writing a publicly available framework for the Vimeo API. This framework needs to get information from the Internet. Because this can take some time, I need to use threadin to prevent the UI from hanging. Foundation uses delegates for this, like NSURLConnectionDelegate. However, Game Kit uses blocks as callback functions. What is the recommended way of doing this? I know blocks aren't supported in standard GCC versions, but they require less, much less code for the one that uses my framework. Delegates, on the other hand, are real methods and when protocols are used, I'm sure the methods are implemented. Thanks.

    Read the article

  • How to make shell output redirect (>) write while script is still running?

    - by Noio
    I wrote a short script that never terminates. This script continuously generates output that I have to check on every now and then. I'm running it on a lab computer through SSH, and redirecting the output to a file in my public_html folder on that machine. python script.py > ~/public_html/results.txt However, the results don't show up immediately when I refresh the address. The results show up when I terminate the program, but as I said, it doesn't halt by itself. Is that redirect (>) being lazy with with writing? Is there a way to continuously (or with an interval) update the results in the file? Or is it the webserver that doesn't update the file while it is still being written?

    Read the article

  • How can I get the Forever to write to a different log file every day?

    - by user1438940
    I have a cluster of production servers running a Node.JS app via Forever. As far as I can tell, my options for log files are as follows: Let Forever do it on its own, in which case it will log to ~/.forever/XXXX.log Specify one specific log file for the entire life of the process What I'd like to do, however, is have it log to a different file every day. eg. 20121027.log, 20121028.log, etc. Is this possible? If so, how can it be done?

    Read the article

  • How can I write this in a shorter way?

    - by oaziz
    This code repeats itself. How can I make it shorter? Maybe by using anonymous function or something? foreach ($value as $wrong) { if (starts_with($wrong, '%') and ends_with($wrong, '%')) { $wrong = trim($wrong, '%'); if (contains($address, $wrong)) { $corrected_address = str_replace($wrong, $key, $address); break; } } else { $wrong = trim($wrong, '%'); if (ends_with($address, $wrong)) { $corrected_address = str_replace($wrong, $key, $address); break; } } } Thanks.

    Read the article

  • Nested If (x) checks - Better way to write this?

    - by Will
    There are places where I check for valid pointers before I perform an operation with them; these checks can be nested pretty deeply sometimes. For example, I have if (a) { if (a->b()) { if (a->b()->c()) { a->b()->c()->DoSomething(); } } } I really don't like the look of this. Is there a way to turn this into something more readable? Ideally, if (a && a->b() && a->b()->c() ) { ... } would be great, but obviously would not work.

    Read the article

  • Better way to write this method with this pattern?

    - by Slorthe
    I have written a lot of methods and I want to time how long it takes for them to run. public void myMethod(){ startTiming(); doLotsOfStuff(); stopTiming(); } I am not only timing, I am also doing some other stuff before AND after the doLotsOfStuff() method. I was wondering if there is a better/smarter way to do this in C# to achieve lesser amount of lines/coding needed for this particular pattern.

    Read the article

  • Do I have to write my own IsNumeric function?

    - by cf_PhillipSenn
    I found this function: function IsNumeric(sText) { var ValidChars = "0123456789."; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1){ IsNumber = false; } } return IsNumber; }; Q: Isn't there a built-in JavaScript function for isNumeric? Something like val()?

    Read the article

  • Is there a way to write a Python script that creates and executes code?

    - by KaliMa
    Is there a way in Python to create Python code inside the Python script and then execute/test it? My function has the following type of form (as an example) def f(n): if n<=3: return [0, 0, 6, 12][n] return 2*f(n-1) - 4*f(n-2) - 5*f(n-3) + 15*f(n-4) But I want to be able to create these kinds of functions dynamically (or any arbitrary function for that matter) and then test their outputs during runtime (as opposed to copying/pasting this function into the script and then manually testing it). Not sure if this makes sense, please ask for elaboration if needed. I've already looked into eval and exec but couldn't get them to work with entire function definitions, just basic statements like 1+2, etc.

    Read the article

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >