Search Results

Search found 179 results on 8 pages for 'emil hansen'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • My java.util.Scanner won't work

    - by Kevin Steen Hansen
    Hello Stackoverflow my code is getting this error: Skriv din alder herunder og tryk enter: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextInt(Scanner.java:2160) at java.util.Scanner.nextInt(Scanner.java:2119) at Tasteturindtastning.main(Tasteturindtastning.java:20) [Finished in 1.7s with exit code 1] Adn my code is: // Starter java som man plejer, læs i HejVerden.java public class Tasteturindtastning { public static void main(String[] arg) { /* Jeg skal nu angive en variable, men jeg kan ikke bestemme denne variable * Da jeg ønsker at indtastningen fra dette tastetur skal være variablen. * I stedet for int og double bruger jeg så java.util.Scanner, som aflæser * brugerens indtastninger. */ java.util.Scanner tastetur = new java.util.Scanner(System.in); // Printer en opgave/spørgsmål til brugeren System.out.println("Skriv din alder herunder og tryk enter:"); int alder; // Angiver et variablenavn alder = tastetur.nextInt(); // Angiver variablen med værdien fra indtastningen /* Herunder gør jeg brug af et if statement der tjekker værdien for * variablen alder, og ser om den er lig med eller højere end 18, og hvis * dette er tilfældet, så udprinter den en sætning */ if (alder >= 18) System.out.println("Du er myndig, da du er " + alder + " år gammel"); // Printes hvis han er 18 eller ældre } } Can snyone tell me what is wrong?

    Read the article

  • Dynamic Objects for ASPxGridview

    - by André Snede Hansen
    I have a dictionary that is populated with data from a table, we are doing this so we can hold multiple SQL tables inside this object. This approached cannot be discussed. The Dictionary is mapped as a , and contains SQL column name and the value, and each dictionary resembles one row entry in the Table. Now I need to display this on a editable gridview, preferably the ASPxGridView. I already figured out that I should use Dynamic Objects(C#), and everything worked perfectly, up to the part where I find out that the ASPxGridview is built in .NET 2.0 and not 4.0 where Dynamic objects where implemented, therefor I cannot use it... As you cannot, to my knowledge, add rows to the gridview programmatically, I am out of ideas, and seek your help guys! protected void Page_Load(object sender, EventArgs e) { UserValidationTableDataProvider uvtDataprovider = _DALFactory.getProvider<UserValidationTableDataProvider>(typeof(UserValidationTableEntry)); string[] tableNames = uvtDataprovider.TableNames; UserValidationTableEntry[] entries = uvtDataprovider.getAllrecordsFromTable(tableNames[0]); userValidtionTableGridView.Columns.Clear(); Dictionary<string, string> firstEntry = entries[0].Values; foreach (KeyValuePair<string, string> kvp in firstEntry) { userValidtionTableGridView.Columns.Add(new GridViewDataColumn(kvp.Key)); } var dynamicObjectList = new List<dynamic>(); foreach (UserValidationTableEntry uvt in entries) { //dynamic dynObject = new MyDynamicObject(uvt.Values); dynamicObjectList.Add(new MyDynamicObject(uvt.Values)); } } public class MyDynamicObject : DynamicObject { Dictionary<string, string> properties = new Dictionary<string, string>(); public MyDynamicObject(Dictionary<string, string> dictio) { properties = dictio; } // If you try to get a value of a property // not defined in the class, this method is called. public override bool TryGetMember(GetMemberBinder binder, out object result) { // Converting the property name to lowercase // so that property names become case-insensitive. string name = binder.Name.ToLower(); string RResult; // If the property name is found in a dictionary, // set the result parameter to the property value and return true. // Otherwise, return false. bool wasSuccesfull = properties.TryGetValue(name, out RResult); result = RResult; return wasSuccesfull; } // If you try to set a value of a property that is // not defined in the class, this method is called. public override bool TrySetMember(SetMemberBinder binder, object value) { // Converting the property name to lowercase // so that property names become case-insensitive. properties[binder.Name.ToLower()] = value.ToString(); // You can always add a value to a dictionary, // so this method always returns true. return true; } } Now, I am almost certain that his "Dynamic object" approach, is not the one I can go with from here on. I hope you guys can help me :)!

    Read the article

  • containsObject - why doesen't this work?

    - by Emil
    Hi. I have an array that I am trying to check wether or not an indexPath(.row) exists in. I use this code: if ([array containsObject:[NSNumber numberWithInt:indexPath.row]]){ NSLog(@"Yep, it exists in there."); } the array consist of the numbers 3, 8 and 2. The index path loads numbers fromm 0 to 8 in a loop. Can anybody see why this doesen't work?

    Read the article

  • Redundancy algorithm for reading noisy bitstream

    - by Tedd Hansen
    I'm reading a lossy bit stream and I need a way to recover as much usable data as possible. There can be 1's in place of 0's and 0's in palce of 1's, but accuracy is probably over 80%. A bonus would be if the algorithm could compensate for missing/too many bits as well. The source I'm reading from is analogue with noise (microphone via FFT), and the read timing could vary depending on computer speed. I remember reading about algorithms used in CD-ROM's doing this in 3? layers, so I'm guessing using several layers is a good option. I don't remember the details though, so if anyone can share some ideas that would be great! :) Edit: Added sample data Best case data: in: 0000010101000010110100101101100111000000100100101101100111000000100100001100000010000101110101001101100111000101110000001001111011001100110000001001100111011110110101011100111011000100110000001000010111 out: 0010101000010110100101101100111000000100100101101100111000000100100001100000010000101110101001101100111000101110000001001111011001100110000001001100111011110110101011100111011000100110000001000010111011 Bade case (timing is off, samples are missing): out: 00101010000101101001011011001110000001001001011011001110000001001000011000000100001011101010011011001 in: 00111101001011111110010010111111011110000010010000111000011101001101111110000110111011110111111111101 Edit2: I am able to controll the data being sent. Currently attempting to implement simple XOR checking (though it won't be enough).

    Read the article

  • Why is this leaking memory? UIImage `cellForRowAtIndexPath:`

    - by Emil
    Hey. Instruments' Leaks tells me that this UIImage is leaking: UIImage *image = [[UIImage alloc] initWithContentsOfFile:[imagesPath stringByAppendingPathComponent:[NSString stringWithFormat:@"/%@.png", [postsArrayID objectAtIndex:indexPath.row]]]]; // If image contains anything, set cellImage to image. If image is empty, try one more time or use noImage.png, set in IB if (image != nil){ // If image != nil, set cellImage to that image cell.cellImage.image = image; } image = nil; [image release]; (class cell (custom table view cell) also releases cellImage in dealloc method). I haven't got a clue of why it's leaking, but it certainly is. The images gets loaded multiple times in a cellForRowAtIndexPath:-method. The first three cells' image does not leak (130px high, all the space avaliable). Leaks gives me no other info than that a UIImage allocated here in the code leaks. Can you help me figure it out? Thanks :)

    Read the article

  • multiple ajax requests with jquery

    - by Emil
    I got problems with the async nature of Javascript / JQuery. Lets say the following (no latency is counted for, in order to not make it so troublesome); I got three buttons (A, B, C) on a page, each of the buttons adds an item into a shopping cart with one ajax-request each. If I put an intentional delay of 5 seconds in the serverside script (PHP) and pushes the buttons with 1 second apart, I want the result to be the following: Request A, 5 seconds Request B, 6 seconds Request C, 7 seconds However, the result is like this Request A, 5 seconds Request B, 10 seconds Request C, 15 seconds This have to mean that the requests are queued and not run simultaneously, right? Isnt this opposite to what async is? I also tried to add a random get-parameter to the url in order to force some uniqueness to the request, no luck though. I did read a little about this. If you avoid using the same "request object (?)" this problem wont occure. Is it possible to force this behaviour in JQuery? This is the code that I am using $.ajax( { url : strAjaxUrl + '?random=' + Math.floor(Math.random()*9999999999), data : 'ajax=add-to-cart&product=' + product, type : 'GET', success : function(responseData) { // update ui }, error : function(responseData) { // show error } }); I also tried both GET and POST, no difference. I want the requests to be sent right when the button is clicked, not when the previous request is finnished. I want the requests to be run simultaneously, not in a queue.

    Read the article

  • How can I see which shared folders my program has access to?

    - by Kasper Hansen
    My program needs to read and write to folders on other machines that might be in another domain. So I used the System.Runtime.InteropServices to add shared folders. This worked fine when it was hard coded in the main menu of my windows service. But since then something went wrong and I don't know if it is a coding error or configuration error. What is the scope of a shared folder? If a thread in my program adds a shared folder, can the entire local machine see it? Is there a way to view what shared folders has been added? Or is there a way to see when a folder is added? [DllImport("NetApi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] internal static extern System.UInt32 NetUseAdd(string UncServerName, int Level, ref USE_INFO_2 Buf, out uint ParmError); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] internal struct USE_INFO_2 { internal LPWSTR ui2_local; internal LPWSTR ui2_remote; internal LPWSTR ui2_password; internal DWORD ui2_status; internal DWORD ui2_asg_type; internal DWORD ui2_refcount; internal DWORD ui2_usecount; internal LPWSTR ui2_username; internal LPWSTR ui2_domainname; } private void AddSharedFolder(string name, string domain, string username, string password) { if (name == null || domain == null || username == null || password == null) return; USE_INFO_2 useInfo = new USE_INFO_2(); useInfo.ui2_remote = name; useInfo.ui2_password = password; useInfo.ui2_asg_type = 0; //disk drive useInfo.ui2_usecount = 1; useInfo.ui2_username = username; useInfo.ui2_domainname = domain; uint paramErrorIndex; uint returnCode = NetUseAdd(String.Empty, 2, ref useInfo, out paramErrorIndex); if (returnCode != 0) { throw new Win32Exception((int)returnCode); } }

    Read the article

  • Looking for a real-time IMAP notification of new Emails

    - by Emil
    I'm looking for a way to monitor a GMail inbox for new e-mails. However, I want to avoid checking every few minutes and I'm looking for some sort of real-time notification. I've noticed that Outlook (and other IMAP-supporting clients) instantly show when there is a new e-mail, but unfortunately all .NET IMAP libraries seem to lack this functionality. Does anyone know of an IMAP library that has this functionality? Or is there another way to be instantly notified of new message without doing some short-period polling?

    Read the article

  • How can I make a Yes/No combobox return true/false?

    - by Kasper Hansen
    I am new to creating forms in Visual Studio and C#. But I made a UI that has some comboboxes where the DropDownStyle is DropDownList. The items shown is Yes and No. But I need to assign this as a boolean value to a property on some object ai and currently do this: if (cmbExample.Text == "Yes") { ai.isPacketType = true; } else if (cmbExample.Text == "No") { ai.isPacketType = false; } I basically want to do something like this (or some other one liner): ai.isPacketType = cmbExample.Text; How do I link the Text Yes to the value true and No to false?

    Read the article

  • Spring aop multiple pointcuts & advice but only the last one is working

    - by Jarle Hansen
    I have created two Spring AOP pointcuts that are completely separate and will be woven in for different parts of the system. The pointcuts are used in two different around advices, these around-advices will point to the same Java method. How the xml-file looks: <aop:config> <aop:pointcut expression="execution(......)" id="pointcutOne" /> <aop:pointcut expression="execution(.....)" id="pointcurTwo" /> <aop:aspect id="..." ref="springBean"> <aop:around pointcut-ref="pointcutOne" method="commonMethod" /> <aop:aroung pointcut-ref="pointcutTwo" method="commonMethod" /> </aop:aspect> </aop:config> The problem is that only the last pointcut works (if I change the order "pointcutOne" works because it is last). I have gotten it to work by creating one big pointcut, but I would like to have them separate. Any suggestions to why only one of the pointcuts works at a time?

    Read the article

  • how to mysqldump remote db from local machine

    - by Mauritz Hansen
    Hi folks, I need to do a mysqldump of a database on a remote server, but the server does not have mysqldump installed. I would like to use the mysqldump on my machine to connect to the remote database and do the dump on my machine. I have tried to create an ssh tunnel and then do the dump, but this does not seem to work. I tried: ssh -f -L3310:remote.server:3306 [email protected] -N The tunnel is created with success. If I do telnet localhost 3310 I get some blurb which shows the correct server mysql version. However, doing the following seems to try to connect locally mysqldump -P 3310 -h localhost -u mysql_user -p database_name table_name Can someone assist me? Thanks, Mauritz

    Read the article

  • How do I protect static files with ASP.NET form auhentication on IIS 7.5?

    - by Egil Hansen
    Hi all I have a website running on a IIS 7.5 server with ASP.NET 4.0 on a shared host, but in full trust. The site is a basic "file browser" that allows the visitors to login and have a list of files available to them displayed, and, obviously, download the files. The static files (mostly pdf files) are located in a sub folder on the site called data, e.g. http://example.com/data/... The site uses ASP.NET form authentication. My question is: How do I get the ASP.NET engine to handle the requests for the static files in the data folder, so that request for files are authenticated by ASP.NET, and users are not able to deep link to a file and grab files they are not allowed to have? Best regards, Egil.

    Read the article

  • NSDateFormatter - set device language as locale?

    - by Emil
    Hey. I'm trying to get the iPhone to display dates formatted by an NSDateFormatter in the current device language. I have tried setLocale:[NSLocale currentLocale], but that only returns 5 instead of May (or Mai, as I want it to be). Any help is appreciated. Thanks! :)

    Read the article

  • Format a date from a string

    - by Emil
    Hey. I'm trying to format a date from a string into another format. For example: 2012-05-29 23:55:52 into 29/05 *newline* 2010. I just don't get the logics behind NSDate and NSDateFormatter, I think.. Any help will be appreciated. Thanks :)

    Read the article

  • FileNotFoundException Java

    - by Troels Hansen
    Hi, I'm trying to make a simple highscore system for a minesweeper game. However i keep getting a file not found exception, and i've tried to use the full path for the file aswell. package minesweeper; import java.io.*; import java.util.*; public class Highscore{ public static void submitHighscore(String difficulty) throws IOException{ int easy = 99999; int normal = 99999; int hard = 99999; //int newScore = (int) MinesweeperView.getTime(); int newScore = 10; File f = new File("Highscores.dat"); if (!f.exists()){ f.createNewFile(); } Scanner input = new Scanner(f); PrintStream output = new PrintStream(f); if (input.hasNextInt()){ easy = input.nextInt(); normal = input.nextInt(); hard = input.nextInt(); } output.flush(); if(difficulty.equals("easy")){ if (easy > newScore){ easy = newScore; } }else if (difficulty.equals("normal")){ if (normal > newScore){ normal = newScore; } }else if (difficulty.equals("hard")){ if (hard > newScore){ hard = newScore; } } output.println(easy); output.println(normal); output.println(hard); } //temporary main method used for debugging public static void main(String[] args) throws IOException { submitHighscore("easy"); } }

    Read the article

  • Hashtable with int array as key in java

    - by Niels Hansen
    Hey! I'm trying to make a hashtable in java where the keys are int[], but it dosen't work. I have made a little test program to show my problem: public class test{ public static void main(String[] args){ int[] test0 = {1,1}; int[] test1 = {1,1}; Hashtable<int[], String> ht = new Hashtable<int[], String>(); String s0 = "foo"; ht.put(test0, s0); System.out.println("the result from ht.get(test1)"); System.out.println(ht.get(test1)); System.out.println("the result from ht.get(test0)"); System.out.println(ht.get(test0)); } } My intention is that both ht.get calles should return the same result, since the two arrays are equal, but they dont. Here is the result from running the code: the result from ht.get(test1) null the result from ht.get(test0) foo Am I missing something here or is it just impossible to use int[] as keys in a hastable?

    Read the article

  • "Cannot load ViewState" after dynamic control changed

    - by Emil D
    In my ASP.NET page I have to dynamically choose and load a custom control, depending on the selected value in a dropdownlist.However I encountered the following problem: When the parameters of the dynamically loaded control are changed, and then the selection in the dropdownlist is changed( thus forcing me to load a different dynamic control the next time the page reloads ), I end up with a "Cannot load ViewState" exception.I assume that this happens because the ViewState is trying to restore the parameters of the old control and it doesn't find it. So , is there any way to stop the viewstate from attempting to restore the state of the non-existig control?

    Read the article

  • TabHost disappears after locking the phone and reopening it:

    - by Emil Adz
    I have a weird issue with my TabHost in my FragmentActivity that contains a ViewPager. The problem is that when I close my phone (press the power button) while I use my application, and then I turn back the phone and my application gets reopened, at this point my TabHost is missing. So the closing of my phone is causes the TabHost to disappear. My guess would be that I need to save my tabHost state in the saveInstanceState object, and restore it in onResume I only have no idea how it's done. here is my code for the FragmentActivity: public class TabsViewPagerFragmentActivity extends FragmentActivity implements ViewPager.OnPageChangeListener, TabHost.OnTabChangeListener { static final String TAG = TabsViewPagerFragmentActivity.class.getSimpleName(); private TabHost mTabHost; private ViewPager mViewPager; private HashMap<String, TabInfo> mapTabInfo; public ViewPagerAdapter mPagerAdapter; private TextView tvReportName, tvTabTitle; private Button bBackToParameters; private Dialog progressDialog; private SGRaportManagerAppObj application; private int numberOfTabs = 0; private Display display; public static final int POPUP_MARGIN = 6; LeftSideMenu leftSideMenu; public void NotifyTabActivityViewPagerAdapter() { mPagerAdapter.notifyDataSetChanged(); } public ViewPagerAdapter getTabActivityViewPagerAdapter() { return mPagerAdapter; } public ViewPager getTabActivityViewPager() { return mViewPager; } public void setCurrentTabTitle (String title) { tvTabTitle.setText(title); Log.d(TAG, "set tab title from activity: "+title); } /** * Maintains extrinsic info of a tab's construct */ private class TabInfo { private String tag; private Class<?> clss; private Bundle args; private Fragment fragment; TabInfo(String tag, Class<?> clazz, Bundle args) { this.tag = tag; this.clss = clazz; this.args = args; } } /** * A simple factory that returns dummy views to the Tabhost */ class TabFactory implements TabContentFactory { private final Context mContext; /** * @param context */ public TabFactory(Context context) { mContext = context; } /** (non-Javadoc) * @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String) */ public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; } } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); application = SGRaportManagerAppObj.getInstance(); display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); // Inflate the layout setContentView(R.layout.tabs_screen_activity_layout); tvTabTitle = (TextView) findViewById(R.id.tvTabName); tvReportName = (TextView)findViewById(R.id.tvReportName); tvReportName.setText(application.currentReport.getName()+ " - "); bBackToParameters = (Button) findViewById(R.id.bBackToParameters); leftSideMenu = (LeftSideMenu) findViewById(R.id.leftSideMenu); applyOnClickListenerToLeftSideMenu(); findViewById(R.id.showLeftMenuButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Display d = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = d.getWidth(); View panel = findViewById(R.id.leftSideMenu); View appPanel = findViewById(R.id.appLayout); if (panel.getVisibility() == View.GONE){ appPanel.setLayoutParams(new LinearLayout.LayoutParams(width, LayoutParams.FILL_PARENT)); panel.setVisibility(View.VISIBLE); applyOnClickListenerToLeftSideMenu(); }else{ ToggleButton button = (ToggleButton) findViewById(R.id.showLeftMenuButton); button.setChecked(false); panel.setVisibility(View.GONE); } } }); // Initialise the TabHost progressDialog = DialogUtils.createProgressDialog(this, this.getString(R.string.populating_view_pager)); progressDialog.show(); if (SGRaportManagerAppObj.getInstance().parametersRepository.getParametersRepository().size() == 0) { bBackToParameters.setText(R.string.back_to_report_list); } this.initialiseTabHost(savedInstanceState); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); //set the tab as per the saved state } // Intialise ViewPager this.intialiseViewPager(); progressDialog.dismiss(); } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle) */ protected void onSaveInstanceState(Bundle outState) { outState.putString("tab", mTabHost.getCurrentTabTag()); //save the tab selected super.onSaveInstanceState(outState); } /** * Initialise ViewPager */ public void intialiseViewPager() { List<Fragment> fragments = new Vector<Fragment>(); // TabInfo tabInfo = null; if (application.getCurrentDataSource().equals(DataSource.SSRS)) { numberOfTabs = application.currentReport.getTabsList().size(); } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { numberOfTabs = application.currentReport.getODTabsList().size(); Log.d(TAG, "CURRENT REPORT FROM VIEW PAGER: "+ application.currentReport.toString()); } Log.d(TAG,"Current Tabs number from TabsViewPager activity: " +numberOfTabs); if (application.getCurrentDataSource().equals(DataSource.SSRS)) { for (int i = 0; i < numberOfTabs; i++) { Tab tempTab = application.currentReport.getTabsList().get(i); if (tempTab.getTabTemplateId() == 7) { GridFragment gridFragment = new GridFragment(tempTab); fragments.add(gridFragment); } else if (tempTab.getTabTemplateId() == 8) { NewChartFragment chartFragment = new NewChartFragment(tempTab, this); fragments.add(chartFragment); } } } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { for (int i = 0; i < numberOfTabs; i++) { ODTab tempTab = application.currentReport.getODTabsList().get(i); if (tempTab.getTabType().equals(ODGrid.XML_GRID_ELEMENT)) { GridFragment gridFragment = GridFragment.newInstance(tempTab.getTabId()); fragments.add(gridFragment); } else if (tempTab.getTabType().equals(ODChart.XML_CHART_ELEMENT)) { NewChartFragment chartFragment = NewChartFragment.newInstance(tempTab.getTabId()); fragments.add(chartFragment); } } } Log.d(TAG, "Current report fragments set to adapter: "+fragments.toString()); /* if (this.mPagerAdapter == null) { this.mPagerAdapter = new ViewPagerAdapter(super.getSupportFragmentManager(), fragments); } else { this.mPagerAdapter.removeAllFragments(); this.mPagerAdapter.addFragmentsListToAdapter(fragments); } */ this.mPagerAdapter = new ViewPagerAdapter(super.getSupportFragmentManager(), fragments); this.mViewPager = (ViewPager)super.findViewById(R.id.pager); // this.mViewPager.setAdapter(null); this.mViewPager.setAdapter(this.mPagerAdapter); this.mViewPager.setOffscreenPageLimit(0); this.mViewPager.setOnPageChangeListener(this); Log.d(TAG, "Adapter initialized!"); } /** * Initialise the Tab Host */ public void initialiseTabHost(Bundle args) { mTabHost = (TabHost)findViewById(android.R.id.tabhost); /* //new edit if (mTabHost.getChildCount() > 0) { mTabHost.removeAllViews(); } */ mTabHost.setup(); TabInfo tabInfo = null; mapTabInfo = new HashMap<String, TabsViewPagerFragmentActivity.TabInfo>(); if (args != null) {} else { if (application.getCurrentDataSource().equals(DataSource.SSRS)) { int numberOfTabs = application.currentReport.getTabsList().size(); for (int i = 0; i < numberOfTabs; i++) { Tab tempTab = application.currentReport.getTabsList().get(i); if (tempTab.getTabTemplateId() == 7) { //GridFragment gridFragment = new GridFragment(tempTab); TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), GridFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } else if (tempTab.getTabTemplateId() == 8) { TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), NewChartFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } } } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { int numberOfTabs = application.currentReport.getODTabsList().size(); for (int i = 0; i < numberOfTabs; i++) { ODTab tempTab = application.currentReport.getODTabsList().get(i); // Log.d(TAG,"Crashed Tab type: "+ tempTab.getTabType()); if (tempTab.getTabType().equals(ODGrid.XML_GRID_ELEMENT)) { //GridFragment gridFragment = new GridFragment(tempTab); TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), GridFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } else if (tempTab.getTabType().equals(ODChart.XML_CHART_ELEMENT)) { TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), NewChartFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } } } } // Default to first tab //this.onTabChanged("Tab1"); // mTabHost.setOnTabChangedListener(this); } /** * Add Tab content to the Tabhost * @param activity * @param tabHost * @param tabSpec * @param clss * @param args */ private static void AddTab(TabsViewPagerFragmentActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) { // Attach a Tab view factory to the spec ImageView indicator = new ImageView(activity.getBaseContext()); indicator.setPadding(10, 10, 10, 10); indicator.setImageResource(R.drawable.tab_select_icon_selector); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10, 10, 10, 10); indicator.setLayoutParams(lp); tabSpec.setIndicator(indicator); tabSpec.setContent(activity.new TabFactory(activity)); tabHost.addTab(tabSpec); } /** (non-Javadoc) * @see android.widget.TabHost.OnTabChangeListener#onTabChanged(java.lang.String) */ public void onTabChanged(String tag) { //TabInfo newTab = this.mapTabInfo.get(tag); int pos = this.mTabHost.getCurrentTab(); this.mViewPager.setCurrentItem(pos); } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrolled(int, float, int) */ @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageSelected(int) */ @Override public void onPageSelected(int position) { // TODO Auto-generated method stub this.mTabHost.setCurrentTab(position); } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrollStateChanged(int) */ @Override public void onPageScrollStateChanged(int state) { // TODO Auto-generated method stub } How would one save the state of the TabHost and restore it in onResume? Any help would be very appreciated.

    Read the article

  • Recompiling an old fortran 2/4\66 program that was compiled for os\2 need it to run in dos

    - by Mike Hansen
    I am helping an old scientist with some problems and have 1 program that he found and modified about 20 yrs. ago, and runs fine as a 32 bit os\2 executable but i need it to run under dos! I am not a programmer but a good hardware & software man, so I'am pretty stupid about this problem, but here go's I have downloaded 6 different compilers watcom77,silverfrost ftn95,gfortran,2 versions of g77 and f80. Watcom says it is to old of program,find older compiler,silverfrost opens it,debugs, etc. but is changing all the subroutines from "real" to "complex" and vice-vesa,and the g77's seem to install perfectly (library links and etc.) but wont even compile the test.f programs.My problem is 1; to recompile "as is" or "upgrade" the code? PROGRAM xconvlv INTEGER N,N2,M PARAMETER (N=2048,N2=2048,M=128) INTEGER i,isign REAL data(n),respns(m),resp(n),ans(n2),t3(n),DUMMY OPEN(UNIT=1, FILE='C:\QKBAS20\FDATA1.DAT') DO 1 i=1,N READ(1,*) T3(i), data(i), DUMMY continue CLOSE(UNIT-1) do 12 i=1,N respns(i)=data(i) resp(i)=respns(i) continue isign=-1 call convlv(data,N,resp,M,isign,ans) OPEN(UNIT=1,FILE='C:\QKBAS20\FDATA9.DAT') DO 14 i=1,N WRITE(1,*) T3(i), ans(i) continue END SUBROUTINE CONVLV(data,n,respns,m,isign,ans) INTEGER isign,m,n,NMAX REAL data(n),respns(n) COMPLEX ans(n) PARAMETER (NMAX=4096) * uses realft, twofft INTEGER i,no2 COMPLEX fft (NMAX) do 11 i=1, (m-1)/2 respns(n+1-i)=respns(m+1-i) continue do 12 i=(m+3)/2,n-(m-1)/2 respns(i)=0.0 continue call twofft (data,respns,fft,ans,n) no2=n/2 do 13 i=1,no2+1 if (isign.eq.1) then ans(i)=fft(i)*ans(i)/no2 else if (isign.eq.-1) then if (abs(ans(i)) .eq.0.0) pause ans(i)=fft(i)/ans(i)/no2 else pause 'no meaning for isign in convlv' endif continue ans(1)=cmplx(real (ans(1)),real (ans(no2+1))) call realft(ans,n,-1) return END SUBROUTINE realft(data,n,isign) INTEGER isign,n REAL data(n) * uses four1 INTEGER i,i1,i2,i3,i4,n2p3 REAL c1,c2,hli,hir,h2i,h2r,wis,wrs DOUBLE PRECISION theta,wi,wpi,wpr,wr,wtemp theta=3.141592653589793d0/dble(n/2) cl=0.5 if (isign.eq.1) then c2=-0.5 call four1(data,n/2,+1) else c2=0.5 theta=-theta endif (etc.,etc., etc.) SUBROUTINE twofft(data,data2,fft1,fft2,n) INTEGER n REAL data1(n,data2(n) COMPLEX fft1(n), fft2(n) * uses four1 INTEGER j,n2 COMPLEX h1,h2,c1,c2 c1=cmplx(0.5,0.0) c2=cmplx(0.0,-0.5) do 11 j=1,n fft1(j)=cmplx(data1(j),data2(j) continue call four1 (fft1,n,1) fft2(1)=cmplx(aimag(fft1(1)),0.0) fft1(1)=cmplx(real(fft1(1)),0.0) n2=n+2 do 12 j=2,n/2+1 h1=c1*(fft1(j)+conjg(fft1(n2-j))) h2=c2*(fft1(j)-conjg(fft1(n2-j))) fft1(j)=h1 fft1(n2-j)=conjg(h1) fft2(j)=h2 fft2(n2-j)=conjg(h2) continue return END SUBROUTINE four1(data,nn,isign) INTEGER isign,nn REAL data(2*nn) INTEGER i,istep,j,m,mmax,n REAL tempi,tempr DOUBLE PRECISION theta, wi,wpi,wpr,wr,wtemp n=2*nn j=1 do 11 i=1,n,2 if(j.gt.i)then tempr=data(j) tempi=data(j+1) (etc.,etc.,etc.,) continue mmax=istep goto 2 endif return END There are 4 subroutines with this that are about 3 pages of code and whould be much easier to e-mail to someone if their able to help me with this.My e-mail is [email protected] , or if someone could tell me where to get a "working" compiler that could recompile this? THANK-YOU, THANK-YOU,and THANK-YOU for any help with this! The errors Iam getting are; 1.In a call to CONVLV from another procedure,the first argument was of a type REAL(kind=1), it is now a COMPLEX(kind=1) 2.In a call to REALFT from another procedure, ... COMPLEX(kind=1) it is now a REAL(kind=1) 3.In a call to TWOFFT from...COMPLEX(kind-1) it is now a REAL(kind=1) 4.In a previous call to FOUR1, the first argument was of a type REAL(kind=1) it is now a COMPLEX(kind=1).

    Read the article

  • Struggling with a loop

    - by Emil
    Hey. I am trying to make an integer match another integer by adding a number to one of them. I have tried several loop types, but none has worked. Take a look at the code: int favoriteLoop = [favoriteThing intValue]; if (favoriteLoop != [[[array objectAtIndex:favoriteLoop] description] intValue]){ NSLog(@"%d", [[[array objectAtIndex:favoriteLoop] description] intValue]); int favTemp = favoriteLoop; for (int x = favTemp; (favoriteLoop == [[[array objectAtIndex:favoriteLoop] description] intValue]); x++) { NSLog(@"Still not there.."); } } Could anyone help me clear up this mess? It just won't work! Could it have something to do with it allready being inside a for-loop?

    Read the article

  • Why doesen't the number 2 work in this for-loop?

    - by Emil
    Hello. I have a function that runs trough each element in an array. It's hard to explain, so I'll just paste in the code here: NSLog(@"%@", arraySub); for (NSString *string in arrayFav){ int favoriteLoop = [string intValue] + favCount; NSLog(@"%d", favoriteLoop); id arrayFavObject = [array objectAtIndex:favoriteLoop]; [arrayFavObject retain]; [array removeObjectAtIndex:favoriteLoop]; [array insertObject:arrayFavObject atIndex:0]; [arrayFavObject release]; id arraySubFavObject = [arraySub objectAtIndex:favoriteLoop]; [arraySubFavObject retain]; [arraySub removeObjectAtIndex:favoriteLoop]; [arraySub insertObject:arraySubFavObject atIndex:0]; [arraySubFavObject release]; id arrayLengthFavObject = [arrayLength objectAtIndex:favoriteLoop]; [arrayLengthFavObject retain]; [arrayLength removeObjectAtIndex:favoriteLoop]; [arrayLength insertObject:arrayLengthFavObject atIndex:0]; [arrayLengthFavObject release]; } NSLog(@"%@", arraySub); The array arrayFav contains these strings: "3", "8", "2", "10", "40". Array array contains 92 strings with a name. Array arraySub contains numbers 0 to 91, representing a filename with a title from the array array. Array arrayLength contains 92 strings representing the size of each file from array arraySub. Now, the first NSLog shows, as expected, the numbers 0 to 91. The NSLog-s in the loop shows the numbers 3, 8, 2, 10, 40, also as expected. But here's the odd part: the last NSLog shows these numbers: 40, 10, 0, 8, 3, 1, 2, 4, 5, 6, 7, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 that is 40, 10, 0, 8, 3, and so on. It was not supposed to be a zero in there, it was supposed to be a 2.. Do you have any idea at why this is happening or a way to fix it? Thank you.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >