Insertion Sort dengan Phython

Program Insertion Sort berikut ini saya tulisb dalam bahasa Python, sesuai dengan pseudocode dari buku “Introduction to Algorithms, Thomas H. Cormen” halaman 18.

Programnya sebagai berikut (saya jalankan di python 3.5.1) :

 

A=[5,2,4,6,1,3]

print(“Data sebelum di sortir :”)
for j in range(0,len(A)):
print(A[j],” “, end=”)

print()

for j in range(1, len(A)):
key=A[j]
i=j-1
while i>=0 and A[i] >key :
A[i+1]=A[i]
i=i-1
A[i+1]=key

print(“Data setelah di sortir :”)
for j in range(0,len(A)):
print(A[j],” “, end=”)

 

Program diatas menyortir list A secara Ascending. Untuk menyortir secara Descending, cukup mengubah baris :

while i>=0 and A[i] >key :

menjadi :

while i>=0 and A[i] <key :

 

 

Sierra 885 can send an sms 2 times faster with any other modem

This is my experience, may be not for you, so do not blame me if you do not have like me. I already use some type of modem to send sms, but all of the fastest send sms in 3-6 seconds. But when I tried the Sierra 885, the speed increased 2 times more, it can send sms in 1.5-2 seconds.

Updated:  With this modem, I can send SMS  in  1:17 seconds ! Title should be changed to 3 times faster!

Send SMS
at+cmgs=64
> 0691261801000031000C9126186235911700008F39D4F29C0E9AB7E720B3FCDD060D9F4D908D05
1A269B49900E548BC162B05B8D26B3C164B7988C056ABFC9653648071AE27035

+CMGS: 96

 

OK
Delivery Deport
+CDS: 25
0691261801000006600C91261862359117113062704421821130627044618200

Incoming SMS
+CMTI: "SM",12

Read SMS on SIM Memory 12
at+cmgr=12
+CMGR: 0,,25
06912618010000240C9126186235911700001130627054918206EF3548FC9E03

Delete SMS on SIM Memory 11
at+cmgd=11
OK

List SMS on SIM Memory (1)
at+cmgl=1
+CMGL: 12,1,,25
06912618010000240C9126186235911700001130627054918206EF3548FC9E03
+CMGL: 13,1,,21
06912618010000240C9126186235911700001130628020328202EF35

How to turn on automatic logon in Windows


Use Registry Editor to turn on automatic logon

Important This
section, method, or task contains steps that tell you how to modify the
registry. However, serious problems might occur if you modify the registry
incorrectly. Therefore, make sure that you follow these steps carefully. For
added protection, back up the registry before you modify it. Then, you can
restore the registry if a problem occurs. For more information about how to back
up and restore the registry, click the following article number to view the
article in the Microsoft Knowledge Base:


322756
How to back up and
restore the registry in Windows



To use Registry Editor (Regedt32.exe) to turn on automatic logon, follow these
steps:

  1. Click Start,
    and then click Run.
  2. In the Open box,
    type Regedt32.exe, and then press ENTER.
  3. Locate the
    following subkey in the registry:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
    NT\CurrentVersion\Winlogon
  4. Double-click
    the DefaultUserName entry,
    type your user name, and then click OK.
  5. Double-click
    the DefaultPassword entry,
    type your password, and then clickOK.NOTE:
    If the DefaultPassword value
    does not exist, it must be added. To add the value, follow these steps:


    1. On the Edit menu,
      click New,
      and then point to String
      Value
      .
    2. Type DefaultPassword,
      and then press ENTER.
    3. Double-click DefaultPassword.
    4. In the Edit
      String
      dialog, type your
      password and then click OK.

    NOTE: If no DefaultPassword
    string is specified, Windows automatically changes the value of the AutoAdminLogon key
    from 1 (true) to 0 (false), disabling the AutoAdminLogon feature.


  6. On the Edit menu,
    click New,
    and then point to String
    Value
    .
  7. Type AutoAdminLogon,
    and then press ENTER.
  8. Double-click AutoAdminLogon.
  9. In the Edit
    String
    dialog box, type 1 and
    then click OK.
  10. Quit
    Registry Editor.
  11. Click Start,
    click Shutdown,
    and then type a reason in the Comment text
    box.
  12. Click OK to
    turn off your computer.
  13. Restart your
    computer. You can now log on automatically.

Source : http://support.microsoft.com/kb/324737

Date and Time Format Patterns

Date and Time Format Patterns

Copas from :

http://authors.aspalliance.com/aspxtreme/sys/globalization/demos/ DateTimeFormatInfoGetAllDateTimePatterns.aspx

All the patterns:

0

MM/dd/yyyy

09/15/2010

1

dddd, dd MMMM yyyy

Wednesday, 15 September
2010

2

dddd, dd MMMM yyyy HH:mm

Wednesday, 15 September
2010 00:35

3

dddd, dd MMMM yyyy hh:mm
tt

Wednesday, 15 September
2010 12:35 AM

4

dddd, dd MMMM yyyy H:mm

Wednesday, 15 September
2010 0:35

5

dddd, dd MMMM yyyy h:mm
tt

Wednesday, 15 September
2010 12:35 AM

6

dddd, dd MMMM yyyy
HH:mm:ss

Wednesday, 15 September
2010 00:35:07

7

MM/dd/yyyy HH:mm

09/15/2010 00:35

8

MM/dd/yyyy hh:mm tt

09/15/2010 12:35 AM

9

MM/dd/yyyy H:mm

09/15/2010 0:35

10

MM/dd/yyyy h:mm tt

09/15/2010 12:35 AM

11

MM/dd/yyyy HH:mm:ss

09/15/2010 00:35:07

12

MMMM dd

September 15

13

MMMM dd

September 15

14

yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss.fffffffK

2010-09-15T00:35:07.4151985-04:00

15

yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss.fffffffK

2010-09-15T00:35:07.4151985-04:00

16

ddd, dd MMM yyyy
HH’:’mm’:’ss ‘GMT’

Wed, 15 Sep 2010 00:35:07
GMT

17

ddd, dd MMM yyyy
HH’:’mm’:’ss ‘GMT’

Wed, 15 Sep 2010 00:35:07
GMT

18

yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss

2010-09-15T00:35:07

19

HH:mm

00:35

20

hh:mm tt

12:35 AM

21

H:mm

0:35

22

h:mm tt

12:35 AM

23

HH:mm:ss

00:35:07

24

yyyy’-‘MM’-‘dd
HH’:’mm’:’ss’Z’

2010-09-15 00:35:07Z

25

dddd, dd MMMM yyyy
HH:mm:ss

Wednesday, 15 September
2010 00:35:07

26

yyyy MMMM

2010 September

27

yyyy MMMM

2010 September

Continue reading “Date and Time Format Patterns” »

Fatal error: Allowed memory size of … bytes exhausted

Error di atas terjadi saat saya mengupload sebuah template pada Joomla. Sekilas, error tersebut berasal dari Database mySQL. Namun sebenarnya, error tersebut berasal dari PHP, dimana jumlah maksimum memory yang digunakan oleh script PHP sudah melebihi batas maksimum yang ditentukan.

Ternyata cukup mudah untuk menangani masalah ini. Cukup masuk ke php.ini, dan carilah bagian berikut :

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ;
max_input_time = 60 ;
memory_limit = 8M      ;

Gantilah memory_limit=8M menjadi yang lebih besar misalnya 16M. Setelah itu Restart IIS anda, dan semuanya sudah berjalan dengan baik.

Selamat Mencoba

RSS
Follow by Email
Facebook
Twitter
Visit Us
Follow Me
INSTAGRAM