L’articolo è stato aggiornato. La nuova versione si trova a questo link:
Traffico Tethering Router WiFi nascosto tramite proxy socks su Android
In this post i will write a checklist of common operations i do after clean installation of Windows Vista or Windows 7 (the most are not recommeded by Bill):
1. disable UAC (User Account Control)
2. disable System Protection on all disks
3. delete all Tasks except Registry Backup Task
Delete all folders contained in:
C:\Windows\system32\Tasks [for 32 and 64 bit systems] (do not delete the folder Microsoft\Windows\Registry it’s the registry backup, it’s important to recover a corrupted registry)
C:\Windows\SysWOW64\Tasks [for 64 bit only]
4. [OPTIONAL] disable Task Scheduler Service (doing this genarates an error when installing Office 2016)
It cannot be disabled with services.msc, but only via registry: locate HKLM\SYSTEM\CurrentControlSet\Services\Schedule and change the Start value from 2 to 4
5. disable Windows Search / Indexing
Control Panel >> Programs and Features >> Turn Windows features on and off and uncheck Windows Search
6. disable Automatic Defragmentation Service
Run services.msc and disable “Disk Defragmenter” service
7. cleanup msconfig
8. enable telnet client
Control Panel >> Programs and Features >> Turn Windows features on and off and check telnet client
Today i solved a two year problem with Windows 7 and my hp notebook. After leaving the computer idle for a while 10 or 20 minutes or more, the computer become unresponsive and the hard disk keeps working forever. To restore to normal operation i had to reset the pc.
To solve the problem i followed these steps:
1. Disable Windows Search from Control Panel >> Programs and Features >> Turn Windows features on and off and uncheck Windows Search
2. Remove all Windows Tasks, deleting all files and folders in these folders:
C:\Windows\system32\Tasks [for 32 and 64 bit systems]
C:\Windows\SysWOW64\Tasks [for 64 bit only]
3. Disable Windows Task Scheduler from registry: locate HKLM\SYSTEM\CurrentControlSet\Services\Schedule and change the Start value from 2 to 4
4. Disable Disk Defragmenter service from services.msc, set as DISABLED
5. reboot
This is a simple code to hide fields in scaffolding views. In the controller add the method beforeRender in this way:
public function beforeRender() { $action = $this->request->params['action']; if ($action == 'index') { $fields = array('id', 'username', 'role', 'created', 'email'); //'password','modified' $this->set('scaffoldFields', $fields); } else if ($action == 'view') { $fields = array('id', 'username', 'role', 'created', 'modified', 'email'); //'password' $this->set('scaffoldFields', $fields); } return parent::beforeRender(); }
in this example the fields were changed in the index and view actions, but in the other actions the fields are displayed all.
I have a tablet (allwinner a13 mid tablet 7″). Contacts application Contacts.apk is installed, but the icon is missing in the application list.
It can be started from terminal emulator. My android version is 4.0.4, i run on the terminal this command:
am start -n com.android.contacts/com.android.contacts.activities.PeopleActivity
or
am start -n com.android.contacts/.activities.PeopleActivity
[see: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.4_r2.1/com/android/contacts/activities/PeopleActivity.java?av=f]
- Run Cmd as Administrator
- Execute this command: schtasks /delete /tn *
This delete all tasks, but not the folders. To delete also the folders you must delete those in these directories:
- C:\Windows\System32\Tasks\Microsoft\Windows
- C:\Windows\SysWOW64\Tasks\Microsoft\Windows
Here is the code i used:
private void addPeople(String name, List<String> homeNumbers, List<String> mobileNumbers) { //insert contact ContentValues peopleContentValues = new ContentValues(); peopleContentValues.put(Contacts.People.NAME, name); //WARNING: this is for HTC to indicate the contact type //extra_group = 0 [google contact] //extra_group = 1 [??: maybe SIM contact] //extra_group = 2 [phone concact] peopleContentValues.put("extra_group", 2); Uri peopleUri = getContentResolver().insert(Contacts.People.CONTENT_URI, peopleContentValues); //get contact id [i need it to add phone numbers to it] Cursor cursorPeople = getContentResolver().query(peopleUri, new String[]{Contacts.People._ID}, null, null, null); cursorPeople.moveToNext(); long peopleId = cursorPeople.getLong(0); //add phones for (String num : mobileNumbers) { addPhoneToPeople(peopleId, Contacts.Phones.TYPE_MOBILE, num); } for (String num : homeNumbers) { addPhoneToPeople(peopleId, Contacts.Phones.TYPE_HOME, num); } } private void addPhoneToPeople(long peopleId, int type, String number) { if (number != null && !number.equals("")) { ContentValues phoneContentValues = new ContentValues(); phoneContentValues.put(Contacts.Phones.PERSON_ID, peopleId); phoneContentValues.put(Contacts.Phones.TYPE, type); phoneContentValues.put(Contacts.Phones.NUMBER, number); getContentResolver().insert(Contacts.Phones.CONTENT_URI, phoneContentValues); } }
This is a simple macro example that describes how to update outlook contacts:
Sub updateContacts() Dim ContactsFolder As Folder Dim Contact As ContactItem Set ContactsFolder = Session.GetDefaultFolder(olFolderContacts) i = 0 For Each Contact In ContactsFolder.Items first_name = Contact.FirstName middle_name = Contact.MiddleName last_name = Contact.LastName If middle_name <> "" Then Contact.FirstName = first_name & " " & middle_name Contact.MiddleName = "" Contact.Save i = i + 1 End If Next MsgBox ("Contacts Found: " & ContactsFolder.Items.Count & ", Updated: " & i) End Sub
This is a perl script that creates the svg code that matches a ddrescue log file.
SVG module is required. Edit the $INPUT_FILE and $SCALE_FACTOR variables as needed.
The SVG code is outputted to standard output. The messages to standard error.
Use ddrescue-svg-log.pl > output.svg to output to file.
#!/usr/bin/perl use strict; use warnings; use SVG; use Math::BigInt; ############################## my $SCALE_FACTOR = 10240000; my $SCALE_FACTOR_LABEL = 1024 * 1024 * 1024; #giga my $INPUT_FILE = "sda-80gb-log.txt"; ############################## my $ddlogfile; open $ddlogfile, "<$INPUT_FILE"; my $svg = SVG->new(width=>1000,height=>200); # use explicit element constructor to generate a group element my $svg_disc_group=$svg->group(id => 'disc_group'); while (<$ddlogfile>) { my $row = $_; chomp $row; # STATUS CHARACTERS: +,-,/,*,? if($row =~ m/^(0x[0-9A-z]*)\s*(0x[0-9A-z]*)\s*(\+|-|\/|\*|\?)/) { my $start = $1; my $size = $2; my $status = $3; print STDERR $row; #CALCULATE SVG COORDINATES USING $SCALE_FACTOR my $bigint_start_scaled = Math::BigInt->new($1); my $bigint_size_scaled = Math::BigInt->new($2); my ($_qx, $_rx) = $bigint_start_scaled->bdiv($SCALE_FACTOR); my ($_qw, $_rw) = $bigint_size_scaled->bdiv($SCALE_FACTOR); my $x = $_qx->numify() + ( $_rx->numify() / $SCALE_FACTOR ) ; my $w = $_qw->numify() + ( $_rw->numify() / $SCALE_FACTOR ) ; #LABEL VALUES my $bigint_start_label = Math::BigInt->new($1); my $bigint_size_label = Math::BigInt->new($2); my ($_q_start_lbl, $_r_start_lbl) = $bigint_start_label->bdiv($SCALE_FACTOR_LABEL); my ($_q_size_lbl, $_r_size_lbl) = $bigint_size_label->bdiv($SCALE_FACTOR_LABEL); my $start_lbl = $_q_start_lbl->numify() + ( $_r_start_lbl->numify() / $SCALE_FACTOR_LABEL ) ; my $size_lbl = $_q_size_lbl->numify() + ( $_r_size_lbl->numify() / $SCALE_FACTOR_LABEL ) ; my $rect_label = sprintf("%.2f", $start_lbl) . "[" . sprintf("%.2f", $size_lbl) . "]($status)"; my $svg_sector_group = $svg_disc_group->group(); my $rect_style = ($status eq '+')?{ fill=>"green" }:{ fill=>"red", stroke=>"red" }; # add a rectangle to the group $svg_sector_group->rectangle( x => $x, width => $w, y => 0, height => 30, style => $rect_style ); $svg_sector_group->text(x=>$x, y=>40, -cdata=> $rect_label, style=>'font-size: 2px'); print STDERR ("START: $start, SIZE: $size, STATUS: $status\n"); } } # now render the SVG object, implicitly use svg namespace print $svg->xmlify;
1. install phpunit correctly
pear install phpunit/PHPUnit
pear install phpunit/PHPUnit_Selenium
2. create the class CConsoleLogRoute in the components directory in the file CConsoleLogRoute.php with this code:
<?php
class CConsoleLogRoute extends CLogRoute {
protected function processLogs($logs)
{
foreach($logs as $log) {
echo $this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
}
}
}
3. configure YII to log when unit testing:
3a. add the log key in the components array in protected/config/test.php
‘log’=>array(
‘class’=>’CLogRouter’,
‘routes’=>array(
array(
‘class’=>’CConsoleLogRoute’,
‘levels’=>’error, warning, info, trace’,
),
),
),
3b. add some lines in protected/tests/bootstrap.php, the modified file should be this: (added the lines with YII_DEBUG, YII_TRACE_LEVEL, autoFlush and autoDump)
<?php
// change the following paths if necessary
$yiit=dirname(__FILE__).’/../../../framework/yiit.php’;
$config=dirname(__FILE__).’/../config/test.php’;
defined(‘YII_DEBUG’) or define(‘YII_DEBUG’,true);
defined(‘YII_TRACE_LEVEL’) or define(‘YII_TRACE_LEVEL’, 0);
require_once($yiit);
require_once(dirname(__FILE__).’/WebTestCase.php’);
Yii::createWebApplication($config);
Yii::getLogger()->autoFlush = 1;
Yii::getLogger()->autoDump = true;