Did you know that you can navigate the posts by swiping left and right?
if [ -d "$DIRECTORY" ]; then
# Control will enter here if $DIRECTORY exists.
fi
Or to check if a directory doesn't exist:
if [ ! -d "$DIRECTORY" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
fi
a='hello'
b='world'
c=$a$b
echo $c
helloworld
svn checkout file:///home/landonwinters/svn/waterproject/trunk
svn up --depth infinity
svn up --set-depth infinity
shell> sudo /usr/local/mysql/bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
shell> bg
(Press Control-D or enter "exit" to exit the shell)
#!/bin/bash
while read line
do
name=$line
echo "Text read from file - $name"
done < $1
flag=`echo $a|awk '{print match($0,"pass")}'`;
if [ $flag -gt 0 ];then
echo "Success";
else
echo "fail";
fi
openssl genrsa 1024 >server.key
openssl req -new -key server.key > server.csr
openssl req -x509 -days 3650 -key server.key -in server.csr >server.crt
CREATE TABLE Persons
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (P_Id))
INSERT INTO table_name (column1,column2,column3,...) VALUES (value1,value2,value3,...);
1.Stop the MySQL Server.
sudo /etc/init.d/mysql stop
2.Start the mysqld configuration.
sudo mysqld --skip-grant-tables &
3.Login to MySQL as root.
mysql -u root mysql
4.Replace YOURNEWPASSWORD with your new password! UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
<?php
// Create connection$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();}
$result = mysqli_query($con,"SELECT * FROM Persons");
while($row = mysqli_fetch_array($result)) {
echo $row['FirstName'] . " " . $row['LastName'];
}
mysqli_close($con);
?>
1.Create a UNIQUE constraint on your subs_email column, if one does not already exist:
ALTER TABLE subs ADD UNIQUE (subs_email)
2.Use INSERT ... ON DUPLICATE KEY UPDATE:
INSERT INTO subs (subs_name, subs_email, subs_birthday) VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE
subs_name = VALUES(subs_name),
subs_birthday = VALUES(subs_birthday)
NSString *html = [yourWebView stringByEvaluatingJavaScriptFromString:
@"document.body.innerHTML"];
CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage], cropRect);
// or use the UIImage wherever you like
[UIImageView setImage:[UIImage imageWithCGImage:imageRef]];
CGImageRelease(imageRef);
Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file.
In the viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate];
Add the following method:
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
NSArray *newArray = [[NSArray alloc] initWithArray:oldArray copyItems:YES];
[newArray makeObjectsPerformSelector:@selector(doSomethingToObject)];
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
#import "UIImage+AverageColor.h"
@implementation UIImage (AverageColor)
- (UIColor *)averageColor {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
unsigned char rgba[4];
CGContextRef context = CGBitmapContextCreate(rgba, 1, 1, 8, 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGContextDrawImage(context, CGRectMake(0, 0, 1, 1), self.CGImage);
CGColorSpaceRelease(colorSpace);
CGContextRelease(context);
if(rgba[3] > 0) {
CGFloat alpha = ((CGFloat)rgba[3])/255.0;
CGFloat multiplier = alpha/255.0;
return [UIColor colorWithRed: ((CGFloat)rgba[0])*multiplier
green:((CGFloat)rgba[1])*multiplier
blue:((CGFloat)rgba[2])*multiplier
alpha:alpha];
}
else{
return [UIColor colorWithRed:((CGFloat)rgba[0])/255.0
green:((CGFloat)rgba[1])/255.0
blue:((CGFloat)rgba[2])/255.0
alpha:((CGFloat)rgba[3])/255.0];
}
}
@end
GET with JSON:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource
with XML:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource
POST:
For posting data:
curl --data "param1=value1¶m2=value2" http://hostname/resource
For file upload:
curl --form "fileupload=@filename.txt" http://hostname/resource
RESTful HTTP Post:
curl -X POST -d @filename http://hostname/resource
For logging into a site (auth):
curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
curl -L -b headers http://localhost/
lipo -info xx.a
creates or operate on fat (multi-architecture) files.
curl --header "Cookie: xq_a_token=tokenvalue;" http://api.xueqiu.com/v4/stock/quote.json?code=SHcode
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
sudo lsof -i -n -P | grep TCP
- (UIColor *)averageColor {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
unsigned char rgba[4];
CGContextRef context = CGBitmapContextCreate(rgba, 1, 1, 8, 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGContextDrawImage(context, CGRectMake(0, 0, 1, 1), self.CGImage);
CGColorSpaceRelease(colorSpace);
CGContextRelease(context);
if(rgba[3] > 0) {
CGFloat alpha = ((CGFloat)rgba[3])/255.0;
CGFloat multiplier = alpha/255.0;
return [UIColor colorWithRed:((CGFloat)rgba[0])*multiplier
green:((CGFloat)rgba[1])*multiplier
blue:((CGFloat)rgba[2])*multiplier
alpha:alpha];
}
else {
return [UIColor colorWithRed:((CGFloat)rgba[0])/255.0
green:((CGFloat)rgba[1])/255.0
blue:((CGFloat)rgba[2])/255.0
alpha:((CGFloat)rgba[3])/255.0];
}
}
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID
(lldb) command script import lldb.macosx.heap
(lldb) malloc_info --stack-history 0XAddress
clang -arch armv7 -arch arm64 -isysroot $(xcodebuild -sdk iphoneos -version Path) -shared test.m -framework Foundation -framework UIKit -o test.dylib
optool install -c load -p "@executable_path/test.dylib" -t ./WeChat.app/WeChat
cp ../test.dylib ./WeChat.app/
codesign -fs "iPhone Distribution" ./WeChat.app/test.dylib
codesign -fs "iPhone Distribution" ./WeChat.app
git config commit.template absolute-path-to-your-gitmessage.txt
Attention:Use the absolute path instead of the relative one.It seems that the relative one doesn't work.