Search Results

Search found 254200 results on 10168 pages for 'activity stack'.

Page 1/10168 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Java: immutability, overuse of stack -- better data structure?

    - by HH
    I overused hashSets but it was slow, then changed to Stacks, speed boost-up. Poly's reply uses Collections.emptyList() as immutable list, cutting out excess null-checkers. No Collections.emptyStack(). Combining the words stack and immutability, from the last experiences, gets "immutable stack" (probably not related to functional prog). Java Api 5 for list interface shows that Stack is an implementing class for list and arraylist, here. The java.coccurrent pkg does not have any immutable Stack data structure. The first hinted of misusing stack. The lack of immutabily in the last and poly's book recommendation leads way to list. Something very primitive, fast, no extra layers, with methods like emptyThing(). Overuse of stack and where I use it DataFile.java: public Stack<DataFile> files; FileObject.java: public Stack<String> printViews = new Stack<String>(); FileObject.java:// private static Stack<Object> getFormat(File f){return (new Format(f)).getFormat();} Format.java: private Stack<Object> getLine(File[] fs,String s){return wF;} Format.java: private Stack<Object> getFormat(){return format;} Positions.java: public static Stack<Integer[]> getPrintPoss(String s,File f,Integer maxViewPerF) Positions.java: Stack<File> possPrint = new Stack<File>(); Positions.java: Stack<Integer> positions=new Stack<Integer>(); Record.java: private String getFormatLine(Stack<Object> st) Record.java: Stack<String> lines=new Stack<String>(); SearchToUser.java: public static final Stack<File> allFiles = findf.getFs(); SearchToUser.java: public static final Stack<File> allDirs = findf.getDs(); SearchToUser.java: private Stack<Integer[]> positionsPrint=new Stack<Integer[]>(); SearchToUser.java: public Stack<String> getSearchResults(String s, Integer countPerFile, Integer resCount) SearchToUser.java: Stack<File> filesToS=Fs2Word.getFs2W(s,50); SearchToUser.java: Stack<String> rs=new Stack<String>(); View.java: public Stack<Integer[]> poss = new Stack<Integer[4]>(); View.java: public static Stack<String> getPrintViewsFileWise(String s,Object[] df,Integer maxViewsPerF) View.java: Stack<String> substrings = new Stack<String>(); View.java: private Stack<String> printViews=new Stack<String>(); View.java: MatchView(Stack<Integer> pss,File f,Integer maxViews) View.java: Stack<String> formatFile; View.java: private Stack<Search> files; View.java: private Stack<File> matchingFiles; View.java: private Stack<String> matchViews; View.java: private Stack<String> searchMatches; View.java: private Stack<String> getSearchResults(Integer numbResults) Easier with List: AllDirs and AllFs, now looping with push, but list has more pow. methods such as addAll [OLD] From Stack to some immutable data structure How to get immutable Stack data structure? Can I box it with list? Should I switch my current implementatios from stacks to Lists to get immutable? Which immutable data structure is Very fast with about similar exec time as Stack? No immutability to Stack with Final import java.io.*; import java.util.*; public class TestStack{ public static void main(String[] args) { final Stack<Integer> test = new Stack<Integer>(); Stack<Integer> test2 = new Stack<Integer>(); test.push(37707); test2.push(80437707); //WHY is there not an error to remove an elment // from FINAL stack? System.out.println(test.pop()); System.out.println(test2.pop()); } }

    Read the article

  • Updating Activity UI from Different Activity Method?

    - by stormin986
    I have a tab widget where one of the tabs is a chat-type feature. I want to update the chat data at an interval (variable depending on whether the chat tab is active or not). The best approach seemed to be using an AsyncTask in my main TabActivity class, as that would avoid any issues of the chat activity being destroyed while in the background, while an AsyncTask was running. I wanted to ensure that the Activity isn't destroyed and recreated, thus causing my AsyncTask to be unable to modify the actual active Activity's data. However, now that my AsyncTask is in the TabActivity activity, I don't have a direct way to call my Chat's ListAdapter notifyDataSetChanged() from my onPostExecute() method anymore. Is there a way to get a reference to a given Tab's current Activity from the TabHost/TabActivity? Or, alternatively, can I assume my chat activity will never be destroyed as a child activity of the TabActivity activity (well, never destroyed while the TabActivity is active at least), and then just put the AsyncTask in the Chat Activity?

    Read the article

  • Workflow Activity Extensions, Activity Packs and Unit Testing Framework

    - by JoshReuben
    http://wf.codeplex.com/ contains a plethora of infrastructure code and new activities for extending Workflow Foundation 4. These are also available as Nuget packages. These include: Activity Extensions Security Activity Pack ADO.NET Activity Pack Azure Activity Pack Activity Unit Testing Framework   view my PowerPoint presentation on these and more here: http://www.slideshare.net/joshuareuben9/workflow-foundation-activity-packs-extensions-and-unit-testing

    Read the article

  • Scheduling runtime-specified Activity in Workflow 4 RC

    - by johnny g
    Hi, so I have this requirement to kick off Activities provided to me at run-time. To facilitate this, I have set up a WorkflowService that receives Activities as Xaml, hydrates them, and kicks them off. Sounds simple enough ... ... this is my WorkflowService in Xaml <Activity x:Class="Workflow.Services.WorkflowService.WorkflowService" ... xmlns:local1="clr-namespace:Workflow.Activities" > <Sequence sap:VirtualizedContainerService.HintSize="277,272"> <Sequence.Variables> <Variable x:TypeArguments="local:Workflow" Name="Workflow" /> </Sequence.Variables> <sap:WorkflowViewStateService.ViewState> <scg3:Dictionary x:TypeArguments="x:String, x:Object"> <x:Boolean x:Key="IsExpanded">True</x:Boolean> </scg3:Dictionary> </sap:WorkflowViewStateService.ViewState> <p:Receive CanCreateInstance="True" DisplayName="ReceiveSubmitWorkflow" sap:VirtualizedContainerService.HintSize="255,86" OperationName="SubmitWorkflow" ServiceContractName="IWorkflowService"> <p:ReceiveParametersContent> <OutArgument x:TypeArguments="local:Workflow" x:Key="workflow">[Workflow]</OutArgument> </p:ReceiveParametersContent> </p:Receive> <local1:InvokeActivity Activity="[ActivityXamlServices.Load(New System.IO.StringReader(Workflow.Xaml))]" sap:VirtualizedContainerService.HintSize="255,22" /> </Sequence> </Activity> ... which, except for repetitive use of "Workflow" is pretty straight forward. In fact, it's just a Sequence with a Receive and [currently] a custom Activity called InvokeActivity. Get to that in a bit. Receive Activity accepts a custom type, [DataContract] public class Workflow { [DataMember] public string Xaml { get; set; } } which contains a string whose contents are to be interpreted as Xaml. You can see the VB expression that then converts this Xaml to an Activity and passes it on. Now this second bit, the custom InvokeActivity is where I have questions. First question: 1) given an arbitrary task, provided at runtime [as described above] is it possible to kick off this Activity using Activities that ship with WF4RC, out of the box? I'm fairly new, and thought I did a good job going through the API and existing documentation, but may as well ask :) Second: 2) my first attempt at implementing a custom InvokeActivity looked like this public sealed class InvokeActivity : NativeActivity { private static readonly ILog _log = LogManager.GetLogger (typeof (InvokeActivity)); public InArgument<Activity> Activity { get; set; } public InvokeActivity () { _log.DebugFormat ("Instantiated."); } protected override void Execute (NativeActivityContext context) { Activity activity = Activity.Get (context); _log.DebugFormat ("Scheduling activity [{0}]...", activity.DisplayName); // throws exception to lack of metadata! :( ActivityInstance instance = context.ScheduleActivity (activity, OnComplete, OnFault); _log.DebugFormat ( "Scheduled activity [{0}] with instance id [{1}].", activity.DisplayName, instance.Id); } protected override void CacheMetadata (NativeActivityMetadata metadata) { // how does one add InArgument<T> to metadata? not easily // is my first guess base.CacheMetadata (metadata); } // private methods private void OnComplete ( NativeActivityContext context, ActivityInstance instance) { _log.DebugFormat ( "Scheduled activity [{0}] with instance id [{1}] has [{2}].", instance.Activity.DisplayName, instance.Id, instance.State); } private void OnFault ( NativeActivityFaultContext context, Exception exception, ActivityInstance instance) { _log.ErrorFormat ( @"Scheduled activity [{0}] with instance id [{1}] has faulted in state [{2}] {3}", instance.Activity.DisplayName, instance.Id, instance.State, exception.ToStringFullStackTrace ()); } } Which attempts to schedule the specified Activity within the current context. Unfortunately, however, this fails. When I attempt to schedule said Activity, the runtime returns with the following exception The provided activity was not part of this workflow definition when its metadata was being processed. The problematic activity named 'DynamicActivity' was provided by the activity named 'InvokeActivity'. Right, so the "dynamic" Activity provided at runtime is not a member of InvokeActivitys metadata. Googled and came across this. Couldn't sort out how to specify an InArgument<Activity> to metadata cache, so my second question is, naturally, how does one address this issue? Is it ill advised to use context.ScheduleActivity (...) in this manner? Third and final, 3) I have settled on this [simpler] solution for the time being, public sealed class InvokeActivity : NativeActivity { private static readonly ILog _log = LogManager.GetLogger (typeof (InvokeActivity)); public InArgument<Activity> Activity { get; set; } public InvokeActivity () { _log.DebugFormat ("Instantiated."); } protected override void Execute (NativeActivityContext context) { Activity activity = Activity.Get (context); _log.DebugFormat ("Invoking activity [{0}] ...", activity.DisplayName); // synchronous execution ... a little less than ideal, this // seems heavy handed, and not entirely semantic-equivalent // to what i want. i really want to invoke this runtime // activity as if it were one of my own, not a separate // process - wrong mentality? WorkflowInvoker.Invoke (activity); _log.DebugFormat ("Invoked activity [{0}].", activity.DisplayName); } } Which simply invokes specified task synchronously within its own runtime instance thingy [use of WF4 vernacular is certainly questionable]. Eventually, I would like to tap into WF's tracking and possibly persistance facilities. So my third and final question is, in terms of what I would like to do [ie kick off arbitrary workflows inbound from client applications] is this the preferred method? Alright, thanks in advance for your time and consideration :)

    Read the article

  • Prevent an Activity from being killed by the OS while starting a child activity

    - by Martin Marinov
    I have a main activity which calls a child one via Intent I = new Intent(this, Child.class); startActivityForResult(I, 0); But as soon as Child becomes visible the main activity gets its onStop and immediately after that onDestroy method triggered. And as soon as I call finish() within the Child activity or press the back button, the Child activity closes and the home screen shows (instead of the main activity). How can I prevent the main activity from being destroyed? :\

    Read the article

  • Android 1.5 - 2.1 Search Activity affects Parent Lifecycle

    - by pacoder
    Behavior seems consistent in Android 1.5 to 2.1 Short version is this, it appears that when my (android search facility) search activity is fired from the android QSR due to either a suggestion or search, UNLESS my search activity in turn fires off a VISIBLE activity that is not the parent of the search, the search parents life cycle changes. It will NOT fire onDestroy until I launch a visible activity from it. If I do, onDestroy will fire fine. I need a way to get around this behavior... The long version: We have implemented a SearchSuggestion provider and a Search activity in our application. The one thing about it that is very odd is that if the SearchManager passes control to our custom Search activity, AND that activity does not create a visible Activity the Activity which parented the search does not destroy (onDestroy doesn't run) and it will not until we call a visible Activity from the parent activity. As long as our Search Activity fires off another Activity that gets focus the parent activity will fire onDestroy when I back out of it. The trick is that Activity must have a visual component. I tried to fake it out with a 'pass through' Activity so that my Search Activity could fire off another Intent and bail out but that didn't work either. I have tried setting our SearchActivity to launch singleTop and I also tried setting its noHistory attribute to true, tried setResult(RESULT_OK) in SearchACtivity prior to finish, bunch of other things, nothing is working. This is the chunk of code in our Search Activity onCreate. Couple of notes about it: If Intent is Action_Search (user typed in their own search and didn't pick a suggestion), we display a list of results as our Search Activity is a ListActivity. In this case when the item is picked, the Search Activity closes and our parent Activity does fire onDestroy() when we back out. If Intent is Action_View (user picked a suggestion) when type is "action" we fire off an Intent that creates a new visible Activity. In this case same thing, when we leave that new activity and return to the parent activity, the back key does cause the parent activity to fire onDestroy when leaving. If Intent is Action_View (user picked a suggestion) when type is "pitem" is where the problem lies. It works fine (the method call focuses an item on the parent activity), but when the back button is hit on the parent activity onDestroy is NOT called. IF after this executes I pick an option in the parent activity that fires off another activity and return to the parent then back out it will fire onDestroy() in the parent activity. Note that the "action" intent ends up running the exact same method call as "pitem", it just bring up a new visual Activity first. Also I can take out the method call from "pitem" and just finish() and the behavior is the same, the parent activity doesn't fire onDestroy() when backed out of. if (Intent.ACTION_SEARCH.equals(queryAction)) { this.setContentView(_layoutId); String searchKeywords = queryIntent.getStringExtra(SearchManager.QUERY); init(searchKeywords); } else if(Intent.ACTION_VIEW.equals(queryAction)){ Bundle bundle = queryIntent.getExtras(); String key = queryIntent.getDataString(); String userQuery = bundle.getString(SearchManager.USER_QUERY); String[] keyValues = key.split("-"); if(keyValues.length == 2) { String type = keyValues[0]; String value = keyValues[1]; if(type.equals("action")) { Intent intent = new Intent(this, EventInfoActivity.class); Long longKey = Long.parseLong(value); intent.putExtra("vo_id", longKey); startActivity(intent); finish(); } else if(type.equals("pitem")) { Integer id = Integer.parseInt(value); _application._servicesManager._mapHandlerSelector.selectInfoItem(id); finish(); } } } It just seems like something is being held onto and I can't figure out what it is, in all cases the Search Activity fires onDestroy() when finish() is called so it is definitely going away. If anyone has any suggestions I'd be most appreciative. Thanks, Sean Overby

    Read the article

  • Android: Dialog themed activity not visible

    - by Vincent
    I have an activity which, when started, needs to check if the user is authenticated. If not, I need to display an interface to authenticate. I do this with another activity, which has a dialog theme, and I start it in onResume() with flags NO_HISTORY and EXCLUDE_FROM_RECENTS. Everything works fine when starting the application for the first time. But I have a feature that resets login after some time, if the user is not in an activity. When I test this, I start the applicatio, enter the password, then move back to home. Then when I enter the application again, the background darkens as if the dialog would show, but it doesn't. At this point, if I press the back button, the darkening from the background activity disappears for a second, then the dialog finally appears. I used logcat to investigate the case, and the activity lifecycle functions get called properly: //For the first start: onCreate background activity onStart background activity onResume background activity onPause background activity onCreate dialog onStart dialog onResume dialog //Enter password onPause dialog onResume background activity onStop dialog onDestroy dialog //navigating to homescreen onPause background activity onStop background activity //starting again onRestart background activity onStart background activity onResume background activity onPause background activity onCreate dialog onStart dialog onResume dialog //no dialog shown, only darkened background activity recieving no input //pressing back button onPause dialog onResume background activity onPause background activity onCreate NEW dialog onStart NEW dialog onResume NEW dialog onStop OLD dialog onDestroy OLD dialog //now the dialog is properly shown //entering password onPause NEW dialog onResume background activity onStop NEW dialog onDestroy NEW dialog Using the SINGLE_TOP flag makes no change. However, if I remove the dialog theme from the dialog activity, it IS shown after the restart. So far I didn't want to use a Dialog instead of an Activity, because I consider them problematic sometimes and less encapsulated and this part has to be quite secure. You may be able to convince me though.. Thank you in advance!

    Read the article

  • UML Activity diagram: decision branch ends whole activity

    - by Ytsejammer
    I was wondering if there is a way to depict that, on an activity that has a decision; one of the branches completely terminates with the activity. This would be similar to a subroutine just returning control to the invoker when a condition is met. sub activity() { ... ... if ( condition ) { ... } else { return;//This branch finishes the activity } ... } Thanks, Carlos

    Read the article

  • Which are the fundamental stack manipulation operations?

    - by Aadit M Shah
    I'm creating a stack oriented virtual machine, and so I started learning Forth for a general understanding about how it would work. Then I shortlisted the essential stack manipulation operations I would need to implement in my virtual machine: drop ( a -- ) dup ( a -- a a ) swap ( a b -- b a ) rot ( a b c -- b c a ) I believe that the following four stack manipulation operations can be used to simulate any other stack manipulation operation. For example: nip ( a b -- b ) swap drop -rot ( a b c -- c a b ) rot rot tuck ( a b -- b a b ) dup -rot over ( a b -- a b a ) swap tuck That being said however I wanted to know whether I have listed all the fundamental stack manipulation operations necessary to manipulate the stack in any possible way. Are there any more fundamental stack manipulation operations I would need to implement, without which my virtual machine wouldn't be Turing complete?

    Read the article

  • Handle existing instance of root activity when launching root activity again from intent filter

    - by Robert
    Hi, I'm having difficulties handling multiple instances of my root (main) activity for my application. My app in question has an intent filter in place to launch my application when opening an email attatchment from the "Email" app. My problem is if I launch my application first through the the android applications screen and then launch my application via opening the Email attachment it creates two instances of my root activity. steps: Launch root activity A, press home Open email attachment, intent filter triggers launches root activity A Is it possible when opening the Email attachment that when the OS tries to launch my application it detects there is already an instance of it running and use that or remove/clear that instance?

    Read the article

  • Start Activity and clear activity history

    - by sandis
    So I have a huge maze of activities in my application. What I need to do, is that when the user logs in into the system, the activity history should be cleared. I cant just use finish() when I start a new activity, because I want the activities to have a history until the user logs in. I have experimentet with the different flags when starting an activity, but I have had no success. Any ideas? Cheers,

    Read the article

  • Binding output of Custom Activity designer to activity argument

    - by gbanfill
    I am trying to add a custom activity designer for an activity that I have. The activity looks a little like: public class WaitForUserInputActvitiy : NativeActivity { public InArgument<UserInteractionProperty[]> UserInteraction { get; set; } } I am trying to put a designer on the activity to make it a bit nicer to set these values (so you don't end up typing VB in directly. My designer is based on mindscape property grid. I have an ObservableDictionary source that I want to get the values from and put them in to the InArgument. Currently I am using private void TestGrid_LostFocus(object sender, RoutedEventArgs e) { using (ModelEditingScope editingScope = this.ModelItem.BeginEdit()) { Argument myArg = Argument.Create(typeof(WaitForUserInputActvitiy), ArgumentDirection.In); this.ModelItem.Properties["UserInteraction"].SetValue(source.Values.ToArray()); editingScope.Complete(); } } However this results in an ArgumentException "Object of type UserInteractionProperty[] cannot be converted to InArgument`1[UserInteractionProperty[]]. So how do I convert my array of UserInteractionProperties into an InArgument?

    Read the article

  • Confusion of the "stack" in Assembly-level programming

    - by Bigyellow Bastion
    What is the "stack" exactly? I've read articles, tried comprehending it through my understanding, experience, and educated guessing of programming and computers, but I'm a bit perplexed here. The "stack" is a region in RAM? Or is it some other space I'm uncertain of here? The processor pushes bits through registers on to the stack in RAM, or do I have it wrong here? Also, the processor moves the bits from the RAM to the register to "process" it, such as maybe a compare, arithmetic, etc. But what actually can help understand, in some visual or verbal description or both, of how to implement the idea of a "stack" here? Is the stack actually the same in terminology with a "machine stack" meaning it's in RAM? I'm sorry, I don't want to solicit debate or arguments, but I really could use some help here if anyone can straighten things out. TO ADD: I know what a software stack is. I know about LIFO, FIFO, etc. I just want to gain a better understanding of the Assembly-level stack, what it is, where it is, how exactly it works, etc. Thanks for reading!

    Read the article

  • Public static variables and Android activity life cycle management

    - by jsstp24n5
    According to the documentation the Android OS can kill the activity at the rear of the backstack. So, say for example I have an app and open the Main Activity (let's call it Activity A). In this public activity class I declare and initialize a public static variable (let's call it "foo"). In Activity A's onCreate() method I then change the value of "foo." From Activity A the user starts another activity within my app called Activity B. Variable "foo" is used in Activity B. Activity B is then paused after the user navigates to some other activities in other apps. Eventually, after a memory shortage occurs, Activity A then Activity B can be killed. After the user navigates back to my app it restarts (actually "recreates") activity B. What happens: 1) Will variable "foo" at this point have the value that was set to it when Activity A's onCreate() method ran? 2) Variable "foo" does not exist? 3) Variable "foo" exists and but is now the initialized value and not the value set in Activity A's onCreate() method?

    Read the article

  • launch android activity from non-activity class

    - by Alberto Barrera
    im New on Android. I know theres a lot of similar Questions but anyone is helping. Im using a 3rd party app that just launch a class that extends their own class. So from that class i would like to launch an activity. public class SkyTest extends VtiUserExit { @Override public VtiUserExitResult execute() throws VtiExitException { // TODO Auto-generated method stub logInfo("TEST"); return null; } } How do i launch an activity named MainActivity from here. i tryed this: Context context = null; Intent intent = new Intent(context, MainActivity.class); context.startActivity(intent); but its not working, i know i cant use the null context, but how do i create a context o how it works? Thanks

    Read the article

  • TabWidget Activity Handling - Does it Create a New Activity EVERY Time?

    - by stormin986
    When a TabWidget is using intents to designate the target Activity for each tab, is there any special handling of those Activities on the Activity Stack outside of the default operation? For Instance, if my app has tabs A, B, and C, and I click them in this order––A, B, A, C, A, B––how will the Activity stack change? My understanding of the default operation, if startActivity() is called each time on the intent, would have the Stack keep loading up new instances of the activities: A, AB, ABA, ABAC, ABACA, ABACAB It's hard to believe that's how it works though... Seems like it would be a waste of resources and could be endless. Can anyone tell me how this will actually work?

    Read the article

  • Ghost activity in android

    - by Ari
    My application works as follow: On start I have some AppStartActivity which does something, finishes itself and starts MainActivity if user is logged in or LoginActivity otherwise. LoginActivity finishes itself and starts MainActivity when user log in successfully. On MainActivity I have SomeActivity from which user can logout. Activity stack for this situation is MainActivity > SomeActivity. It is correct, back button works well. When user click LogOut button there is a problem. I need to show LoginActivity but I don't want to have MainActivity and SomeActivity on activity stack anymore. I could resolve this problem if I wouldn't finish AppStartActivity. I could go back then with flag FLAG_ACTIVITY_CLEAR_TOP and it would work well. But here is a problem with back button. I don't want user to come back to this activity with back button. I want it to exit app instead. UPDATED: Flags FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK would be best, but I need it working in API level 9.

    Read the article

  • How to Use USER_DEFINED Activity in OWB Process Flow

    - by Jinggen He
    Process Flow is a very important component of Oracle Warehouse Builder. With Process Flow, we can create and control the ETL process by setting all kinds of activities in a well-constructed flow. In Oracle Warehouse Builder 11gR2, there are 28 kinds of activities, which fall into three categories: Control activities, OWB specific activities and Utility activities. For more information about Process Flow activities, please refer to OWB online doc. Most of those activities are pre-defined for some specific use. For example, the Mapping activity allows execution an OWB mapping in Process Flow and the FTP activity allows an interaction between the local host and a remote FTP server. Besides those activities for specific purposes, the User Defined activity enables you to incorporate into a Process Flow an activity that is not defined within Warehouse Builder. So the User Defined activity brings flexibility and extensibility to Process Flow. In this article, we will take an amazing tour of using the User Defined activity. Let's start. Enable execution of User Defined activity Let's start this section from creating a very simple Process Flow, which contains a Start activity, a User Defined activity and an End Success activity. Leave all parameters of activity USER_DEFINED unchanged except that we enter /tmp/test.sh into the Value column of the COMMAND parameter. Then let's create the shell script test.sh in /tmp directory. Here is the content of /tmp/test.sh (this article is demonstrating a scenario in Linux system, and /tmp/test.sh is a Bash shell script): echo Hello World! > /tmp/test.txt Note: don't forget to grant the execution privilege on /tmp/test.sh to OS Oracle user. For simplicity, we just use the following command. chmod +x /tmp/test.sh OK, it's so simple that we’ve almost done it. Now deploy the Process Flow and run it. For a newly installed OWB, we will come across an error saying "RPE-02248: For security reasons, activity operator Shell has been disabled by the DBA". See below. That's because, by default, the User Defined activity is DISABLED. Configuration about this can be found in <ORACLE_HOME>/owb/bin/admin/Runtime.properties: property.RuntimePlatform.0.NativeExecution.Shell.security_constraint=DISABLED The property can be set to three different values: NATIVE_JAVA, SCHEDULER and DISBALED. Where NATIVE_JAVA uses the Java 'Runtime.exec' interface, SCHEDULER uses a DBMS Scheduler external job submitted by the Control Center repository owner which is executed by the default operating system user configured by the DBA. DISABLED prevents execution via these operators. We enable the execution of User Defined activity by setting: property.RuntimePlatform.0.NativeExecution.Shell.security_constraint= NATIVE_JAVA Restart the Control Center service for the change of setting to take effect. cd <ORACLE_HOME>/owb/rtp/sql sqlplus OWBSYS/<password of OWBSYS> @stop_service.sql sqlplus OWBSYS/<password of OWBSYS> @start_service.sql And then run the Process Flow again. We will see that the Process Flow completes successfully. The execution of /tmp/test.sh successfully generated a file /tmp/test.txt, containing the line Hello World!. Pass parameters to User Defined Activity The Process Flow created in the above section has a drawback: the User Defined activity doesn't accept any information from OWB nor does it give any meaningful results back to OWB. That's to say, it lacks interaction. Maybe, sometimes such a Process Flow can fulfill the business requirement. But for most of the time, we need to get the User Defined activity executed according to some information prior to that step. In this section, we will see how to pass parameters to the User Defined activity and pass them into the to-be-executed shell script. First, let's see how to pass parameters to the script. The User Defined activity has an input parameter named PARAMETER_LIST. This is a list of parameters that will be passed to the command. Parameters are separated from one another by a token. The token is taken as the first character on the PARAMETER_LIST string, and the string must also end in that token. Warehouse Builder recommends the '?' character, but any character can be used. For example, to pass 'abc,' 'def,' and 'ghi' you can use the following equivalent: ?abc?def?ghi? or !abc!def!ghi! or |abc|def|ghi| If the token character or '\' needs to be included as part of the parameter, then it must be preceded with '\'. For example '\\'. If '\' is the token character, then '/' becomes the escape character. Let's configure the PARAMETER_LIST parameter as below: And modify the shell script /tmp/test.sh as below: echo $1 is saying hello to $2! > /tmp/test.txt Re-deploy the Process Flow and run it. We will see that the generated /tmp/test.txt contains the following line: Bob is saying hello to Alice! In the example above, the parameters passed into the shell script are static. This case is not so useful because: instead of passing parameters, we can directly write the value of the parameters in the shell script. To make the case more meaningful, we can pass two dynamic parameters, that are obtained from the previous activity, to the shell script. Prepare the Process Flow as below: The Mapping activity MAPPING_1 has two output parameters: FROM_USER, TO_USER. The User Defined activity has two input parameters: FROM_USER, TO_USER. All the four parameters are of String type. Additionally, the Process Flow has two string variables: VARIABLE_FOR_FROM_USER, VARIABLE_FOR_TO_USER. Through VARIABLE_FOR_FROM_USER, the input parameter FROM_USER of USER_DEFINED gets value from output parameter FROM_USER of MAPPING_1. We achieve this by binding both parameters to VARIABLE_FOR_FROM_USER. See the two figures below. In the same way, through VARIABLE_FOR_TO_USER, the input parameter TO_USER of USER_DEFINED gets value from output parameter TO_USER of MAPPING_1. Also, we need to change the PARAMETER_LIST of the User Defined activity like below: Now, the shell script is getting input from the Mapping activity dynamically. Deploy the Process Flow and all of its necessary dependees then run the Process Flow. We see that the generated /tmp/test.txt contains the following line: USER B is saying hello to USER A! 'USER B' and 'USER A' are two outputs of the Mapping execution. Write the shell script within Oracle Warehouse Builder In the previous section, the shell script is located in the /tmp directory. But sometimes, when the shell script is small, or for the sake of maintaining consistency, you may want to keep the shell script inside Oracle Warehouse Builder. We can achieve this by configuring these three parameters of a User Defined activity properly: COMMAND: Set the path of interpreter, by which the shell script will be interpreted. PARAMETER_LIST: Set it blank. SCRIPT: Enter the shell script content. Note that in Linux the shell script content is passed into the interpreter as standard input at runtime. About how to actually pass parameters to the shell script, we can utilize variable substitutions. As in the following figure, ${FROM_USER} will be replaced by the value of the FROM_USER input parameter of the User Defined activity. So will the ${TO_USER} symbol. Besides the custom substitution variables, OWB also provide some system pre-defined substitution variables. You can refer to the online document for that. Deploy the Process Flow and run it. We see that the generated /tmp/test.txt contains the following line: USER B is saying hello to USER A! Leverage the return value of User Defined activity All of the previous sections are connecting the User Defined activity to END_SUCCESS with an unconditional transition. But what should we do if we want different subsequent activities for different shell script execution results? 1.  The simplest way is to add three simple-conditioned out-going transitions for the User Defined activity just like the figure below. In the figure, to simplify the scenario, we connect the User Defined activity to three End activities. Basically, if the shell script ends successfully, the whole Process Flow will end at END_SUCCESS, otherwise, the whole Process Flow will end at END_ERROR (in our case, ending at END_WARNING seldom happens). In the real world, we can add more complex and meaningful subsequent business logic. 2.  Or we can utilize complex conditions to work with different results of the User Defined activity. Previously, in our script, we only have this line: echo ${FROM_USER} is saying hello to ${TO_USER}! > /tmp/test.txt We can add more logic in it and return different values accordingly. echo ${FROM_USER} is saying hello to ${TO_USER}! > /tmp/test.txt if CONDITION_1 ; then ...... exit 0 fi if CONDITION_2 ; then ...... exit 2 fi if CONDITION_3 ; then ...... exit 3 fi After that we can leverage the result by checking RESULT_CODE in condition expression of those out-going transitions. Let's suppose that we have the Process Flow as the following graph (SUB_PROCESS_n stands for more different further processes): We can set complex condition for the transition from USER_DEFINED to SUB_PROCESS_1 like this: Other transitions can be set in the same way. Note that, in our shell script, we return 0, 2 and 3, but not 1. As in Linux system, if the shell script comes across a system error like IO error, the return value will be 1. We can explicitly handle such a return value. Summary Let's summarize what has been discussed in this article: How to create a Process Flow with a User Defined activity in it How to pass parameters from the prior activity to the User Defined activity and finally into the shell script How to write the shell script within Oracle Warehouse Builder How to do variable substitutions How to let the User Defined activity return different values and in what way can we leverage

    Read the article

  • Android: How to make launcher always open the main activity instead of child activity? (or otherwise

    - by yuku
    I have activities A and B. The A is the one with LAUNCHER intent-filter (i.e. the activity that is started when we click the app icon on home screen). A launches B using startActivity(new Intent(A.this, B.class)). When the user has the B activity open, and then put my application into the background, and later my application's process is killed, when the user starts my application again, B is opened instead of A. This caused a force close in my app, because A is the activity that initializes the resources my app needs, and when B tried to access the uninitialized resources, B crashes. Do you have any suggestions what should I do in this situation?

    Read the article

  • Assembly keep getting seg fault when working with stack [migrated]

    - by user973917
    I'm trying to learn assembly and have found that I keep getting segfaults when trying to push/pop data off of the stack. I've read a few guides and know how the stack works and how to work with the stack; but don't know why I keep getting the error. Can someone help? segment .data myvar: db "hello world", 0xA0, 0 myvarL: equ $-myvar segment .text global _start _start: push ebp mov ebp, esp push myvarL push myvar call _hworld _hworld: mov eax, 4 mov ebx, 1 mov ecx, [ebp+4] mov edx, [ebp+8] pop ebp int 0x80 ret I'm assuming that the +4 is 32 bits, then +8 is 64 bits. It isn't really clear to me why this way is being done on some of the guides I've read. I would assume that myvar is 13 bits?

    Read the article

  • Gnome Activity Journal does not show recently used files

    - by Nik
    I am running ubuntu 10.10, and installed Gnome Activity Journal. However it does not show any recently used files. I have attached a screenshot below. Please note that gnome activity journal has been installed on the system for quite some time. So it is not that I recently installed and it still has to slowly gather data. Also the zeitgeist-daemon is running in the background. Would reinstalling zeitgeist help solve this problem? If yes could you please provide a ppa where I can find the latest stable release of zeitgeist.

    Read the article

  • calculater by using reverse polish notation and using a stack

    - by programmer
    hello everyone I have a segmentation fault ,can you help please? if i have this operater "3 5 +" that mean 3+5 and like "9 8 * 5 + 4 + sin", "sin(((9*8)+5)+4)" so my idea is check if the first and second are numbers and push theem in the stack then when i have operator i pop the numbers and make the calculation then push the answer again. ` typedef struct st_node { float val; struct st_node *next; } t_node; typedef t_node t_stack; // a function to allocate memory for a stack and returns the stack t_stack* fnewCell() { t_stack* ret; ret = (t_stack*) malloc(sizeof(t_stack)); return ret; } // a function to allocate memory for a stack, fills it with value v and pointer n , and returns the stack t_stack* fnewCellFilled(float v, t_stack* n) { t_stack* ret; ret = fnewCell(); ret->val = v; ret->next =n; return ret; } //function to initialize stack void initstack(t_stack** stack) { fnewCellFilled(0,NULL); } // add new cell void insrtHead(t_stack** head,float val) { *head = fnewCellFilled(val,*head); } //function to push the value v into the stack s void push(t_stack **s, float val) { insrtHead(s,val); } //function to pop a value from the stack and returns it int pop(t_stack **s) { t_stack* tmp; int ret; tmp = (*s)->next; ret = (*s)->val; free(*s); (*s) = tmp; return ret; } int isempty (t_stack *t) { return t == NULL; } //function to transfer a string(str) to int (value) //returns -1 when success , i otherwise int str2int(char *str,int *value) { int i; *value = 0; int sign=(str[0]=='-' ? -1 : 1); for(i=(str[0]=='-' ? 1 : 0);str[i]!=0;i++) { if(!(str[i]>=48 && str[i]<=57)) // Ascii char 0 to 9 return i; *value= *value*10+(str[i]-48); } *value = *value * sign; return -1; } //a function that takes a string, transfer it into integer and make operation using a stack void function(t_stack *stack, char *str) { char x[10]=" "; int y,j,i=0,z; printf("++\n"); if(str[i] != '\0') { strcpy(x, strtok(str, " ")); z= str2int(x, &y); if(z == -1) { push(&stack,y); i=i+2; } } while(str[i] != '\0') { strcpy(x, strtok(NULL, " ")); z= str2int(x, &y); if(z == -1) { printf("yes %d",y); push(&stack,y); i=i+2; } else { y=pop(&stack); j=pop(&stack); if(x[0] == '+' ) push(&stack,y+j); else if (x[0] == '-' ) push(&stack,j-y); else if(x[0] == '*' ) push(&stack,j*y); else if(x[0] == '/') push (&stack ,j/y); } } } int main() { t_stack *s; initstack(&s); char *str="3 5 +"; function(s,str); return 0; } `

    Read the article

  • Strange activity stack behavior when using MapActivity

    - by AndroidDev
    I have the following activity structure in my application A simple "splash screen" activity is started when the application is fired up (let's call it "Splash"). This activity starts the main activity when the user presses a button (I will call it "Main"). Main can in turn start two activities from the menu. The first activity presents a simple form (let's call this one "Form"), the second is a MapActivity that presents a map (it is called "Map"). Main, Form, and Map are declared exactly the same in the manifest: <activity android:name="fully qualified activity class" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|orientation" > <intent-filter> <action android:name="android.intent.action.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> When Main is active and I start Form and press "back", Main comes up again. Pressing "back" again brings up "Splash". Nothing strange here. Now comes the strange part: when I am in Main, start Map, and press "back", Main comes up as expected. But pressing "back" again just restarts Main. A second press on "back" is needed to bring me back to Splash! So it seems that starting the Map activity somehow results in Main ending up on the activity stack twice while starting the Form activity does not! Both Form and Map are started like this: startActivity(new Intent(this, MyActivity.class)); I don not catch the back key in any activity. Any clues on what is going on or how to debug this?

    Read the article

  • Does pressing Back always cause Activity to finish()?

    - by stormin986
    I've heard that pressing the back button will essentially cause the current Activity to finish(). Is this always the case? Seems like it would be with the way it pops the Activity off the stack. The one situation I'm not so sure about is when the root Activity in a Task has back pressed. I'm currently experiencing a very weird effect, described as follows: On loading my application, the first Activity is for initialization, and once it finishes, it calls my main Activity (a TabActivity). This first init activity has android:noHistory="true" set in the Manifest so pressing Back from my main Activity won't go back to that. It goes to the Launcher. When I click on my App in the Launcher a second time, the initialization activity loads again, and loads the main Activity when done. Almost immediately after, it loads a second instance of my main Activity. But ONLY after the Application has already been run once, and was exited by pressing BACK from the main Activity. It does it every subsequent time until I force quit the app or load a new version from the IDE. Based on this, I am suspecting some kind of Activity instance is lying around and being reused, since it only happens on the second+ time I run the application (and exit with BACK -- using HOME just returns to the last state of the app, no big deal). Anyone have any thoughts??

    Read the article

  • Java: immutable Stack?

    - by HH
    I chose to use Stacks and Tables before knowing Collections has immutable empty things only for Set, Map and List. Because the size of table does not change after its init: Integer[] table = new Intger[0] I can use the zero-witdh table as an empty table. But I cannot use final or empty Stack to get immutable Stack: No immutability to Stack with Final import java.io.*; import java.util.*; public class TestStack{ public static void main(String[] args) { final Stack<Integer> test = new Stack<Integer>(); Stack<Integer> test2 = new Stack<Integer>(); test.push(37707); test2.push(80437707); //WHY is there not an error to remove an elment // from FINAL stack? System.out.println(test.pop()); System.out.println(test2.pop()); } } Java Api 5 for list interface shows that Stack is an implementing class for list and arraylist, here. The java.coccurrent pkg does not have any immutable Stack data structure. From Stack to some immutable data structure How to get immutable Stack data structure? Can I box it with list? Should I switch my current implementatios from stacks to Lists to get immutable? Which immutable data structure is Very fast with about similar exec time as Stack?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >