Archive for luglio, 2010
28
lug

Hello,
I found a magic trick for windows… it use WMIC.

Using WMIC, it is possible to list out all the running processes and their parameters!

The following command-line outputs the list of running processes (with the complete command-line arguments used for each process) to a text file:

1
WMIC /OUTPUT:C:\ProcessList.txt path win32_process get Caption,Processid,Commandline





Yeah!!!
I was interested to this line in particulary…
I downloaded a tool that convert mp3, avi, etc… in various format (it use ffmpeg background utility), but i want to know the correct parameters used in ffmped to convert avi in IPOD compatible video!
After 1 second I give that magic string!

ffmpeg.exe -y -i “DEC_M6_U1_L3_R.avi” [...] “DEC_M6_U1_L3_R.mp4″

I’m happy!

Rif: albertopasca.it



FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , , , , , ,

21
lug

Well,

a usefully thing (for me) that convert real media files like CAMV, RM, SMIL in iPod compatible video (AVI mpeg4).

It’s a multithread windows executable easy to use.

It merge RM and CAMV in AVI file and after convert the AVI in Mpeg4 for iPod compatible video in 320×240.

Rcam

you can download it here.

    - Requires Framework .net 2.0+. It’s a C# application.
    - Unzip all and click Rcam.exe. Mantain mencoder.exe and ffmpeg.exe in the same path of your executable.

If you prefer unix version of rm camv converter, read this old article.

WARNING! It’s a beta version 000000.000001 ! There are a lot of bugs… but it works!

it’s all.

Rif: albertopasca.it

FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , , , , , , , , , ,

13
lug

Yes!
It’s double right click!

In this snippet you can use right double click to “go back” on your web browser!
It’s a stupid tricks, but it’s very useful!

Here we go!

As usually, copy and paste this snippet in your windows application.

First of all, you must include this libs:

using System.Runtime.InteropServices;
using System.Diagnostics;





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
private static LowLevelMouseProc _proc = HookCallback;
private static IntPtr _hookID = IntPtr.Zero;
private static MSLLHOOKSTRUCT _posDblClk;

private const int WH_MOUSE_LL = 14;

private enum MouseMessages
{
  WM_LBUTTONDOWN = 0x0201,
  WM_LBUTTONUP = 0x0202,
  WM_MOUSEMOVE = 0x0200,
  WM_MOUSEWHEEL = 0x020A,
  WM_RBUTTONDOWN = 0x0204,
  WM_RBUTTONUP = 0x0205
}

[StructLayout( LayoutKind.Sequential )]
private struct POINT
{
  public int x;
  public int y;
}

[StructLayout( LayoutKind.Sequential )]
private struct MSLLHOOKSTRUCT
{
  public POINT pt;
  public uint mouseData;
  public uint flags;
  public uint time;
  public IntPtr dwExtraInfo;
}

[DllImport( "user32.dll", CharSet = CharSet.Auto, SetLastError = true )]
private static extern IntPtr SetWindowsHookEx( int idHook, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId );

[DllImport( "user32.dll", CharSet = CharSet.Auto, SetLastError = true )]
[return: MarshalAs( UnmanagedType.Bool )]
private static extern bool UnhookWindowsHookEx( IntPtr hhk );

[DllImport( "user32.dll", CharSet = CharSet.Auto, SetLastError = true )]
private static extern IntPtr CallNextHookEx( IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam );

[DllImport( "kernel32.dll", CharSet = CharSet.Auto, SetLastError = true )]
private static extern IntPtr GetModuleHandle( string lpModuleName );

Ok, this is first part of code, used to catch mouse event with windows API like kernel32.dll and user32.dll.

After that, create two simple method that invoke mouse hook:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
private static IntPtr SetHook( LowLevelMouseProc proc )
{
  using ( Process curProcess = Process.GetCurrentProcess() )
  using ( ProcessModule curModule = curProcess.MainModule ) {
    return SetWindowsHookEx( WH_MOUSE_LL, proc, GetModuleHandle( curModule.ModuleName ), 0 );
  }
}

private delegate IntPtr LowLevelMouseProc( int nCode, IntPtr wParam, IntPtr lParam );

private static IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam )
{
  if ( nCode >= 0 && MouseMessages.WM_RBUTTONDOWN == ( MouseMessages )wParam ) {
    MSLLHOOKSTRUCT hookStruct = ( MSLLHOOKSTRUCT )Marshal.PtrToStructure( lParam, typeof( MSLLHOOKSTRUCT ) );

    if ( ( _posDblClk.pt.x == hookStruct.pt.x ) && ( _posDblClk.pt.y == hookStruct.pt.y ) ) {
      SendKeys.Send( "%{LEFT}" );
    }
    _posDblClk.pt.x = hookStruct.pt.x;
    _posDblClk.pt.y = hookStruct.pt.y;
  }

  return CallNextHookEx( _hookID, nCode, wParam, lParam );
}

…you can view that in HookCallback function there is a method that use “%{LEFT}”, this is equivalent to ALT+LEFTARROW, used to go back in web browser.

SendKeys.Send( “%{LEFT}” );

When is detected a double right click, the program send to the system the ALT+LEFTARROW keys. If you are in a browser, you go back!

Finally,
in you form init, insert this lines

1
2
3
_hookID = SetHook( _proc );
Application.Run();
UnhookWindowsHookEx( _hookID );

that starting the mouse hook.

Perfect! Compile and test it!

If you like this tricks, add it in Windows Autorun!
If you like this post, click iLike!
If you don’t want to compile and want only to use it, you can download from here.




byz

Rif: albertopasca.it

FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , , , , , , ,

12
lug

Hello,

a simple trick for you to get pixel color on a particular position of your screen with Windows GDI32.dll API libs.




First of all, you need to import Win32 API:

1
2
3
4
5
6
7
8
    [DllImport( "user32.dll" )]
    static extern IntPtr GetDC( IntPtr hwnd );

    [DllImport( "user32.dll" )]
    static extern Int32 ReleaseDC( IntPtr hwnd, IntPtr hdc );

    [DllImport( "gdi32.dll" )]
    static extern uint GetPixel( IntPtr hdc, int nXPos, int nYPos );

after that, create a function like this that return color in ARGB:

1
2
3
4
5
6
7
8
9
10
    static public System.Drawing.Color GetPixelColor( int x, int y )
    {
      IntPtr hdc = GetDC( IntPtr.Zero );
      uint pixel = GetPixel( hdc, x, y );
      ReleaseDC( IntPtr.Zero, hdc );
      Color color = Color.FromArgb( ( int )( pixel & 0x000000FF ),
                   ( int )( pixel & 0x0000FF00 ) >> 8,
                   ( int )( pixel & 0x00FF0000 ) >> 16 );
      return color;
    }

you can call it simply GetPixelColor( 0, 100 );

That’s all.

Rif: albertopasca.it

FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , , ,

08
lug

As a Linux user, you may have to get the following error:

bash: /bin/rm: Argument list too long

There are a lot of methods to resolve this issue, but I use this stupid and simple one:

Here the code (copy, type vi rmany.sh, paste the code):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# rmany.sh
#  - List or delete a lot of files...
#    ...specially in this folder!
#
# (c)apasca
#
#
#!/bin/bash
#
for X in *.$1
do
$2 "$X";
done
#
# FIRST:
#   chmod +x rmany.sh
#   alias rmany='./rmany.sh'
#
# USAGE:
#   rmany [EXTENSION] [COMMAND]
#

You need to make it executable (chmod +x rmany.sh) and optionally add it as alias (alias rmany=’./rmany.sh’).





If you have created an alias you can type on console simply “rmany txt rm” and press enter!

Your input is rmany [EXTENSION] [COMMAND]

!

FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , ,

02
lug

Apple: iPhone 4 reception problem is a software issue, fix coming in ‘a few weeks’

Upon investigation, we were stunned to find that the formula we use to calculate how many bars of signal strength to display is totally wrong. Our formula, in many instances, mistakenly displays 2 more bars than it should for a given signal strength. For example, we sometimes display 4 bars when we should be displaying as few as 2 bars. Users observing a drop of several bars when they grip their iPhone in a certain way are most likely in an area with very weak signal strength, but they don’t know it because we are erroneously displaying 4 or 5 bars. Their big drop in bars is because their high bars were never real in the first place.

To fix this, we are adopting AT&T’s recently recommended formula for calculating how many bars to display for a given signal strength. The real signal strength remains the same, but the iPhone’s bars will report it far more accurately, providing users a much better indication of the reception they will get in a given area. We are also making bars 1, 2 and 3 a bit taller so they will be easier to see.

We will issue a free software update within a few weeks that incorporates the corrected formula. Since this mistake has been present since the original iPhone, this software update will also be available for the iPhone 3GS and iPhone 3G.

Rif: http://www.engadget.com/2010/07/02/apple-iphone-4-reception-problems-a-software-issue-fix-coming/

FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , , ,

Switch to our mobile site