PHP - Include Cross Domain File
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.domain.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
Aqua Utopia|海の底で記憶を紡ぐ
h
YOU ARE THE REASON

izzy's playlists!

No title available
let's talk about Bridgerton tea, my ask is open

Discoholic 🪩
he wasn't even looking at me and he found me
we're not kids anymore.
Game of Thrones Daily
Stranger Things

PR's Tumblrdome
almost home

Kiana Khansmith
Sweet Seals For You, Always
$LAYYYTER
Monterey Bay Aquarium

⁂
hello vonnie
I'd rather be in outer space 🛸
seen from United States

seen from United States
seen from United States

seen from Brazil

seen from United States

seen from Saudi Arabia

seen from United States
seen from United States

seen from Türkiye

seen from United Kingdom
seen from United States

seen from United States

seen from Australia
seen from Canada
seen from Brazil
seen from United States

seen from United States
seen from United States
seen from United States
seen from Türkiye
@codersapprentice-blog
PHP - Include Cross Domain File
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.domain.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
Android - Send Email From Your App
/* Create the Intent */ final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); /* Fill it with Data */ emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"[email protected]"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text"); /* Send it off to the Activity-Chooser */ context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Emails only works if you are using the application in a real phone, so if you are using the emulator, try it on a real phone.
Android - Google Maps inside an App
In AndroidManifest.xml ------------------------ <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> In the Java code for the activity --------------------------------- add "implements LocationListener" to the defination of the class String MapUrl = "http://www.google.com/maps?q=37.423156,-122.084917"; //MapUrl = "http://maps.google.com/maps?q=Pizza,texas&ui=maps"; private WebView _webView; _webView = (WebView)_yourrelativelayourSrc.findViewById(R.id.layout_webview); _webView.getSettings().setJavaScriptEnabled(true); _webView.getSettings().setBuiltInZoomControls(true); _webView.getSettings().setSupportZoom(true); LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); String provider = locationManager.getBestProvider(criteria,true); //In order to make sure the device is getting the location, request updates. locationManager.requestLocationUpdates(provider, 1, 0, this); mostRecentLocation = locationManager.getLastKnownLocation(provider); MapUrl = "http://www.google.com/maps?q=" + mostRecentLocation.getLatitude().toString() + "," + mostRecentLocation.getLongitude().toString(); final String centerURL = "javascript:centerAt(" + mostRecentLocation.getLatitude() + "," + mostRecentLocation.getLongitude()+ ")"; _webView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { // Activities and WebViews measure progress with different scales. // The progress meter will automatically disappear when we reach 100% ((Activity) activity).setProgress(progress * 1000); } }); //Wait for the page to load then send the location information _webView.setWebViewClient(new WebViewClient(){ @Override public void onPageFinished(WebView view, String url){ _webView.loadUrl(centerURL); } }); _webView.loadUrl(MapUrl);
Android - Basic Gesture Detection
//Implement the following events in your class public class ActivitySwipeDetector implements View.OnTouchListener { static final String logTag = "ActivitySwipeDetector"; static final int MIN_DISTANCE = 100; private float downX, downY, upX, upY; public void onRightToLeftSwipe(){ Log.i(logTag, "RightToLeftSwipe!"); activity.doSomething(); } public void onLeftToRightSwipe(){ Log.i(logTag, "LeftToRightSwipe!"); activity.doSomething(); } public void onTopToBottomSwipe(){ Log.i(logTag, "onTopToBottomSwipe!"); activity.doSomething(); } public void onBottomToTopSwipe(){ Log.i(logTag, "onBottomToTopSwipe!"); activity.doSomething(); } public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()){ case MotionEvent.ACTION_DOWN: { downX = event.getX(); downY = event.getY(); return true; } case MotionEvent.ACTION_UP: { upX = event.getX(); upY = event.getY(); float deltaX = downX - upX; float deltaY = downY - upY; // swipe horizontal? if(Math.abs(deltaX) > MIN_DISTANCE){ // left or right if(deltaX < 0) { this.onLeftToRightSwipe(); return true; } if(deltaX > 0) { this.onRightToLeftSwipe(); return true; } } else { Log.i(logTag, "Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE); return false; // We don't consume the event } // swipe vertical? if(Math.abs(deltaY) > MIN_DISTANCE){ // top or down if(deltaY < 0) { this.onTopToBottomSwipe(); return true; } if(deltaY > 0) { this.onBottomToTopSwipe(); return true; } } else { Log.i(logTag, "Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE); return false; // We don't consume the event } return true; } } return false; } } //To Bind the touch events on your controls
ActivitySwipeDetector activitySwipeDetector = new ActivitySwipeDetector(this); lowestLayout = (RelativeLayout)this.findViewById(R.id.lowestLayout); lowestLayout.setOnTouchListener(activitySwipeDetector);
Android - Open Gallery For Image
//Open Gallery To Select Image Intent intent = new Intent(Intent.ACTION_GET_CONTENT);intent.setType("image/*");startActivityForResult(intent, 0); //To Show Image After Selection or Get its Path protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch(requestCode) { case 0: if(resultCode == RESULT_OK){ Uri selectedImage = imageReturnedIntent.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePath = cursor.getString(columnIndex); // file path of selected image cursor.close(); // Convert file path into bitmap image using below line. Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath); // put bitmapimage in your imageview yourimgView.setImageBitmap(yourSelectedImage); } } }
Android - Adding External JARS in Your Project
A Best way to add External Jars to your Anroid Project or any Java project is:
Create a folder call 'lib' into you project root folder
Copy your Jar files to the lib folder
Now right click on the Jar file and Build Path > Add to Build Path, this will create a folder called 'Refrenced Library' into you project, and your are done
By do doing like this, whenever you transfer you project, you will not miss you libraries which are being referenced to some space on your Hard drive.
Android - Share Menu Feature
Intent intent = new Intent(android.content.Intent.ACTION_SEND);intent.setType(“text/plain”);intent.putExtra(android.content.Intent.EXTRA_TEXT, “Your Link”);intent.putExtra(android.content.Intent.EXTRA_SUBJECT, “Some extra text if you want it”);startActivity(Intent.createChooser(intent, “Share via”));
C# - Decoding String From Base64
static public string DecodeFrom64(string encodedData)
{
byte[] encodedDataAsBytes = System.Convert.FromBase64String(encodedData);
string returnValue = System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);
return returnValue;
}
C# - Encoding Strings to Base64
static public string EncodeTo64(string toEncode)
{
byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
string returnValue = System.Convert.ToBase64String(toEncodeAsBytes);
return returnValue;
}
Android - Access SQLite Database File in Emulator
You have to be on the DDMS perspective on your Eclipse IDE
(Window > Open Perspective > Other > DDMS)
and the most important:
YOUR APPLICATION MUST BE RUNNING SO YOU CAN SEE THE HIERARCHY OF FOLDERS AND FILES.
Then in the File Explorer Tab you will follow the path :
data > data > your-package-name > databases > your-database-file.
Then select the file, click on the disket icon in the right corner of the screen to download the .db file. If you want to upload a database file to the emulator you can click on the phone icon(beside disket icon) and choose the file to upload.
If you want to see the content of the .db file, I advise you to use SQLite Database Browser, which you can download here.
PS: If you want to see the database from your real device, you must root your phone.
Source: http://stackoverflow.com/questions/1510840/where-does-android-emulator-store-sqlite-database
Decompile APK file to JAR
The Following Tutorial Describes very thoroughly how to decompile APK file to get its source code. I have tried it myself and its working. Keep in mind it only gets the "JAVA" code not the layouts and any other resources. http://a4apphack.com/security/sec-code/extract-android-apk-from-market-and-decompile-it-to-java-source
Windows - Lock Folder
Following link explains very beautifully how to lock the folder with password. http://www.simplehelp.net/2010/11/29/how-to-create-a-password-protected-folder-in-windows-7/
How to Create RESTful webservice using WCF
Setting Up the Project: The Following link explains very throughly how to create a RESTful webservice using WCF Project type. http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide Creating Operation & DataContract For the Services: http://www.codeproject.com/Articles/29570/Simple-WCF-Hosting-and-Consuming
Javascript - Detect Browser
function getInternetExplorerVersion() { var rv = -1; // Return value assumes failure. //You can user "navigator.appName" to detect other browsers as well. if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) { rv = parseFloat(RegExp.$1); if (rv > -1) { if (rv < 9.0) { alert("This is Not Microsoft Internet Explorer 9.0"); return; } } } } }
iPhone/iPad Splash Screen File Names
Default File Names for Individual Orientation of Device:
Default-Portrait.png
Default-PortraitUpsideDown.png
Default-Landscape.png
Default-LandscapeLeft.png
Default-LandscapeRight.png
Setting NTFS Permissions with C# Programmatically
Reference the dll, and use it.
using Microsoft.Win32.Security;
Here's a method to add a dir, and set NTFS permissions on it for a given user:
private Boolean CreateDir(String strSitePath, String strUserName) { Boolean bOk; try { Directory.CreateDirectory(strSitePath); SecurityDescriptor secDesc = SecurityDescriptor.GetFileSecurity(strSitePath, SECURITY_INFORMATION.DACL_SECURITY_INFORMATION); Dacl dacl = secDesc.Dacl; Sid sidUser = new Sid (strUserName); // allow: folder, subfolder and files // modify dacl.AddAce (new AceAccessAllowed (sidUser, AccessType.GENERIC_WRITE | AccessType.GENERIC_READ | AccessType.DELETE | AccessType.GENERIC_EXECUTE , AceFlags.OBJECT_INHERIT_ACE | AceFlags.CONTAINER_INHERIT_ACE)); // deny: this folder // write attribs // write extended attribs // delete // change permissions // take ownership DirectoryAccessType DAType = DirectoryAccessType.FILE_WRITE_ATTRIBUTES | DirectoryAccessType.FILE_WRITE_EA | DirectoryAccessType.DELETE | DirectoryAccessType.WRITE_OWNER | DirectoryAccessType.WRITE_DAC; AccessType AType = (AccessType)DAType; dacl.AddAce (new AceAccessDenied (sidUser, AType)); secDesc.SetDacl(dacl); secDesc.SetFileSecurity(strSitePath, SECURITY_INFORMATION.DACL_SECURITY_INFORMATION); bOk = true; } catch { bOk = false; } return bOk; } /* CreateDir */
The AceFlags determine the level of inheritance on the object. And the DirectoryAccessType is used to create a AccessType with some permissions not in the AccessType enum. I hope this is useful.
iPhone – Set or change title of UIBarButtonItem
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"TITLE GOES HERE" style:UIBarButtonItemStyleBordered target:self action:@selector(functionToCallOnClick)];