How to make the Facebook Like Box responsive?

NOTE: this answer is obsolete. See the community wiki answer below for an up-to-date solution. I found this Gist today and it works perfectly: https://gist.github.com/2571173 (Many thanks to https://gist.github.com/smeranda) /* Make the Facebook Like box responsive (fluid width) https://developers.facebook.com/docs/reference/plugins/like-box/ */ /* This element holds injected scripts inside iframes that in some cases may stretch layouts. … Read more

How to make an expandable/collapsable section widget in Qt

I stumbled upon the same problem and solved it by implementing the collapsible widget as a QScrollArea whose maximum height is animated by a QPropertyAnimation. But since I don’t use QDesigner, I can’t tell you if it works there. I still have one problem: Instead of only expanding towards the bottom direction, the collapsible widget … Read more

Django required field in model form

If you don’t want to modify blank setting for your fields inside models (doing so will break normal validation in admin site), you can do the following in your Form class: def __init__(self, *args, **kwargs): super(CircuitForm, self).__init__(*args, **kwargs) for key in self.fields: self.fields[key].required = False The redefined constructor won’t harm any functionality.

How to add button to notifications in android?

You can create an intent for the action (in this case stop playing) and then add it as an action button to your notification. Intent snoozeIntent = new Intent(this, MyBroadcastReceiver.class); snoozeIntent.setAction(ACTION_SNOOZE); snoozeIntent.putExtra(EXTRA_NOTIFICATION_ID, 0); PendingIntent snoozePendingIntent = PendingIntent.getBroadcast(this, 0, snoozeIntent, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID) .setSmallIcon(R.drawable.notification_icon) .setContentTitle(“My notification”) .setContentText(“Hello World!”) .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setContentIntent(pendingIntent) .addAction(R.drawable.ic_snooze, getString(R.string.snooze), … Read more

Failed binder transaction when putting an bitmap dynamically in a widget

This is caused because all the changes to the RemoteViews are serialised (e.g. setInt and setImageViewBitmap ). The bitmaps are also serialised into an internal bundle. Unfortunately this bundle has a very small size limit. You can solve it by scaling down the image size this way: public static Bitmap scaleDownBitmap(Bitmap photo, int newHeight, Context … Read more

How to pass parameters to a Script tag?

I apologise for replying to a super old question but after spending an hour wrestling with the above solutions I opted for simpler stuff. <script src=”..” one=”1″ two=”2″></script> Inside above script: document.currentScript.getAttribute(‘one’); // 1 document.currentScript.getAttribute(‘two’); // 2 Much easier than jQuery or URL parsing. You might need the polyfill for document.currentScript from @Yared Rodriguez’s answer … Read more

RecyclerView – Get view at particular position

This is what you’re looking for. I had this problem too. And like you, the answer is very hard to find. But there IS an easy way to get the ViewHolder from a specific position (something you’ll probably do a lot in the Adapter). myRecyclerView.findViewHolderForAdapterPosition(pos); NOTE: If the View has been recycled, this will return … Read more