Daily Archives

Articles indexed Monday April 5 2010

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

  • Function pointers with default parameters in C++

    - by user308926
    How does C++ handle function pointers in relation to functions with defaulted parameters? If I have: void foo(int i, float f = 0.0f); void bar(int i, float f); void (*func_ptr1)(int); void (*func_ptr2)(int, float); void (*func_ptr3)(int, float = 10.0f); Which function pointers can I use in relation to which function?

    Read the article

  • objective C NSString retain

    - by Amarsh
    If I create a String with [NSString StringWithFormat], do I have to [retain] it? My understanding is that convenience methods add the objects to autorelease pool. If that is the case, shouldnt we retain the object so that it doesnt get drained with pool at the end of the event loop?

    Read the article

  • ClickOnce and mageUI adding custom file folder problems

    - by Leszek Wachowicz
    What I do: Publishing .Net 3.5 application via VS, or msbuild (whatever), and now I need to insert to the published application separate directory (Modules - not added as a reference to the project - our project architecture does not allow this). So I'm copying the folder to published location then runs mageUI.exe select the application manifest and then the problems starts. As I press the populate button it's adding also hidden directory? So I remove the directory, after I want to save the manifest file I get the "Warning MSB3110: Assembly 'NAME.Shell.application.deploy' has mismatched identity 'NAME.Shell.application', expected file name: 'NAME.Shell.application.application'". Did you have the same problems, according to http://smartclient.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=5060 it should be easy as 1-2-3 but it's not.

    Read the article

  • Cruisecontrol.NET & IIS7 Static File Handler Problem

    - by Mr. Flibble
    I'm trying to get Cruisecontrol.NET running with Server 2008/IIS7 and when I try and navigate to the dashboard I get the following error: HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler. I'm a bit lost in IIS7 so it could be something pretty straightforward. They (cc.net) do some funny stuff with http handlers in the web.config which may be related to the problem: Anyone have any pointers?

    Read the article

  • How to read the 3D chart data with directX?

    - by MemoryLeak
    I am reading a open source project, and I found there is a function which read 3D data(let's say a character) from obj file, and draw it . the source code: List<Vertex3f> verts=new List<Vertex3f>(); List<Vertex3f> norms=new List<Vertex3f>(); Groups=new List<ToothGroup>(); //ArrayList ALf=new ArrayList();//faces always part of a group List<Face> faces=new List<Face>(); MemoryStream stream=new MemoryStream(buffer); using(StreamReader sr = new StreamReader(stream)){ String line; Vertex3f vertex; string[] items; string[] subitems; Face face; ToothGroup group=null; while((line = sr.ReadLine()) != null) { if(line.StartsWith("#")//comment || line.StartsWith("mtllib")//material library. We build our own. || line.StartsWith("usemtl")//use material || line.StartsWith("o")) {//object. There's only one object continue; } if(line.StartsWith("v ")) {//vertex items=line.Split(new char[] { ' ' }); vertex=new Vertex3f();//float[3]; if(flipHorizontally) { vertex.X=-Convert.ToSingle(items[1],CultureInfo.InvariantCulture); } else { vertex.X=Convert.ToSingle(items[1],CultureInfo.InvariantCulture); } vertex.Y=Convert.ToSingle(items[2],CultureInfo.InvariantCulture); vertex.Z=Convert.ToSingle(items[3],CultureInfo.InvariantCulture); verts.Add(vertex); continue; } And why it need to read the data manually in directX? As far as I know, in XDA programming, we just need to call a function a load the resource. Is this because it is in DirectX, there is no function to read resource? If yes, then how to prepare the 3D resource ? in XDA we just need to use other software draw the 3D picture and then export. but what should I do in DirectX?

    Read the article

  • easiest to code algorithm for rubik's cube

    - by kokokok
    edit : I should rephrase this,what would be a relatively easy algorithm to code in java for solving a rubik's cube. Efficiency is also important but a secondary consideration. orig : what is the easiest algorithm to code for solving a rubik's cube? it could be the least efficient but I am looking for something easy to code right now

    Read the article

  • Puting contact number into field

    - by dfilkovi
    I have this code that has one button that let's me choose an entry from contacts, and passes that choesn contact to onActivityResult function. My question is how do I select data of that single contact when all that is passed is an Intent in data variable. That data variable, if converted to string shows something like "dat: content://contacts/people/4" so I see that selected contact is somehow passed, but what now? How to get that data? And also all I found by googling was examples with deprecated class People, so I don't know how too use new classes. Please help. Thank you. public class HelloAndroid extends Activity { private static final int CONTACT_ACTIVITY = 100; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button contactButton = (Button) findViewById(R.id.pick_contact_button); contactButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Uri uri = Uri.parse("content://contacts/people"); Intent contacts_intent = new Intent(Intent.ACTION_PICK, uri); startActivityForResult(contacts_intent, CONTACT_ACTIVITY); } }); } public void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode, resultCode, data); switch(requestCode){ case(CONTACT_ACTIVITY): { if(resultCode == Activity.RESULT_OK) { alertText(data.toString()); } break; } } } }

    Read the article

  • Is it bad programming style to have a single, maybe common, generic exception?

    - by m0s
    Hi, so in my program I have parts where I use try catch blocks like this try { DirectoryInfo dirInfo = new DirectoryInfo(someString); //I don't know if that directory exists //I don't know if that string is valid path string... it could be anything //Some operations here } catch(Exception iDontCareWhyItFailed) { //Didn't work? great... we will say: somethings wrong, try again/next one } Of course I probably could do checks to see if the string is valid path (regex), then I would check if directory exists, then I could catch various exceptions to see why my routine failed and give more info... But in my program it's not really necessary. Now I just really need to know if this is acceptable, and what would a pro say/think about that. Thanks a lot for attention.

    Read the article

  • Tile map collision detection

    - by hero
    There are many topics like this, but none with concrete answers. I am drawing a tile-map in the traditional way (two for loops) and keeping my player centered except when the edges of the map is reached. How would I create collision detection? I need to know how to translate tile location in the array to screen coordinates I think.

    Read the article

  • Why does DataInputStream not support integers?

    - by Jason
    I need to read in a list of numbers from a file, none of which are larger than 32767. Originally I was going to use the Scanner class to pull in the data, then I read about DataInputStream. This would work well for me, except that according to the API, it supports all primitive variables EXCEPT ints! Listed are longs, shorts, bytes, chars, booleans, ect, but no ints. I have no need for double precision from the incoming data. Is this a deliberate or unintentional oversight?

    Read the article

  • What is the difference between Java RMI and JMS?

    - by Sanoj
    When designing an distributed application in Java there seams to be a few technologies that address the same kind of problem. I have briefly read about Java Remote Method Invocation and Java Message Service, but it is hard to really see the difference. Java RMI seams to be more tightly coupled than JMS because JMS use asynchronous communication, but otherwise I don't see any big differences. What is the difference between them? Is one of them newer than the other one? Which one is more common/popular in enterprises? What advantages do they have over eachother? When is one preferred over the other? Do they differ much in how difficult they are to implement? I also think that Web Services and CORBA address the same problem.

    Read the article

  • Java Memory Model: reordering and concurrent locks

    - by Steffen Heil
    Hi The java meomry model mandates that synchronize blocks that synchronize on the same monitor enforce a before-after-realtion on the variables modified within those blocks. Example: // in thread A synchronized( lock ) { x = true; } // in thread B synchronized( lock ) { System.out.println( x ); } In this case it is garanteed that thread B will see x==true as long as thread A already passed that synchronized-block. Now I am in the process to rewrite lots of code to use the more flexible (and said to be faster) locks in java.util.concurrent, especially the ReentrantReadWriteLock. So the example looks like this: // in thread A synchronized( lock ) { lock.writeLock().lock(); x = true; lock.writeLock().unlock(); } // in thread B synchronized( lock ) { lock.readLock().lock(); System.out.println( x ); lock.readLock().unlock(); } However, I have not seen any hints within the memory model specification that such locks also imply the nessessary ordering. Looking into the implementation it seems to rely on the access to volatile variables inside AbstractQueuedSynchronizer (for the sun implementation at least). However this is not part of any specification and moreover access to non-volatile variables is not really condsidered covered by the memory barrier given by these variables, is it? So, here are my questions: Is it safe to assume the same ordering as with the "old" synchronized blocks? Is this documented somewhere? Is accessing any volatile variable a memory barrier for any other variable? Regards, Steffen

    Read the article

  • Create Audio file on iPhone/iPad from many other audio files (mixer)

    - by Brian
    I am trying to create something similar like Piano app on the iPhone. When people tap a key, it play a piano note. Basically, there will have only 7 notes (C) at the moment. Each note is a .caf file and its length is 5 seconds. I do not know if there is any way to save the song user played and export to mp3/caf format? The AVAudioRecord seems only record from the microphone input. Many thanks

    Read the article

  • Problem Linking Boost Filesystem Library in Microsoft Visual C++

    - by Scott
    Hello. I am having trouble getting my project to link to the Boost (version 1.37.0) Filesystem lib file in Microsoft Visual C++ 2008 Express Edition. The Filesystem library is not a header-only library. I have been following the Getting Started on Windows guide posted on the official boost web page. Here are the steps I have taken: I used bjam to build the complete set of lib files using: bjam --build-dir="C:\Program Files\boost\build-boost" --toolset=msvc --build-type=complete I copied the /libs directory (located in C:\Program Files\boost\build-boost\boost\bin.v2) to C:\Program Files\boost\boost_1_37_0\libs. In Visual C++, under Project Properties Additional Library Directories I added these paths: C:\Program Files\boost\boost_1_37_0\libs C:\Program Files\boost\boost_1_37_0\libs\filesystem\build\msvc-9.0express\debug\link-static\threading-multi I added the second one out of desperation. It is the exact directory where libboost_system-vc90-mt-gd-1_37.lib resides. In Configuration Properties C/C++ General Additional Include Directories I added the following path: C:\Program Files\boost\boost_1_37_0 Then, to put the icing on the cake, under Tools Options VC++ Directories Library files, I added the same directories mentioned in step 3. Despite all this, when I build my project I get the following error: fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_37.lib' Additionally, here is the code that I am attempting to compile as well as a screen shot of the aformentioned directory where the (assumedly correct) lib file resides: #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations #include <iostream> // for std::cout using boost::filesystem; // for ease of tutorial presentation; // a namespace alias is preferred practice in real code using namespace std; int main() { cout << "Hello, world!" << endl; return 0; } Can anyone help me out? Let me know if you need to know anything else. As always, thanks in advance.

    Read the article

  • type of an array

    - by Tim
    Hi, when I need to pass an array to a function, it seems all the following declarations of the function will work void f(int arr[]) void f(int arr[4]) // is this one correct? for this: int a[]={1,2,3,4}; f(a); But when I assign an array to another array, it fails int a[]={1,2,3,4}; int b[4] = a; // error: array must be initialized with a brace-enclosed initializer So why an array passed as an argument of a function is okay, but used on the rhs of simple assignment is wrong? Thanks!

    Read the article

  • GData for my own API?

    - by Malax
    Hi StackOverflow! Im currently planning to build an API for my service. I want to use GData because it fits the application scheme and there are libraries for many programming languages available. The first question that rose: Am I allowed to do that? I mean, Google put lots of work into the GData specification and have some sort of copyright. Does anyone know anything about this issue or did that before? You could extend the case if you want to specifically mimic an API which uses GData like the YouTube API to have my API 100% compliant. This is not my case, but I was wondering about that too. :-) Thank you for any input, Malax Edit: Note that i want to use it for my own service. So, I am implementing an API using the GData protocol, not using one of the Google APIs.

    Read the article

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