Need to retrieve all of the text messages from Amy. I have used iPhone 5 guidebook and have not from any directions on finding deleted conversation.

I believe, in Python defaultdict inherited from dict violates Liskov Substitution Principle. defaultdict doesn't raise KeyError while x in d is still False, for instance.

Is that so? If it is, why developer decided to make such a sacrifice?

In the context of MVC sometimes I find myself creating a Factory and injecting the factory with Repository.

While it is certainly possible to use Repository as layer inside the Factory, I wonder if it is an anti-pattern to do so. i.e. is it advisable to keep Factory Repository-free?

Example

For example, my QuoteFactory class is tasked with

  • creating Quote class
  • maintaining Repository methods & generally being Repository-aware

Code

$repository = new QuoteRepository(111);
$factory = new QuoteFactory($repository);    
$quote = $factory->loadQuote();

class QuoteRepository
{
    function __construct($id)
    {
        $this->id = $id;
        $this->em = DoctrineConnector::getEntityManager();
    }

    function getLineItems()
    {
        $query = $this->em->createQuery('SELECT s FROM...');
        return $query->getResult();
    }
}

class QuoteFactory
{
    function __construct(QuoteRepository $repository)
    {
        $this->repository = $repository;
    }

    function loadQuote()
    {
        $quote = new Quote();
        $quote->setLines($this->repository->getLineItems());
        return $quote;
    }
}

class Quote
{    
    function setLines(array $lines)
    {
        $this->lines = $lines;
    }
}

i'm attempting to execute a C# program to write to an Azure DocumentDB database. However, I'm very new to C# and am not sure how to get the main() entry to execute CreateDocument() call. Here is the code that I'm using. Any help would be greatly appreciated.

  namespace MyFirstDocDbApp
{
    class Program
    {
        static void Main(string[] args)
        {
           // CreateDocument();
         }

        public const string EndpointUri = "<Uri>";
        public const string PrimaryKey = "<key>";

        public static async Task CreateDocument()
        {
            //attach to DocumentDB using the URI and Key from the Azure portal
            DocumentClient client = new DocumentClient(new Uri(EndpointUri), PrimaryKey);
            //query for the right database inside the DocDB account
            Database database = client.CreateDatabaseQuery().Where(d => d.Id == "SchoolDB").AsEnumerable().FirstOrDefault();
            //find the right collection where we want to add the document
            DocumentCollection collection = client.CreateDocumentCollectionQuery((String)database.SelfLink).
                ToList().Where(cl => cl.Id.Equals("Collect1")).FirstOrDefault();
            //create a simple document in the collection by providing the DocumentsLink and the object to be serialized
            //and stored
            await client.CreateDocumentAsync(
              collection.DocumentsLink,
              new PersonInformation
              {
                  FirstName = "Riccardo",
                  LastName = "Becker",
                  DateOfBirth = new DateTime(1974, 12, 21)
              }
            );
        }

tl;dr-ers:

How does a lexer normally deal with none-inline statements. statements that do not end with a specified statement delimiter. Such as control flow statements?


I believe that I have a fairly good grasp on lexical analysis, and can move on in my quest for understanding lexers/parsers. I do however, understand how lexers deal with 1multi-line statements.

After reading a Wikipedia article on the Comparison of programming languages syntax, The thing that all languages have in common, is that they have a very specfic statement delimeter. Some used semicolons(;) as a statement delimiter, others use whitespace(\ws), and some used periods(.).

Using this method, i fail to see how those programming languages, are able to have functions\class\control flow, that span multiple lines. Correct me if I'm wrong, but I'm pretty sure that most of the popular programming languages(Python, Java, C, C++, C#, Javascript, etc...) Do not use their statement delimiters at the end of functions, or classes(I know that classes in C++ do use semicolons at there end, but that is besides the point), or control flow.

This means that either: A: Lexers make a special exception for statements that span multiple lines. Or B: The lexer just treats multi-line statements as a regular statement, and it is the parser's job to make sense of them.

For example, Take take this pseudo program in C++:

int exampleVar; //<-- inline statement. Delimited with a semicolon

void exampleFunc() { //<-- multi-line statement. This statement is the start of a block.
    // do things
} //<-- this is where the statement that was started above, should end?

Clearly, it's easy to see where you should end the first statement. You end it at the semicolon. But how is the second statement dealt with? Is the statement extend to include everything up until the closing curly brace?

Or I could just be misguided in my thinking. It could be that the lexer has absolutely nothing to to do with 1multi-line statements. Is this the job of the parser? That is, is it the parser's job to make sense of 1multi-line statements?

To as clear as possible, my question is: How(if they should in the first place), should a lexer deal with statements that are not inline, and cannot just be terminated as if they were. How does a lexer normally deal with none-inline statements. statements that do not end with a specified statement delimiter. Such as control flow statements?

1To be clear, I do not mean multi-line statements, in the sense of line continuation. I mean them in the sense of statements that start off a block. Such as a function declaration. When you're defining a function, you also need to know the statements that follow the function definition up to a certain block delimiter. So you can't just terminate the statement after the definition.

I am trying to implement a simple UIPageViewController that cashes images from the internet using Haneke swift.

I get a crash and the massage that my iPod has been disconnected Lost connection

I also sometimes (rarely) get memory warnings before the crash so I'm pretty sure its a memory issue.

I managed to fix the crashes with a solution that i dont particularly like but I just end up running into this other problem later on.

Here is my code for my single page:

    import UIKit

import Haneke

class GreenViewController: UIViewController {

    @IBOutlet weak var imageVIew: UIImageView!

  //  var imageUrl: String!

    var pageIndex: Int?
    override func viewDidLoad() {
        super.viewDidLoad()

        if let index = pageIndex {
            if let url = NSURL(string: TutorialPageViewController.urls[index]){
                imageVIew.hnk_setImageFromURL(url)
            }
        }

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func viewWillAppear(animated: Bool) {
        //print("pageIndex \(pageIndex)")

           }
}

And here is the rest of my code (although I dont think anything there is causing the issues)

import UIKit

class TutorialPageViewController: UIPageViewController {

    internal static let urls = ["losts of image urls"

    ]

    private var urlIndex = 0

    private func newColoredViewController(color: String) -> UIViewController {
        return UIStoryboard(name: "Main", bundle: nil) .
            instantiateViewControllerWithIdentifier("\(color)ViewController")
    }


    override func viewDidLoad() {
        super.viewDidLoad()

        dataSource = self
        delegate = self

        if let firstController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("GreenViewController") as? GreenViewController {
        //    firstController.imageUrl = TutorialPageViewController.urls[0]
            firstController.pageIndex = 0
            setViewControllers([firstController],
                               direction: .Forward,
                               animated: true,
                               completion: nil)
        }

    }
}


extension TutorialPageViewController: UIPageViewControllerDataSource {

    func pageViewController(pageViewController: UIPageViewController,
                            viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {

        let pageContent: GreenViewController = viewController as! GreenViewController
          var index = pageContent.pageIndex!

        guard index > 0 else {
            return nil
        }


        index -= 1

        let pageContentViewController = UIStoryboard(name: "Main", bundle: nil) .
            instantiateViewControllerWithIdentifier("GreenViewController") as! GreenViewController
        pageContentViewController.pageIndex = index

        return pageContentViewController
    }

    func pageViewController(pageViewController: UIPageViewController,
                            viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {


        let pageContent: GreenViewController = viewController as! GreenViewController
        var index = pageContent.pageIndex!
        index += 1

        guard TutorialPageViewController.urls.count > index else{
            return nil
        }


        let pageContentViewController = UIStoryboard(name: "Main", bundle: nil) .
            instantiateViewControllerWithIdentifier("GreenViewController") as! GreenViewController


        pageContentViewController.pageIndex = index

        return pageContentViewController
    }

}

I would like the user to select an Album and then display the photos of it in react-native. There is the CameraRoll and it has the ability to filter by groupName, but I did not find a way of how to retrieve these groupNames. Does anybody know how to do this, or do I need to write a native plugin?

The app runs fine when compiled from xcode 7 for iOS 8 through 10 but when compiled from xcode 8, the app only works normally on iOS 9 and 10 on iOS 8, the app crashes inconsistently. Sometimes it will stop at a random UI element such as:

enter image description here

But more often it will just crash at main:

enter image description here

* thread #1: tid = 0x11d655, 0x35deaf56 libobjc.A.dylib`objc_msgSend + 22, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xf632d5c1)
frame #0: 0x35deaf56 libobjc.A.dylib`objc_msgSend + 22
frame #1: 0x2db167ea CoreUI`-[CUINamedImage initWithName:usingRenditionKey:fromTheme:] + 98
frame #2: 0x2db21d48 CoreUI`-[CUICatalog imageWithName:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:] + 128
frame #3: 0x2b8aee98 UIKit`__98-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 240
frame #4: 0x2b8aecea UIKit`-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 230
frame #5: 0x2b95df86 UIKit`-[UIImageAsset imageWithTraitCollection:] + 474
frame #6: 0x2b58d9d2 UIKit`-[UIImageView _resolveImageForTrait:] + 286
frame #7: 0x2b58d690 UIKit`-[UIImageView _didMoveFromWindow:toWindow:] + 156
frame #8: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #9: 0x2b300d50 UIKit`-[UIControl _didMoveFromWindow:toWindow:] + 44
frame #10: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #11: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #12: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #13: 0x2b28a804 UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
frame #14: 0x2b28a720 UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 428
frame #15: 0x2b294bce UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1462
frame #16: 0x2b29460e UIKit`-[UIView(Hierarchy) addSubview:] + 30
frame #17: 0x2b459eae UIKit`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1262
frame #18: 0x2b29ada4 UIKit`+[UIView(Animation) performWithoutAnimation:] + 72
frame #19: 0x2b45977c UIKit`-[_UINavigationParallaxTransition animateTransition:] + 812
frame #20: 0x2b417cfc UIKit`-[UINavigationController _startCustomTransition:] + 2860
frame #21: 0x2b337026 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 422
frame #22: 0x2b336e2c UIKit`-[UINavigationController __viewWillLayoutSubviews] + 44
frame #23: 0x2b336dc0 UIKit`-[UILayoutContainerView layoutSubviews] + 184
frame #24: 0x2b28b7fe UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 514
frame #25: 0x2acb1834 QuartzCore`-[CALayer layoutSublayers] + 136
frame #26: 0x2acad20c QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 360
frame #27: 0x2acad094 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #28: 0x2acaca70 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 224
frame #29: 0x2acac874 QuartzCore`CA::Transaction::commit() + 324
frame #30: 0x2aca674c QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
frame #31: 0x27d37ffc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
frame #32: 0x27d356ba CoreFoundation`__CFRunLoopDoObservers + 278
frame #33: 0x27d35ac2 CoreFoundation`__CFRunLoopRun + 914
frame #34: 0x27c833b0 CoreFoundation`CFRunLoopRunSpecific + 476
frame #35: 0x27c831c2 CoreFoundation`CFRunLoopRunInMode + 106
frame #36: 0x2f1f2200 GraphicsServices`GSEventRunModal + 136
frame #37: 0x2b2ed43c UIKit`UIApplicationMain + 1440
* frame #38: 0x0017bf62 Dev`main(argc=1, argv=0x01549a28) + 106 at main.m:14
frame #39: 0x3636aaae libdyld.dylib`start + 2

I already have NSZombies enabled and I have gotten no new information. I have also tried turning on the address sanitizer and it will also crash sporadically but usually also at the main method:

enter image description here

thread #1: tid = 0x11d992, 0x020fce9e libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie(), queue = 'com.apple.main-thread', stop reason = Attempt to free a non-allocated address
{
"access_size" : 0,
  "access_type" : 0,
  "address" : 103442256,
  "description" : "Attempt to free a non-allocated address",
  "instrumentation_class" : "AddressSanitizer",
  "pc" : 0,
  "stop_type" : "fatal_error"
}

Again the app works fine when built from Xcode 7 or from Xcode 8 for iOS 9 or 10. This only happens when built from Xcode 8 for iOS 8. Any ideas?

Pokemon Go Image

From the link, you can see that the Pokeball is always centered in the middle of the screen and stays there irregardless of camera movement.

My question is how could I replicate this behavior in iOS? I have researched into Computer Vision APIs such as Vuforia but it seems like Vuforia tracks 3D objects through markers which is not what I want.

Any guidance or advice is greatly appreciated.

I'm trying to access an Swift Extension from my Objective-C implementation but not able to do it. I found this solution

But it doesn't work for me. Any of you knows how can I access to an extension from an Objective-C implementation?

This iCarousel: https://github.com/nicklockwood/iCarousel

He has a 'multiple carousels' example project that is in Obj-C, however the number of items is random.

In the number of item function, I am unable to explicitly state which iCarousel I wish to assign a number of items too. They always seem to load in a random order. I have 6 BTW.

View bottomSheet = findViewById( R.id.bottom_sheet );
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
mBottomSheetBehavior.setPeekHeight(100);
mBottomSheetBehavior.setPeekHeight(100);
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);

Is it possible to add overlay to backgrounund for Persistent Bottom sheet, when the Persistent bottom sheet is expanded?????

I have a scenario where, when views are recycled, the layout is incorrect. My row item layouts are as follows (note the wrap_content LinearLayout width, weight, and ellipsize):

     <LinearLayout
          android:id="@+id/header"
          android:layout_width="wrap_content"       
          android:layout_height="wrap_content"    
          android:orientation="horizontal"
          >
        <TextView
            android:id="@+id/text1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"               
            android:ellipsize="middle"
            android:singleLine="true"
            tools:text="Ann really freaking long last name Droid"
            />
        <TextView
            android:id="@+id/text2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
        <TextView
            android:id="@+id/text3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
      </LinearLayout>

Desired behavior

    row1 | 1-short-text | 2-text | 3-more-text
    ----------------------------------------------------
    row2 | 1-short-text | 2-text | 3-more-text
    ----------------------------------------------------
    row3 | 1-long-ellipsiz...text | 2-text | 3-more-text
    ----------------------------------------------------
    row4 | 1-tiny | 2-text-longer | 3-more-text-blah
    ----------------------------------------------------

Actual behavior

    row1 | 1-...et | 2-text | 3-more-text     <-- ellipsized unnecessarily
    ----------------------------------------------------
    row4 | 1-short-text | 2-text | 3-more-text
    ----------------------------------------------------
    row2 | 1-long-ellipsiz...text | 2-text | 3-more-text
    ----------------------------------------------------
    row3 | 1-tiny |    2-text-longer | 3-more-text-blah  <-- spacing
    ----------------------------------------------------

What's the best way to go about solving this layout issue? Note: it works fine in a 4.1.1 emulator.

I accidentally removed an account from my w10m and most of my contact disappeared from People app.

How can I recover them? I have a number of backups on my OneDrive.

Thanks.

I recently bought Sony MDR-AS200 headphones. They sound quite good, amazing clarity, but the bass ain't good. Since my phone (Lumia 525) doesn't support an audio equalizer, I kept using them as they were.

But the problem is, the very same headphones sound just AMAZING when plugged into an iPhone or Android. The sound is completely different than what I get on my Lumia 525. I tried plugging them in my PC (Win 10) and the sound was much better.

So why is this happening?

I created multi language (English, Russian, Uzbek) app. I put 4 string resoureses in 4 folders (values, values-en, values-ru, values-uz) as docs. When I change app language updates resourses configuration in App Controller like below:

 Settings.LANGUAGE = prefs.getString(User.LANG, Settings.RUSSIAN);
 Locale locale = new Locale(Settings.LANGUAGE);
 Locale.setDefault(locale);
 Configuration configuration = new Configuration();
 configuration.locale = locale;
 getBaseContext().getResources().updateConfiguration(configuration,
     getBaseContext().getResources().getDisplayMetrics());

After that App restarts by calling App controller's method like below:

public void reStart() {
    Intent i = getBaseContext().getPackageManager()
            .getLaunchIntentForPackage(getBaseContext().getPackageName());
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(i);
}

After them It works well almost all devises. But on Samsung Galaxy S6 (SM-G920F), it works as crazy. Some words are in english and others are in Uzbek and ets. So, How to fix this error? isn't the concepts of "Supporting Different Languages" supported by (applicable to) all devises? By the way I have checked that all resourses are given in corresponding languages (as shown in attached image):

enter image description here

I'm building a chat app using Firebase Realtime Database. I want to implement the functionality like whattsApp, that user can send the message without internet(Add the message object on RecyclerView) but will have the clock icon(To show that the message was not send yet) and when the Firebase database receive the message(The user get internet and firebase send the message) I want to update the added element on recyclerview(change the clock icon for a positive icon).

What I tried?

I have that

mFirebaseDatabaseReference = FirebaseDatabase.getInstance().getReference();
    mFirebaseAdapter = new ChatFirebaseAdapter(mFirebaseDatabaseReference.child("chat_id"), user.getId());
recyclerChat.setLayoutManager(mLinearLayoutManager);
    recyclerChat.setAdapter(mFirebaseAdapter);

My adapter extends FirebaseRecyclerAdapter from firebase-ui-database

I tried to add a addChildEventListener on my DatabaseReference I get dataSnapshot of the new element but I don't known I to get the right position on recyclerview.

mFirebaseDatabaseReference.addChildEventListener(new ChildEventListener() {
        @Override
        public void onChildAdded(DataSnapshot dataSnapshot, String s) {
            UPDATE RECYCLERVIEW ITEM
        }

        @Override
        public void onChildChanged(DataSnapshot dataSnapshot, String s) {

        }

        @Override
        public void onChildRemoved(DataSnapshot dataSnapshot) {

        }

        @Override
        public void onChildMoved(DataSnapshot dataSnapshot, String s) {

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

I added a onCompletionListener when I add a new message but I don't know how get the right position again.

mFirebaseDatabaseReference.push().setValue(message, new DatabaseReference.CompletionListener() {
        @Override
        public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
            if (databaseError == null) {
                UPDATE RECYCLERVIEW ITEM
            }
        }
    });

So someone have an idea how I cant accomplish that?

Thanks. I search a lot before ask but I don't find the right answer.

I got a google map key and applied in my Android Studio It works well but problem occurred when I send my project to other person Nothing shown on their map except the google map mark I think the problem is on google map key... Isn't possible to use google map in one person's key?? And what if I make the apk??

I amm trying to upload couple of audio files to server using the following method, and server side code is written in php. My concern is that out of three files two are being uploaded, but one files is not uploading to server. I have checked the that the path of file is correct and removed white spaces from the path. Still can't figure out why one of these files is not uploading.

here is the code

int serverResponseCode = 0;

      HttpURLConnection connection;
      DataOutputStream dataOutputStream;
      String lineEnd = "\r\n";
      String twoHyphens = "--";
      String boundary = "*****";


      int bytesRead, bytesAvailable, bufferSize;
      byte[] buffer;
      int maxBufferSize = 1 * 1024 * 1024;
      File selectedFile = new File(selectedFilePath);


      String[] parts = selectedFilePath.split("/");
      final String fileName = parts[parts.length - 1];

      try {
          // Log.e("selected file", selectedFile.toString());
          Log.e("selected file path ", selectedFilePath);
          FileInputStream fileInputStream = new FileInputStream(selectedFile);
          URL url = new URL(SERVER_URL);
          connection = (HttpURLConnection) url.openConnection();
          connection.setDoInput(true);//Allow Inputs
          connection.setDoOutput(true);//Allow Outputs
          connection.setUseCaches(false);//Don't use a cached Copy
          connection.setRequestMethod("POST");
          System.setProperty("http.keepAlive", "false");
          connection.setRequestProperty("Connection", "close");
          //connection.setRequestProperty("Connection", "Keep-Alive");
          connection.setRequestProperty("ENCTYPE", "multipart/form-data");
          connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
          connection.setRequestProperty("uploaded_file", selectedFilePath);

          //creating new dataoutputstream
          dataOutputStream = new DataOutputStream(connection.getOutputStream());

          //writing bytes to data outputstream
          dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd);
          dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""
                  + selectedFilePath + "\"" + lineEnd);

          dataOutputStream.writeBytes(lineEnd);

          //returns no. of bytes present in fileInputStream
          bytesAvailable = fileInputStream.available();
          //selecting the buffer size as minimum of available bytes or 1 MB
          bufferSize = Math.min(bytesAvailable, maxBufferSize);
          //setting the buffer as byte array of size of bufferSize
          buffer = new byte[bufferSize];

          bytesRead = fileInputStream.read(buffer, 0, bufferSize);

          //loop repeats till bytesRead = -1, i.e., no bytes are left to read
          while (bytesRead > 0) {

              //write the bytes read from inputstream
              dataOutputStream.write(buffer, 0, bufferSize);
              bytesAvailable = fileInputStream.available();
              bufferSize = Math.min(bytesAvailable, maxBufferSize);
              bytesRead = fileInputStream.read(buffer, 0, bufferSize);

          }

          dataOutputStream.writeBytes(lineEnd);

          dataOutputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
          serverResponseCode = connection.getResponseCode();
          String serverResponseMessage = connection.getResponseMessage();

          Log.e("TAG", "Server Response is: " + serverResponseMessage + ": " + serverResponseCode);

          //closing the input and output streams

          Log.e("above closing ", " fileinputstreamclosing");
          fileInputStream.close();
          dataOutputStream.flush();
          dataOutputStream.close();


      } catch (FileNotFoundException e) {
          e.printStackTrace();

          {
              Log.e("File Not Found", "");
          }

      } catch (MalformedURLException e) {
          e.printStackTrace();


      } catch (IOException e) {
          e.printStackTrace();

      }

And to be exact about the path these are the filepaths -

1 - /storage/emulated/0/WhatsApp/Media/WhatsApp Audio/AUD-20160322-WA0009.mp3, 2-/storage/emulated/0/WhatsApp/Media/WhatsApp Audio/AUD-20160728-WA0002.mp3

these two are able to uplaod to server but

/storage/emulated/0/Download/Shawn%20Mendes%20-%20Treat%20You%20Better.mp3 this can't .. Any help would be appreciated. Thanks

php code

<?php

$file_path = "uploads/";

$file_path = $file_path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path) ){
    echo "success";
} else{
    echo "fail";
}

?>

I have several surfaceviews in a row in my layout and when I call recreate method after changing device configuration all of them becomes black from most left to most right and only after that activity recreates its ui but all lifecycle methods are already being called before this moment. After ui recreates itself everything is fine. If I add setVisibility (Gone) for all surfaceviews in onDestory that just doesnt work.

Could someone help me to figure out what is the reason of black surface view?

enter image description here

SurfaceView

public abstract class SkyconSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
private static final String LOG_TAG = SkyconSurfaceView.class.getSimpleName();


private RenderBase mRender;
int mScreenW;
int mScreenH;

public SkyconSurfaceView(Context context) {
    super(context);
    getHolder().addCallback(this);
}

@Override
public void surfaceCreated(SurfaceHolder holder) {
    Log.d(LOG_TAG, "surfaceCreated");
    mRender = getRender();
    mRender.setRunning(true);
    mRender.start();
}

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
    Log.d(LOG_TAG, "surfaceDestroyed");
    boolean retry = true;
    mRender.setRunning(false);
    while (retry) {
        try {
            mRender.join();
            retry = false;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    mRender = null;
}

@Override
public void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mScreenW = w;
    mScreenH = h;
}

protected abstract RenderBase getRender();
}

Render Thread

abstract class RenderBase extends Thread {
private final SurfaceHolder mSurfaceHolder;
final int mScreenW;
final int mScreenH;
float mCenterX;
float mCenterY;
boolean isRunFlag;
private long mPrevTime;
boolean isAnimated = true;
boolean isStatic;
final int mStrokeColor = Color.WHITE;

RenderBase(SurfaceHolder holder, int screenW, int screenH) {
    mSurfaceHolder = holder;
    mScreenW = screenW;
    mScreenH = screenH;
    mCenterX = screenW / 2;
    mCenterY = screenH / 2;
    mPrevTime = System.currentTimeMillis();
}

public void setRunning(boolean run) {
    isRunFlag = run;
}

@Override
public void run() {
    while (isRunFlag) {
        long now = System.currentTimeMillis();
        long elapseTime = now - mPrevTime;
        if (elapseTime < 5) continue;
        mPrevTime = now;
        calculate();
        Canvas canvas = null;
        try {
            if (!mSurfaceHolder.getSurface().isValid())
                continue;
            canvas = mSurfaceHolder.lockCanvas(null);
            synchronized (mSurfaceHolder) {
                if (canvas == null) return;
                draw(canvas);
            }
        } finally {
            if (canvas != null) {
                // show result
                mSurfaceHolder.unlockCanvasAndPost(canvas);
            }
        }
    }
}

abstract void draw(Canvas canvas);

abstract void calculate();

}

Here is log

09-27 18:01:24.693 26778-26778/    D/MainActivity: onPause
09-27 18:01:24.693 26778-26778/D/MainActivity: onDestroy
09-27 18:01:24.700 26778-26778/ D/MainActivity: onCreate
09-27 18:01:24.800 26778-26778/D/MainActivity: onResume

                                                                                  --------- beginning of system
09-27 18:01:24.892 26778-26778/D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:24.952 26778-26778/ D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.043 26778-26778/ D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.378 26778-26778/D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.392 26778-26778/D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.408 26778-26778/ D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.432 26778-26778/D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.459 26778-26778/D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.529 26778-26778/ D/SkyconSurfaceView: surfaceDestroyed
09-27 18:01:25.582 26778-26778/ I/Choreographer: Skipped 53 frames!  The application may be doing too much work on its main thread.
09-27 18:01:25.651 26778-26818/   W/EGL_emulation: eglSurfaceAttrib not implemented
09-27 18:01:25.651 26778-26818/W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa34e16e0, error=EGL_SUCCESS
09-27 18:01:25.659 26778-26778/ D/MainActivity: Success
09-27 18:01:25.710 26778-26778/ D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.736 26778-26778/D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.772 26778-26778/D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.789 26778-26778/ D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.812 26778-26778/ D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.834 26778-26778/D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.848 26778-26778/D/SkyconSurfaceView: surfaceCreated

                                                                                       [ 09-27 18:01:25.850 26778:28598 D/         ]
                                                                                   HostConnection::get() New Host Connection established 0xa3429940, tid 28598
09-27 18:01:25.872 26778-26778/D/SkyconSurfaceView: surfaceCreated
09-27 18:01:25.955 26778-26778/D/SkyconSurfaceView: surfaceCreated

                                                                                   [ 09-27 18:01:26.005 26778:28607 D/         ]
                                                                                   HostConnection::get() New Host Connection established 0xaf1d02b0, tid 28607

Please suggest me via references and what was the best approach to achieve this task?