Search Results

Search found 8588 results on 344 pages for 'thread abort'.

Page 158/344 | < Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >

  • Strange behavior using getchar() and -O3

    - by Eduardo
    I have these two functions void set_dram_channel_width(int channel_width){ printf("one\n"); getchar(); } void set_dram_transaction_granularity(int cacheline_size){ printf("two\n"); getchar(); } //output: one f //my keyboard input two one f //keyboard input two one f //keyboard input //No more calls Then I change the functions to: void set_dram_channel_width(int channel_width){ printf("one\n"); } void set_dram_transaction_granularity(int cacheline_size){ printf("two\n"); getchar(); } //output one two f //keyboard input //No more calls Both functions are called by an external code, the code for both programs is the same, just changing the getchar() I get those two different outputs. Is this possible or there is something that is really wrong in my code? Thanks This is the output I get with GDB** For the first code (gdb) break mem-dram.c:374 Breakpoint 1 at 0x71c810: file build/ALPHA_FS/mem/dramsim/mem-dram.c, line 374. (gdb) break mem-dram.c:381 Breakpoint 2 at 0x71c7b0: file build/ALPHA_FS/mem/dramsim/mem-dram.c, line 381. (gdb) run -d ./tmp/MyBench2/ one f [Switching to Thread 47368811512112 (LWP 17507)] Breakpoint 1, set_dram_channel_width (channel_width=64) (gdb) c Continuing. two one f Breakpoint 2, set_dram_transaction_granularity (cacheline_size=64) (gdb) c Continuing. Breakpoint 1, set_dram_channel_width (channel_width=8) 374 void set_dram_channel_width(int channel_width){ (gdb) c Continuing. two one f For the second code (gdb) break mem-dram.c:374 Breakpoint 1 at 0x71c7b6: file build/ALPHA_FS/mem/dramsim/mem-dram.c, line 374. (gdb) break mem-dram.c:380 Breakpoint 2 at 0x71c7f0: file build/ALPHA_FS/mem/dramsim/mem-dram.c, line 380. (gdb) run one two f [Switching to Thread 46985688772912 (LWP 17801)] Breakpoint 1, set_dram_channel_width (channel_width=64) (gdb) c Continuing. Breakpoint 2, set_dram_transaction_granularity (cacheline_size=64) (gdb) c Continuing. Breakpoint 1, set_dram_channel_width (channel_width=8) (gdb) c Continuing.

    Read the article

  • WPD on XP, Vista, and 7 (need to transfer photo and video files)

    - by Bradley Dean
    I need to transfer files (still photos and videos) from any portable device that a user may connect (still camera, video camera, mobile phone, etc.) I don't need to worry about plain storage devices as these have drive letters. And I only care about existing files, I don't care about live video, preview video, taking new pictures, etc. I originally tried WIA, which works great except it can not transfer video files. So then I tried WPD, following along with dimeby8's tutorial: http://blogs.msdn.com/b/dimeby8/archive/2006/09/27/774259.aspx I haven't gotten the transfer working yet (I'm converting it over to C#), but I can at least see the device and enumerate the files in Win7. In XP I get nothing. It's pointed out in this thread that WPD won't enumerate devices on XP (see Lisa O [MSFT]'s post): http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/56459945-b757-45df-8c9f-4ebdbbb18a2c So WIA is out because it won't do video. And WPD is out because it won't do XP. Has anyone gotten this to work? Am I missing something simple here? Thanks.

    Read the article

  • Android Multiple Handlers Design Question

    - by Soumya Simanta
    This question is related to an existing question I asked. I though I'll ask a new question instead of replying back to the other question. Cannot "comment" on my previous question because of a word limit. Marc wrote - I've more than one Handlers in an Activity." Why? If you do not want a complicated handleMessage() method, then use post() (on Handler or View) to break the logic up into individual Runnables. Multiple Handlers makes me nervous. I'm new to Android. Is having multiple handlers in a single activity a bad design ? I'm new to Android. My question is - is having multiple handlers in a single activity a bad design ? Here is the sketch of my current implementation. I've a mapActivity that creates a data thread (a UDP socket that listens for data). My first handler is responsible for sending data from the data thread to the activity. On the map I've a bunch of "dynamic" markers that are refreshed frequently. Some of these markers are video markers i.e., if the user clicks a video marker, I add a ViewView that extends a android.opengl.GLSurfaceView to my map activity and display video on this new vide. I use my second handler to send information about the marker that the user tapped on ItemizedOverlay onTap(int index) method. The user can close the video view by tapping on the video view. I use my third handler for this. I would appreciate if people can tell me what's wrong with this approach and suggest better ways to implement this. Thanks.

    Read the article

  • SQL Server Compact timed out waiting for a lock

    - by jankhana
    Hi all, I'm having an application in that i use Sql Compact 3.5 with VS2008. I'm running multiple threads in my application which contacts the compact database and accesses the row. It selects and deletes those rows in a fashion i.e selecting and giving to the application 5 rows and deleting those rows from the table. It works great with a single thread but if i use multiple threads i.e if 3 or more threads are running I get very often the TimeOut Error!!! I have increased the Time out property in the connection string but it didn't give me expected result. The error log is as follow: SQL Server Compact timed out waiting for a lock. The default lock time is 2000ms for devices and 5000ms for desktops. The default lock timeout can be increased in the connection string using the ssce: default lock timeout property. [ Session id = 5,Thread id = 4204,Process id = 4808,Table name = XXX,Conflict type = x lock (s blocks),Resource = TAB ] The Query that I use to retrieve is as follows: " select Top(5) * from TableName order by id; delete from TableName where id in(select top(5) id from TableName order by id); " Is there any way by which we can avoid this Time Out exception??????? The above query I un as a transaction in VS2008 one using SQLCECommand and the other using SqlCEDataAdapter. Any Idea!!!!!! Reply

    Read the article

  • instantiate python object within a c function called via ctypes

    - by gwk
    My embedded Python 3.3 program segfaults when I instantiate python objects from a c function called by ctypes. After setting up the interpreter, I can successfully instantiate a python Int (as well as a custom c extension type) from c main: #import <Python/Python.h> #define LOGPY(x) \ { fprintf(stderr, "%s: ", #x); PyObject_Print((PyObject*)(x), stderr, 0); fputc('\n', stderr); } // c function to be called from python script via ctypes. void instantiate() { PyObject* instance = PyObject_CallObject((PyObject*)&PyLong_Type, NULL); LOGPY(instance); } int main(int argc, char* argv[]) { Py_Initialize(); instantiate(); // works fine // run a script that calls instantiate() via ctypes. FILE* scriptFile = fopen("emb.py", "r"); if (!scriptFile) { fprintf(stderr, "ERROR: cannot open script file\n"); return 1; } PyRun_SimpleFileEx(scriptFile, scriptPath, 1); // close on completion return 0; } I then run a python script using PyRun_SimpleFileEx. It appears to run just fine, but when it calls instantiate() via ctypes, the program segfaults inside PyObject_CallObject: import ctypes as ct dy = ct.CDLL('./emb') dy.instantiate() # segfaults lldb output: instance: 0 Process 52068 stopped * thread #1: tid = 0x1c03, 0x000000010000d3f5 Python`PyObject_Call + 69, stop reason = EXC_BAD_ACCESS (code=1, address=0x18) frame #0: 0x000000010000d3f5 Python`PyObject_Call + 69 Python`PyObject_Call + 69: -> 0x10000d3f5: movl 24(%rax), %edx 0x10000d3f8: incl %edx 0x10000d3fa: movl %edx, 24(%rax) 0x10000d3fd: leaq 2069148(%rip), %rax ; _Py_CheckRecursionLimit (lldb) bt * thread #1: tid = 0x1c03, 0x000000010000d3f5 Python`PyObject_Call + 69, stop reason = EXC_BAD_ACCESS (code=1, address=0x18) frame #0: 0x000000010000d3f5 Python`PyObject_Call + 69 frame #1: 0x00000001000d5197 Python`PyEval_CallObjectWithKeywords + 87 frame #2: 0x0000000201100d8e emb`instantiate + 30 at emb.c:9 Why does the call to instantiate() fail from ctypes only? The function only crashes when it calls into the python lib, so perhaps some interpreter state is getting munged by the ctypes FFI call?

    Read the article

  • how to continuously send data without blocking?

    - by Donal Rafferty
    I am trying to send rtp audio data from my Android application. I currently can send 1 RTP packet with the code below and I also have another class that extends Thread that listens to and receives RTP packets. My question is how do I continuously send my updated buffer through the packet payload without blocking the receiving thread? public void run() { isRecording = true; android.os.Process.setThreadPriority (android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); int buffersize = AudioRecord.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); Log.d("BUFFERSIZE","Buffer size = " + buffersize); arec = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, buffersize); short[] readBuffer = new short[80]; byte[] buffer = new byte[160]; arec.startRecording(); while(arec.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING){ int frames = arec.read(readBuffer, 0, 80); @SuppressWarnings("unused") int lenghtInBytes = codec.encode(readBuffer, 0, buffer, frames); RtpPacket rtpPacket = new RtpPacket(); rtpPacket.setV(2); rtpPacket.setX(0); rtpPacket.setM(0); rtpPacket.setPT(0); rtpPacket.setSSRC(123342345); rtpPacket.setPayload(buffer, 160); try { rtpSession2.sendRtpPacket(rtpPacket); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RtpException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } So when I send on one device and receive on another I get decent audio, but when I send and receive on both I get broken sound like its taking turns to send and receive audio. I have a feeling it could be to do with the while loop? it could be looping around in there and not letting anything else run?

    Read the article

  • Problem running java code through command line

    - by kunjaan
    I have a simple Class package chapter10; public class CompilationTest { public static void main(String[] args) { System.out.println("HELLO WORLD"); } } The path is Test\src\chapter10\CompilationTest.java I successfully compiled the code into the same folder and now I have Test\src\chapter10\CompilationTest.class However when I try to run from the same folder it I get this error >java CompilationTest Exception in thread "main" java.lang.NoClassDefFoundError: CompilationTest (wrong name: chapter10/CompilationTest) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: CompilationTest. Program will exit. When I run using >java chapter10/PropertiesTest Exception in thread "main" java.lang.NoClassDefFoundError: chapter10/PropertiesTest Caused by: java.lang.ClassNotFoundException: chapter10.PropertiesTest at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: chapter10/PropertiesTest. Program will exit.

    Read the article

  • Switch statement usage - C

    - by Jamie Keeling
    Hello, I have a thread function on Process B that contains a switch to perform certain operations based on the results of an event sent from Process A, these are stored as two elements in an array. I set the first element to the event which signals when Process A has data to send and I have the second element set to the event which indicates when Process A has closed. I have began to implement the functionality for the switch statement but I'm not getting the results as I expect. Consider the following: // //Thread function DWORD WINAPI ThreadFunc(LPVOID passedHandle) { for(i = 0; i < 2; i++) { ghEvents[i] = OpenEvent(EVENT_ALL_ACCESS, FALSE, TEXT("Global\\ProducerEvents")); if(ghEvents[i] == NULL) { getlasterror = GetLastError(); } } dwProducerEventResult = WaitForMultipleObjects( 2, ghEvents, FALSE, INFINITE); switch (dwProducerEventResult) { case WAIT_OBJECT_0 + 0: { //Producer sent data //unpackedHandle = *((HWND*)passedHandle); MessageBox(NULL,L"Test",L"Test",MB_OK); break; } case WAIT_OBJECT_0 + 1: { //Producer closed ExitProcess(1); break; } default: return; } } As you can see if the event in the first array is signalled Process B should display a simple message box, if the second array is signalled the application should close. When I actually close Process A, Process B displays the message box instead. If I leave the first case blank (Do nothing) both applications close as they should. Furthermore Process B sends data an error is thrown (When I comment out the unpacking): Have I implemented my switch statement incorrectly? I though I handled the unpacking of the HWND correctly too, any suggestions? Thanks for your time.

    Read the article

  • Displaying music list using custom lists instead of array adapters

    - by Rahul Varma
    Hi, I have displayed the music list in a list view. The list is obtained from a website. I have done this using Arraylist. Now, i want to iterate the same program using custom lists and custom adapters instead of array list. The code i have written using array lists is... public class MusicListActivity extends Activity { MediaPlayer mp; File mediaFile; TextView tv; TextView albumtext; TextView artisttext; ArrayList<String> al=new ArrayList<String>(); //ArrayList<String> al=new ArrayList<String>(); ArrayList<String> node=new ArrayList<String>(); ArrayList<String> filepath=new ArrayList<String>(); ArrayList<String> imgal=new ArrayList<String>(); ArrayList<String> album=new ArrayList<String>(); ArrayList<String> artist=new ArrayList<String>(); ListView lv; Object[] webImgListObject; String[] stringArray; XMLRPCClient client; String loginsess; HashMap<?, ?> siteConn = null; //ImageView im; Bitmap img; String s; int d; int j; StreamingMediaPlayer sm; int start=0; Intent i; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.openadiuofile); lv=(ListView)findViewById(R.id.list1); al=getIntent().getStringArrayListExtra("titles"); //node=getIntent().getStringArrayListExtra("nodeid"); filepath=getIntent().getStringArrayListExtra("apath"); imgal=getIntent().getStringArrayListExtra("imgpath"); album=getIntent().getStringArrayListExtra("album"); artist=getIntent().getStringArrayListExtra("artist"); // ArrayAdapter<String> aa=new ArrayAdapter<String>(this,R.layout.row,R.id.text2,al); //lv.setAdapter(aa); try{ lv.setAdapter( new styleadapter(this,R.layout.row, R.id.text2,al)); }catch(Throwable e) { Log.e("openaudio error",""+e.toString()); goBlooey(e); } lv.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3){ j=1; try{ d=arg2; String filep=filepath.get(d); String tit=al.get(d); String image=imgal.get(d); String singer=artist.get(d); String movie=album.get(d); sendpath(filep,tit,image,singer,movie); // getpath(n); }catch(Throwable t) { goBlooey(t); } } }); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); if(j==0) {i=new Intent(this,gorinkadashboard.class); startActivity(i);} } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); j=0; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_SEARCH) { Log.i("go","go"); return true; } return(super.onKeyDown(keyCode, event)); } public void sendpath(String n,String nn,String image,String singer,String movie) { Intent ii=new Intent(this,MusicPlayerActivity.class); ii.putExtra("path",n); ii.putExtra("titletxt",nn); //ii.putStringArrayListExtra("playpath",filepath); ii.putExtra("pos",d); ii.putExtra("image",image); ii.putStringArrayListExtra("imagepath",imgal); ii.putStringArrayListExtra("filepath", filepath); ii.putStringArrayListExtra("imgal", imgal); ii.putExtra("movie" ,movie ); ii.putExtra("singer",singer); ii.putStringArrayListExtra("album", album); ii.putStringArrayListExtra("artist",artist); ii.putStringArrayListExtra("tittlearray",al); startActivity(ii); } class styleadapter extends ArrayAdapter<String> { Context context=null; public styleadapter(Context context, int resource, int textViewResourceId, List<String> objects) { super(context, resource, textViewResourceId, objects); this.context=context; } @Override public View getView(int position, View convertView, ViewGroup parent) { final int i=position; LayoutInflater inflater = ((Activity) context).getLayoutInflater(); View v = inflater.inflate(R.layout.row, null); tv=(TextView)v.findViewById(R.id.text2); albumtext=(TextView)v.findViewById(R.id.text3); artisttext=(TextView)v.findViewById(R.id.text1); tv.setText(al.get(i)); albumtext.setText(album.get(i)); artisttext.setText(artist.get(i)); final ImageView im=(ImageView)v.findViewById(R.id.image); s="http://www.gorinka.com/"+imgal.get(i); // displyimg(s,v); // new imageloader(s,im); String imgPath=s; AsyncImageLoaderv asyncImageLoaderv=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoaderv.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { im.setImageBitmap(imageDrawable); } }); im.setImageBitmap(cachedImage); return v; } } public class imageloader implements Runnable{ private String ss; //private View v; //private View v2; private ImageView im; public imageloader(String s, ImageView im) { this.ss=s; //this.v2=v2; this.im=im; Thread thread = new Thread(this); thread.start(); } public void run(){ try { // URL url = new URL(ss); // URLConnection conn = url.openConnection(); // conn.connect(); HttpGet httpRequest = null; httpRequest = new HttpGet(ss); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = response.getEntity(); BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); InputStream is = bufHttpEntity.getContent(); // BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(is); Log.d("img","img"); // bis.close(); is.close(); im.setImageBitmap(bm); // im.forceLayout(); // v2.postInvalidate(); // v2.requestLayout(); } catch (Exception t) { Log.e("bitmap url", "Exception in updateStatus()", t); //goBlooey(t); // throw new RuntimeException(t); } } } private void goBlooey(Throwable t) { AlertDialog.Builder builder=new AlertDialog.Builder(this); builder .setTitle("Exception!") .setMessage(t.toString()) .setPositiveButton("OK", null) .show(); } } I have created the SongList.java, SongsAdapter.java and also SongsAdapterView.java. Their code is... public class SongsList { private String titleName; private String movieName; private String singerName; private String imagePath; private String mediaPath; // Constructor for the SongsList class public SongsList(String titleName, String movieName, String singerName,String imagePath,String mediaPath ) { super(); this.titleName = titleName; this.movieName = movieName; this.singerName = singerName; this.imagePath = imagePath; this.mediaPath = mediaPath; } public String gettitleName() { return titleName; } public void settitleName(String titleName) { this.titleName = titleName; } public String getmovieName() { return movieName; } public void setmovieName(String movieName) { this.movieName = movieName; } public String getsingerName() { return singerName; } public void setsingerName(String singerName) { this.singerName = singerName; } public String getimagePath() { return imagePath; } public void setimagePath(String imagePath) { this.imagePath = imagePath; } public String getmediaPath() { return mediaPath; } public void setmediaPath(String mediaPath) { this.mediaPath = mediaPath; } } public class SongsAdapter extends BaseAdapter{ private Context context; private List<SongsList> listSongs; public SongsAdapter(Context context, List<SongsList> listPhonebook){ this.context = context; this.listSongs = listSongs; } public int getCount() { return listSongs.size(); } public Object getItem(int position) { return listSongs.get(position); } public long getItemId(int position) { return position; } public View getView(int position, View view, ViewGroup viewGroup) { SongsList entry = listSongs.get(position); return new SongsAdapterView(context,entry); } } public SongsAdapterView(Context context, SongsList entry) { super(context); this.setOrientation(VERTICAL); this.setTag(entry); // TODO Auto-generated constructor stub View v = inflate(context, R.layout.row, null); TextView tvTitle = (TextView)v.findViewById(R.id.text2); tvTitle.setText(entry.gettitleName()); TextView tvMovie = (TextView)v.findViewById(R.id.text3); tvTitle.setText(entry.getmovieName()); TextView tvSinger = (TextView)v.findViewById(R.id.text1); tvTitle.setText(entry.getsingerName()); addView(v); } } Can anyone please tell me how to display the list using custom lists and custom adapters using the code above???

    Read the article

  • Java swing hold buttons

    - by Simon Charette
    Hi, I'm trying to create a subclass of JButton or AbstractButton that would call specified .actionPerformed as long as the mouse is held down on the button. So far I was thinking of extending JButton, adding a mouse listener on creation (inside constructor) and calling actionPerformed while the mouse is down. So far i came up with that but I was wondwering if I was on the right track and if so, how to correctly implement the "held down" logic. package components; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.Action; import javax.swing.Icon; import javax.swing.JButton; public class HoldButton extends JButton { private class HeldDownMouseListener implements MouseListener { private boolean mouseIsHeldDown; private HoldButton button; private long millis; public HeldDownMouseListener(HoldButton button, long millis) { this.button = button; this.millis = millis; } @Override public void mouseClicked(MouseEvent arg0) { } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mousePressed(MouseEvent arg0) { mouseIsHeldDown = true; // This should be run in a sub thread? // while (mouseIsHeldDown) { // button.fireActionPerformed(new ActionEvent(button, ActionEvent.ACTION_PERFORMED, "heldDown")); // try { // Thread.sleep(millis); // } catch (InterruptedException e) { // e.printStackTrace(); // continue; // } // } } @Override public void mouseReleased(MouseEvent arg0) { mouseIsHeldDown = false; } } public HoldButton() { addHeldDownMouseListener(); } public HoldButton(Icon icon) { super(icon); addHeldDownMouseListener(); } public HoldButton(String text) { super(text); addHeldDownMouseListener(); } public HoldButton(Action a) { super(a); addHeldDownMouseListener(); } private void addHeldDownMouseListener() { addMouseListener(new HeldDownMouseListener(this, 300)); } } Thanks a lot for your time.

    Read the article

  • Create xml document in java applet.

    - by zproxy
    If I try to create a new xml document in a java applet by this code: http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance() DocumentBuilderFactory.newInstance(); I will get this error: Java Plug-in 1.6.0_19 Using JRE version 1.6.0_19-b04 Java HotSpot(TM) Client VM javax.xml.parsers.FactoryConfigurationError: Provider <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> not found at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source) I do not care about DTD's. Why is it looking for it? How am I supposed to create a xml document in java applets? How can I make it work? The enclosing html document looks like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Loading...</title> </head> Can some comment this thread? The problem was with the entity resolver, which points to the w3c.org web site. The access to the reference DTDs on this site has been restricted for application use. The solution was to implement my own entity resolver. Related: http://forums.sun.com/thread.jspa?threadID=515055 http://stackoverflow.com/questions/1016286/org-apache-xerces-jaxp-saxparserfactoryimpl-not-found-when-importing-gears-api-in http://java.itags.org/java-desktop/4839/

    Read the article

  • ASP.NET MVC Creating a impersonated user.

    - by Malcolm
    Hi, I have a MVC app where I have a User class and the user can also impersonate another user(Admin users only). So I have this code below that authenticates the request and instantiates my version of a User class. It then tries to get the impersonated user from the Session object but Session is not available in this method in the global.asax. Hope this makes sense. How else could I do this? protected void Application_OnAuthenticateRequest(object sender, EventArgs e) { IMylesterService service = ObjectFactory.GetInstance(); if (Context.User != null) { if (Context.User.Identity.IsAuthenticated) { User user = service.GetUser(Context.User.Identity.Name); if (user == null) throw new ApplicationException("Context.user.Identity.name is not a recognized user"); User impersonatedUser = (User)this.Session["ImpersonatedUser"]; if (impersonatedUser == null) user.ImpersonatedUser = user; else user.ImpersonatedUser = impersonatedUser; System.Threading.Thread.CurrentPrincipal = Context.User = user; return; } } User guest = service.GetGuestUser(); guest.ImpersonatedUser = guest; System.Threading.Thread.CurrentPrincipal = Context.User = guest; }

    Read the article

  • iPhone Multithreaded Search

    - by Kulpreet
    I'm sort of new to any sort of multithreading and simply can't seem to get a simple search method working on a background thread properly. Everything seems to be in order with an NSAutoreleasePool and the UI being updated on the main thread. The app doesn't crash and does perform a search in the background but the search results yield the several of the same items several times depending on how fast I type it in. The search works properly without the multithreading (which is commented out), but is very slow because of the large amounts of data I am working with. Here's the code: - (void)filterContentForSearchText:(NSString*)searchText { isSearching = YES; NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init]; /* Update the filtered array based on the search text and scope. */ //[self.filteredListContent removeAllObjects]; // First clear the filtered array. for (Entry *entry in appDelegate.entries) { NSComparisonResult result = [entry.gurmukhiEntry compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])]; if (result == NSOrderedSame) { [self.filteredListContent addObject:entry]; } } [self.searchDisplayController.searchResultsTableView performSelectorOnMainThread:(@selector(reloadData)) withObject:nil waitUntilDone:NO]; //[self.searchDisplayController.searchResultsTableView reloadData]; [apool drain]; isSearching = NO; } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { if (!isSearching) { [self.filteredListContent removeAllObjects]; // First clear the filtered array. [self performSelectorInBackground:(@selector(filterContentForSearchText:)) withObject:searchString]; } //[self filterContentForSearchText:searchString]; return NO; // Return YES to cause the search result table view to be reloaded. }

    Read the article

  • AdressBook Crash, only with some contacts!

    - by Zebs
    My app crashes, it is a problem that arises from the AddressBook API, it only happens with some contacts. Here is the log: Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x00000102, 0x316ebd38 Crashed Thread: 0 Thread 0 Crashed: 0 CoreFoundation 0x00001cfe CFRetain + 90 1 AddressBook 0x00004b2c ABCMultiValueCopyValueAtIndex + 28 2 AddressBook 0x0001066a ABMultiValueCopyValueAtIndex + 2 3 Call Monitor 0x00003824 -[CallAppDelegate peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:] (AppDelegate.m:408) 4 AddressBookUI 0x00032cfc -[ABPeoplePickerNavigationController personViewController:shouldPerformDefaultActionForPerson:property:identifier:withMemberCell:] + 152 5 AddressBookUI 0x0003b8ce -[ABPersonViewControllerHelper personTableViewDataSource:selectedPropertyAtIndex:inPropertyGroup:withMemberCell:forEditing:] + 222 6 AddressBookUI 0x0004a17c -[ABPersonTableViewDataSource valueAtIndex:selectedForPropertyGroup:withMemberCell:forEditing:] + 40 7 AddressBookUI 0x00048c00 -[ABPersonTableViewDataSource tableView:didSelectRowAtIndexPath:] + 316 8 UIKit 0x00091f40 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 656 9 UIKit 0x0009db40 -[UITableView _userSelectRowAtIndexPath:] + 124 10 Foundation 0x00086c86 __NSFireDelayedPerform + 362 11 CoreFoundation 0x00071a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8 12 CoreFoundation 0x00073ede __CFRunLoopDoTimer + 854 13 CoreFoundation 0x0007485e __CFRunLoopRun + 1082 14 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224 15 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52 16 GraphicsServices 0x000036e8 GSEventRunModal + 108 17 GraphicsServices 0x00003794 GSEventRun + 56 18 UIKit 0x000062a0 -[UIApplication _run] + 396 19 UIKit 0x00004e10 UIApplicationMain + 664 20 Call Monitor 0x000028e8 main (main.m:14) 21 Call Monitor 0x000028b8 start + 32 This is driving me crazy, as it only happens with an isolated number of contacts. Any help would be greatly appreciated. Here is the code that was requested, thank you very very much for your help: (It is an extract from the method where I think the error happens) The weird thing is that it only happens with certain contacts, and deleting the contact, then creating a new one solves the problem... - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier NSString* firstName = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty); NSString* lastName = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty); NSNumber* record = [NSNumber numberWithInt:ABRecordGetRecordID(person)]; if(lastName!=nil){ name=[NSString stringWithFormat:@"%@ %@",firstName,lastName]; } else { name=firstName; } ABMultiValueRef phone = ABRecordCopyValue(person, property); NSString *value =(NSString *)ABMultiValueCopyValueAtIndex(phone, identifier); NSString *label =(NSString *)ABMultiValueCopyLabelAtIndex(phone, identifier); NSMutableArray *tempArray=[[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"MainArray"]]; NSDictionary *stringDictionary = [NSDictionary dictionaryWithObjectsAndKeys:name, kLabelKey, value, kNumberKey,label, kNumberLabelKey,record, kReferenceKey, nil]; [tempArray addObject:stringDictionary]; NSArray *mainArray = [NSArray arrayWithArray:tempArray]; [[NSUserDefaults standardUserDefaults] setObject:mainArray forKey:@"MainArray"];

    Read the article

  • How do I browse a Websphere MQ message without removing it?

    - by jmgant
    I'm writing a .NET Windows Forms application that will post a message to a Websphere MQ queue and then poll a different queue for a response. If a response is returned, the application will partially process the response in real time. But the response needs to stay in the queue so that a daily batch job, which also reads from the response queue, can do the rest of the processing. I've gotten as far as reading the message. What I haven't been able to figure out is how to read it without removing it. Here's what I've got so far. I'm an MQ newbie, so any suggestions will be appreciated. And feel free to respond in C#. Public Function GetMessage(ByVal msgID As String) As MQMessage Dim q = ConnectToResponseQueue() Dim msg As New MQMessage() Dim getOpts As New MQGetMessageOptions() Dim runThru = Now.AddMilliseconds(CInt(ConfigurationManager.AppSettings("responseTimeoutMS"))) System.Threading.Thread.Sleep(1000) 'Wait for one second before checking for the first response' While True Try q.Get(msg, getOpts) Return msg Catch ex As MQException When ex.Reason = MQC.MQRC_NO_MSG_AVAILABLE If Now > runThru Then Throw ex System.Threading.Thread.Sleep(3000) Finally q.Close() End Try End While Return Nothing 'Should never reach here' End Function NOTE: I haven't verified that my code actually removes the message. But that's how I understand MQ to work, and that appears to be what's happening. Please correct me if that's not the default behavior.

    Read the article

  • .NET threading solution for long queries

    - by Eddie
    Senerio We have an application that records incidents. An external database needs to be queried when an incident is approved by a supervisor. The queries to this external database are sometimes taking a while to run. This lag is experienced through the browser. Possible Solution I want to use threading to eliminate the simulated hang to the browser. I have used the Thread class before and heard about ThreadPool. But, I just found BackgroundWorker in this post. MSDN states: The BackgroundWorker class allows you to run an operation on a separate, dedicated thread. Time-consuming operations like downloads and database transactions can cause your user interface (UI) to seem as though it has stopped responding while they are running. When you want a responsive UI and you are faced with long delays associated with such operations, the BackgroundWorker class provides a convenient solution. Is BackgroundWorker the way to go when handling long running queries? What happens when 2 or more BackgroundWorker processes are ran simultaneously? Is it handled like a pool?

    Read the article

  • Error invoking stored procedure with input parameter from ADO.Net

    - by George2
    Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + ADO.Net. Here is my code and related error message. The error message says, @Param1 is not supplied, but actually it is supplied in my code. Any ideas what is wrong? System.Data.SqlClient.SqlException: Procedure or function 'Pr_Foo' expects parameter '@Param1', which was not supplied. class Program { private static SqlCommand _command; private static SqlConnection connection; private static readonly string _storedProcedureName = "Pr_Foo"; private static readonly string connectionString = "server=.;integrated Security=sspi;initial catalog=FooDB"; public static void Prepare() { connection = new SqlConnection(connectionString); connection.Open(); _command = connection.CreateCommand(); _command.CommandText = _storedProcedureName; _command.CommandType = CommandType.StoredProcedure; } public static void Dispose() { connection.Close(); } public static void Run() { try { SqlParameter Param1 = _command.Parameters.Add("@Param1", SqlDbType.Int, 300101); Param1.Direction = ParameterDirection.Input; SqlParameter Param2 = _command.Parameters.Add("@Param2", SqlDbType.Int, 100); portal_SiteInfoID.Direction = ParameterDirection.Input; SqlParameter Param3 = _command.Parameters.Add("@Param3", SqlDbType.Int, 200); portal_RoleInfoID.Direction = ParameterDirection.Input; _command.ExecuteScalar(); } catch (Exception e) { Console.WriteLine(e); } } static void Main(string[] args) { try { Prepare(); Thread t1 = new Thread(Program.Run); t1.Start(); t1.Join(); Dispose(); } catch (Exception ex) { Console.WriteLine(ex.Message + "\t" + ex.StackTrace); } } } Thanks in advance, George

    Read the article

  • PHP Post Count in Forum

    - by Chris
    I'm currently desiging a forum application, I considered using a premade but decided against it as it's useful for me to learn some of the techniques. So I've written a fairly full featured forum... great. One of the problems I want to solve is to include user data for each post, at the minute the post table includes the poster ID (obviously) and I added the poster's username at a later date so I didn't have to query the User DB for X number of posts in a thread. However, it's become apparent I now want to do this, usernames don't need to update retrospectively, however avatars, sigs, and especially post counts need to update actively, so data in some form needs keeping up to date somewhere... What would be a good way of implementing this? I obviously don't want to include any more user data on the Posts DB table than necessary, but I'm struggling to find an easy way to do this short of querying the DB for each post in a thread, which is potentially going to create a lot of traffic. How have other people solved this, I've been examining the code on some other open source apps but I can't find what I'm looking for. Is it possible to select multiple records in one query? In which case I could build an array dynamically on each page request (eg 'SQL blah blah' then a for each loop to insert the ID's). Could I join the tables each time? Do I submit a query for each post? Hmm.

    Read the article

  • Is it possible to write map/reduce jobs for Amazon Elastic MapReduce using .NET?

    - by Chris
    Is it possible to write map/reduce jobs for Amazon Elastic MapReduce (http://aws.amazon.com/elasticmapreduce/) using .NET languages? In particular I would like to use C#. Preliminary research suggests not. The above URL's marketing text suggests you have a "choice of Java, Ruby, Perl, Python, PHP, R, or C++", without mentioning .NET languages. This Amazon thread (http://developer.amazonwebservices.com/connect/thread.jspa?messageID=136051 -- "Support for C# / F# map/reducers") explicitly says that "currently Amazon Elastic MapReduce does not support Mono platform or languages such as C# or F#." The above suggests that it can't be done. I'm wondering if there are any workarounds, though. For example, can I modify the Elastic MapReduce machine image for my account, and install Mono on there? An alternative, suggested by Amazon FAQs "Using Other Software Required by Your Jar" (http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/index.html?CHAP_AdvancedTopics.html) and "How to Use Additional Files and Libraries With the Mapper or Reducer" (http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/index.html?addl_files.html), is to make the first step of the Map/Reduce job be to install Mono on the local instance. That sounds kind of inefficient, but maybe it could work? Maybe a saner alternative would be to try to forgo the convenience of Elastic MapReduce, and manually set up my own Hadoop cluster on EC2. Then I assume I could install Mono without difficulty.

    Read the article

  • int.Parse of "8" fails. int.Parse always requires CultureInfo.InvariantCulture?

    - by Henrik Carlsson
    We develop an established software which works fine on all known computers except one. The problem is to parse strings that begin with "8". It seems like "8" in the beginning of a string is a reserved character. Parsing: int.Parse("8") -> Exception message: Input string was not in a correct format. int.Parse("80") -> 0 int.Parse("88") -> 8 int.Parse("8100") -> 100 CurrentCulture: sv-SE CurrentUICulture: en-US The problem is solved using int.Parse("8", CultureInfo.InvariantCulture). However, it would be nice to know the source of the problem. Question: Why do we get this behaviour of "8" if we don't specify invariant culture? Additional information: I did send a small program to my client achieve the result above: private int ParseInt(string s) { int parsedInt = -1000; try { parsedInt = int.Parse(s); textBoxMessage.Text = "Success: " + parsedInt; } catch (Exception ex) { textBoxMessage.Text = string.Format("Error parsing string: '{0}'", s) + Environment.NewLine + "Exception message: " + ex.Message; } textBoxMessage.Text += Environment.NewLine + Environment.NewLine + "CurrentCulture: " + Thread.CurrentThread.CurrentCulture.Name + "\r\n" + "CurrentUICulture: " + Thread.CurrentThread.CurrentUICulture.Name + "\r\n"; return parsedInt; }

    Read the article

  • What is likely cause of Android runtime exception "No suitable Log implementation" related to loggin

    - by M.Bearden
    I am creating an Android app that includes a third party jar. That third party jar utilizes internal logging that is failing to initialize when I run the app, with this error: "org.apache.commons.logging.LogConfigurationException: No suitable Log implementation". The 3rd party jar appears to be using org.apache.commons.logging and to depend on log4j, specifically log4j-1.2.14.jar. I have packaged the log4j jar into the Android app. The third party jar was packaged with a log4j.xml configuration file, which I have tried packaging into the app as an XML resource (and also as a raw resource). The "No suitable Log implementation" error message is not very descriptive, and I have no immediate familiarity with Java logging. So I am looking for likely causes of the problem (what class or configuration resources might I be missing?) or for some debugging technique that will result in a different error message that is more explicit about the problem. I do not have access to source code for the 3rd party jar. Here is the exception stack trace. When I run the app, I get the following exception as soon as one of the third party jar classes attempts to initialize its internal logging. DEBUG/AndroidRuntime(15694): Shutting down VM WARN/dalvikvm(15694): threadid=3: thread exiting with uncaught exception (group=0x4001b180) ERROR/AndroidRuntime(15694): Uncaught handler: thread main exiting due to uncaught exception ERROR/AndroidRuntime(15694): java.lang.ExceptionInInitializerError ERROR/AndroidRuntime(15694): Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log implementation ERROR/AndroidRuntime(15694): at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:842) ERROR/AndroidRuntime(15694): at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:601) ERROR/AndroidRuntime(15694): at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:333) ERROR/AndroidRuntime(15694): at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:307) ERROR/AndroidRuntime(15694): at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645) ERROR/AndroidRuntime(15694): at org.apache.commons.configuration.ConfigurationFactory.<clinit>(ConfigurationFactory.java:77)

    Read the article

  • MSTest unit test passes by itself, fails when other tests are run

    - by Sarah Vessels
    I'm having trouble with some MSTest unit tests that pass when I run them individually but fail when I run the entire unit test class. The tests test some code that SLaks helped me with earlier, and he warned me what I was doing wasn't thread-safe. However, now my code is more complicated and I don't know how to go about making it thread-safe. Here's what I have: public static class DLLConfig { private static string _domain; public static string Domain { get { return _domain = AlwaysReadFromFile ? readCredentialFromFile(DOMAIN_TAG) : _domain ?? readCredentialFromFile(DOMAIN_TAG); } } } And my test is simple: string expected = "the value I know exists in the file"; string actual = DLLConfig.Domain; Assert.AreEqual(expected, actual); When I run this test by itself, it passes. When I run it alongside all the other tests in the test class (which perform similar checks on different properties), actual is null and the test fails. I note this is not a problem with a property whose type is a custom Enum type; maybe I'm having this problem with the Domain property because it is a string? Or maybe it's a multi-threaded issue with how MSTest works?

    Read the article

  • Passing an object as parameter from Andriod to web service using ksoap

    - by user3718626
    I have an object called User which implements KvmSerializable. Would like to pass this object to the webservice. PropertyInfo pi = new PropertyInfo(); pi.setName("obj"); pi.setValue(user); pi.setType(user.getClass()); request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); envelope.addMapping(NAMESPACE, "User",User.class); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); I get the following error.... SoapFault - faultcode: 'soapenv:Server' faultstring: 'Unknow type {http://users.com}User' faultactor: 'null' detail: org.kxml2.kdom.Node@53263024 at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:141) at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140) at org.ksoap2.transport.Transport.parseResponse(Transport.java:118) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:272) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113) at com.compete.WebServiceCallTask.getQuestion(WebServiceCallTask.java:114) at com.compete.WebServiceCallTask.doInBackground(WebServiceCallTask.java:53) at com.compete.WebServiceCallTask.doInBackground(WebServiceCallTask.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) Appreciate if any one can point me to an sample code or can direct me what is the issue. Thanks.

    Read the article

  • How do you protect a common resource using mutexes?

    - by Steve
    I have a common resource, which I want 1 and only 1 instance of my application (or it's COM API) to have access to at any time. I have tried to protect this resource using mutexes, but when multiple threads of a host dotnet application try to access the COM object, the mutex doesn't seem to be released. This is the code I have used to protect my resource. repeat Mutex := CreateMutex(nil, True, PChar('Connections')); until (Mutex <> 0) and (GetLastError <> ERROR_ALREADY_EXISTS); try //use resource here! finally CloseHandle(Mutex); end; If I run the threads simultaneously, the first thread get's through (obviously, being the first one to create the mutex), but subsequent threads are caught in the repeat loop. If I run each thread at 5 second intervals, then all is ok. I suspect I'm not using mutexes correctly here, but I have found very little documentation about how to do this. Any ideas?

    Read the article

  • Splitting EJBs and interfaces into separate module -- deployment fails

    - by Hank
    I'm having trouble following this guide to "extract" my interfaces and entities from my EAR to use them from another Web Application: I use NetBeans 6.8 and Glassfish 3.0.1 "Java Class Library" project contains all the entities and interfaces "Java EE Application" project class library added to the project, is packaged into the EAR contains EJB implementations, MDBs, Test "Java Web Application" project class library added to the project, is packaged into the WAR contains REST interface When I build and deploy the Web Application, all goes well. When I build the JEE application, I can see the jar-file (interfaces, entities) being included. But when I try to deploy the EAR, Glassfish refuses it with a java.lang.NoClassDefFoundError error: [#|2010-03-28T18:25:59.875+0200|WARNING|glassfishv3.0|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=28;_ThreadName=Thread-1;|Error in annotation processing: java.lang.NoClassDefFoundError: mvs/core/StoreServiceLocal|#] [#|2010-03-28T18:25:59.876+0200|SEVERE|glassfishv3.0|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=28;_ThreadName=Thread-1;|Exception while deploying the app java.lang.IllegalArgumentException: Invalid ejb jar [CoreServer]: it contains zero ejb. Note: 1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean. 2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar. 3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly. 'mvs/core/StoreServiceLocal' is an interface which is defined in the library jar file. What am I doing wrong?

    Read the article

< Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >