This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Linq; | |
namespace SocialKit.ImageUtil | |
{ | |
/// <summary> | |
/// Provides methods for combine images into a single one. | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST http://172.21.120.186:8001/rest.aspx HTTP/1.1 | |
Host: 172.21.120.186:8001 | |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 | |
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 | |
Accept-Language: en-us,en;q=0.5 | |
Accept-Encoding: gzip,deflate | |
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 | |
Keep-Alive: 115 | |
Connection: keep-alive | |
Referer: http://172.21.120.186:8001/upload.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Save 100 quality JPEG image in C# | |
var combinedImage = ImageCombiner.Combine(16, images); | |
var encoder = ImageCodecInfo.GetImageEncoders().FirstOrDefault(e => e.MimeType == "image/jpeg"); | |
var encoderParams = new EncoderParameters(); | |
encoderParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L); | |
combinedImage.Save("wall_big.jpg", encoder, encoderParams); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#Does the $str ends with $end? | |
function str_ends_with($str, $end){ | |
return (substr($str, strlen($str) - strlen($end)) === $end); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Solution for calculate xy=total, x-y -> 0. | |
/// Reference: http://www.wolframalpha.com/input/?i=xy%3D200,+x%3E0 | |
/// </summary> | |
/// <param name="total">The integer to calculate.</param> | |
/// <returns>x,y pair, x <= y.</returns> | |
public static KeyValuePair<int, int> MinXPlusY(int total) | |
{ | |
var allXplusY = Enumerable.Range(1, total) | |
.Where(i => total % i == 0 && i <= total / i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#Solution for calculating xy=total, x-y->0. | |
#y is always equal or greater than x | |
#Reference: http://www.wolframalpha.com/input/?i=xy%3D200,+x%3E0 | |
function min_xy($total){ | |
$all_xy = array(); | |
$min = $total;//minimum number | |
$min_idx = -1;//minium number position in $all_xy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Data Access Layer for FansWall(http://fanswall.sinaapp.com) | |
Author: Shiny Zhu(http://t.sina.com.cn/shinyzhu) | |
*/ | |
class DAL{ | |
private $server, $username, $password, $db; | |
private $link; | |
private $result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- set these 2 attributes to hide secondary y-axis value in mscombidy2d.swf of FusionCharts --> | |
<chart showDivLineSecondaryValue="0" showSecondaryLimits="0"> | |
</chart> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSBundle *mainBudle=[NSBundle mainBundle]; | |
NSString *hgURL = [mainBudle objectForInfoDictionaryKey:@"HGGuideURL"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface Base58Encoder : NSObject { | |
} | |
+ (NSString *)base58EncodedValue:(long long)num; | |
@end |
OlderNewer