How can an iOS app keep a TCP connection alive indefinitely while in the background?

Tapbots solved this problem with Pastebot by prompting the user to run a silent background audio track at all times. Note that Apple frowns on using hacks like employing the background audio or VOIP APIs to keep non audio or VOIP apps running (as evidenced by the ‘workaround’ described in the article above) so dabbling … Read more

Android shape background

Yes you can use any shape file as background for any view. This sample create rounded background with white color and black border around the shape. Sample : rounded_corner.xml <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle” > <corners android:bottomLeftRadius=”10dp” android:bottomRightRadius=”10dp” android:topLeftRadius=”10dp” android:topRightRadius=”10dp” /> <stroke android:width=”0.5dp” android:color=”@color/color_grey” /> <solid android:color=”@color/color_white” /> </shape> u can use this as, <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” … Read more

How to scale images to screen size in Pygame

You can scale the image with pygame.transform.scale: import pygame picture = pygame.image.load(filename) picture = pygame.transform.scale(picture, (1280, 720)) You can then get the bounding rectangle of picture with rect = picture.get_rect() and move the picture with rect = rect.move((x, y)) screen.blit(picture, rect) where screen was set with something like screen = pygame.display.set_mode((1600, 900)) To allow your … Read more

Gradient colors in Internet Explorer

The code I use for all browser gradients: background: #0A284B; background: -webkit-gradient(linear, left top, left bottom, from(#0A284B), to(#135887)); background: -webkit-linear-gradient(#0A284B, #135887); background: -moz-linear-gradient(top, #0A284B, #135887); background: -ms-linear-gradient(#0A284B, #135887); background: -o-linear-gradient(#0A284B, #135887); background: linear-gradient(#0A284B, #135887); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=”#0A284B”, endColorstr=”#135887″); zoom: 1; You will need to specify a height or zoom: 1 to apply hasLayout to the element … Read more

How to fade changing background image

This is probably what you wanted: $(‘#elem’).fadeTo(‘slow’, 0.3, function() { $(this).css(‘background-image’, ‘url(‘ + $img + ‘)’); }).fadeTo(‘slow’, 1); With a 1 second delay: $(‘#elem’).fadeTo(‘slow’, 0.3, function() { $(this).css(‘background-image’, ‘url(‘ + $img + ‘)’); }).delay(1000).fadeTo(‘slow’, 1);

iPhone – Setting background on UITableViewController

I know it’s been a long time, but just for the record.. I Think I found a better solution using UITableView.backgroundView: UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”lisbon.png”]]; self.tableView.backgroundView = imageView; [imageView release]; I tried with an image size of 320×480 on iPhone, and works perfect (I have tried with .jpg also).

How to change the background color around a DialogFragment?

I had to set android:windowIsFloating to false and android:windowBackground to my custom color in the dialog style: styles.xml <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”MyDialog” parent=”@android:style/Theme.Dialog”> <item name=”android:windowFrame”>@null</item> <item name=”android:windowBackground”>@color/orange_transparent</item> <item name=”android:windowIsFloating”>false</item> <item name=”android:windowContentOverlay”>@null</item> <item name=”android:windowTitleStyle”>@null</item> <item name=”android:colorBackgroundCacheHint”>@null</item> <item name=”android:windowAnimationStyle”>@android:style/Animation.Dialog</item> <item name=”android:windowSoftInputMode”>stateUnspecified|adjustPan</item> <item name=”android:gravity”>center</item> </style> </resources> MyDialogFragment public class MyDialogFragment extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) … Read more

How to set a shape’s background in xml?

I think a layer-list might help you: <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item> <shape android:shape=”rectangle” > <solid android:color=”#ffffff” /> </shape> </item> <item> <shape android:innerRadiusRatio=”4″ android:shape=”ring” android:thicknessRatio=”9″ android:useLevel=”false” > <solid android:color=”#FF0000″ /> <size android:height=”48dip” android:width=”48dip” /> </shape> </item> </layer-list>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)