TwitterFacebook

Using facepy to deal with facebook – part 001.

This python module allow you to get some data from facebook using Facebook’s Graph API.
The development team told us:
Facepy can do more than reading your latest posts and posting photographs of parrots, but you’ll have to read the documentation to find out how.
You can use pip to install this module ( pip2.7 or pip3.4):

pip install facepy
The python script is simple :
...\Python34>cd Scripts
Scripts>pip3.4.exe install facepy

Now you can test this with this simple script:

C:\Python34>python.exe
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import facepy
>>> from facepy import *
>>> from facepy import GraphAPI
>>> graph = GraphAPI('.....my...token.....'
)
>>> graph.get('me')
{'gender': .....................................
......................'}

Make low poly fir tree with Blender 3D.

This will be the final result of this tutorial, I hope you will find this helpful.
fir-tree-output
First, open and save the scene with the name fir-tree or named it with your file name project.
The next step is to remove the default cube with Delete key or X key and press Enter key to remove it.
Press Shift + A keys and select from Mesh – Cylinder.
The see if you have the this Panel in the left of the screen. If is not just press T key to make it visible ( working like on / off swich). Change the number of the vertices to 8, see the next image:
treelow-001
Now will need to have a Front Orto view, so press key 1 and 5 from Numpad ( you need to have Num Lk on).
Press G+Z keys and move the cylinder up to red line ( this means the cylinder it’s under x-y 0,0 horizontal plane).
Press Tab key – this will allow you to edit this object. Press A to deselect the vertices and Z – this allow you to select the back size with vertices.
Select with B key the bottom of this cylinder and press G + Z . Move this selection to make the height of leaf litter.
treelow-002
Press S and scale this selection to make the top of the tree.
Press Ctr+R and after press 5 to make 5 sections – press Enter key or left mouse button. Then press A key to deselect this.
For each section of the tree will make same changes.
First , move the mouse on the first area of the top selection and press Ctr+R – will see another color line , move this to the bottom and press Enter key – the limit will be the top of the next section. Press S key and scale this selection.
See the next screenshot:
treelow-003
After we make this changes for all sections will go to the next step.
This is a bit difficult. You need to select with Alt key and right mouse button and then with Shift key – this will make the old selection – all this rings , see the next image:
treelow-004
With this selections press G and Z key and move to the bottom like in the next image:
treelow-005
Press Z key and Tab key to go to the Object Mode. Click on the material and press New button.
treelow-006
Press on Diffuse material , and select green color and darkness like this:
treelow-007
The last step is to make the the tree’s trunk.
Add one new cylinder , scale it , move it under the first cylinder. Make one brown material for tree’s trunk.
Select Camera position to see the tree when press the 0 key from NumPad and press F12 key to render it.
You can also try to change the subject. You will gain the skill and accuracy with time.

LINQ and LinkPad – part 001.

LINQ stands for Language Integrated Query and enadbles us to query any type of data store, like SQL Server , XML documents, Objects in memory etc.
You don’t need to know the syntax specific to data source because LINQ enables us to work with different data source.
The great goal is that it provides intellisense and compile time error checking.
If we development one application and this working with databases , xml documents and / or in memory objects then we can use LINQ.
LINQ query can be using any .NET supported programmiing language, because LINQ component between the LINQ query and the data source.
LinqPad tool can be downloaded for free from here.Now I help you to learn , write and test LINQ.
Today I will try to use C# with LinqPad.
LinqPad help you to under C# to make it converted to Intermediate Language (IL) which is also known as Microsoft Intermediate Language or Common Intermediate Language.
LinqPad
If you try to use LinqPad without source code then the oonly error under C# will come into C#Statement : ; expected
Press F4 button then press Add button (Query Properties ) and type WindowsBase.dll (Add Custom Assembly References – window) then press Ok button.
LinqPad
Let’s test all. Wrote this example and under Results tab click under IL.

Example 1
C# Expression

DateTime.Now.ToString("dd-MMM-yyyy")

Result IL

IL_0000:  call        System.DateTime.get_Now
IL_0005:  stloc.0     // CS$0$0000
IL_0006:  ldloca.s    00 // CS$0$0000
IL_0008:  ldstr       "dd-MMM-yyyy"
IL_000D:  call        System.DateTime.ToString
IL_0012:  call        LINQPad.Extensions.Dump
IL_0017:  pop         
IL_0018:  ret   

Example 2
C# Statement

int[] numbers =  {1,2,3,4,5};
var result = from n in numbers
	where n >  0
	select n;
result.Dump();

Result IL:

IL_0018:  brtrue.s    IL_002B
IL_001A:  ldnull      
IL_001B:  ldftn       b__0
IL_0021:  newobj      System.Func
...

this can a little dizzy for you but will come with future details.

Example 3
C# Program

static void IterationExample()
	  {
	      int i = 0;
	      while (i < 5)
	      {
	          i++;
	      }
	  }

Results IL :

IterationExample:
IL_0000:  ldc.i4.0    
IL_0001:  stloc.0     // i
IL_0002:  br.s        IL_0008
IL_0004:  ldloc.0     // i
IL_0005:  ldc.i4.1    
IL_0006:  add         
IL_0007:  stloc.0     // i
IL_0008:  ldloc.0     // i
IL_0009:  ldc.i4.5    
IL_000A:  blt.s       IL_0004
IL_000C:  ret

This examples will show us the results over IL.
Using LinqPad with assemblies .NET .
Under C# the most simple DLL example can be:

using System;

public class Test
{
	public static void Test()
	{
		Console.WriteLine("tutorial LinqPad -001");
	}

}

If we wrote into LinqPad under C# Statement and then run it.

Console.WriteLine(“tutorial LinqPad -001″);
… the result will be :

IL_0000:  ldstr       "tutorial LinqPad -001"
IL_0005:  call        System.Console.WriteLine
IL_000A:  ret

The next step is to create one new file into our C# project named Test.dll with this source code:

.assembly Test {}
.assembly extern mscorlib {}
.class public Test extends [mscorlib]System.Object {
	.method public static void TestMethod() cil managed {
	ldstr       "tutorial LinqPad -001"
	call        void [mscorlib]System.Console::WriteLine(string)
	ret         

	}
}

If you parse this code you will see under call I need to add this :

.assembly Test {}
.assembly extern mscorlib {}
.class public Test extends [mscorlib]System.Object {
	.method public static void TestMethod() cil managed {
void [mscorlib]   ::   (string)
	}
}

This is just one simple example about LinqPad.This software it’s very good when working with SQL , ASP , data , arrays.
To make the DLL file you need this : ilasm.exe
Run the command under cmd.exe:

C:\C#>C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ilasm.exe /DLL /OUT:Test.dll Test.il

The result will be: Test.dll .
Let test it:
Make another file with notepad , named DllTest.cs and put this source code:

using System;
class MainClass
{
	static void Main()
	{
	Test.TestMethod();
	}
}

Use cmd.exe to complile this into exe file format :

C:\C#>C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe /r:Test.dll DllTest.cs

If you run this using cmd.exe the the output will be:

C:\C#>DllTest.exe
tutorial LinkPad -001

C# compile assemblies together using any .NET language – part 001.

News: Notepad++ 6.7.4 Je suis Charlie edition .

The Notepad++ team come with one new version named : Je suis Charlie.
The main reason : The Notepad++ official site was hacked on 12th January 2015, due to its controversial new version 6.7.4 “Je suis Charlie” edition, released on 10th January 2015. The site was restored on the same day.
This great editor can be test it now with this edition.
Some new features and bug fixes:

  1. Add ghost typing feature: launch Notepad++ with the auto-typing text from command line (via command line with argument -qn, -qt or -qf).
  2. Fix auto-insert bad behaviour : under some condition typing ” or ‘ makes erase the further ” or ‘.
  3. Fix the crash issue while user Ctrl + double click on an empty document.
  4. Fix crash bug on loading dropbox settings.
  5. Show progress window instead of a static window during FindInFiles and ReplaceInFiles.
  6. Filename rendered incorrectly on tab bar while it contains ‘&’ character.
  7. Make highlighting (if enabled) follow typing for Incremental search, and add several Incremental search enhancements.
  8. Add the followings notifications for plugins : NPPN_BEFORESHUTDOWN NPPN_CANCELSHUTDOWN NPPN_FILEBEFORERENAME NPPN_FILERENAMECANCEL NPPN_FILERENAMED NPPN_FILEBEFOREDELETE NPPN_FILEDELETEFAILED NPPN_FILEDELETED
  9. Make keystroke ENTER trigger the shortcut editor dialog in Shortcut Mapper.
  10. Allow drop files onto doc switcher and other side panels.
  11. Installer remembers user’s choices of last installation.
  12. Fix Auto-indent in new code block not respecting current EOL bug.
  13. Restore focus to editor when a panel is closed.

Freedom of expression is like the air we breathe, we don’t feel it, until people take it away from us.

For this reason, Je suis Charlie, not because I endorse everything they published, but because I cherish the right to speak out freely without risk even when it offends others.
And no, you cannot just take someone’s life for whatever he/she expressed.

Hence this “Je suis Charlie” edition.
You can download this from