Jul 10, 2018

AWS CLI: How to remove all items from AWS DynamoDB by recreating tables?

A while ago I wrote about removing items from DynamoDB one by one AWS CLI: How to remove all items from AWS DynamoDB table with complex key? unfortunately it's very very very slow approach and I've found the best way: recreate tables :) Script:
(
aws_profile=your profile
LOG_DIR=logs
aws dynamodb --profile $aws_profile delete-table --table-name your-table
aws dynamodb --profile $aws_profile create-table --table-name your-table --attribute-definitions AttributeName=dataDateTime,AttributeType=S AttributeName=userId,AttributeType=S --key-schema AttributeName=userId,KeyType=HASH AttributeName=dataDateTime,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --sse-specification Enabled=true
)

Jun 28, 2018

AWS CLI: How to remove all items from AWS DynamoDB table with complex key?

I have Dynamo table and need to clean up it with AWS CLI (on Ubuntu 16.04 or Windows 10 Pro Linux Subsystem). I couldn't find examples about this topic and decided to share my findings.
First of all I have Primary Key "userId", and the sort key is "dataDateTime". To transform JSON I'm using JQ tool.
aws dynamodb scan --table-name dev-data-table --attributes-to-get "userId" "dataDateTime" | jq .Items[] -c | xargs -t -0 -d '\n' -I keyvalue aws dynamodb delete-item --table-name dev-data-table --key ''keyvalue''
Be careful, this method is very slow, up to 10K items.
Have a good day.

JQ: How to install JQ 1.5 in Ubuntu?

JQ is a great JSON Query tool. More info about the tool you find at the site https://stedolan.github.io/jq/.

In Ubuntu 16.04 you can install jq 1.3 by running command:
sudo apt-get install jq
To install jq 1.5 you can run the command below:
curl -O -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
chmod +x jq-linux64
sudo mv jq-linux64 /usr/bin/jq
Have a good day.
 

Oct 25, 2012

Raphael: gravity model

Gravity model written on JavaScript. It uses Raphael lib.
If you have any additional ideas, you are welcome in comments.

Aug 31, 2012

WCF: How to ignore not valid certificate

WCF: How to ignore not valid certificate. Before calling webservice please add this line of code:
ServicePointManager.ServerCertificateValidationCallback +=
          ((sender, certificate, chain, sslPolicyErrors) =>true);

Dec 24, 2011

HTML5: Interference Demo

About 10 years ago I wrote this demo in Delphi using OpenGL. Using HTML5 we can generate interference scene of two coherent point sources more simpler. Please check out sources http://jsfiddle.net/JfdMn/19/.
How to use: click at the two different points of the image and enjoy the generated pictures.

Oct 21, 2011

.NET: One version file for all projects in solution

Glean a colleague the method of keeping the version info of all projects in solution:
  1. Create file VersionInfo.cs in solution root folder near .sln file.
  2. Put version info into the file:
    using System.Reflection;
    
    [assembly: AssemblyCompany("wonderu.com")]
    [assembly: AssemblyCopyright("Copyright © wonderu.com 2011")]
    [assembly: AssemblyTrademark("")]
    [assembly: AssemblyCulture("")]
    
    [assembly: AssemblyVersion("3.7.1.2")]
    [assembly: AssemblyFileVersion("3.7.1.2")]
    
  3.  Delete corresponding assembly attributes from all AssemblyInfo.cs files
  4. Link to VersionInfo.cs file in all projects: Project -> Add Existing Item... -> Add as a Link (down arrow near the "Add" button).

Oct 20, 2011

SVN: How to commit ("the true way")

Follow the simple rules then you commit to source control (SVN e.g.):
  1. Before committing the code please update ALL sources. Your code may have references to code in other folders.
  2. Build whole solution.
  3. Run unit-tests. You can use the minimal acceptance scenario for these purposes.
  4. (optional) Run check style utilities such as StyleCop or FxCop.
  5. (optional) Deploy solution locally and manually check changed cases and related functionality.
  6. Commit the code with log message:
    • Use notation:
      • "[+] something has been added (new functions, files etc.)"
      • "[*] something has been changed  (fix bugs, refactoring etc.)"
      • "[-] something has been deleted (delete files, unused classes etc.)"
    • Add Jira or other bugtracker issue number to comments. If you use integrated tools e.g. TortoiseSVN+CSharpTest.Net or Visual Studio+TFS you could select the issue number in the client tool.
    • Add an additional comments about the changes
  7. Check how your code builds on the build-server.
  8. Keep in mind that if your commit is the reason for the project to fail building or otherwise causes a severe bug, you will be taken out of wherever you are (bath, bar, bed whatever) and will be forced into your workplace to fix the problem ASAP ;)

Oct 19, 2011

Free SVN Hosting. Part 2

After 4 years of using hosted SVN I returned to http://assembla.com/ for private projects. It has free plans and very stable!

Oct 17, 2011

Jira: How to add comment from C# code

1. Add reference to web-service http://jiraserver.local/rpc/soap/jirasoapservice-v2?wsdl
2. Execute code:
using (var jira = new JiraSoapServiceService())
{
  var token = jira.login("user", "password");
  jira.addComment(token, "Project-2233", 
      new RemoteComment { body = "Comment from C# code" });
}