how to sort an array based on previous numerical keys? [duplicate]

Uncategorized
Question: This question already has an answer here:Sort array keys ascending 3 answers I would like to sort an array to reindex its keys. I tried using custom loop but it does not work. Is there a php function to do this? I have an array like this:Array ( [3] => Array ( [id] => 44 [name] => 1495714823.jpg ) [1] => Array ( [id] => 48 [name] => 1495795384.jpg ) [2] => Array ( [id] => 11 [name] => 1495602099.jpg ) ) I need to sort array like this:Array ( [1] => Array ( [id] => 48 [name] => 1495795384.jpg ) [2] => Array ( [id] => 11 [name] => 1495602099.jpg ) [3] => Array ( [id] => 44 [name] => 1495714823.jpg ) ) i tried some of the…
Read More

Why material design bottom navigation bar is so slow in first launch?

Uncategorized
Question: I used Material Design Bottom Navigation Bar, And when i launch the App, It has significant delay when i press the 2nd tab. What could be the reason? There is nothing heavy in my 2nd tab , but it has about 2 secs delay when going to the second fragment! I checked out the LinkedIn App to, also it has the delay too... I also saw it in my other friends apps... Thank you all for the answers! Answer: Read more
Read More

HttpTransport & Plus cannot be resolved to a type when using google plus api

java
Question: I have created a maven project in which i am using google plus api to get data from google plus.This project is working correctly on my laptop. The project is on github. When i import this project from github into my computer i get the following errors: HttpTransport cannot be resolved to a type Plus cannot be resolved to a type These libraries are getting error:import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.DateTime; import com.google.api.services.plus.Plus; import com.google.api.services.plus.PlusRequestInitializer; import com.google.api.services.plus.model.Activity; import com.google.api.services.plus.model.Activity.PlusObject.Attachments; import com.google.api.services.plus.model.Activity.PlusObject.Attachments.Thumbnails; This is my maven file: 4.0.0 maven-demo maven-demo 0.0.1-SNAPSHOT com.google.apis google-api-services-plus v1-rev510-1.22.0 com.github.axet vget 1.2.4 org.apache.commons commons-lang3 3.1 1.8 1.8 I have tried cleaning my project, config my build path, adding the google plus api again in maven, restarting eclipse.But it doesnt resolve my problem what should i…
Read More

How can I join shipping and payment method to getCollection()?

Uncategorized
Question: I have custom shipping and payment method ( SELECT * FROM `sales_flat_order` WHERE 'shipping_method = custom_custom' ) and I have to joinLeft this methods to $this->getCollection() from sales_order(http://my-magento.local/index.php/admin/sales_order/) ( appdesignadminhtmldefaultdefaulttemplatewidgetgrid.phtml) to minimize query to db. public function _addCustomFields() { $billingAliasName = 'sfo'; //sales_flat_order $joinTable = $this->getTable('sales/order'); $select = $this->getSelect(); $select ->joinInner( array($billingAliasName => $joinTable), "(main_table.entity_id = {$billingAliasName}.increment_id" . " AND {$billingAliasName}.shipping_method = 'custom_custom')" , array( $billingAliasName . '.shipping_method' ) ); return $this; } and in appcodelocalMageAdminhtmlBlockSalesOrderGrid.php protected function _prepareGrid() { parent::_prepareGrid(); $cls = new Mage_Sales_Model_Resource_Order_Collection; $cls->_addCustomFields(); } but it's not work. Tell me pls what I did wrong? And how to correctly must doing this? Answer: Read more
Read More

What is causing java.lang.ArithmeticException in Facebook Ads SDK

Uncategorized
Question: I'm getting the Crash below from my Google Play Console. Even with uploaded Deobfuscation files, I can't figure out where in the app, the crash is taking place. I'm showing Facebook Interstitial Ads in two places in my app and also in a Banner under mediation with Admob. Any pointers will be appreciated java.lang.ArithmeticException: at com.facebook.ads.internal.view.d.b.i$2.a(i.java) at com.facebook.ads.internal.view.d.b.i$2.a (i.java) at com.facebook.ads.internal.view.d.b.i$2.a (i.java) at com.facebook.ads.internal.view.d.b.i$2.a (i.java) at com.facebook.ads.internal.g.r.b (r.java) at com.facebook.ads.internal.g.r.b (r.java) at com.facebook.ads.internal.g.r.a (r.java) at com.facebook.ads.internal.g.r.a (r.java) at com.facebook.ads.internal.g.r.a (r.java) at com.facebook.ads.internal.view.o$1.run (o.java) at android.os.Handler.handleCallback (Handler.java:739) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:135) at android.app.ActivityThread.main (ActivityThread.java:5401) at java.lang.reflect.Method.invoke (Method.java) at java.lang.reflect.Method.invoke (Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:919) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:714) Answer: Read more
Read More

Does DESKey preserve invalid parity bits?

Uncategorized
Question: According to DES specification, the last bit of each byte of the secret key is used for error detection (each byte should have odd parity). Hence the effective key length is 56 bits, not 64 bits. However, in many use cases these parity bits are not checked. Sometimes they are even used for a completely different purpose: Mifare DESFire cards store the key version in those bits, for example, even though the original error correction purpose gets lost. How do Java Card implementations handle these bits? Let us have a look at this code:DESKey desKey = ... //a single DES key instance byte[] inputKey = new byte[8]; inputKey[7] = (byte) 0x03; //explicitly invalid parity bit in the last byte desKey.setKey(inputKey, (short) 0); byte[] outputKey = new byte[8]; desKey.getKey(outputKey, (short)…
Read More

Can’t create user with role different from ADMIN

Uncategorized
Question: I can't create user with roles different from ADMIN, the server responded with a status of 403 (Forbidden). I have try :@PostMapping("/users") @Timed @Secured({AuthoritiesConstants.ADMIN,AuthoritiesConstants.MANAGER}) public ResponseEntity createUser(@Valid @RequestBody ManagedUserVM managedUserVM) throws URISyntaxException { log.debug("REST request to save User : {}", managedUserVM); } and @RestController @RequestMapping("/api") @EnableGlobalMethodSecurity(prePostEnabled = true) public class UserResource { @PostMapping("/users") @Timed @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MANAGER')") public ResponseEntity createUser(@Valid @RequestBody ManagedUserVM managedUserVM) throws URISyntaxException { log.debug("REST request to save User : {}", managedUserVM); //.... } //.... } Answer: Read more
Read More