Search Results

Search found 1255 results on 51 pages for 'todo'.

Page 26/51 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • std::vector optimisation required

    - by marcp
    I've written a routine that uses std::vector<double> rather heavily. It runs rather slowly and AQTime seems to imply that I am constructing mountains of vectors but I'm not sure why I would be. For some context, my sample run iterates 10 times. Each iteration copies 3 c arrays of ~400 points into vectors and creates 3 new same sized vectors for output. Each output point might be the result of summing up to 20 points from 2 of the input vectors, which works out to a worst case of 10*400*3*2*20 = 480,000 dereferences. Incredibly the profiler indicates that some of the std:: methods are being called 46 MILLION times. I suspect I'm doing something wrong! Some code: vector<double>gdbChannel::GetVector() { if (fHaveDoubleData & (fLength > 0)) { double * pD = getDoublePointer(); vector<double>v(pD, pD + fLength); return v; } else { throw(Exception("attempt to retrieve vector on empty line")); ; } } void gdbChannel::SaveVector(GX_HANDLE _hLine, const vector<double> & V) { if (hLine != _hLine) { GetLine(_hLine, V.size(), true); } GX_DOUBLE * pData = getDoublePointer(); memcpy(pData, &V[0], V.size()*sizeof(V[0])); ReplaceData(); } ///This routine gets called 10 times bool SpecRatio::DoWork(GX_HANDLE_PTR pLine) { if (!(hKin.GetLine(*pLine, true) && hUin.GetLine(*pLine, true) && hTHin.GetLine(*pLine, true))) { return true; } vector<double>vK = hKin.GetVector(); vector<double>vU = hUin.GetVector(); vector<double>vTh = hTHin.GetVector(); if ((vK.size() == 0) || (vU.size() == 0) || (vTh.size() == 0)) { return true; } ///TODO: confirm all vectors the same lenghth len = vK.size(); vUK.clear(); // these 3 vectors are declared as private class members vUTh.clear(); vThK.clear(); vUK.reserve(len); vUTh.reserve(len); vThK.reserve(len); // TODO: ensure everything is same fidincr, fidstart and length for (int i = 0; i < len; i++) { if (vK.at(i) < MinK) { vUK.push_back(rDUMMY); vUTh.push_back(rDUMMY); vThK.push_back(rDUMMY); } else { vUK.push_back(RatioPoint(vU, vK, i, UMin, KMin)); vUTh.push_back(RatioPoint(vU, vTh, i, UMin, ThMin)); vThK.push_back(RatioPoint(vTh, vK, i, ThMin, KMin)); } } hUKout.setFidParams(hKin); hUKout.SaveVector(*pLine, vUK); hUTHout.setFidParams(hKin); hUTHout.SaveVector(*pLine, vUTh); hTHKout.setFidParams(hKin); hTHKout.SaveVector(*pLine, vThK); return TestError(); } double SpecRatio::VValue(vector<double>V, int Index) { double result; if ((Index < 0) || (Index >= len)) { result = 0; } else { try { result = V.at(Index); if (OasisUtils::isDummy(result)) { result = 0; } } catch (out_of_range) { result = 0; } } return result; } double SpecRatio::RatioPoint(vector<double>Num, vector<double>Denom, int Index, double NumMin, double DenomMin) { double num = VValue(Num, Index); double denom = VValue(Denom, Index); int s = 0; // Search equalled 10 in this case while (((num < NumMin) || (denom < DenomMin)) && (s < Search)) { num += VValue(Num, Index - s) + VValue(Num, Index + s); denom += VValue(Denom, Index - s) + VValue(Denom, Index + s); s++; } if ((num < NumMin) || (denom < DenomMin)) { return rDUMMY; } else { return num / denom; } } The top AQTime offenders are: std::_Uninit_copy , double *, std::allocator 3.65 secs and 115731 Hits std::_Construct 1.69 secs and 46450637 Hits std::_Vector_const_iterator ::operator !=1.66 secs and 46566395 Hits and so on... std::allocator<double>::construct, operator new, std::_Vector_const_iterator<double, std::allocator<double> >::operator ++, std::_Vector_const_iterator<double, std::allocator<double> >::operator * std::_Vector_const_iterator<double, std::allocator<double> >::operator == each get called over 46 million times. I'm obviously doing something wrong to cause all these objects to be created. Can anyone see my error(s)?

    Read the article

  • setting actionscript 3 superclass variables

    - by jedierikb
    In AS3, if I have a class such: public class dude { //default value for a dude protected var _strength:Number = 1; public function dude( ):void { super( ); //todo... calculate abilities of a dude based on his strength. } } and a subclass public class superDude extends dude { public function superDude( ):void { _strength = 100; super( ); trace( "strength of superDude: " + _strength ); } } This will trace strength of superDude is 1. I expected the variable I set in the subclass (prior to calling the superclass constructor) to remain. Is there a way to assign class variables in subclass constructors which are not over-written by the superclass construtor? Or should I pass them up as constructor variables?

    Read the article

  • How to properly catch a 404 error in .NET

    - by Luke101
    I would like to know the proper way to catch a 404 error with c# asp.net here is the code I'm using HttpWebRequest request = (HttpWebRequest) WebRequest.Create(String.Format("http://www.gravatar.com/avatar/{0}?d=404", hashe)); // execute the request try { //TODO: test for good connectivity first //So it will not update the whole database with bad avatars HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Response.Write("has avatar"); } catch (Exception ex) { if (ex.ToString().Contains("404")) { Response.Write("No avatar"); } } This code works but I just would like to know if this is the most efficient.

    Read the article

  • How can I simulate the effects of an observable collection in this situation?

    - by MGSoto
    I am making a configuration editor for another application and am using reflection to pull editable fields from the configuration class. The following class is the base class for my various "DataTypeViewModels" and shows how I get and set the appropriate properties. public abstract class DataTypeViewModel<T> : ViewModelBase { Func<T> getFunction; Action<T> setAction; public const string ValuePropertyName = "Value"; public string Label { get; set; } public T Value { get { return getFunction.Invoke(); } set { if (getFunction.Invoke().Equals(value)) { return; } setAction.Invoke(value); // Update bindings, no broadcast RaisePropertyChanged(ValuePropertyName); } } /// <summary> /// Initializes a new instance of the StringViewModel class. /// </summary> public DataTypeViewModel(string sectionName, string label) { if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { Label = label; getFunction = new Func<T>(() => { return (T)Settings.Instance.GetType().GetProperty(sectionName).PropertyType. GetProperty(label).GetValue(Settings.Instance.GetType().GetProperty(sectionName).GetValue(Settings.Instance, null), null); }); setAction = new Action<T>(value => { Settings.Instance.GetType().GetProperty(sectionName).PropertyType.GetProperty(label). SetValue(Settings.Instance.GetType().GetProperty(sectionName).GetValue(Settings.Instance, null), value, null); }); } } } This part works the way I want it to, the next part is a sample DataTypeViewModel on a list of strings. public class StringListViewModel : DataTypeViewModel<ICollection<string>> { /// <summary> /// The <see cref="RemoveItemCommand" /> property's name. /// </summary> public const string RemoveItemCommandPropertyName = "RemoveItemCommand"; private RelayCommand<string> _removeItemCommand = null; public ObservableCollection<string> ObservableValue { get; set; } /// <summary> /// Gets the RemoveItemCommand property. /// TODO Update documentation: /// Changes to that property's value raise the PropertyChanged event. /// This property's value is broadcasted by the Messenger's default instance when it changes. /// </summary> public RelayCommand<string> RemoveItemCommand { get { return _removeItemCommand; } set { if (_removeItemCommand == value) { return; } var oldValue = _removeItemCommand; _removeItemCommand = value; // Update bindings, no broadcast RaisePropertyChanged(RemoveItemCommandPropertyName); } } /// <summary> /// The <see cref="AddItemCommand" /> property's name. /// </summary> public const string AddItemCommandPropertyName = "AddItemCommand"; private RelayCommand<string> _addItemCommand = null; /// <summary> /// Gets the AddItemCommand property. /// TODO Update documentation: /// Changes to that property's value raise the PropertyChanged event. /// This property's value is broadcasted by the Messenger's default instance when it changes. /// </summary> public RelayCommand<string> AddItemCommand { get { return _addItemCommand; } set { if (_addItemCommand == value) { return; } var oldValue = _addItemCommand; _addItemCommand = value; // Update bindings, no broadcast RaisePropertyChanged(AddItemCommandPropertyName); } } /// <summary> /// Initializes a new instance of the StringListViewModel class. /// </summary> public StringListViewModel(string sectionName, string label) : base(sectionName, label) { ObservableValue = new ObservableCollection<string>(Value); AddItemCommand = new RelayCommand<string>(param => { if (param != string.Empty) { Value.Add(param); ObservableValue.Add(param); } }); RemoveItemCommand = new RelayCommand<string>(param => { if (param != null) { Value.Remove(param); ObservableValue.Remove(param); } }); } } As you can see in the constructor, I currently have "Value" mirrored into a new ObservableCollection called "ObservableValue", which is then bound to by a ListView in the XAML. It works well this way, but cloning the List seems like such a hacky way to do this. While bound to Value, I've tried adding: RaisePropertyChanged("Value"); to the AddItemCommand and RemoveItemCommand, but this doesn't work, the ListView won't get updated. What is the proper way to do this?

    Read the article

  • How do you unpack gems using jruby on rails 2.3?

    - by James Moore
    I'm trying to unpack all the system gems to end up with a standalone Rails directory including all the rails gems and all the system gems. I'm starting with a bare rails setup; just did a jruby -S rails and a 'generate jdbc'. I then add a config.gem 'jdbc-mysql' to environment.rb and do the jruby -S rake gems:unpack:dependencies. After unpacking, if I do a rake I get: no such file to load -- jdbc-mysql Is there something else you need to do to get the jdbc gem unpacked? I'm using jruby 1.4.0 (and moving to 1.5 is on my todo list) and rails 2.3.8.

    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

  • is it possible if callback in array_filter receive parameter ?

    - by justjoe
    i got this multiple array name $files[], who consist keys and values as below : [0] = Array ( [name] = index1.php [path] = http://localhost/php/gettingstarted/ [number] = 1 ) [1] = Array ( [name] = index10.php [path] = http://localhost/php/gettingstarted/ [number] = 2 ) [2] = Array ( [name] = index11.php [path] = http://localhost/php/gettingstarted/ [number] = 3 ) and i use this code to create new array consist of 'name' keys only. but it failed array_filter($files, "is_inarr_key('name')"); function is_inarr_key($array, $key) { //TODO : remove every array except those who got the same $key } and i got this error array_filter() [function.array-filter]: The second argument, 'is_inarr_key('name')', should be a valid callback in C:\xampp\htdocs\php\gettingstarted\index.php on line 15 so the queastion : 1. is it possible to make call-back function on array_filter has ability to receive parameter ? What is general rule of thumb on how to use callback in anyPHP built-in function ?

    Read the article

  • How do i create a portable app (runs without installing)

    - by jiewmeng
    how do i create an app that is: lightweight: i am guessing don't require .NET frameworks maybe? portable: runs without installing and saves data in the app directory, so i can just move the folder or maybe even the exe? this is just a personal experiment: i want to try create a simple todo list app that has the above attributes i am thinking C#/WPF (but requires .NET framework, i can explore client profile tho) Appcelerator Titanium (i think this will be lightweight & good enough? i dunno if i can have a portable titanium app tho)

    Read the article

  • Current status on Insight and gdb7.x?

    - by Johan
    Hi Does anybody know the current status on Insight and if they are working on integrating gdb7.x so there may be a new updated version? There don't seem to be much activity on the home page and the mail-lists. And does someone know if somebody over in the gdb camp is trying merge the two projects together? There is a least a interesting todo at the Insight page ( http://sourceware.org/insight/faq.php#q-4.2 ) " 2. Get Insight integrated and accepted into the GDB mainline." Thanks

    Read the article

  • How to prevent UI from freezing during lengthy process?

    - by OverTheRainbow
    Hello, I need to write a VB.Net 2008 applet to go through all the fixed-drives looking for some files. If I put the code in ButtonClick(), the UI freezes until the code is done: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'TODO Find way to avoid freezing UI while scanning fixed drives Dim drive As DriveInfo Dim filelist As Collections.ObjectModel.ReadOnlyCollection(Of String) Dim filepath As String For Each drive In DriveInfo.GetDrives() If drive.DriveType = DriveType.Fixed Then filelist = My.Computer.FileSystem.GetFiles(drive.ToString, FileIO.SearchOption.SearchAllSubDirectories, "MyFiles.*") For Each filepath In filelist 'Do stuff Next filepath End If Next drive End Sub Google returned information on a BackGroundWorker control: Is this the right/way to solve this issue? If not, what solution would you recommend, possibly with a really simple example? FWIW, I read that Application.DoEvents() is a left-over from VBClassic and should be avoided. Thank you.

    Read the article

  • So, I guess I can't use "&&" in the Python if conditional. Any help?

    - by Sergio Tapia
    Here's my code: # F. front_back # Consider dividing a string into two halves. # If the length is even, the front and back halves are the same length. # If the length is odd, we'll say that the extra char goes in the front half. # e.g. 'abcde', the front half is 'abc', the back half 'de'. # Given 2 strings, a and b, return a string of the form # a-front + b-front + a-back + b-back def front_back(a, b): # +++your code here+++ if len(a) % 2 == 0 && len(b) % 2 == 0: return a[:(len(a)/2)] + b[:(len(b)/2)] + a[(len(a)/2):] + b[(len(b)/2):] else: #todo! Not yet done. :P return I'm getting an error in the IF conditional. What am I doing wrong?

    Read the article

  • java timer and socket problem

    - by Guru
    Hi there, I'm trying to make a program which listens to the client input stream by using socket programming and timer but whenever timer executes.. it gets hanged Please help me out here is the code... private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: try { ServerUserName=jTextField1.getText(); ss=new ServerSocket(5000); jButton1.enable(false); jTextArea1.enable(true); jTextField2.enable(true); Timer t=new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { try { s=ss.accept(); InputStream is=s.getInputStream(); DataInputStream dis=new DataInputStream(is); jTextArea1.append(dis.readUTF()); } catch(IOException IOE) { } catch(Exception ex) { setLbl(ex.getMessage()); } } }); t.start(); } catch(IOException IOE) { } } Thanks in advance

    Read the article

  • C# Generics Casting

    - by Nippysaurus
    Visual sutdio 2008 has the ability to automatically create unit test stubs. I have used this to create some basic unit tests, but I am confused by something: private class bla : BaseStoreItem { // } /// <summary> ///A test for StoreData ///</summary> public void StoreDataTestHelper<T>() where T : BaseStoreItem { FileStore<T> target = new FileStore<T>(); // TODO: Initialize to an appropriate value BaseStoreItem data = new bla(); target.StoreData(data); } [TestMethod()] public void StoreDataTest() { //Assert.Inconclusive("No appropriate type parameter is found to satisfies the type constraint(s) of T. " + // "Please call StoreDataTestHelper<T>() with appropriate type parameters."); StoreDataTestHelper<bla>(); } Why do I get "Error: Cannot convert type 'StorageUnitTests.FileStoreTest.bla' to 'T'" when T is type "bla"? I know "bla" is not a good function name, but its just an example.

    Read the article

  • save changes problem

    - by ognjenb
    // GET: /Transporter/Edit/5 public ActionResult Edit(int id) { var FilesQueryEdit = (from i in FilesEntities.transporter where i.Id == id select i).First(); return View(FilesQueryEdit); } // // POST: /Transporter/Edit/5 [HttpPost] public ActionResult Edit(int id, transporter trn) { try { // TODO: Add update logic here FilesEntities.AddTotransporter(trn); FilesEntities.SaveChanges(); return RedirectToAction("Transporters"); } catch { return View(); } } This code inserts new row after post edited data. How to modify post action result to save changes in edited row without inserting new row

    Read the article

  • How do I correctly use generics?

    - by ninjasense
    I basically am making webrequests and recieving a JSON response. Depending on the request, I am parsing JSON request into objects I have created. The parsing is pretty much the same no matter what the object Im parsing into looks like. So I have a bunch of methods doing the same work only with different objects, I was wondering how I could accomplish this with generics? Here is an example public static ArrayList<Contact> parseContacts(String responseData) { ArrayList<Contact> Contacts = new ArrayList<Contact>(); try { JSONArray jsonContacts = new JSONArray(responseData); if (!jsonContacts.isNull(0)) { for (int i = 0; i < jsonContacts.length(); i++) { Contacts.add(new Contact(jsonContacts.getJSONObject(i))); } } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { } return Contacts; }

    Read the article

  • How to correctly handle click events on Widget

    - by www.liveinternet.ruusersilya_bog
    There is a task to make smt like todo list on widget (with dinamic number of elements), how to organize this list for click support on this elements. I only found how add click event on one widget layout element (with setOnClickPendingIntent), and how send text to widget element TextView. But it's unclear how handle click events for sub-elemets, or how get click coordinates(or item) where was click event. I saw widget "Agenda widget" - and it work fine with clicking on different calendar rows. I will be very much appreciated for help.

    Read the article

  • Sqlite database entries pass to array list?

    - by Rjay Guillermo Baltazar
    This is my code in getting the question into SQLite Database . I want to pass the questions into array list ? is it possible to my code ? Thanks for your help . public String getquestions() { // TODO Auto-generated method stub String[] sqlSelect = { "0 _id", "question", "answer" }; String sqlTables = "mytables"; SQLiteDatabase db = getWritableDatabase(); SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); qb.setTables(sqlTables); String result = ""; c = qb.query(db, sqlSelect, null, null, null, null, null); int id = c.getColumnIndex(ID); int question = c.getColumnIndex(ROW1); int answer = c.getColumnIndex(ROW2); c.moveToFirst(); result = result + c.getString(question) + c.getString(count); return result; }

    Read the article

  • RFC Repository of programming RFC's with ability to direct-link sections or even lines?

    - by Lasse V. Karlsen
    Forgive me if this is the wrong place to ask this, I feel like the question is slightly off-topic even though it is also about programming. I am inputting todo-tasks for my WebDAV-project into my issue tracker, as I read through the relevant RFC's, and it would be nice to be able to add a link in my issue text directly to the relevant text, instead of just a link to the RFC file with a section number in the issue text, and then I have to use the find function to find it. For instance, a link like this: http://ieft.org/rfc2518.txt#1000 <-- line 1000 http://ieft.org/rfc2518.txt#9.8.3 <-- section 9.8.3 Neither of these two works, since they just post the full text files, so my question is this: Does anyone know of hosted versions of the RFC documents that contains such links?

    Read the article

  • my window's handle is unused and cannot be evaluated

    - by numerical25
    I am trying to encapsulate my Win32 application into a class. My problem occurs when trying to initiate my primary window for the application below is my declaration and implementation... I notice the issue within my class method InitInstance(); declaration #pragma once #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 class RenderEngine { protected: int m_width; int m_height; ATOM RegisterEngineClass(); public: static HINSTANCE m_hInst; HWND m_hWnd; int m_nCmdShow; TCHAR m_szTitle[MAX_LOADSTRING]; // The title bar text TCHAR m_szWindowClass[MAX_LOADSTRING]; // the main window class name bool InitWindow(); bool InitDirectX(); bool InitInstance(); //static functions static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); int Run(); }; implementation #include "stdafx.h" #include "RenderEngine.h" HINSTANCE RenderEngine::m_hInst = NULL; bool RenderEngine::InitWindow() { RenderEngine::m_hInst = NULL; // Initialize global strings LoadString(m_hInst, IDS_APP_TITLE, m_szTitle, MAX_LOADSTRING); LoadString(m_hInst, IDC_RENDERENGINE, m_szWindowClass, MAX_LOADSTRING); if(!RegisterEngineClass()) { return false; } if(!InitInstance()) { return false; } return true; } ATOM RenderEngine::RegisterEngineClass() { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = RenderEngine::WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = m_hInst; wcex.hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_RENDERENGINE)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = MAKEINTRESOURCE(IDC_RENDERENGINE); wcex.lpszClassName = m_szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); return RegisterClassEx(&wcex); } LRESULT CALLBACK RenderEngine::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(m_hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } bool RenderEngine::InitInstance() { m_hWnd = NULL;// When I step into my code it says on this line 0x000000 unused = ??? expression cannot be evaluated m_hWnd = CreateWindow(m_szWindowClass, m_szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, m_hInst, NULL); if (!m_hWnd)// At this point, memory has been allocated unused = ??. It steps over this { return FALSE; } if(!ShowWindow(m_hWnd, m_nCmdShow))// m_nCmdShow = 1 and m_hWnd is still unused and expression {//Still cannot be evaluated. This statement is true. and shuts down. return false; } UpdateWindow(m_hWnd); return true; } // Message handler for about box. INT_PTR CALLBACK RenderEngine::About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; } int RenderEngine::Run() { MSG msg; HACCEL hAccelTable; hAccelTable = LoadAccelerators(m_hInst, MAKEINTRESOURCE(IDC_RENDERENGINE)); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; } and my winMain function that calls the class // RenderEngine.cpp : Defines the entry point for the application. #include "stdafx.h" #include "RenderEngine.h" // Global Variables: RenderEngine go; int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: Place code here. RenderEngine::m_hInst = hInstance; go.m_nCmdShow = nCmdShow; if(!go.InitWindow()) { return 0; } go.Run(); return 0; }

    Read the article

  • inconsistency between Sun JRE javac and Eclipse java compiler?

    - by Jason S
    This confuses me. The following compiles fine under Eclipse. package com.example.gotchas; public class GenericHelper1 { static <T> T fail() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } /** * just calls fail() * @return something maybe */ public boolean argh() { return fail(); } public static void main(String[] args) { // TODO Auto-generated method stub } } But if I try to do a clean build with ant, or at the command line with javac, I get this: src\com\example\gotchas\GenericHelper1.java:14: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds boolean,java.lang.Object public boolean argh() { return fail(); } ^ 1 error what gives, and how do I fix it?

    Read the article

  • Correct way to add objects to an ArrayList

    - by ninjasense
    I am trying to add an object to an arraylist but when I view the results of the array list, it keeps adding the same object over and over to the arraylist. I was wondering what the correct way to implement this would be. public static ArrayList<Person> parsePeople(String responseData) { ArrayList<Person> People = new ArrayList<Person>(); try { JSONArray jsonPeople = new JSONArray(responseData); if (!jsonPeople.isNull(0)) { for (int i = 0; i < jsonPeople.length(); i++) { Person.add(new Person(jsonPeople.getJSONObject(i))); } } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { } return People; } I have double checked my JSONArray data and made sure they are not duplicates. It seems to keep adding the first object over and over.

    Read the article

  • How to pass Remote Interface (aidl) throughout Activities ?

    - by Spredzy
    Hi All, I am developing an application using services and Remote interface. I have a question about passing the reference of my Remote interface throughout Activities. In my first Activity, I bind my service with my activity, in order to get a reference to my interface I use private ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName arg0, IBinder service) { x = X.Stub.asInterface(service); } @Override public void onServiceDisconnected(ComponentName arg0) { // TODO Auto-generated method stub } }; x being the reference to my interface. Now I would like to access this interface from another activity, I see two ways to do it but I don't know which one is the "proper" way to do it : passing x with my intent when I call the new Activity redo this.bindService(new Intent(y.this,z.class), mConnection, Context.BIND_AUTO_CREATE); in the onCreate() of my new Activity What would you advice me to do ?

    Read the article

  • Getting Result of $q's Resolution or Rejection

    - by Kevin Meredith
    I'm looking at a $q example from Mastering Web Application Development with Angular. For this code, how can I retrieve the String result of pizzaOrderFulfillment.resolve(...) or pizzaOrderFulfillment.reject? var myApp = angular.module('myApp',[]); myApp.controller("MyCtrl", function ($scope, $q) { var Person = function(name) { this.eat = function(food) { return name + " is eating " + food; }; this.beHungry = function(reason) { return name + " is hungry because" + reason; }; }; // success var pizzaOrderFulfillment = $q.defer(); var pizzaDelivered = pizzaOrderFulfillment.promise; var man = new Person("man"); pizzaDelivered.then(man.eat, man.beHungry); pizzaOrderFulfillment.resolve("chicken"); // TODO: var successResult = "man is eating chicken" });

    Read the article

  • My mod_rewrite won't work, what's wrong?

    - by Tim Rogers
    I have the following rewrite rule, but nothing is hapenning at all when I try to use it. I have the file in the directory server.blahblahblah.com/todo and the following is my .htaccess file: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteRule ^tasks/view/([0-9]+)?/$ controller.php?task=view&id=$1 RewriteRule ^tasks/view/([0-9]+).xml$ controller.php?task=viewxml&id=$1 RewriteRule ^tasks/new?/$ controller.php?task=new RewriteRule ^tasks/delete/([0-9]+)?/$ controller.php?task=delete&id=$1 RewriteRule ^tasks/completed/([0-9]+)?/$ controller.php?task=complete&id=$1 RewriteRule ^tasks?/$ controller.php?task=home Does anyone know why this won't work at all? Thanks, Tim

    Read the article

  • What's wrong in this simple android Program, I get 'Force Close'.

    - by andyfan
    What is wrong in this program, My eclipse IDE doesn't show any errors....when I execute this simple program the emulator shows force close....Anybody please clarify import android.app.Activity; import android.view.View.OnClickListener; import android.view.View; import android.os.Bundle; import android.widget.*; public class HelloWorld extends Activity implements OnClickListener { /** Called when the activity is first created. */ View Et1,Bt1,TxtDisp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.name_getter); Bt1=(Button)findViewById(R.id.Btn1); Et1=(EditText)findViewById(R.id.UserInput); TxtDisp=(TextView)findViewById(R.id.TextDisp); Bt1.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub String userInput=((EditText) Et1).getText().toString(); ((TextView)TxtDisp).setText(userInput); } }

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >