Search Results

Search found 25401 results on 1017 pages for 'adobe partner program'.

Page 88/1017 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • Flash video slooow in AIR 2 HTMLLoader component

    - by shane
    I am working on a full screen kiosk application in Flex 4/Air 2 using Flash Builder 4. We have a company training website which staff can access via the kiosk, and the main content is interactive flash training videos. Our target machines are by no means 'beefy', they are Atom n270s @ 1.6Ghz with 1Gb RAM. As it stands the videos are all but unusable when used from within the Air application, the application becomes completely unresponsive (100% cpu usage, click events take approx 5-10 seconds to register). So far I have tried: increasing the default frame rate from 24fps to 60. No improvement. nativeWindow.stage.frameRate = 60; running the videos in a stripped down version of my app, just a full screen HTMLLoader component pointed at the training website. No better than before. disabled hyper threading. The Atom CPU is split into two virtual cores, and the AIR app was only able to use one thread so maxed out at 50% CPU usage. Since the kiosk will only run the AIR app I am happy to loose hyper threading to increase the performance of the Air app. Marginal Improvement. The same website with the same videos is responsive if viewed in ie7 on the same machine, although Internet Explorer takes advantage of the CPU’s hyper threading. The flash videos are built with Adobe Captivate and from what I understand employee JavaScript to relay results back to the server. I will add more information about the video content asap as the training guru is back in the office later this week.

    Read the article

  • I/O between AIR client using Native process and executable java .jar

    - by aseem behl
    I am using Adobe AIR 2.0 native process API to launch a java executable jar. I/O is handled by writing to the input stream of the java process and reading from the output stream. The application is event based where several events are fired from the server. We catch these events in java code, handle them and write the output to the outputstream using the synchronized static method below. public class ReaderWriter { static Logger logger = Logger.getLogger(ReaderWriter.class); public synchronized static void writeToAir(String output){ try{ byte[] byteArray = output.getBytes(); DataOutputStream dataOutputStream = new DataOutputStream(System.out); dataOutputStream.write(byteArray); dataOutputStream.flush(); } catch (IOException e) { logger.info("Exception while writing the output. " + e); } } } The issue is that some messages are lost between the transfer and not all messages reach the AIR client. If I run the java application from the console I am receiving all the messages. It would be great if somebody could point out what I am missing. Following are some of the listeners used to send the event data to the AIR client. // class used to process Shutdown events from the Session private class SessionShutdownListener implements SessionListener{ public void onEvent(Event e) { Session.Shutdown sd = (Session.Shutdown) e; Session.ShutdownReason sr = sd.getReason(); String eventOutput = "eo;" + "Session Shutdown event ocurred reason=" + sr.strValue() + "\n"; ReaderWriter.writeToAir(eventOutput); } } // class used to process OperationSucceeded events from the Session private class SessionOperationSucceededListener implements SessionListener{ public void onEvent(Event e) { Session.OperationSucceeded os = (Session.OperationSucceeded) e; String eventOutput = "eo;" + "Session OperationSucceeded event ocurred" + "\n"; ReaderWriter.writeToAir(eventOutput); } }

    Read the article

  • How to run an external SWF inside a Flex Application?

    - by lk
    I want to run an Action Script 3.0 Application into a Flex Application. To do this I've done the following: <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication windowComplete="loadSwfApplication()" xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ private function loadSwfApplication() { var urlRequest:URLRequest = new URLRequest("path/to/the/application.swf"); swfLoader.addEventListener(Event.COMPLETE, loadComplete); swfLoader.load(urlRequest); } private function loadComplete(completeEvent:Event) { var swfApplication:* = completeEvent.target.content; swfApplication.init(); // this is a Function that I made it in the Root class of swfApplication } ]]> </mx:Script> <mx:SWFLoader id="sfwLoader"/> </mx:WindowedApplication> The problem is that in the calling of swfApplication.init(); the AIR Player throws me an exception: Security sandbox violation: caller file:///path/to/the/application.swf cannot access Stage owned by app:/SWFApplicationLoader.swf. This is because somewhere in application.swf I use the stage like this: if (root.stage != null) root.stage.addEventListener(Event.REMOVED, someFunction); root.stage.stageFocusRect = false; How can I load this swf application and USE the stage without any problems?

    Read the article

  • Flash CS5- Problem with "navigateToURL" in web-browswer hosted on MySpace

    - by NervXT
    I made a quick flash document for my friend who posted it his MySpace. The document has 3 buttons, each with a URL attached to them. When I play the SWF file locally, the links work fine, however once it's published to MySpace, the links refuse to work. The hand icon comes up so it understands them at least as buttons, but it seems to do nothing when clicked in the web-browser. Also, I can open the SWF in my browser and it also works fine. I'm using Flash CS5 and working in ActionScript 3.0. The three buttons are on one layer called "Buttons". I right click the button and click "Actions". From there, I click the "Code Snippets" and under the folder "Actions" there is an item called "Click to Go To Webpage". Here is the code it gives you by default: button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_6); function fl_ClickToGoToWebPage_6(event:MouseEvent):void { navigateToURL(new URLRequest("http://www.adobe.com"), "_blank"); } I heard there was a problem with MySpace not allowing action scripts, but after checking the source code of the web-page, the values in the "param" code seem to "always" allow action scripts. At any point, I'm lost and not sure what it causing this. I don't think it's a browser issue, since it's working fine when I execute the SWF by itself, and when I load it into Firefox. It's just seems MySpace is having a problem with it. Any advice is appreciated.

    Read the article

  • Web service actionscript error

    - by H P
    Hello, I am new to Flex and needed some help setting up Web service client. I have a web service of method: public String printEchoStr(String str); I am facing problem while creating action script to call this service. I am getting error: 1067: Implicit coercion of a value of type String to an unrelated type generated.webservices:PrintEcho. I am not sure if this is the correct way. Thanks, -H <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:srv="generated.webservices.*" creationComplete="initFunc()"> <mx:Script> <![CDATA[ import generated.webservices.EchoService; import generated.webservices.PrintEchoStrResultEvent; import generated.webservices.PrintEchoResultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.controls.Alert; import generated.webservices.PrintEchoStr; import generated.webservices.PrintEcho; public var myService:EchoService = new EchoService(); private function initFunc():void{ myService.addprintEchoStrEventListener(argPrintEchoStr); /*-------------- 1067: Implicit coercion of a value of type String to an unrelated type generated.webservices:PrintEcho. at line below ----------------*/ myService.printEchoStr(textAreaPrintEchoStr.text); myService.addEventListener(FaultEvent.FAULT,myServices_faultHandler); } public function argPrintEchoStr(event:PrintEchoStrResultEvent):void{ trace(event.result); } private function myServices_faultHandler(event:FaultEvent):void { Alert.show(event.fault.faultString,"error with WebServices"); } ]]> </mx:Script> <mx:TextArea id ="textAreaPrintEchoStr" x="81" y="125"/> </mx:Application>

    Read the article

  • (illustrator scripting) how to release objects to layers(sequence) but retain object's name?

    - by Eugene
    Hi, I've asked the same question to adobe scripting forum. but seems there are not many forum users there, and I'm asking the same question here. I was writing my first illustrator script to export all layers to png files with layer structure converted to file structure. I found there are many layers that my script can't detect and found out that they are not actually layers but objects(or groups). Found a layer menu (release to layers), but doesn't quite solve the problem perfectly. initially I have this layer 001 object 01 object 1 object 2 release to layers(sequence) on object 01 gives layer 001 layer 91(whatever the layer number illustrator gives when release to layers are performed) layer 92 object 1 layer 93 object 2 now I need to convert them to (so that layer can retain the name of the object) layer 001 layer 01 layer 1 object 1 layer 2 object 2 I have hundreds of layer 001, and couple thousands of object 01, and wonder if anything can be done with script to do this... If it's possible to detect object in a script, I could rewrite the 'release to layers' functionality in script maybe. Any help would be greatly appreciated.

    Read the article

  • Not Understanding Basics Of Dynamic DataBinding (bindPropety) In Flex

    - by Joshua
    I need to dynamically bind properties of components created at runtime. In this particular case please assume I need to use bindProperty. I don't quite understand why the following simplistic test is failing (see code). When I click the button, the label text does not change. I realize that there are simpler ways to go about this particular example using traditional non-dynamic binding, but I need to understand it in terms of using bindProperty. Can someone please help me understand what I'm missing? <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="Tools.*" minWidth="684" minHeight="484" xmlns:ns2="*" creationComplete="Init();"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.binding.utils.*; public var Available:ArrayCollection=new ArrayCollection(); public function get Value():String { return (Available.getItemAt(0).toString()); } public function Init():void { Available.addItemAt('Before', 0); BindingUtils.bindProperty(Lab, 'text', this, 'Value'); } public function Test():void { Available.setItemAt('After', 0); } ]]> </mx:Script> <mx:Label x="142" y="51" id="Lab"/> <mx:Button x="142" y="157" label="Button" click="Test();"/> </mx:WindowedApplication> Thanks in advance.

    Read the article

  • XML in Authorware 7.01

    - by Mikael
    Let me explain the setup that is being used. Right now I have an authorware program which loads an ocx control. This control receives data in the form on an XML string. This part is working properly. However I need parse this XML string in authorware and have not been successful. I have been trying to use the XMLParser Xtra. The documentation listed here shows how to create a new XMLParser object and then shows how to call the object but never explains how to link the Parser to a XML file or XML string. The information I have been using can be found here https://www.adobe.com/livedocs/authorware/7/using_aw_en/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Using_Authorware_7&file=09_va110.htm#224295 I need more information on how to Parse XML with this function or if there is another way to do this in Authorware. As a side note the documentation says it cannot create or append to XML, I will need to do this also inside of Authorware. Is this possible and if so, how?

    Read the article

  • Save the date! Manageability Partner Community Forum at Oracle Openworld - Oct. 1st

    - by Javier Puerta
    The Exadata & Manageability Partner Communities will be celebrating a Community Forum in San Francisco during Oracle Openworld. The session will take place on Monday, October 1st, from 4:00 - 6:00 pm local time.If you would like to present an experience around a customer project or sales best practice in the Manageability or Quality & Testing areas, please contact [email protected] with a short description of your proposal.

    Read the article

  • Pourquoi ne pas laisser les développeurs et le public choisir ? Le PDG d'Adobe répond à la lettre ou

    Mise à jour du 30/04/10 NB : Les commentaires sur cette mise à jour commencent ici dans le topic Pourquoi ne pas laisser les développeurs et le public choisir ? Le PDG d'Adobe répond à la lettre ouverte anti-flash de Steve Jobs C'est en substance la réponse de Shantanu Narayen : si notre technologie est si mauvaise et si « inadaptée à l'iPhone » (comme l'écrit noir sur blanc Steve Jobs - lire ci-avant), les développeurs ne l'utiliseront pas et les consommateurs s'en détourneront.

    Read the article

  • LIVE: Oracle FY13 Partner Kickoff - Red Stack. Red Team. Engineered to Win.

    - by Kristin Rose
    Oracle’s FY13 Partner Kickoff is still in full swing and what an exciting day it has already been! Oracle executives started their mornings off at 5 a.m. to address our partners from around the world. The day began with the EMEA region, closely followed by the North America region in front of a live audience, and then on to Latin America! But hang tight because Japan and APAC are up next!If you haven’t already done so, be sure you register to watch the rest of the show. Also, join the Twitter conversation via #OPN and @OraclePartners and keep sending in those questions. Here is what the rest of the day looks like: JAPAN - 6:00pm – 7:30pm PT APAC - 8:00 pm – 9:30pm PT We also had a chance to speak with Nick Kritikos, VP of Partner Enablement and host of the PKO after show, “Partner Pulse”, to get his thoughts on the day. See what Nick had to say below: To all of our Partners, thanks for tuning in! Until next year, Good Selling,The OPN Communications Team

    Read the article

  • Android 3 : pas de Flash sur les tablettes avant plusieurs semaines, mais Adobe annonce une version améliorée et optimisée

    Android 3 : pas de Flash sur les tablettes avant plusieurs semaines Mais Adobe annonce des améliorations et une version optimisée de sa technologie Beaucoup d'agitation se fait sentir actuellement dans la presse IT autour d'une publicité de l'opérateur télécom américain Verizon pour Xoom, la première tablette PC sous Android 3, la nouvelle version de l'OS adaptée aux tablettes PC. Cette publicité annonce (en marge et en petits caractères) le report de l'intégration de Flash sur la tablette de Motorola au printemps proch...

    Read the article

  • java client program to send digest authentication request using HttpClient API

    - by Rajesh
    I have restlet sample client program which sends the digest request. Similar to this I need java client program which sends a digest request using HttpClient api. Can anybody send me sample code. Thanks in advance. Reference reference = new Reference("http://localhost:8092/authenticate"); Client client = new Client(Protocol.HTTP); Request request = new Request(Method.GET, reference); Response response = client.handle(request); System.out.println("response: "+response.getStatus()); Form form = new Form(); form.add("username", "rajesh"); form.add("uri", reference.getPath()); // Loop over the challengeRequest objects sent by the server. for (ChallengeRequest challengeRequest : response .getChallengeRequests()) { // Get the data from the server's response. if (ChallengeScheme.HTTP_DIGEST .equals(challengeRequest.getScheme())) { Series<Parameter> params = challengeRequest.getParameters(); form.add(params.getFirst("nonce")); form.add(params.getFirst("realm")); form.add(params.getFirst("domain")); form.add(params.getFirst("algorithm")); form.add(params.getFirst("qop")); } } // Compute the required data String a1 = Engine.getInstance().toMd5( "rajesh" + ":" + form.getFirstValue("realm") + ":" + "rajesh"); String a2 = Engine.getInstance().toMd5( request.getMethod() + ":" + form.getFirstValue("uri")); form.add("response", Engine.getInstance().toMd5( a1 + ":" + form.getFirstValue("nonce") + ":" + a2)); ChallengeResponse challengeResponse = new ChallengeResponse( ChallengeScheme.HTTP_DIGEST, "", ""); challengeResponse.setCredentialComponents(form); // Send the completed request request.setChallengeResponse(challengeResponse); response = client.handle(request); // Should be 200. System.out.println(response.getStatus());

    Read the article

  • What's a good way to teach my son to program Java

    - by Software Monkey
    OK, so I've read through various posts about teaching beginner's to program, and there were some helpful things I will look at more closely. But what I want to know is whether there are any effective tools out there to teach a kid Java specifically? I want to teach him Java specifically because (a) with my strong background in C I feel that's too complex, (b) Java is the other language I know extremely well and therefore I can assist meaningfully without needing to teach myself a new but (to me) useless language, and (c) I feel that managed languages are the future, and lastly (d) Java is one of the simplest of all the languages I know well (aside from basic). I learned in basic, and I am open to teaching that first, but I am unaware of a decent free basic shell for Windows (though I haven't really searched, yet since it's not my first choice), and would anyway want to progress quickly to Java. My son is 8, so that's a couple of years earlier than I started - but he has expressed an interest in learning to program (possibly because I work from home a lot and he sees me programming all the time). If no-one can suggest a tool designed for this purpose, I will probably start him off with text/console based apps to teach the basics, and then progress to GUI building. Oh, one last thing, I am not a fan of IDE's (old school text editor type), so I would not be put off at all by a system that has him typing real code, and would likely prefer that to a toy drag/drop system. EDIT: Just to clarify; I really am specifically after ways to teach him Java; there are already a good many posts with good answers for other language alternatives - but that's not what I am looking for here. EDIT: What about Java frameworks for 2D video games - can anyone recommend any of them from personal experience? I like the idea of him starting with the mechanics in place (main game loop, scoring, etc) and adding the specifics for a game of his own imagining - that's what I did, though for me it was basic on a Commodore VIC-20 and a Sinclair ZX-81.

    Read the article

  • simple Stata program

    - by Cyrus S
    I am trying to write a simple program to combine coefficient and standard error estimates from a set of regression fits. I run, say, 5 regressions, and store the coefficient(s) and standard error(s) of interest into vectors (Stata matrix objects, actually). Then, I need to do the following: Find the mean value of the coefficient estimates. Combine the standard error estimates according to the formula suggested for combining results from "multiple imputation". The formula is the square root of the formula for "T" on page 6 of the following document: http://bit.ly/b05WX3 I have written Stata code that does this once, but I want to write this as a function (or "program", in Stata speak) that takes as arguments the vector (or matrix, if possible, to combine multiple estimates at once) of regression coefficient estimates and the vector (or matrix) of corresponding standard error estimates, and then generates 1 and 2 above. Here is the code that I wrote: (breg is a 1x5 vector of the regression coefficient estimates, and sereg is a 1x5 vector of the associated standard error estimates) mat ones = (1,1,1,1,1) mat bregmean = (1/5)*(ones*breg’) scalar bregmean_s = bregmean[1,1] mat seregmean = (1/5)*(ones*sereg’) mat seregbtv = (1/4)*(breg - bregmean#ones)* (breg - bregmean#ones)’ mat varregmi = (1/5)*(sereg*sereg’) + (1+(1/5))* seregbtv scalar varregmi_s = varregmi[1,1] scalar seregmi = sqrt(varregmi_s) disp bregmean_s disp seregmi This gives the right answer for a single instance. Any pointers would be great! UPDATE: I completed the code for combining estimates in a kXm matrix of coefficients/parameters (k is the number of parameters, m the number of imputations). Code can be found here: http://bit.ly/cXJRw1 Thanks to Tristan and Gabi for the pointers.

    Read the article

  • Loops on a Matlab program

    - by lebland-matlab
    I have 3 sets of 10 vectors each, and I want to take 2 vectors from the first set , 2 vectors from the second set and 3 vectors from the third set . My goal is to make a loop to implement the following program, knowing that after each calculation, the result shall be saved in a new file. My problem is that I can not handle the indices included in the strings. I try to use multiple loops to scan the 3 sets in the order of indices. loops should contain the following program clc; clear all; load('C:\Users\Documents\MATLAB\myFile\matrice_F.mat'); load('C:\Users\Documents\MATLAB\myFile\matrice_G.mat'); F = m_F; G = m_G; load('C:\Users\Documents\MATLAB\myFile\matrice_J.mat'); load('C:\Users\Documents\MATLAB\myFile\matrice_K.mat'); J = m_J; K = m_K; load('C:\Users\Documents\MATLAB\myFile\matrice_N.mat'); load('C:\Users\Documents\MATLAB\myFile\matrice_O.mat'); load('C:\Users\Documents\MATLAB\myFile\matrice_P.mat'); N = m_N ; O = m_O; P = m_P; [A,B,C,D,E] = myFun(F,G,J,K,N,O,P); file_name = 'matrice_final.mat'; save(file_name,'A','B','C','D','E');

    Read the article

  • In Java, send commands to another command-line program

    - by bradvido
    I am using Java on Windows XP and want to be able to send commands to another program such as telnet. I do not want to simply execute another program. I want to execute it, and then send it a sequence of commands once it's running. Here's my code of what I want to do, but it does not work: (If you uncomment and change the command to "cmd" it works as expected. Please help.) try { Runtime rt = Runtime.getRuntime(); String command = "telnet"; //command = "cmd"; Process pr = rt.exec(command); BufferedReader processOutput = new BufferedReader(new InputStreamReader(pr.getInputStream())); BufferedWriter processInput = new BufferedWriter(new OutputStreamWriter(pr.getOutputStream())); String commandToSend = "open localhost\n"; //commandToSend = "dir\n" + "exit\n"; processInput.write(commandToSend); processInput.flush(); int lineCounter = 0; while(true) { String line = processOutput.readLine(); if(line == null) break; System.out.println(++lineCounter + ": " + line); } processInput.close(); processOutput.close(); pr.waitFor(); } catch(Exception x) { x.printStackTrace(); }

    Read the article

  • VERY simple C program won't compile with VC 64

    - by Paperflyer
    Here is a very simple C program: #include <stdio.h> int main (int argc, char *argv[]) { printf("sizeof(short) = %d\n",(int)sizeof(short)); printf("sizeof(int) = %d\n",(int)sizeof(int)); printf("sizeof(long) = %d\n",(int)sizeof(long)); printf("sizeof(long long) = %d\n",(int)sizeof(long long)); printf("sizeof(float) = %d\n",(int)sizeof(float)); printf("sizeof(double) = %d\n",(int)sizeof(double)); return 0; } While it compiles fine on Win32 (command line: cl main.c), it does not using the Win64 compiler ("c:\Program Files(x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe" main.c). Specifically, it sais "error LNK2019: unresolved external symbol printf referenced in function main". As far as I understand this, it can not link to printf, right? Obviously, I have Microsoft Visual C++ Compiler 2008 (Standard enu) x86 and x64 installed and am using the 64-bit flavor of Windows (7). What is the problem here?

    Read the article

  • program that writes the even and odd numbers

    - by user292489
    enter code herei was writting a program that can read a set of numbers file called dog.txt; and also writes to two file separating odd and even. i was able to compile my program however, the output expected is not the same which was supposed to be even numbers in one file called EVEN, odd numbers in file odd. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i; int even,odd; int num; if (argc != 4) { printf("Usage: executable in_file output_file\n"); exit(0); } FILE *dog = fopen(argv[1], "r"); FILE *feven= fopen(argv[2], "w"); FILE *fodd= fopen (argv[3], "w"); while (fscanf(dog, "%d", &num) != EOF) { if (0==i%2){ i++; printf("even= %d\n", num); } else if(i!=0){ i++; printf("odd= %d\n", num); } } fclose(feven); fclose(fodd); fclose(dog); return 0; } output: even= 1 odd= 2 even= 34 odd= 44 even= 66 odd= 78 even= 94 odd= 21 even= 23 odd= 54 even= 44 odd= 65 even= 78 odd= 68 even= 92

    Read the article

  • Time complexity of a certain program

    - by HokageSama
    In a discussion with my friend i am not able to predict correct and tight time complexity of a program. Program is as below. /* This Function reads input array "input" and update array "output" in such a way that B[i] = index value of nearest greater value from A[i], A[i+1] ... A[n], for all i belongs to [1, n] Time Complexity: ?? **/ void createNearestRightSidedLargestArr(int* input, int size, int* output){ if(!input || size < 1) return; //last element of output will always be zero, since no element is present on its right. output[size-1] = -1; int curr = size - 2; int trav; while(curr >= 0){ if(input[curr] < input[curr + 1]){ output[curr] = curr + 1; curr--; continue; } trav = curr + 1; while( input[ output [trav] ] < input[curr] && output [trav] != -1) trav = output[trav]; output[curr--] = output[trav]; } } I said time complexity is O(n^2) but my friend insists that this is not correct. What is the actual time complexity?

    Read the article

  • stack overflow problem in program

    - by Jay
    So I am currently getting a strange stack overflow exception when i try to run this program, which reads numbers from a list in a data/text file and inserts it into a binary search tree. The weird thing is that when the program works when I have a list of 4095 numbers in random order. However when i have a list of 4095 numbers in increasing order (so it makes a linear search tree), it throws a stack overflow message. The problem is not the static count variable because even when i removed it, and put t=new BinaryNode(x,1) it still gave a stack overflow exception. I tried debugging it, and it broke at if (t == NULL){ t = new BinaryNode(x,count); Here is the insert function. BinaryNode *BinarySearchTree::insert(int x, BinaryNode *t) { static long count=0; count++; if (t == NULL){ t = new BinaryNode(x,count); count=0; } else if (x < t->key){ t->left = insert(x, t->left); } else if (x > t->key){ t->right = insert(x, t->right); } else throw DuplicateItem(); return t; }

    Read the article

  • lnk2019 error in very simple c++ program

    - by Erin
    I have tried removing various parts and building, but nothing makes the lnk2019 error go away, or even produces any normal errors. Everything is in the one file at the moment (it won't be later when it is finished). The program has three lists of words and makes a jargon phrase out of them, and you are supposed to be able to add words, remove words, view the lists, restore defaults, save changes to file, and load changes from file. #include "stdafx.h" #include <iostream> #include <string.h> using namespace std; const int maxlist = 20; string adj1[maxlist], adj2[maxlist], noun[maxlist]; void defaultlist(int list) { if(list == 1) { adj1[0] = "green"; adj1[1] = "red"; adj1[2] = "yellow"; adj1[3] = "blue"; adj1[4] = "purple"; int i = 5; while(i != maxlist) { adj1[i] = ""; i = i + 1; } } if(list == 2) { adj2[0] = "shiny"; adj2[1] = "hard"; adj2[2] = "soft"; adj2[3] = "spiky"; adj2[4] = "furry"; int i = 5; while(i != maxlist) { adj2[i] = ""; i = i + 1; } } if(list == 3) { noun[0] = "cat"; noun[1] = "dog"; noun[2] = "desk"; noun[3] = "chair"; noun[4] = "door"; int i = 5; while(i != maxlist) { noun[i] = ""; i = i + 1; } } return; } void printlist(int list) { if(list == 1) { int i = 0; while(!(i == maxlist)) { cout << adj1[i] << endl; i = i + 1; } } if(list == 2) { int i = 0; while(!(i == maxlist)) { cout << adj2[i] << endl; i = i + 1; } } if(list == 3) { int i = 0; while(!(i == maxlist)) { cout << noun[i] << endl; i = i + 1; } } return; } string makephrase() { int num1 = rand()%maxlist; int num2 = rand()%maxlist; int num3 = rand()%maxlist; int num4 = rand()%1; string word1, word2, word3; if(num4 = 0) { word1 = adj1[num1]; word2 = adj2[num2]; } else { word1 = adj2[num1]; word2 = adj1[num2]; } word3 = noun[num3]; return word1 + " ," + word2 + " " + word3; } string addword(string word, int list) { string result; if(list == 1) { int i = 0; while(!(adj1[i] == "" || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "List is full. Please try again."; if(adj1[i] == "") { adj1[i] = word; result = "Word was entered successfully."; } } if(list == 2) { int i = 0; while(!(adj2[i] == "" || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "List is full. Please try again."; if(adj2[i] == "") { adj2[i] = word; result = "Word was entered successfully."; } } if(list == 3) { int i = 0; while(!(noun[i] == "" || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "List is full. Please try again."; if(noun[i] == "") { noun[i] = word; result = "Word was entered successfully."; } } return result; } string removeword(string word, int list) { string result; if(list == 1) { int i = 0; while(!(adj1[i] == word || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "Word is not on the list. Please try again."; if(adj1[i] == word) { adj1[i] = ""; result = "Word was removed successfully."; } } if(list == 2) { int i = 0; while(!(adj2[i] == word || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "Word is not on the list. Please try again."; if(adj2[i] == word) { adj2[i] = ""; result = "Word was removed successfully."; } } if(list == 3) { int i = 0; while(!(noun[i] == word || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "Word is not on the list. Please try again."; if(noun[i] == word) { noun[i] = ""; result = "Word was removed successfully."; } } return result; } /////////////////////////////main/////////////////////////////////// int main() { string mainselection; string makeselection; string phrase; defaultlist(1); defaultlist(2); defaultlist(3); cout << "This program generates jargon phrases made of two adjectives and one noun,"; cout << " on three lists. Each list may contain a maximum of " << maxlist << "elements."; cout << " Please choose from the following menu by typing the appropriate number "; cout << "and pressing enter." << endl; cout << endl; cout << "1. Make a jargon phrase." << endl; cout << "2. View a list." << endl; cout << "3. Add a word to a list." << endl; cout << "4. Remove a word from a list." << endl; cout << "5. Restore default lists." << endl; cout << "More options coming soon!." << endl; cin mainselection if(mainselection == 1) { phrase = makephrase(); cout << "Your phrase is " << phrase << "." << endl; cout << "To make another phrase, press 1. To go back to the main menu,"; cout << " press 2. To exit the program, press 3." << endl; cin makeselection; while(!(makeselection == "1" || makeselection == "2" || makeselection == "3")) { cout << "You have entered an invalid selection. Please try again." << endl; cin makeselection; } while(makeselection == "1") { phrase = makephrase(); cout << "To make another phrase, press 1. To go back to the main menu,"; cout << " press 2. To exit the program, press 3." << endl; } if(makeselection == "2") main(); if(makeselection == "3") return 0; } return 0; } //Rest of the options coming soon!

    Read the article

  • Keep Hibernate Initializer from Crashing Program

    - by manyxcxi
    I have a Java program using a basic Hibernate session factory. I had an issue with a hibernate hbm.xml mapping file and it crashed my program even though I had the getSessionFactory() call in a try catch try { session = SessionFactoryUtil.getSessionFactory().openStatelessSession(); session.beginTransaction(); rh = getRunHistoryEntry(session); if(rh == null) { throw new Exception("No run history information found in the database for run id " + runId_ + "!"); } } catch(Exception ex) { logger.error("Error initializing hibernate"); } It still manages to break out of this try/catch and crash the main thread. How do I keep it from doing this? The main issue is I have a bunch of cleanup commands that NEED to be run before the main thread shuts down and need to be able to guarantee that even after a failure it still cleans up and goes down somewhat gracefully. The session factory looks like this: public class SessionFactoryUtil { private static final SessionFactory sessionFactory; static { try { // Create the SessionFactory from hibernate.cfg.xml sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { try { return sessionFactory; } catch(Exception ex) { return null; } } }

    Read the article

  • How to learn how to program?

    - by twinbornJoint
    I would like to know the best methods for learning to program. I've been directed towards the Python language because I was told it is good for beginners. I ultimately want to make games for OS X/iPhone. My problem is that I understand what I read but I can't apply my knowledge to anything. I am a programming noob. Should I stick with Python? (is there a better language I should be learning?) Where can I learn programming theory? I get very hyper when reading my book sometimes, any tips on staying calm and focusing? What are effective ways to learn how to program? Are there standard exercises for programming? (I feel solving problems helps my understanding immensely) Ultimately I feel like I am in a never ending tunnel that leads me no where. It feels like I am just completely unable to pursue anything in the world of programming, yet it is something I want to do very much. Thanks.

    Read the article

  • Vector insert() causes program to crash

    - by wrongusername
    This is the first part of a function I have that's causing my program to crash: vector<Student> sortGPA(vector<Student> student) { vector<Student> sorted; Student test = student[0]; cout << "here\n"; sorted.insert(student.begin(), student[0]); cout << "it failed.\n"; ... It crashes right at the sorted part because I can see "here" on the screen but not "it failed." The following error message comes up: Debug Assertion Failed! (a long path here...) Expression: vector emplace iterator outside range For more information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. I'm not sure what's causing the problem now, since I have a similar line of code elsewhere student.insert(student.begin() + position(temp, student), temp); that does not crash (where position returns an int and temp is another declaration of a struct Student). What can I do to resolve the problem, and how is the first insert different from the second one?

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >