dir /b /s /ad | findstr "android-ndk-r10e"
Found the directory. As I've downloaded 64 bit NDK, it's
"C:\Windows\SysWOW64\android-ndk-r10e"
on my 64bit Windows 7 machine.
Hope this helps and you don't have to search C: like me.
EOD Blog of a Programmer
decimal NearestOfPenny(decimal amountToRound)
{
return UltimateRoundingFunction(amountToRound, 0.01m, 0.5m);
}
decimal NearestOfNickel(decimal amountToRound)
{
return UltimateRoundingFunction(amountToRound, 0.05m, 0.5m);
}
decimal NearestOfDime(decimal amountToRound)
{
return UltimateRoundingFunction(amountToRound, 0.10m, 0.5m);
}
decimal NearestOfQuarter(decimal amountToRound)
{
return UltimateRoundingFunction(amountToRound, 0.25m, 0.5m);
}
decimal NearestOfDollar(decimal amountToRound)
{
return UltimateRoundingFunction(amountToRound, 1m, 0.5m);
}
decimal UpwardDollarOnlyIfReminderIsMoreThan70Cents(decimal amountToRound)
{
return UltimateRoundingFunction(amountToRound, 1m, 0.3m);
//i.e. 0.70 will round up. but 0.69 will be rounded to 0.. this magic is from value of 'fairness'.
}
//amountToRound => input amount
//nearestOf => .25 if round to quater, 0.01 for rounding to 1 cent, 1 for rounding to $1
//fairness => btween 0 to 0.9999999___.
// 0 means floor and 0.99999... means ceiling. But for ceiling, I would recommend, Math.Ceiling
// 0.5 = Standard Rounding function. It will round up the border case. i.e. 1.5 to 2 and not 1.
// 0.4999999... Non-standard rounding function. Where border case is rounded down. i.e. 1.5 to 1 and not 2.
// 0.75 means first 75% values will be rounded down, rest 25% value will be rounded up.
decimal UltimateRoundingFunction(decimal amountToRound, decimal nearstOf, decimal fairness)
{
return Math.Floor(amountToRound / nearstOf + fairness) * nearstOf;
}
using System;
using System.Collections.ObjectModel;
using System.Security.Permissions;
public class ReadOnlyClassAsReturnValue
{
private int sampleInt;
// make regular property read-only by creating only 'get' call
public int SampleInt
{
get { return sampleInt; }
}
private bool[] sampleCollection;
// Collections need to be made ReadOnlyCollection<T> .
// NOTE: Though ReadOnlyCollection<T> can be casted as IList<T>, never
// do that. It allows someone to to change collection in compilte
// time only to realized during runtime that it cannot be changed
public ReadOnlyCollection<bool> SampleCollection
{
get { return Array.AsReadOnly(sampleCollection); } //gives ReadOnlyCollection<T>
}
// 'private' varialbes can only be assigned in contructor. If any variable need to be assigned after
// object is created, it need to be made 'internal'.
protected string sampleString = "x";
public string SampleString
{
get { return sampleString; }
}
// Contructor is made 'protected' as this class is to be used by serious consumers only.
// If ultimate (dumb) user is going to be outside your assembly, you can make it
// 'internal' instead of 'prorected' eliminating need to override this class and
// providing more protection than 'protected' (and 'proected internal').
protected ReadOnlyClassAsReturnValue(int sampleInt, bool[] sampleCollection)
{
this.sampleInt = sampleInt;
this.sampleCollection = sampleCollection;
}
}
public class PrimaryUserClass
{
// Inherit ReadOnlyClassAsReturnValue so internal methods/properties/variables can be assigned
private class ReadOnlyObjectMaker : ReadOnlyClassAsReturnValue
{
public ReadOnlyObjectMaker(int sampleInt, bool[] sampleCollection)
: base(sampleInt, sampleCollection)
{ }
public string SampleString
{
set
{
this.sampleString = value;
}
}
}
//NO ONE CAN CHANGE THIS RETURN VALUE
public ReadOnlyClassAsReturnValue ReadOnlyClassReturner()
{
ReadOnlyObjectMaker returnValue = new ReadOnlyObjectMaker(10, new bool[] { true, false });
returnValue.SampleString = "I can assign this";
return returnValue;
}
}
class Program
{
static void Main(string[] args)
{
var returnValue = new PrimaryUserClass().ReadOnlyClassReturner();
//returnValue cannot be modified. Why? Just for fun. Someone has to hack it to change anythingin returnValue.
}
}
private int CountNumberOfLinesInCSFilesOfDirectory(string dirPath)
{
FileInfo[] csFiles = new DirectoryInfo(txtPath.Text.Trim())
.GetFiles("*.cs", SearchOption.AllDirectories);
int totalNumberOfLines = 0;
Parallel.ForEach(csFiles, fo =>
{
Interlocked.Add(ref totalNumberOfLines, CountNumberOfLine(fo));
});
return totalNumberOfLines;
}
private int CountNumberOfLine(Object tc)
{
FileInfo fo = (FileInfo)tc;
int count = 0;
int inComment = 0;
using (StreamReader sr = fo.OpenText())
{
string line;
while ((line = sr.ReadLine()) != null)
{
if (IsRealCode(line.Trim(), ref inComment))
count++;
}
}
return count;
}
private bool IsRealCode(string trimmed, ref int inComment)
{
if (trimmed.StartsWith("/*") && trimmed.EndsWith("*/"))
return false;
else if (trimmed.StartsWith("/*"))
{
inComment++;
return false;
}
else if (trimmed.EndsWith("*/"))
{
inComment--;
return false;
}
return
inComment == 0
&& !trimmed.StartsWith("//")
&& (trimmed.StartsWith("if")
|| trimmed.StartsWith("else if")
|| trimmed.StartsWith("using (")
|| trimmed.StartsWith("else if")
|| trimmed.Contains(";")
|| trimmed.StartsWith("public") //method signature
|| trimmed.StartsWith("private") //method signature
|| trimmed.StartsWith("protected") //method signature
);
}
ffmpeg.exe -i D:\my.bik D:\output\my_%d.png
$query = sprintf("SELECT UNIX_TIMESTAMP('%s') as UTS",
mysql_real_escape_string($DateTime));
$result = mysql_query($query);
if($row = mysql_fetch_assoc($result)) {
return $row['UTS'];
}
May PHP god have mercy on you! Happy Coding!
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Exception Stacktrace:
at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" > </script>
<script type="text/javascript">
$(function() {
if($.browser.mozilla)
//table row doean't float in firefox, div floats
$(".floatingHeader" + " tr th div")
.addClass("floatingStyle");
else
//table row can float in IE and Chrome
$(".floatingHeader"+ " tr th")
.addClass("floatingStyle");
});
function changeFloatingHeaderPosition(container, headerId) {
if($.browser.webkit) //chrome rendering bug fix
$("#"+headerId + " tr th")
.css("visibility", "hidden");
if($.browser.mozilla)
$("#"+headerId + " tr th div")
.css("top", container.scrollTop);
else
$("#"+headerId + " tr th")
.css("top", container.scrollTop);
if($.browser.webkit) //chrome rendering bug fix
$("#"+headerId + " tr th")
.css("visibility", "visible");
}
// Remove this method if you are using Jqeury earlier than 1.9
(function() {
var matched, browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
})();
</script>
<style>
.floatingStyle
{
position:relative;
background-color:#829DC0;
top:0px;
}
</style>
</head>
<body>
<div class="floatingContainer" onscroll="changeFloatingHeaderPosition(this, 'idHeader' );" style="height:150px; width: 100px;overflow:auto;">
<table cellspacing=0 cellpadding=0>
<thead class="floatingHeader" id="idHeader">
<tr>
<th><div>Col1</div></th> <th ><div>Col2<div></th>
<th ><div>Col3<div></th>
</tr>
</thead>
<tbody>
<tr><td>first_row</td><td>first_row</td><td>first_row</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td><td>data</td></tr> </tbody>
</table>
</div></body><html>
Note: Dan/Kenji has written plugging for the same which might be useful to you. I've not verified if it works in all case but worth having a look. You can find it: here: http://www.redkitetechnologies.com/2013/03/floatingsticky-headers-for-visualforce-pageblocktable/
SELECT
colT.TABLE_NAME ,
colT.COLUMN_NAME
FROM
INFORMATION_SCHEMA.COLUMNS AS colT
WHERE
COLUMN_NAME LIKE '%id'
AND
(colT.TABLE_NAME + colT.COLUMN_NAME) NOT IN
( SELECT
KOM.TABLE_NAME + KOM.COLUMN_NAME
FROM
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS KOM)
Note: Latest Available Amazon SimpleDB version as of today, i.e. when I am writing this, is in Beta status with API Version: “2009-04-15”
Overview of SimpleDB
Amazon SimpleDB is a highly available, flexible, and scalable non-relational data store that offloads the work of database administration. Developers simply store and query data items via web services requests.[1]
Representation of Data with SimpleDB:
Domains— Domains are similar to tables that contain similar data.
You can execute queries against a domain, but cannot execute queries across different domains.
Attributes— They are similar to columns in RDBMS, attributes represent categories of data that can be assigned to items.
Items— Represented by rows, items represent individual objects that contain one or more attribute name-value pairs.
Values—Similar to column value, values represent instances of attributes for items. An attribute can have multiple values. There is no data typing supported for attribute and all data is treated as text data during query execution.
However, Amazon SimpleDB is not a relational database, and does not offer some features needed in certain applications, e.g. complex transactions or joins (i.e. execute queries across different domains).[1] You need to rely on duplicating the data to avoid such scenarios.[2]
Benefits of using SimpleDB
Highly Available
Amazon SimpleDB creates and manages multiple geographically distributed replicas of your data automatically to enable high availability and data durability.
Flexible
You can change your data model on the fly, and data is automatically indexed for you.
Scalability
You can access additional machine resources by spreading your data set and requests across multiple domains.
Support for Reporting
Sql Server Reporting Service (SSRS) is a popular platform to build and access reports. SSRS reports are build based on dataset that has set for a report. It is possible to build dataset from SimpleDB.[3]
Limitation with SimpleDB
Domain (similar to table): 250 active domains per account. More can be requested by filling a form. Note that each attribute (similar to column) can hold multiple value.[4]
Attribute (similar to column) name-value pairs per item: 256[4]
Maximum response size for Select: 1 MB (large data like images can be stored separately into cloud as files and an Attribute can store URL for the resource).[4]
Maximum items per select: 2500[4]
Attribute value length: 1024 bytes[4]
No datatyping: text only. Integers and reals must be represented using leading zeros to ensure proper query comparisons.[5]
References:
[1] Amazon SimpleDB (beta)
http://aws.amazon.com/simpledb/
[2] How And Why Glue Is Using Amazon SimpleDB Instead Of A Relational Database
http://blog.getglue.com/?p=1145
[3] Accessing SimpleDB from SSRS
http://www.chrisumbel.com/article/simpledb_ssrs.aspx
[4] Amazon SimpleDB Limits, Amazon SimpleDB Developer Guide (API Latest version)
http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/
[5] M/DB - A Free Open Source "plug-compatible" alternative to Amazon's SimpleDB database
http://gradvs1.mgateway.com/main/index.html?path=mdb
Good user experience cannot be achieved by jazzy animations. It is these simple things that everyone wants to have.
Some common tips for better user experience (most of us knows but we don’t follow):
1. Use standard controls. In laymen language, text should look like text and button should look like a button.
2. Optimize for speed. Everyone want to get the things done faster. Don’t put animations which hinders speed of doing something. Your UI (specially forms) should be accessible by ‘keyboard only’ as well.
3. Think about the common mistake that user may be making while data entry. When you find something wrong, locate exact position and show understandable message to show the error.
4. Try to optimize available space. You controls should be able to adjust to larger width to avoid scrollbars if possible. Don’t put big logos of the application on each screen top.
5. Find the most used flows for your UI and optimize UI so user can complete the common tasks faster. If necessary, create different views of the same UI for different kind of user in organizational hierarchy.
public class SmartTransaction
{
bool _transactionOwner =false;
bool _transactionActive = false;
public bool IsActive
{
get
{
return _transactionActive;
}
}
public void Begin()
{
if (_transactionActive) return; //return to bad programer's code
try
{
_transactionOwner = !NHibernateSessionManager.Instance.HasOpenTransaction();
if (_transactionOwner)
NHibernateSessionManager.Instance.BeginTransaction();
_transactionActive = true;
}
catch
{
_transactionOwner = false;
_transactionActive = false;
throw;
}
}
public void Commit()
{
if (!_transactionActive || !NHibernateSessionManager.Instance.HasOpenTransaction())
{
_transactionActive = false;
return;
}
try
{
if (_transactionOwner)
NHibernateSessionManager.Instance.CommitTransaction();
}
catch //when you don't know what you are committing to.
{
NHibernateSessionManager.Instance.RollbackTransaction();
throw;
}
finally
{
_transactionActive = false;
}
}
public void Rollback()
{
_transactionActive = false;
if (!NHibernateSessionManager.Instance.HasOpenTransaction())
return;
NHibernateSessionManager.Instance.RollbackTransaction();
}
}
If you are developing iPhone application and trying to use UIButton on ‘Navigation Bar’ instead of ' ‘difficult to use’ ‘Bar Button Item’, you need a button image that exactly looks like Bar Button.
As I couldn’t find the button background on net, I created it myself using Paint.NET. Here it is for you.
I’ve been associate with an Innovation Lab from quite a some time and observing for life how a genuine ideas turn into a success. Though I’ve never been able to own a killer existing idea, I can still depict some characteristics of successful innovative idea (based on guts but without example or stories - bad bad to convince people).
In order to avoid confusion and/or be inline with OOP concepts, WPF style will not allow you to concatenate multiple style in one control. Instead, you can use ‘BasedOn’ property (of Style element) to inherit from the other style. It is possible to create chain of inheritance but multiple inheritance is not supported by default. Initially I though it is not possible until I came across this amazing link: http://swdeveloper.wordpress.com/2009/01/03/wpf-xaml-multiple-style-inheritance-and-markup-extensions/
It shows use of MarkupExtension to enable inheritance from multiple styles (in actual, your triggers and setters will be merged. Duplicates will be overwritten by the second style that you define)
Happy interfacing!
You get this exception when you try to upload any file in your Vanilla Forum (Version 1) using any Attachment extension :
You are not allowed to upload ‘FileName’. the requested file type: 'FileType’
Add specified type as allowed type. Steps to do so follow here:
Remove check for allowed types. Note that this is not very safe for public forum but it’s ‘ok’ for internal forum with known and responsible user. Steps to do so follow here: