Hello every one,
I'd like to ask how to access to a mysql database on internet.Thank you.
Hello every one,
I'd like to ask how to access to a mysql database on internet.Thank you.
Hello guys ! I am currently programming an app for Android (which later will be also programmed to iOS) and I am confused. I program in C# and ASP for like 3 years now and I can program a web application pretty easily, using web services and an Access database to store the information. I've downloaded Xamarin and I am trying to develop an app, the problem is, I have no idea how the hell does this thing works. Since Access uses a pretty amateur DB I've decided to move on to MySQL for the first time though this is kinda irrelevant as I need to solve other things before getting down to this. I've seen that using web services isn't that simple as using them in a web app so I figured I'll just do a static class that will do all of those actions and to activate those functions in an activity (I don't know if it's the right place to activate them though). For say I have a "Login with Facebook", and I managed to make it work and I can login with Facebook now and can retrieve the information, though I have zero idea on how to store it to a MySQL database. I have a simple class that does the ADO functions such as "Execute Non Query" :
class DoQueries
{
public static SqliteConnection cnn;
public static SqliteConnection Connection()
{
var documents = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.Personal);
string db = Path.Combine(documents, "HookAppsDB.mwb");
bool exists = File.Exists(db);
if (!exists)
SqliteConnection.CreateFile(db);
var cnn = new SqliteConnection("Data Source=" + db);
return cnn;
}
public static bool ExecuteNonQuery(string strSQL)
{
cnn = Connection();
var cmd = strSQL;
bool r = false;
cnn.Open();
using (var c = cnn.CreateCommand())
{
c.CommandText = cmd;
c.CommandType = CommandType.Text;
r = (c.ExecuteNonQuery() != 0);
}
cnn.Close();
return r;
}
And then in a different static class I have the function that adds the user to the database :
public static void AddUpdateUser(User userDetails, int flag)
{
strsql = string.Format("insert into tblUsers (UserEmail, Username, FirstName, LastName, Gender, Birthday, ProfileURL, Status, FacebookID) values ('{0}', '{1}', '{2}', '{3}', {4}, {5}, '{6}', {7}, '{8}')", userDetails.Email, userDetails.UserName, userDetails.FName, userDetails.LName, userDetails.Gender, userDetails.Birthday, userDetails.ProfileURL, userDetails.UStatus, userDetails.FacebookID);
DoQueries.ExecuteNonQuery(strsql);
}
I'm getting all of that data from the Facebook sdk.
I am 100% I'm not doing something right as it seems hella wrong, I just don't know what and where to progress to.
Creating a local db seems wrong since I'm expecting a big traffic on the app (I at least hope so) and how to export it to a MySQL database is all new to me.
Thanks !
P.s also opened it in General forum since I don't know where it really belongs to.
I have been developing in Xamarin for about 4 months (VS2012/mono-android-4.8.03015) and there's some kind of bug that happens rather frequently where you're debugging, hit a breakpoint, and VS is no longer responding. The IDE process isn't dead but you will see a "Visual Studio is Busy" notification on the taskbar. It's beyond annoying because you pretty much have to kill the IDE via Task Manager.
Is Xamarin aware of this bug? Is there something I can do or kill to get around this?
Hi!
I'm getting a crash with a game when calling:
var purchases=_serviceConnection.BillingHandler.GetPurchases (ItemType.Product);
The In App Billing is correctly configured, the products are correctly listed and users have even purchased some products (and not being able to use them due to the crash).
The program crashes only in production, did not crash on debug.
The stack trace is this: (sorry about the file line numbers, I've not been able to set them correctly to be shown)
Exception of type \'Java.Lang.IllegalArgumentException\' was thrown. at Xamarin.InAppBilling.Utilities.Security.GeneratePublicKey (System.String encodedPublicKey) [0x00000] in :0 at Xamarin.InAppBilling.Utilities.Security.VerifyPurchase (System.String publicKey, System.String signedData, System.String signature) [0x00000] in :0 at Xamarin.InAppBilling.InAppBillingHandler.GetPurchases (System.String itemType) [0x00000] in :0 at Snippets.InAppWrapper+d__2.MoveNext () [0x00000] in :0 --- End of managed exception stack trace --- java.lang.IllegalArgumentException at mono.java.lang.RunnableImplementor.n_run(Native Method) at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5279) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
any ideas?
Thanks! Kak
I added icons to an iPhone project (Hello World) and then removed the icons (in Info.plist, right-click the icon and select "Unset image") - debug via simulator and the icons are still there.
Manually removing the <ItemGroup>
section from the .csproj and manually removing the .png files in the project directory works fine.
Looks like unsetting the image in the IDE isn't working? Or am I missing something?
Thanks :) -Andrew
When I installed the Xamarin Studio on my MacBook Pro with MacOSX 10.9.1. After updated to the latest version including Xamarin.iOS and Xamarin.Android. Then I open the sample project Tasky. After hitting the run button for debug, it has error "Build failed. A type load exception has occurred." as shown in the attached screen shot. Does anyone have idea? Thanks.
I'm trying to imply the voice recognition intent but I don't want that popup. how can I do that? I tried this but it doesn't seem to work nor the onresult void fired :( `
public class Activity2 : Activity,IRecognitionListener
{
private SpeechRecognizer mSpeechRecognizer;
private Intent mSpeechRecognizerIntent;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Create your application here
mSpeechRecognizer = SpeechRecognizer.CreateSpeechRecognizer(this);
mSpeechRecognizerIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
mSpeechRecognizerIntent.PutExtra(RecognizerIntent.ExtraCallingPackage, PackageName);
mSpeechRecognizerIntent.PutExtra(RecognizerIntent.ExtraPrompt, GetString(Resource.String.VoiceCommandsDesc));
mSpeechRecognizerIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, this.Resources.Configuration.Locale.Language);
mSpeechRecognizerIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 5);
Button StartListening = FindViewById<Button>(Resource.Id.Startlisning);
StartListening.Click += StartListening_Click;
}
void StartListening_Click(object sender, EventArgs e)
{
mSpeechRecognizer.StartListening(mSpeechRecognizerIntent);
}
public void OnBeginningOfSpeech()
{
throw new NotImplementedException();
}
public void OnBufferReceived(byte[] buffer)
{
throw new NotImplementedException();
}
public void OnEndOfSpeech()
{
throw new NotImplementedException();
}
public void OnError(SpeechRecognizerError error)
{
throw new NotImplementedException();
}
public void OnEvent(int eventType, Bundle @params)
{
throw new NotImplementedException();
}
public void OnPartialResults(Bundle partialResults)
{
throw new NotImplementedException();
}
public void OnReadyForSpeech(Bundle @params)
{
throw new NotImplementedException();
}
public void OnResults(Bundle results)
{
IList<string> matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
}
public void OnRmsChanged(float rmsdB)
{
throw new NotImplementedException();
}
}
} `
After adding a new file to my project as Content, I get the following Visual Studio exception when creating a breakpoint anywhere in that project:
"EXCEPTION: System.ArgumentException: Cannot set breakpoint on the specified IL offset. at Mono.Debugger.Soft.VirtualMachine.ErrorHandler(Object sender, ErrorHandlerEventArgs args)"
Is this a known issue or am I possibly doing something incorrectly? I just created a folder called Content, added a file to the project from that folder, and set the build action to Content.
Not that it should matter, but the file is a database file that I'm using to seed a user's db.
Any help would be greatly appreciated.
Hi, I am using Xamarin Studio for Unity3D for mac. I have changed code format settings int Xarmarin preferences, all new projects are adopting this new settings. But how to change these settings for my already previous projects? Would I need to change settings for each solution separately? That wont be possible because I have large number of projects. Thanks
Hi!
I'm debugging my game in a Galaxy Tab 3 and I'm having startup times of (way) more than 3 seconds from clicking the icon to getting to the OnCreate. Is this time normal?
I've also noticed the loading times for big Asset files on the Galaxy Tab are very big (like 1.5 seconds for a 16MB file)... the device is new, and has 3 or 4 apps installed max, so I'm almost sure it's not an space problem nor a virus problem.
I'm attaching the startup log:
01-07 21:27:51.115 V/WindowManager( 5253): Window{2153cf80 u0 Keyguard}mOrientationRequetedFromKeyguard=false
01-07 21:27:51.205 D/dalvikvm(12908): Trying to load lib /data/app-lib/mutantbear.superduck-1/libmonodroid.so 0x420e0cf0
01-07 21:27:51.205 D/ (12908): calling hookDlopen()!
01-07 21:27:51.205 D/ (12908): calling hookCheckABI2Header()!
01-07 21:27:51.205 D/ (12908): calling houdiniHookInit()!
01-07 21:27:51.285 D/houdini (12908): [12908] Loading library(version: 3.3.3.43422 RELEASE)... successfully.
01-07 21:27:51.305 D/dalvikvm(12908): Added shared lib /data/app-lib/mutantbear.superduck-1/libmonodroid.so 0x420e0cf0
01-07 21:27:51.305 D/ (12908): calling hookJniOnload()!
01-07 21:27:51.415 D/hwcomposer( 1907): isRGBOverlayLayer: got an RGB overlay layer
01-07 21:27:51.415 D/hwcomposer( 1907): isSpriteLayer: got a sprite layer
01-07 21:27:51.505 W/libc (12908): WARNING: generic atexit() called from legacy shared library
01-07 21:27:52.025 W/monodroid-gc(12908): GREF GC Threshold: 46800
01-07 21:27:52.055 I/monodroid-timing(12908): Runtime.init: start native-to-managed transition time: 1389126472066 ms
01-07 21:27:52.465 W/ContextImpl( 5253): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1375 com.android.server.StatusBarManagerService.sendNotification:179 com.android.server.StatusBarManagerService.updateNotification:796 com.android.server.NotificationManagerService.enqueueNotificationInternal:1296 com.android.server.NotificationManagerService.enqueueNotificationWithTag:1156
01-07 21:27:52.465 D/ProgressBar( 5485): setProgress = 40815076
01-07 21:27:52.465 D/ProgressBar( 5485): setProgress = 40815076, fromUser = false
01-07 21:27:52.465 D/STATUSBAR-StatusBarManagerService( 5253): sendNotification(2) - 62
01-07 21:27:52.475 D/ProgressBar( 5485): mProgress = 40654424mIndeterminate = false, mMin = 0, mMax = 48535185
01-07 21:27:52.475 D/ContexualWidgetMonitor( 5253): action =com.android.server.NotificationManagerService.NotificationArrived
01-07 21:27:52.475 D/ContexualWidgetMonitor( 5253): pkg =null
01-07 21:27:52.905 I/monodroid-timing(12908): JNIEnv.Initialize start: 1389126472465.45
01-07 21:27:52.915 I/monodroid-timing(12908): JNIEnv.Initialize: Logger JIT/etc. time: 1389126472915.73 [elapsed: 451.852 ms]
01-07 21:27:52.945 I/power ( 5253): *** acquire_dvfs_lock : lockType : 1 freq : 1600000
01-07 21:27:52.945 D/CustomFrequencyManagerService( 5253): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT frequency : 1600000 uid : 10094 pid : 5563 tag : LAUNCHER_APP_BOOSTER_CPU@4
01-07 21:27:52.955 I/monodroid-timing(12908): JNIEnv.Initialize: time: 1389126472969.04 [elapsed: 503.585 ms]
01-07 21:27:53.085 I/monodroid-timing(12908): TypeManager.cctor start: 1389126473089.33
01-07 21:27:53.225 I/monodroid-timing(12908): TypeManager.cctor time: 1389126473238.15 [elapsed: 148.82 ms]
01-07 21:27:53.235 I/monodroid-timing(12908): JNIEnv.Initialize: TypeManager init time: 1389126473240.82 [elapsed: 270.02 ms]
01-07 21:27:53.235 I/monodroid-timing(12908): Runtime.init: end native-to-managed transition time: 1389126473244 [elapsed 1178 ms]
01-07 21:27:53.275 I/monodroid-timing(12908): Runtime.register: start time: 1389126473288 ms
01-07 21:27:53.345 I/monodroid-timing(12908): JNIEnv.RegisterJniNatives ("Microsoft.Xna.Framework.AndroidGameActivity, MonoGame.Framework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null", 0xaf300021) start: 1389126473341.16
01-07 21:27:53.955 I/power ( 5253): *** release_dvfs_lock : lockType : 1
01-07 21:27:53.955 D/CustomFrequencyManagerService( 5253): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT frequency : 1600000 uid : 1000 pid : 5253 tag : ACTIVITY_RESUME_BOOSTER@8
01-07 21:27:53.955 W/ActivityManager( 5253): mDVFSHelper.release()
01-07 21:27:53.975 W/ContextImpl( 5253): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1375 com.android.server.StatusBarManagerService.sendNotification:179 com.android.server.StatusBarManagerService.updateNotification:796 com.android.server.NotificationManagerService.enqueueNotificationInternal:1296 com.android.server.NotificationManagerService.enqueueNotificationWithTag:1156
01-07 21:27:53.975 D/ProgressBar( 5485): setProgress = 41069696
01-07 21:27:53.975 D/ProgressBar( 5485): setProgress = 41069696, fromUser = false
01-07 21:27:53.975 D/ContexualWidgetMonitor( 5253): action =com.android.server.NotificationManagerService.NotificationArrived
01-07 21:27:53.975 D/ContexualWidgetMonitor( 5253): pkg =null
01-07 21:27:53.975 D/ProgressBar( 5485): mProgress = 40815076mIndeterminate = false, mMin = 0, mMax = 48535185
01-07 21:27:53.975 D/STATUSBAR-StatusBarManagerService( 5253): sendNotification(2) - 62
01-07 21:27:54.365 I/monodroid-timing(12908): JNIEnv.RegisterJniNatives total time: 1389126474374.1 [elapsed: 1032.937 ms]
01-07 21:27:54.365 I/monodroid-timing(12908): Runtime.register: end time: 1389126474376 [elapsed 1088 ms]
01-07 21:27:54.365 I/monodroid-timing(12908): Runtime.register: start time: 1389126474379 ms
01-07 21:27:54.365 I/monodroid-timing(12908): JNIEnv.RegisterJniNatives ("KakGame.Activity1, android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", 0xaf400021) start: 1389126474379.32
01-07 21:27:54.405 I/monodroid-timing(12908): JNIEnv.RegisterJniNatives total time: 1389126474418.85 [elapsed: 39.531 ms]
01-07 21:27:54.415 I/monodroid-timing(12908): Runtime.register: end time: 1389126474421 [elapsed 42 ms]
01-07 21:27:54.415 I/monodroid-timing(12908): Runtime.register: start time: 1389126474424 ms
01-07 21:27:54.415 I/monodroid-timing(12908): JNIEnv.RegisterJniNatives ("Java.Interop.TypeManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 0xaf500021) start: 1389126474425.5
01-07 21:27:54.425 I/monodroid-timing(12908): JNIEnv.RegisterJniNatives total time: 1389126474436.39 [elapsed: 10.889 ms]
01-07 21:27:54.425 I/monodroid-timing(12908): Runtime.register: end time: 1389126474437 [elapsed 13 ms]
01-07 21:27:54.825 E/Watchdog( 5253): !@Sync 87
01-07 21:27:55.005 E/My-timing(12908): On create time 1389130074945.93 `
I'm working in creating a composite image on the fly for iOS. I have two images, one is the base image (black and white), and the other is a alpha mask 'map' for a color filter. Then, at runtime, supply an RGB value so I can make the composite image be whatever color it should be.
I've found plenty of solutions for changing the entire image, but I'm having trouble finding a good solution for creating that color filter that only colors the area (with the alpha values) contained in the mask map:
Base Images:
Resulting image (if I tell it I want red):
In MonoDroid, I was able to create a custom ImageView
and override the OnDraw
method then used a ColorMatrixColorFilter
which worked like a charm, but don't know how to accomplish the same thing in MonoTouch.
This is what I did for MonoDroid:
protected override void OnDraw(Canvas canvas)
{
if (_alphaMask == null)
_alphaMask = BitmapFactory.DecodeResource(Resources, GetDrawable("star_mask"));
if(_image == null)
_image = BitmapFactory.DecodeResource(Resources, GetDrawable("star"));
AdjustColor(_color, canvas, _alphaMask, _image);
}
private static void AdjustColor(Color color, Canvas c, Bitmap alphaMask, Bitmap image)
{
float R = color.R;
float G = color.G;
float B = color.B;
var maskPaint = new Paint();
var mat = new[]
{
0, 0, 0, 0, R, //red
0, 0, 0, 0, G, //green
0, 0, 0, 0, B, //blue
0, 0, 0, 1, 0 //alpha
};
ColorMatrix cm = new ColorMatrix(mat);
maskPaint.SetColorFilter(new ColorMatrixColorFilter(cm));
c.DrawBitmap(image, 0, 0, null);
c.DrawBitmap(alphaMask, 0, 0, maskPaint);
}
Hi folks,
I have switched on high contrast (ALT+LEFT SHIFT+PRINT SCREEN) in my computer because I'm visual disabled. Xamarin Studio tabs do not change to high contrast and colors very dificult to follow.
Visual Studio is automatically switch to high contrast in this scenario and all colors are very easy to follow.
Do you plan to solve this for us?
Thanks
Is there a way to tell Xamarin Studio to just attach to a running iOS App (Debug build)? Looking at the device's log it seems that the debug App is waiting for a debugger connection on start up anyway.
Hi,
I've filed this bug : https://bugzilla.xamarin.com/show_bug.cgi?id=17053 which I keep getting on the alpha release version.
Is anyone else seeing this and if they are, is there a workaround?
Paul
Hi,
The following code works fine under iOS6, but not under iOS7
private void startAnimation()
{
using (var pool = new NSAutoreleasePool())
{
InvokeOnMainThread(() =>
{
player = new MPMoviePlayerController(NSUrl.FromFilename("Graphics/videos/noaudio-data-download.mp4"))
{
AllowsAirPlay = true,
Fullscreen = true,
ScalingMode = MPMovieScalingMode.Fill,
RepeatMode = MPMovieRepeatMode.One,
SourceType = MPMovieSourceType.File,
ShouldAutoplay = true,
ControlStyle = MPMovieControlStyle.Fullscreen,
};
player.View.Frame = View.Bounds;
View.AddSubview(player.View);
View.BringSubviewToFront(player.View);
player.PrepareToPlay();
player.Play();
});
}
}
private void stopAnimation()
{
player.Stop();
player.Dispose();
}
The video is a 320 x 480 mp4 file that displays fine under quicktime and vlc.
Did something change between iOS 6 and 7 that changed the way video is handled?
Paul
Hi guys!
Even reading, and re-reading publishing tutorial i have some troubles to do that job. I'm using VS 2010, im Package my app, the in bin/release appear 2 apks, signed and not-signed. Then i do the manually job like this.
`keytool -genkey -v -keystore but.keystore -alias publico -keyalg RSA -keysize 2048 -validity 10000
cd C:\Program Files\Java\jdk1.7.0_45\bin jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "C:\Users\BRUNO\but.keystore" "C:\Users\BRUNO\Documents\Visual Studio 2010\Projects\CronometroPeteca\CronometroPeteca\bin\Release\CronometroPeteca.CronometroPeteca.apk" publico
cd C:\Program Files\android\sdk\tools zipalign -f -v 4 "C:\Users\BRUNO\Documents\Visual Studio 2010\Projects\CronometroPeteca\CronometroPeteca\bin\Release\CronometroPeteca.CronometroPeteca.apk" peteca.apk`
My first doubt is: - Which apk should i upload, the new onew recetly created peteca.apk, or the CronometroPeteca.CronometroPeteca.apk?
Even uploading both, google play always return me the following error: "APK package name should be in this format "com.example.myapp". Can contains letters(a-z), numbers and underline(_). Should start with lowercase character."
I tried to put lowercase on my apk, but it doesnt work, can anyone point me to right direction ?
I tried getting some help in the Android sub-forum and got no help, so I'm trying here instead.
I'm running Xamarin Studio V4.2.2 with Xamarin.Android V4.10.1 (Starter Edition) on Windows 7 64-bit SP1, and I can't build any C# Android Applications.
When I attempt to build or clean any C# Android Application, I get the error "Build Failed." or "Clean Failed.", along with the text "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."
I get the error when I create a new C# Android Application, C# Android Honeycomb Application, or C# Android Ice Cream Sandwich Application, and try to build it before adding any code. It also happens when I attempt to build the downloaded HelloWorld Application.
I tried uninstalling Xamarin on my development PC and reinstalling it, but the error persists. I also just recently installed Xamarin Studio and Xamarin.Android on a brand new Windows 7 64-bit PC (including installing all updates), and it gives the error also (can't build or clean ANY Android applications).
As you can see in this thread:
http://forums.xamarin.com/discussion/comment/34799
I am not the only one experiencing this problem. I would really like to continue to use Xamarin to develop apps, but as of now, Xamarin is useless to me.
I'm hoping it is a simple configuration option that I have overlooked. Thank you for your time.
Okay, so finally getting over the learning hump and starting to do more advanced things. Simple tricks like:
AvatarImage.Layer.MasksToBounds = true;
AvatarImage.Layer.CornerRadius = 3f;
Which got me on the right track to so something slick like a rounded avatar image for users:
AvatarImage.Layer.MasksToBounds = true;
AvatarImage.Layer.CornerRadius = cell.AvatarImage.Bounds.Size.Width / 2.0f;
AvatarImage.Layer.BorderColor = new CGColor(0.65f, 0.65f, 0.65f);
AvatarImage.Layer.BorderWidth = 2.0f;
What I've seen in other apps, and what I'd like to know how to do is (a) add a bit of a white border on the inside of the image (an inset), and (b) how do you add the subtle shadow effect around the UIImage (or any other view). I've been doing nearly everything through IB and I've done very little with actual drawing... I've been avoiding it. But if I can find a happy medium where I start to add some nice effects, that'd be great.
TIA.
JB
I have to create a mobile app that runs on Android and IOS, but has to communicate with a database that runs via ODBC driver. Is that in Xamarin possible? It is not a SQL Database, but it works over an ODBC Driver.
After downloading the installer for MAC, I unzip the file and after launching the DMG file all I see is what is in the attached screenshot. Any help would be great.
Cheers.