Search Results

Search found 87 results on 4 pages for 'bm'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • BizTalk 2010 - BAM Portal - No Views to Display

    - by Stuart Brierley
    Our latest BizTalk Server 2010 development project is utilising BizTalk as the integration ring around a new and sizable implementaion of Dynamics AX 2012. With this project we have decided to use BAM to monitor the processes within our various new applications.Although I have been specialising in BizTalk for around 9 years, this is my first time using BAM so it is an interesting process to be going through.Recently when deploying a solution I was attempting to check the BAM Portal to see that the View that I had created was properly deployed and that the Activity I was populating was being surfaced in the Portal as expected. Initially I was presented with the message "No view to display" in the "My Views" area of the BAM Portal landing page.This was because you need to set the permissions on the views that you want to see from the command line using the bm.exe tool:bm.exe add-account -AccountName:YourServerOrDomain\YourUsername -View:YourViewThis tool can be found in the BAM folder at the BizTalk installation location:C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking

    Read the article

  • Android save Checkbox State in ListView with Cursor Adapter

    - by Ricardo
    I cant find a way to save the checkbox state when using a Cursor adapter. Everything else works fine but if i click on a checkbox it is repeated when it is recycled. Ive seen examples using array adapters but because of my lack of experience im finding it hard to translate it into using a cursor adapter. Could someone give me an example of how to go about it. Any help appreciated. private class PostImageAdapter extends CursorAdapter { private static final int s = 0; private int layout; Bitmap bm=null; private String PostNumber; TourDbAdapter mDbHelper; public PostImageAdapter (Context context, int layout, Cursor c, String[] from, int[] to, String Postid) { super(context, c); this.layout = layout; PostNumber = Postid; mDbHelper = new TourDbAdapter(context); mDbHelper.open(); } @Override public View newView(Context context, final Cursor c, ViewGroup parent) { ViewHolder holder; LayoutInflater inflater=getLayoutInflater(); View row=inflater.inflate(R.layout.image_post_row, null); holder = new ViewHolder(); holder.Description = (TextView) row.findViewById(R.id.item_desc); holder.cb = (CheckBox) row.findViewById(R.id.item_checkbox); holder.DateTaken = (TextView) row.findViewById(R.id.item_date_taken); holder.Photo = (ImageView) row.findViewById(R.id.item_thumb); row.setTag(holder); int DateCol = c.getColumnIndex(TourDbAdapter.KEY_DATE); String Date = c.getString(DateCol); int DescCol = c.getColumnIndex(TourDbAdapter.KEY_CAPTION); String Description = c.getString(DescCol); int FileNameCol = c.getColumnIndex(TourDbAdapter.KEY_FILENAME); final String FileName = c.getString(FileNameCol); int PostRowCol = c.getColumnIndex(TourDbAdapter.KEY_Post_ID); String RowID = c.getString(PostRowCol); String Path = "sdcard/Tourabout/Thumbs/" + FileName + ".jpg"; Bitmap bm = BitmapFactory.decodeFile(Path, null); holder.Photo.setImageBitmap(bm); holder.DateTaken.setText(Date); holder.Description.setText(Description); holder.cb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cBox = (CheckBox) v; if (cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, PostNumber); } else if (!cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, ""); } } }); return row; }; @Override public void bindView(View row, Context context, final Cursor c) { ViewHolder holder; holder = (ViewHolder) row.getTag(); int DateCol = c.getColumnIndex(TourDbAdapter.KEY_DATE); String Date = c.getString(DateCol); int DescCol = c.getColumnIndex(TourDbAdapter.KEY_CAPTION); String Description = c.getString(DescCol); int FileNameCol = c.getColumnIndex(TourDbAdapter.KEY_FILENAME); final String FileName = c.getString(FileNameCol); int PostRowCol = c.getColumnIndex(TourDbAdapter.KEY_Post_ID); String RowID = c.getString(PostRowCol); String Path = "sdcard/Tourabout/Thumbs/" + FileName + ".jpg"; Bitmap bm = BitmapFactory.decodeFile(Path, null); File x = null; holder.Photo.setImageBitmap(bm); holder.DateTaken.setText(Date); holder.Description.setText(Description); holder.cb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cBox = (CheckBox) v; if (cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, PostNumber); } else if (!cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, ""); } } }); } } static class ViewHolder{ TextView Description; ImageView Photo; CheckBox cb; TextView DateTaken; } }

    Read the article

  • Learning Haskell: How to remove an item from a List in Haskell

    - by BM
    Trying to learn Haskell. I am trying to write a simple function to remove a number from a list without using built-in function (delete...I think). For the sake of simplicity, let's assume that the input parameter is an Integer and the list is an Integer list. Here is the code I have, Please tell me what's wrong with the following code areTheySame :: Int -> Int-> [Int] areTheySame x y | x == y = [] | otherwise = [y] removeItem :: Int -> [Int] -> [Int] removeItem x (y:ys) = areTheySame x y : removeItem x ys

    Read the article

  • Does Blogging affect Job Prospects?

    - by BM
    Would a hiring manager at a small-to-medium consulting firm/corporation consider active blogging by a candidate about Programming/software/technology as a positive? Should the candidate disclose this information during the interviews or put it on the resume? Thanks for the answers, So far the views about this topic has been.. Don't mention the blog if it is not relevant to the job. Mention the blog, if you believe your blog has quality content. Potential risk of not being accepted by culture of the employer's workplace. Could be a valuable for consultants to publish & preview their skills and experience. Certain Employers may consider blogging of a candidate a plus. Be careful what you post on the blog,no badmouthing,rants and overt criticism of others. Do not lie about blogging,if directly asked during the interview.

    Read the article

  • Delphi - restore actual row in DBGrid

    - by durumdara
    Hi! D6 prof. Formerly we used DBISAM and DBISAMTable. That handle the RecNo, and it is working good with modifications (Delete, edit, etc). Now we replaced with ElevateDB, that don't handle RecNo, and many times we use Queries, not Tables. Query must reopen to see the modifications. But if we Reopen the Query, we need to repositioning to the last record. Locate isn't enough, because Grid is show it in another Row. This is very disturbing thing, because after the modification record is moving into another row, you hard to follow it, and users hate this. We found this code: function TBaseDBGrid.GetActRow: integer; begin Result := -1 + Row; end; procedure TBasepDBGrid.SetActRow(aRow: integer); var bm : TBookMark; begin if IsDataSourceValid(DataSource) then with DataSource.DataSet do begin bm := GetBookmark; DisableControls; try MoveBy(-aRow); MoveBy(aRow); //GotoBookmark(bm); finally FreebookMark(bm); EnableControls; end; end; end; The original example is uses moveby. This working good with Queries, because we cannot see that Query reopened in the background, the visual control is not changed the row position. But when we have EDBTable, or Live/Sensitive Query, the MoveBy is dangerous to use, because if somebody delete or append a new row, we can relocate into wrong record. Then I tried to use the BookMark (see remark). But this technique isn't working, because it is show the record in another Row position... So the question: how to force both the row position and record in DBGrid? Or what kind of DBGrid can relocate to the record/row after the underlying DataSet refreshed? I search for user friendly solution, I understand them, because I tried to use this jump-across DBGrid, and very bad to use, because my eyes are getting out when try to find the original record after update... :-( Thanks for your every help, link, info: dd

    Read the article

  • how to handle out of memory error?

    - by UMMA
    dear friends, i am using following code to display bitmap in my imageview. when i try to load image of size for example bigger than 1.5MB it give me error any one suggest me solution? try { URL aURL = new URL(myRemoteImages[val]); URLConnection conn = aURL.openConnection(); conn.connect(); InputStream is = null; try { is= conn.getInputStream(); }catch(IOException e) { return 0; } int a= conn.getConnectTimeout(); BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm; try { bm = BitmapFactory.decodeStream(bis); }catch(Exception ex) { bis.close(); is.close(); return 0; } bis.close(); is.close(); img.setImageBitmap(bm); } catch (IOException e) { return 0; } return 1; Log cat 06-14 12:03:11.701: ERROR/AndroidRuntime(443): Uncaught handler: thread main exiting due to uncaught exception 06-14 12:03:11.861: ERROR/AndroidRuntime(443): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 06-14 12:03:11.861: ERROR/AndroidRuntime(443): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)

    Read the article

  • Strange response from WCF service, how to return json easily

    - by Exitos
    I want to get a service to respond with just JSON. I have written the following code: namespace BM.Security { [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class AssocFileService { [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] public List<Person> GetPeople(int message) { List<Person> myList = new List<Person>(); Person p = new Person() { Age = 28, Name="Name1" }; Person p2 = new Person() { Age = 26, Name = "Name2" }; myList.Add(p); myList.Add(p2); return myList; } } [DataContract] public class Person { [DataMember] public string Name { get; set; } [DataMember] public int Age { get; set; } } } But im getting the following JSON back which is really wierd... { "d" : [ { "Age" : 28, "Name" : "Name1", "__type" : "Person:#Bm.Security" }, { "Age" : 26, "Name" : "Name2", "__type" : "Person:#BM.Security" } ] } I'm totally stumped by the "d" no idea where that has come from. And also by the __type variable, no thanks don't really want that in my Json :-( How do I set the root node in my data to replace that d? Where did the d come from? So many questions... Hope someone can help....

    Read the article

  • Get the touch position inside the imageview in android

    - by Manikandan
    I have a imageview in my activity and I am able to get the position where the user touch the imageview, through onTouchListener. I placed another image where the user touch over that image. I need to store the touch position(x,y), and use it in another activity, to show the tags. I stored the touch position in the first activity. In the first activity, my imageview at the top of the screen. In the second activity its at the bottom of the screen. If I use the position stored from the first acitvity, it place the tag image at the top, not on the imageview, where I previously clicked in the first activity. Is there anyway to get the position inside the imageview. FirstActivity: cp.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub Log.v("touched x val of cap img >>", event.getX() + ""); Log.v("touched y val of cap img >>", event.getY() + ""); x = (int) event.getX(); y = (int) event.getY(); tag.setVisibility(View.VISIBLE); int[] viewCoords = new int[2]; cp.getLocationOnScreen(viewCoords); int imageX = x - viewCoords[0]; // viewCoods[0] is the X coordinate int imageY = y - viewCoords[1]; // viewCoods[1] is the y coordinate Log.v("Real x >>>",imageX+""); Log.v("Real y >>>",imageY+""); RelativeLayout rl = (RelativeLayout) findViewById(R.id.lay_lin); ImageView iv = new ImageView(Capture_Image.this); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.tag_icon_32); iv.setImageBitmap(bm); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.leftMargin = x; params.topMargin = y; rl.addView(iv, params); Intent intent= new Intent(Capture_Image.this,Tag_Image.class); Bundle b=new Bundle(); b.putInt("xval", imageX); b.putInt("yval", imageY); intent.putExtras(b); startActivity(intent); return false; } }); In TagImage.java I used the following: im = (ImageView) findViewById(R.id.img_cam22); b=getIntent().getExtras(); xx=b.getInt("xval"); yy=b.getInt("yval"); im.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int[] viewCoords = new int[2]; im.getLocationOnScreen(viewCoords); int imageX = xx + viewCoords[0]; // viewCoods[0] is the X coordinate int imageY = yy+ viewCoords[1]; // viewCoods[1] is the y coordinate Log.v("Real x >>>",imageX+""); Log.v("Real y >>>",imageY+""); RelativeLayout rl = (RelativeLayout) findViewById(R.id.lay_lin); ImageView iv = new ImageView(Tag_Image.this); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.tag_icon_32); iv.setImageBitmap(bm); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( 30, 40); params.leftMargin =imageX ; params.topMargin = imageY; rl.addView(iv, params); return true; } });

    Read the article

  • dynamically change bitmap in imageView, android

    - by Junfei Wang
    All, I have a problem related to imageView, android. I have array which contains of 10 bitmap objects, called bm. I have a imageView, called im. Now I wanna show the bitmaps in the array in im one by one, so I did the following: new Thread(new Runnable() { public void run() { for(int j=0;j<10;j++){ im.setImageBitmap(bm[j]); } } }).start(); But the result only shows the last bitmap in the array. Can someone tell me what to do with this issue? Millions of thanks!

    Read the article

  • C#: Why am I getting "the process cannot access the file * because it is being used by another proce

    - by zxcvbnm
    I'm trying to convert bmp files in a folder to jpg, then delete the old files. The code works fine, except it can't delete the bmp's. DirectoryInfo di = new DirectoryInfo(args[0]); FileInfo[] files = di.GetFiles("*.bmp"); foreach (FileInfo file in files) { string newFile = file.FullName.Replace("bmp", "jpg"); Bitmap bm = (Bitmap)Image.FromFile(file.FullName); bm.Save(newFile, ImageFormat.Jpeg); } for (int i = 0; i < files.Length; i++) files[i].Delete(); The files aren't being used by another program/process like the error indicates, so I'm assuming the problem is here. But to me the code seems fine, since I'm doing everything sequentially. This is all that there is to the program too, so the error can't be caused by code elsewhere.

    Read the article

  • Scraping non-absolute URL

    - by cooldude
    I am trying to scrape www.weather.bm. I want all 10 radar images, but I can only get one (the image updates regularly) and it's not a absolute image url. I was hoping I could use the image as a image slideshow like the link but dont know how. Also, how can I remove images/Radarlegend.png? I just need the radar images. Here is my code: include('simple_html_dom.php'); $html = file_get_html('http://www.weather.bm/radarMobile.asp'); foreach($html->find('img') as $element) echo $element->src . '<br>' My output is: <div id="main"> images/Radar/CurrentRadarAnimation_100km_sri/100km_sri-radar-2011-01-04-1556.jpg<br>images/Radarlegend.png<br></div> </div>

    Read the article

  • Android camera to take multiple photos

    - by user2975407
    problem.java public class problem extends Activity { ImageView iv; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.problem); iv=(ImageView) findViewById(R.id.imageView1); Button b=(Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 0); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); Bitmap bm=(Bitmap) data.getExtras().get("data"); iv.setImageBitmap(bm); } } From this code I can only take one photo and it displayed in the screen. **But I want to take more photos nearly 5 photos and display in the screen** Further I want to add these photos to MySQL database.please help me to do that.I am new to android

    Read the article

  • Massive number of context switches on ksoftirqd

    - by Pace
    We have two servers that are grinding to a halt. One is a VM and the other is bare metal. Neither of them are running similar code but they are on the same network. It appears that an incredible number of context switches are arising from ksoftirqd (which is taking up a lot of CPU). vmstat output procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 605092 182496 2637556 0 0 0 0 4177 519187 8 19 73 0 0 2 0 0 605092 182496 2637556 0 0 0 0 4792 520980 8 19 74 0 0 3 0 0 605092 182496 2637552 0 0 0 0 2137 659640 18 26 56 0 0 ... pidstat output TCK4-BM-06A:~ # pidstat -w -I 5 Linux 2.6.32.12-0.7-default (TCK4-BM-06A) 07/02/2012 _x86_64_ 03:03:01 PM PID cswch/s nvcswch/s Command 03:03:06 PM 1 0.20 0.00 init 03:03:06 PM 4 386666.27 0.00 ksoftirqd/0 03:03:06 PM 6 0.60 0.00 ksoftirqd/1 03:03:06 PM 8 378213.17 0.00 ksoftirqd/2 03:03:06 PM 10 0.20 0.00 ksoftirqd/3 03:03:06 PM 12 0.20 0.00 ksoftirqd/4 03:03:06 PM 26 377115.37 0.00 ksoftirqd/11 03:03:06 PM 27 1.80 0.00 events/0 03:03:06 PM 28 1.00 0.00 events/1 03:03:06 PM 29 1.00 0.00 events/2 03:03:06 PM 30 1.00 0.00 events/3 03:03:06 PM 31 0.80 0.00 events/4 03:03:06 PM 32 0.80 0.00 events/5 ... My initial thought is that, since both are on the same network, something is flooding the network. Is this consistent with the data?

    Read the article

  • how to display bitmaps in listview?

    - by mary
    hi i want to show images downloaded in listview.images downloaded with function DownloadImage and are as bitmap.how to show in listview . name photoes with book_id in tabel book are aqual.i want each book has its own image. i can show in listview book_name and book_price just the problem with image book please help me class: package bookstore.category; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.http.NameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import bookstore.pack.JSONParser; import bookstore.pack.R; import android.app.Activity; import android.app.ProgressDialog; public class Computer extends Activity { Bitmap bm = null; // progress dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList<HashMap<String, String>> computerBookList; private static String url_books = "http://10.0.2.2/project/computer.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_BOOK = "book"; private static final String TAG_BOOK_NAME = "book_name"; private static final String TAG_BOOK_PRICE = "book_price"; private static final String TAG_BOOK_ID = "book_id"; private static final String TAG_MESSAGE = "massage"; // category JSONArray JSONArray book = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.category); Typeface font1 = Typeface.createFromAsset(getAssets(), "font/bnazanin.TTF"); // Hashmap for ListView computerBookList = new ArrayList<HashMap<String, String>>(); new LoadBook().execute(); } class LoadBook extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Computer.this); pDialog.setMessage("Please wait..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } protected String doInBackground(String... args) { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); // getting JSON string from URL JSONObject json = jParser.makeHttpRequest(url_books, "GET", params); // Check your log cat for JSON reponse Log.d("book:", json.toString()); try { // Checking for SUCCESS TAG int success = json.getInt(TAG_SUCCESS); if (success == 1) { DownloadImage("10.0.2.2/project/images/100.png"); DownloadImage("10.0.2.2/project/images/101.png"); DownloadImage("10.0.2.2/project/images/102.png"); DownloadImage("10.0.2.2/project/images/103.png"); DownloadImage("10.0.2.2/project/images/104.png"); DownloadImage("10.0.2.2/project/images/105.png"); DownloadImage("10.0.2.2/project/images/106.png"); DownloadImage("10.0.2.2/project/images/107.png"); DownloadImage("10.0.2.2/project/images/108.png"); DownloadImage("10.0.2.2/project/images/109.png"); DownloadImage("10.0.2.2/project/images/110.png"); // books found book = json.getJSONArray(TAG_BOOK); for (int i = 0; i < book.length(); i++) { JSONObject c = book.getJSONObject(i); // Storing each json item in variable String book_name = c.getString(TAG_BOOK_NAME); String book_price = c.getString(TAG_BOOK_PRICE); String book_id = c.getString(TAG_BOOK_ID); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_BOOK_NAME, book_name); map.put(TAG_BOOK_PRICE, book_price); // map.put(TAG_AUTHOR_NAME, author_name); // adding HashList to ArrayList computerBookList.add(map); } return json.getString(TAG_MESSAGE); } else { System.out.println("no book found"); } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { pDialog.dismiss(); // updating UI from Background Thread runOnUiThread(new Runnable() { ListView view1 = (ListView) findViewById(R.id.list_view); public void run() { ImageView iv = (ImageView) findViewById(R.id.list_image); // bm=BitmapFactory.decodeResource(getResources(), resId); //bm=BitmapFactory.decodeResource(null,R.id.list_image); // iv.setImageBitmap(bm); /* * */ /** * Updating parsed JSON data into ListView * */ ListAdapter adapter = new SimpleAdapter(Computer.this, computerBookList, R.layout.search_item, new String[] { TAG_BOOK_NAME, TAG_BOOK_PRICE }, new int[] { R.id.book_name, R.id.book_price }); view1.setAdapter(adapter); } }); } } private Bitmap DownloadImage(String URL) { Bitmap bitmap = null; InputStream in = null; try { in = OpenHttpConnection(URL); bitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e1) { e1.printStackTrace(); } return bitmap; } private InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if (!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP connection"); try { HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if (response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); } } catch (Exception ex) { throw new IOException("Error connecting"); } return in; } }

    Read the article

  • Display last picture

    - by steve
    Hi I'm inserting an image from the camera (Taking a picture) into the MediaStore.Images.Media datastore. Does anyone know how I can go about displaying the last picture taken? I used Uri image = ContentUris.withAppendedId(externalContentUri, 45); to display an image from the datastore but obviously 45 is not the correct image. I try to pass the information from the previous activity (Camera) to the display activity but I'm assuming due to the photo call back being its own thread the value never gets set. Photo code is as follows Camera.PictureCallback photoCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] data, Camera camera) { // TODO Auto-generated method stub FileOutputStream fos; try { Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length); fileUrl = MediaStore.Images.Media.insertImage(getContentResolver(), bm, "LastTaken", "Picture"); if(fileUrl == null) { Log.d("Still", "Image Insert Failed"); return; } else { picUri = Uri.parse(fileUrl); sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, picUri)); } } catch(Exception e) { Log.d("Picture", "Error Picture: ", e); } camera.startPreview(); } };

    Read the article

  • How to genrate a monochrome bit mask for a 32bit bitmap

    - by Mordachai
    Under Win32, it is a common technique to generate a monochrome bitmask from a bitmap for transparency use by doing the following: SetBkColor(hdcSource, clrTransparency); VERIFY(BitBlt(hdcMask, 0, 0, bm.bmWidth, bm.bmHeight, hdcSource, 0, 0, SRCCOPY)); This assumes that hdcSource is a memory DC holding the source image, and hdcMask is a memory DC holding a monochrome bitmap of the same size (so both are 32x32, but the source is 4 bit color, while the target is 1bit monochrome). However, this seems to fail for me when the source is 32 bit color + alpha. Instead of getting a monochrome bitmap in hdcMask, I get a mask that is all black. No bits get set to white (1). Whereas this works for the 4bit color source. My search-foo is failing, as I cannot seem to find any references to this particular problem. I have isolated that this is indeed the issue in my code: i.e. if I use a source bitmap that is 16 color (4bit), it works; if I use a 32 bit image, it produces the all-black mask. Is there an alternate method I should be using in the case of 32 bit color images? Is there an issue with the alpha channel that overrides the normal behavior of the above technique? Thanks for any help you may have to offer! ADDENDUM: I am still unable to find a technique that creates a valid monochrome bitmap for my GDI+ produced source bitmap. I have somewhat alleviated my particular issue by simply not generating a monochrome bitmask at all, and instead I'm using TransparentBlt(), which seems to get it right (but I don't know what they're doing internally that's any different that allows them to correctly mask the image). It might be useful to have a really good, working function: HBITMAP CreateTransparencyMask(HDC hdc, HBITMAP hSource, COLORREF crTransparency); Where it always creates a valid transparency mask, regardless of the color depth of hSource. Ideas?

    Read the article

  • android view web pictures in gallery

    - by bitma
    I am new to android, I just finished Hello gallery tutorial, and a web pciture tutorial. Now I want to know how can I show some web images in gallery? the hello gallery code is from andorid tutor this is Web gallery code, I want to load some pictures from web and then show them in gallery, how can I write it? public class WebGallery extends Activity { String imageUrl = "http://i.pbase.com/o6/92/229792/1/80199697.uAs58yHk.50pxCross_of_the_Knights_Templar_svg.png"; Bitmap bmImg; ImageView imView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); imView = (ImageView) findViewById(R.id.imview); imView.setImageBitmap(getRemoteImage(imageUrl)); } public Bitmap getRemoteImage(String imageUrl) { try { URL aURL = new URL(imageUrl); final URLConnection conn = aURL.openConnection(); conn.connect(); final BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()); final Bitmap bm = BitmapFactory.decodeStream(bis); bis.close(); return bm; } catch (IOException e) { Log.d("DEBUGTAG", "Oh noooz an error..."); } return null; } }

    Read the article

  • Display last image taken in Media.Images

    - by steve
    Hi I'm inserting an image from the camera (Taking a picture) into the MediaStore.Images.Media datastore. Does anyone know how I can go about displaying the last picture taken? I used Uri image = ContentUris.withAppendedId(externalContentUri, 45); to display an image from the datastore but obviously 45 is not the correct image. I try to pass the information from the previous activity (Camera) to the display activity but I'm assuming due to the photo call back being its own thread the value never gets set. Photo code is as follows Camera.PictureCallback photoCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] data, Camera camera) { // TODO Auto-generated method stub FileOutputStream fos; try { Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length); fileUrl = MediaStore.Images.Media.insertImage(getContentResolver(), bm, "LastTaken", "Picture"); if(fileUrl == null) { Log.d("Still", "Image Insert Failed"); return; } else { picUri = Uri.parse(fileUrl); sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, picUri)); } } catch(Exception e) { Log.d("Picture", "Error Picture: ", e); } camera.startPreview(); } };

    Read the article

  • Pixel plot method errors out without error message.

    - by sonny5
    // The following method blows up (big red x on screen) without generating error info. Any // ideas why? // MyPlot.PlotPixel(x, y, Color.BlueViolet, Grf); // runs if commented out // My goal is to draw a pixel on a form. Is there a way to increase the pixel size also? using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class Plot : System.Windows.Forms.Form { private Size _ClientArea; //keeps the pixels info private double _Xspan; private double _Yspan; public Plot() { InitializeComponent(); } public Size ClientArea { set { _ClientArea = value; } } private void InitializeComponent() { this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(400, 300); this.Text="World Plot (world_plot.cs)"; this.Resize += new System.EventHandler(this.Form1_Resize); this.Paint += new System.Windows.Forms.PaintEventHandler(this.doLine); this.Paint += new System.Windows.Forms.PaintEventHandler(this.TransformPoints); // new this.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawRectangleFloat); this.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawWindow_Paint); } private void DrawWindow_Paint(object sender, PaintEventArgs e) { Graphics Grf = e.Graphics; pixPlot(Grf); } static void Main() { Application.Run(new Plot()); } private void doLine(object sender, System.Windows.Forms.PaintEventArgs e) { // no transforms done yet!!! Graphics g = e.Graphics; g.FillRectangle(Brushes.White, this.ClientRectangle); Pen p = new Pen(Color.Black); g.DrawLine(p, 0, 0, 100, 100); // draw DOWN in y, which is positive since no matrix called p.Dispose(); } public void PlotPixel(double X, double Y, Color C, Graphics G) { Bitmap bm = new Bitmap(1, 1); bm.SetPixel(0, 0, C); G.DrawImageUnscaled(bm, TX(X), TY(Y)); } private int TX(double X) //transform real coordinates to pixels for the X-axis { double w; w = _ClientArea.Width / _Xspan * X + _ClientArea.Width / 2; return Convert.ToInt32(w); } private int TY(double Y) //transform real coordinates to pixels for the Y-axis { double w; w = _ClientArea.Height / _Yspan * Y + _ClientArea.Height / 2; return Convert.ToInt32(w); } private void pixPlot(Graphics Grf) { Plot MyPlot = new Plot(); double x = 12.0; double y = 10.0; MyPlot.ClientArea = this.ClientSize; Console.WriteLine("x = {0}", x); Console.WriteLine("y = {0}", y); //MyPlot.PlotPixel(x, y, Color.BlueViolet, Grf); // blows up } private void DrawRectangleFloat(object sender, PaintEventArgs e) { // Create pen. Pen penBlu = new Pen(Color.Blue, 2); // Create location and size of rectangle. float x = 0.0F; float y = 0.0F; float width = 200.0F; float height = 200.0F; // translate DOWN by 200 pixels // Draw rectangle to screen. e.Graphics.DrawRectangle(penBlu, x, y, width, height); } private void TransformPoints(object sender, System.Windows.Forms.PaintEventArgs e) { // after transforms Graphics g = this.CreateGraphics(); Pen penGrn = new Pen(Color.Green, 3); Matrix myMatrix2 = new Matrix(1, 0, 0, -1, 0, 0); // flip Y axis with -1 g.Transform = myMatrix2; g.TranslateTransform(0, 200, MatrixOrder.Append); // translate DOWN the same distance as the rectangle... // ...so this will put it at lower left corner g.DrawLine(penGrn, 0, 0, 100, 90); // notice that y 90 is going UP } private void Form1_Resize(object sender, System.EventArgs e) { Invalidate(); } }

    Read the article

  • Operations on multiple overlapping layers not working

    - by Arun
    Hi I am developing a game in android just like Farmville by Zinga. In that game we have to place elements in the diamond shaped field so the don't overlap each other. Now I did coding for placing the field inside the farm field but I cannot stop the problem of overlapping of the farm field. I Am attaching the code that I have down for all this someone please help me.... try{ if(bm1.getPixel((int)initX,(int)initY)!=0){ if(bm1.getPixel((int)initX,(int)initY+20)!=0){ if(bm1.getPixel((int)initX-20,(int)initY)!=0){ if(bm1.getPixel((int)initX+20,(int)initY)!=0){ if(bm1.getPixel((int)initX,(int)initY-20)!=0){ c.drawBitmap(bm,initX-30,initY-20, paint); } } } } } }catch(Exception e) { Toast.makeText(getContext(), e.toString(), Toast.LENGTH_SHORT); }

    Read the article

  • How can I make these images download on a seperate thread?

    - by Andy Barlow
    Hello!! I have the following code running on my Android device. It works great and displays my list items wonderfully. It's also clever in the fact it only downloads the data when it's needed by the ArrayAdapter. However, whilst the download of the thumbnail is occurring, the entire list stalls and you cannot scroll until it's finished downloading. Is there any way of threading this so it'll still scroll happily, maybe show a place holder for the downloading image, finish the download, and then show? Any help with this would be really apreciated. Thank-you kindly. Andy Barlow private class CatalogAdapter extends ArrayAdapter { private ArrayList<SingleQueueResult> items; //Must research what this actually does! public CatalogAdapter(Context context, int textViewResourceId, ArrayList<SingleQueueResult> items) { super(context, textViewResourceId, items); this.items = items; } /** This overrides the getview of the ArrayAdapter. It should send back our new custom rows for the list */ @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.mylists_rows, null); } final SingleQueueResult result = items.get(position); // Sets the text inside the rows as they are scrolled by! if (result != null) { TextView title = (TextView)v.findViewById(R.id.mylist_title); TextView format = (TextView)v.findViewById(R.id.mylist_format); title.setText(result.getTitle()); format.setText(result.getThumbnail()); // Download Images ImageView myImageView = (ImageView)v.findViewById(R.id.mylist_thumbnail); downloadImage(result.getThumbnail(), myImageView); } return v; } } // This should run in a seperate thread public void downloadImage(String imageUrl, ImageView myImageView) { try { url = new URL(imageUrl); URLConnection conn = url.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(bis); bis.close(); is.close(); myImageView.setImageBitmap(bm); } catch (IOException e) { /* Reset to Default image on any error. */ //this.myImageView.setImageDrawable(getResources().getDrawable(R.drawable.default)); } }

    Read the article

  • How can I make these images download on a separate thread?

    - by Andy Barlow
    I have the following code running on my Android device. It works great and displays my list items wonderfully. It's also clever in the fact it only downloads the data when it's needed by the ArrayAdapter. However, whilst the download of the thumbnail is occurring, the entire list stalls and you cannot scroll until it's finished downloading. Is there any way of threading this so it'll still scroll happily, maybe show a place holder for the downloading image, finish the download, and then show? Any help with this would be really appreciated. private class CatalogAdapter extends ArrayAdapter<SingleQueueResult> { private ArrayList<SingleQueueResult> items; //Must research what this actually does! public CatalogAdapter(Context context, int textViewResourceId, ArrayList<SingleQueueResult> items) { super(context, textViewResourceId, items); this.items = items; } /** This overrides the getview of the ArrayAdapter. It should send back our new custom rows for the list */ @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.mylists_rows, null); } final SingleQueueResult result = items.get(position); // Sets the text inside the rows as they are scrolled by! if (result != null) { TextView title = (TextView)v.findViewById(R.id.mylist_title); TextView format = (TextView)v.findViewById(R.id.mylist_format); title.setText(result.getTitle()); format.setText(result.getThumbnail()); // Download Images ImageView myImageView = (ImageView)v.findViewById(R.id.mylist_thumbnail); downloadImage(result.getThumbnail(), myImageView); } return v; } } // This should run in a seperate thread public void downloadImage(String imageUrl, ImageView myImageView) { try { url = new URL(imageUrl); URLConnection conn = url.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(bis); bis.close(); is.close(); myImageView.setImageBitmap(bm); } catch (IOException e) { /* Reset to Default image on any error. */ //this.myImageView.setImageDrawable(getResources().getDrawable(R.drawable.default)); } }

    Read the article

  • Displaying images in webpage without src URL

    - by Babiker
    Recently i learned that i can display images in a web page without referencing an image URL as follows : <img class="disclosure" img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oIGRQbOY8MjgMAAABVSURBVBjTfc6xDcAwCETRM0rt5nbA+49j70DDAqSLsGXyJQqkVxxwNOeMiEA+waW1VuT/inrvG7wikht8UETy2ygVMjO4O8YYTf6AqrZyUwYlygAAXo+QLmeF4c4uAAAAAElFTkSuQmCC"> I had another small bmp image that i wanted to display, so i opened it in vim and the img source looke like: When i paste this code where it needs to be pasted i only get "BM?" How to i convert/paste this code properly to be used as an image source?

    Read the article

< Previous Page | 1 2 3 4  | Next Page >