w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to match DISPLAY_NAME and Phone.NUMBER in android content provider wile reading contacts
This code basically gets the Number first then uses it to search for the contact name. ` Cursor c; c= mydb.query("sms", null, null, null, null, null, null); while (c.moveToNext()) { String name = null; String sender=c.getString(c.getColumnIndex("phoneNo")); String time=c.getString(c.getColumnIndex("smstype")); String smsbody=c.getString(c.getColumnIndex("message")); String[] projection = new String[]{ ContactsContract.PhoneLookup.DISPLAY_NAME}; Uri contacturi= Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(sender)); ContentResolver cr = getContentResolver(); Cursor crc= cr.query(contacturi, projection, null, null, null); if(crc.moveToNext()){ name=crc.getString(crc.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME)); } else{ name ="

Categories : Android

Problems with IIS and Custom Membership Provider + Custom Role Provider
I have had the similar issue. After adding machineKey to web.config everything works all right. <system.web> <machineKey validationKey="2E417D4AC04F20FA6CE1CF1EFE23FBF1695BF6981B605B1B8628D2182C43D0B10E48C4A83FDCE0D1D6300095D9EE1B8746A37E2C3256554405983DCAA7622875" decryptionKey="FA6D35C22BF7E5E9E4438052B924CCC017521137C5EB017D07C7038B80C5F726" validation="SHA1" decryption="AES" /> </system.web>

Categories : Asp Net Mvc

Dual purpose of Android ContentProvider: 1. Search provider and 2. List content provider
The ContentProvider you're using is generic and can be used for a search feature. You may think at first that maybe you should write a ContentProvider that specifically works for search but: You will have to duplicate a lot of code. ContentProviders are not designed to be specific, they just abstract the access to data. Your "Search Content Provider" will be used to make queries and you already have that with the Content Provider you have. The ContentProvider doesn't need to be specific to search. On the other hand, your Adpater should be specific.

Categories : Android

Symfony Security / Custom User Provider : How to get the login password within the custom User Provider?
@Pazi is correct in that building your own custom authentication provider will work. However, it's not an easy task. An alternative approach is to override DaoAuthenticationProvider and have it pass the password to the loadUser function. security_listeners.xml: <parameter key="security.authentication.provider.dao.class"> SymfonyComponentSecurityCoreAuthenticationProviderDaoAuthenticationProvider </parameter> Bit of a hack perhaps but it saves a good deal of work.

Categories : Authentication

Failed to find provider info for
Try using fully qualified path in android:authorities thereby replacing de.somename.provider with de.somename.provider.hvkContentProvider in so that it becomes as follows. <provider android:authorities="de.somename.provider.hvkContentProvider" android:enabled="true" android:multiprocess="true" android:name=".hvkContentProvider" android:exported="true" ></provider> You can refer this

Categories : Android

I want all photos that are texted to a certain phone number to be uploaded to my server and shown on page
MMS seems to be a solution. But for automatic uploading, you'll need to design apps corresponding to those platforms (android, ios, symbian etc.) to go through the messages and pick up the attachments and upload on tumblr. As far as access is concerned, I guess you're saying that someone who knows that phone-number might be able to search it up on tumblr. Regards

Categories : PHP

Binding provider that support writing to non observables
I solved it like this var applyMemberWriter = function(bindings, bindingName, accessor, memberName, context) { if(!ko.isObservable(accessor)) { bindings._ko_property_writers = bindings._ko_property_writers || {}; bindings._ko_property_writers[bindingName] = function(value) { context[memberName] = value; }; } }; This needs to be called to apply two way binding on none observables, full source https://github.com/AndersMalmgren/Knockout.BindingConventions/commit/7d8e7cdf0ddced5b39f10c1b374bcd5254cc0a58 Above is for KO 2.x For KO 3.x https://github.com/AndersMalmgren/Knockout.BindingConventions/commit/78983119c1e5fb70c637e4ffc1b692d2b4c74dc7

Categories : Knockout Js

Spring Security and nested FilterChainProxy writing SAML Service Provider
I was not able to get any definitive statement of this, but the problem appears to be with Spring Security 3.1.1 not playing well with Spring SAML or indeed any implementation that uses the same kind of nested FilterChainProxys. It appears FilterChainProxy was completely rewritten for 3.1.1. When I looked at the latest release (3.1.4), I noticed that there is a check in the finally clause that only clears the SecurityContextHolder ("SEC-1950") IF it is the first invocation of the filter. Thus, upgrading spring security to 3.1.4 solved the problem.

Categories : Spring

Saving photos to custom library
The method you mentioned in the question saveImage:toAlbum:withCompletionBlock is not part of ALAssetsLibrary. This method is written in ALAssetLibary's category. You got to import the category in your class to use the method. To learn more about objective C category , check out the developer reference.

Categories : Iphone

Missing photos when retrieving Users tagged photos facebook-graph API
The only thing that comes to mind is the settings of each user since according to the answer posted here - facebook graph api - missing fields, API access to these things can be turned off at the user's discretion.

Categories : Facebook

How can I show last saved photo in Photos app iOS via "photos-redirect:" URL scheme?
photos-redirect:// is the URL Scheme for Photo App. However, it is undocumented, thus you shouldn't use it. To view / select a photo, use UIImagePickerController .

Categories : IOS

Android SMS content provider
It won't run perfectly, the SMS not being part of the public API's means its not guaranteed to be standard across the board, for example you may get your app working on standard Android on a Nexus device but HTC/Samsung and all other brands will have slightly different content providers depending on their needs and designs meaning your app will break on these content providers.

Categories : Android

Accessing My Content Provider From Another App
No, ContentProviders are first class components (just like activities and services) and can be accessed at any time. The Content Provider basics go through the main points of accessing a ContentProvider using getContentResolver().query() (where getContentResolver() is a method from Context). You can also use AsyncQueryHandler to provide asynchronous insert/update/delete/query capabilities, which is great for one off queries where you don't want to tie up the main thread (as long queries could make your app appear unresponsive). However, for reoccuring queries, the Loader framework (also available via the Support Library) and CursorLoader are by far the easiest way to work with ContentProviders as they will automatically refresh data as it changes (assuming your ContentProvider is calli

Categories : Android

Content provider - multiple where parameters
Use cur = this.getContentResolver().query(CONTENT_URI, new String[]{ "reco_index_content_name", "reco_index_content_url" }, "user_profile_number = 2 and pkg_name = 'abc'", null, null, null, null); the function used here is public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)

Categories : Android

android - multiple content provider
What about https://developer.android.com/guide/topics/providers/content-provider-basics.html ? A contentprovider is an interface to access a database. I don't understand your question.

Categories : Android

how to create a service to interact with a content provider?
Check the documentation of AlarmManager, BroadcastReceiver and IntentService. You will need all of them because: You probably don't want your Service to be running all the time, but periodically (e.g. once every 2 minutes). For this you will need to register a broadcast with the AlarmManager, which your BroadcastReceiver will pick up periodically. You will be accessing a ContentProvider, and you always do that on a worker thread (and not the main thread) to avoid "Application Not Responding" errors. Starting an IntentService upon receiving a broadcast would ensure that you perform your queries (and resulting actions) in a worker thread (IntentService.onHandleIntent() is guaranteed to run off-main-thread) and because it is also a true Android Service your app is guaranteed to remain alive

Categories : Android

Android Sqlite Transaction and Content Provider
User ContentResolver object to delete multiple rows. // get the ContentResolver from a context // if not from any activity, then you can use application's context to get the ContentResolver // 'where' is the condition e.g., "field1 = ?" // whereArgs is the values in string e.g., new String[] { field1Value } ContentResolver cr = getContentResolver(); cr.delete(ProviderMyDatabase.CONTENT_URI, where, whereArgs); So any row with (field1 = field1Value) will be deleted. If you want to delete all the rows then cr.delete(ProviderMyDatabase.CONTENT_URI, "1 = 1", null);

Categories : Android

Android Content provider Cursor returns 0
What an epic problem this has been. I found the error in my ContentResolver code. selectionClause = BusinessOpsExpenditureProvider.EXPENDITURE_ID + "=?"; I was using the EXPENDITURE_ID variable from the provider rather than the database class. The line now reads. selectionClause = BusinessOpsDatabase.EXPENDITURE_ID + "=?"; And works!

Categories : Android

Content Provider Protection Level using Signature
According to Android Developer Guide. A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval. To forge a signature you need know a private key that was used to sign an application. So it's pretty safe for now (especially if you believe that P != NP :) ).

Categories : Android

Share an image with a content provider in Android app
As @Sun Ning-s comment noted some "share target apps" can handle URI-s starting with "content://.." which you have implemented. Other apps handle file uri-s starting with "file://...." so you have to implement a 2nd share menue "share as file" private Intent getFileShareIntent(String fullPathTofile) { final Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setType("image/jpeg"); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + fullPathTofile)); shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return shareIntent; } You can use the android app intentintercept to find out what other "share source apps" provide.

Categories : Android

Dynamic web page with RESTful content provider
You can have to methods declared at the same @Path but that @Produces two different mime types, the good one is selected accordingly to the Accept header sent by the client: @GET @Path("/article/{id}") @Produces(MediaType.APPLICATION_JSON) public Response getArticle(@PathParam("id") long id) { Article myArticle = getArticleById(id); return Response.ok(myArticle); } @GET @Path("/article/{id}") @Produces(MediaType.TEXT_HTML) public Response getArticleHtml(@PathParam("id") long id) { InputStream myHtml = getClass().getClassLoader().getResourceAsStream("/path/to/html.html"); return Response.ok(myHtml).build(); } But that let your Jax-RS implementation serve static resources for which it is not designed to. Or you can use a Single Page Javascript framework like Angula

Categories : Java

Android content provider update certain columns
do the calculation then do getContentResolver().update(uri,values,selection,selectionArgs); EDIT: so just update with the values ContentValues values = new ContentValues(); values.put(HabitTable.TIME); //whatever column you want to update, I dont know the name of it ...//any other values you want to update too getContentResolver().update(HabitTable.CONTENT_URI,values,HabitTable.ID+"=?",new String[] {String.valueOf(id)}); //id is the id of the row you wan to update obviously you will need to replace stuff with the correct column names

Categories : Android

How to share data using Content Provider in Android
Yes you need to create your content provider here is the tutorial: http://mobile.tutsplus.com/tutorials/android/android-sdk_content-providers/ then to fetch the results from content provider, you need to create a class in another application that extends content resolver and call the query used in content provider.

Categories : Android

Starting a new conversation thread via content provider
Probably because when you "delete" a message thread, it's marked as deleted in the SMS internals, but not actually removed from the underlying database. When you try to add the thread back to the provider, the _ID value conflicts with the row that's still in the database. In general, it's a really bad ("bad bad bad bad bad, not good" - Detritus, the troll, Men At Arms) idea to insert or delete data from bundled content providers using ContentResolver methods. Nearly all of these content providers have a complex internal state management system that you're bound to screw up if you try to "roll your own" process. Instead, you should stick to doing inserts and deletes using intents. The benefits are: The bundled app containing the content provider handles the state management for you. You

Categories : Java

Android - Fail while trying to add values in content provider
I dont know why you add a big wrong code in insert method like this. throw new SQLException("Adding failed: " + uri); Throw exception every time you insert make your app down every insert query. Just remove it from your code pls!

Categories : Android

My custome content provider returns empty cursor
And what is the value of VueConstants.CONTENT_URI? Have you tried an Uri like : "content://"+VueConstants.AUTHORITY+"/"+ VueConstants.AISLES+"/1" "content://"+VueConstants.AUTHORITY+"/"+ VueConstants.AISLES

Categories : Android

Why notify listeners in a content provider query method?
It tells the cursor what uri to watch, so it knows when its source data changes. When any data is modified, the ContentProvider notifies ContentResolver about the changes then the ContentResolver notifies all registered observers. Then if you have any CursorLoaders which have registered the observer, can load the new data by this

Categories : Android

Is writing DHCP client on Windows Phone 8 even possible?
Since DHCP is a simple UDP protocoll it should be possible. You just need to check if it is possible on wp8 to open the ports in that low range. In linux that requires root permission, but luckily we use Windows.

Categories : Sockets

Android Content Provider Query returning true when it should be false
In your query method, you are not putting the selection in the query you make. Hence, SURVEYNAME + " =?" is ignored. You need to call something like : return builder.query(db, projection, selection, selectionArgs, null, null, sortOrder); to pass your arguments to your database.

Categories : Android

What is safe way to populate a listview from a SQL database without a content provider (or do i have to make one)
The android SDK is making it harder and harder to put things that should be services or asynctasks on the UI thread. This is the direction they are moving in. See my answer on cursorloader vs content provider

Categories : Android

Custom membership provider in web Applications
1) Which all function I need to override in my application You mainly need to override GetUser and ValidateUser in order for Membership Provider to work with Login Control. The rest are optional. public class CustomMembershipProvider : MembershipProvider { public override MembershipUser GetUser(string username, bool userIsOnline) { throw new NotImplementedException(); } public override bool ValidateUser(string username, string password) { throw new NotImplementedException(); } } 2) Which all classes i need to inherit from. So far I used classes: MemberShipProvider, RoleProvider. MembershipProvider is a must. If you want to authorize a user by roles, you need to implement RoleProvider. 3) Can the ASP.NET automatically connect to the correct t

Categories : Asp Net

Custom Role Provider variables
Where is this parameter populated? Normally GetRolesForUser method is called from client code (code that you write in your application), so onus is on you to pass username. UserName is normally the login user name that user has used to login into your system so you should have it. In case you want to discover it programmatically, you might be able to use System.Web.HttpContext.Current.User.Identity.Name in ASP.NET MVC.

Categories : Authentication

EntLib Custom Validation Provider Example
Well it is quite late at this point. Anyone working on this, can check these out: http://programersnotebook.blogspot.in/2014/03/extending-enterprise-library-entlib.html http://programersnotebook.blogspot.in/2014/03/extending-entlib-vab-part-1-enable.html http://programersnotebook.blogspot.in/2014/04/extending-entlib-vab-part-21-create.html http://programersnotebook.blogspot.in/2014/04/extending-entlib-vab-part-22-enable.html

Categories : Validation

How to register help for a custom PowerShell provider?
I figured it out. Turns out that the name of the provider was misspelled in the MAML file. The name in /helpItems/providerHelp/Name must match the provider name specified in the ProviderConfigurationEntry object. Additionally, I specified the full path to the MAML file as the third parameter of the ProviderConfigurationEntry constructor and it works!

Categories : Dotnet

Symfony 2 Custom User Provider
I figured it out. It seems the DI container just create "EntityUserProvider" when specified "entity" in provider in security.xml. Then the AuthenticationProvider just call the methods in user provider. So I have to create a service for the user provider and specify ID in providers section in security.xml. src/Meot/FormBundle/Resources/config/services.xml <parameters> <parameter key="custom_user_provider.class">MeotFormBundleEntityUserRepository</parameter> <parameter key="custom_user_entity">MeotFormBundleEntityUser</parameter> </parameters> <services> <service id="custom_user_provider" class="%custom_user_provider.class%" factory-service="doctrine" factory-method="getRepository"> <argument>%custom_user_ent

Categories : Symfony2

How can I serve a file from the internal storage directory using a content provider in Android application?
I found a good solution at Android: Attaching files from internal cache to Gmail. This allows me to attach files from internal storage to any other application which are not part of our application.

Categories : Android

save images to sdcard with thumbnails and pass it to a gridview without using the Gallery content provider?
public Bitmap downloadImage() { URL myFileUrl = null; Bitmap bmImg = null; try { myFileUrl = new URL(this.getImageUrl()); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); Log.i("im connected", "Download"); bmImg = BitmapFactory.decodeStream(is); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return bmImg; } public void saveImage(Context context, Bitmap bmImg) { File filename; String imagePath = IMAGE_DIR; try {

Categories : Android

Using custom membership provider in a wcf service error
It is trying to find it in the System.Web assembly because you have not specified in the configuration where it should actually search for your provider. Try amending your configuration to include the assembly name like below: <providers> <add name="KinematMembershipProvider" type="Kinemat.Web.Infrastructure.KinematMembershipProvider, Assembly.Name.Where.Provider.Resides" .../> </providers>

Categories : Wcf

Unit testing my custom membership provider
Since you've exposed your repository as a property, just create an instance of your provider in your test class and set that property to your mock like so: public void Test() { MyMembershipProvider provider = new MyMembershipProvder(); provider.UserRepository = mock.Object; // Do test stuff here // Verify mock conditions } Presumably your repository implementation is using the UserRepository property so when you test it, this code will use the mocked dependency.

Categories : C#

custom role provider for user.isuserinrole mvc
Try creating a custom role provider. This page on MSDN goes into the basics. The custom role provider should inherit from the abstract class System.Web.Security.RoleProvider. In this class, you can then implement the abstract method IsUserInRole(string username, string roleName) to provide the logic that you need to answer the IsUserInRole call properly based on your application needs.

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.