Freitag, 18. November 2016

SQL Server Management Studio Syntax error in TextHeader of View


In Query Windows enter this: 
 
sp_helptext N'NameOfView'
 
 
If you want to get The Create Table Statment:
SELECT c.name +' ' +t.name + 
    case t.name 
      when 'nvarchar' 
        then ' ('+convert(varchar,c.max_length/2)+') '
      else ''
    end +','
  --,t.name data_type
  --,c.max_length max_length
  --,c.precision precision
  --,c.scale scale
  --,c.is_nullable is_nullable
  --,c.is_identity is_identity
  --,c.collation_name collation_name
FROM sys.columns c
  ,sys.objects o
  ,sys.types t
WHERE c.object_id = o.object_id
  AND t.system_type_id = c.system_type_id
  and o.name = 'yourTableName'
  and t.name != 'sysname' 

Samstag, 13. August 2016

python remove empty lines from string


How about:
text = os.linesep.join([s for s in text.splitlines() if s])
where text is the string with the possible extraneous lines?

http://stackoverflow.com/questions/1140958/whats-a-quick-one-liner-to-remove-empty-lines-from-a-python-string/1140966#1140966

TinyCoreLinux


sudo fdisk /dev/mmcblk0
p drücken

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 342 2902 30720 c Win95 FAT32 (LBA)
/dev/mmcblk0p2 2903 5089280 61036536 83 Linux

Merke den Startcylinder der partition “/dev/mmcblk0p2” hier 2903. Lösche Partition 2 mit d. Jetzt mit n eine neue Partition erstellen. Als Partitionsnummer 2 eingeben. Startzylinder (2903) eigeben. Als Endzylinder nichts eingeben, somit wird der gesamte restliche platz für die Partition verwendet. Mit w die Partiton erstellen.

Neustart

sudo resize2fs /dev/mmcblk0p2
 

http://forum.tinycorelinux.net/index.php?topic=18932.0
SCYL=$(sudo fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{ print $2 }')
echo -e "p\nd\n2\nn\np\n2\n${SCYL}\n\n\np\nw\n" | sudo fdisk /dev/mmcblk0
sudo reboot
sudo resize2fs /dev/mmcblk0p2 
    

Nun kann man programme installieren:
tce-load -iw python
tce-load -iw curl

----

Um Konfiguration am System zu persistieren:
Persistence:
    filetool.sh -b

Hier werden startup-Befehle eingegeben:
/opt/bootlocal.sh
filetool.sh -b nicht vergessen

----
pip installieren:
tc@box:~$ wget https://bootstrap.pypa.io/get-pip.py
tc@box:~$ sudo python get-pip.py


TinyCoreLinux


sudo fdisk /dev/mmcblk0
p drücken

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 342 2902 30720 c Win95 FAT32 (LBA)
/dev/mmcblk0p2 2903 5089280 61036536 83 Linux

Merke den Startcylinder der partition “/dev/mmcblk0p2” hier 2903. Lösche Partition 2 mit d. Jetzt mit n eine neue Partition erstellen. Als Partitionsnummer 2 eingeben. Startzylinder (2903) eigeben. Als Endzylinder nichts eingeben, somit wird der gesamte restliche platz für die Partition verwendet. Mit w die Partiton erstellen.

Neustart

sudo resize2fs /dev/mmcblk0p2

Nun kann man programme installieren:
tce-load -iw python
tce-load -iw curl

----

Um Konfiguration am System zu persistieren:
Persistence:
    filetool.sh -b

Hier werden startup-Befehle eingegeben:
/opt/bootlocal.sh
filetool.sh -b nicht vergessen

Donnerstag, 11. August 2016

linux restart network interfaces

all
/etc/init.d/networking restart

restart specific interface
ifdown wlan0
ifup wlan0

all interfaces
ifconfig -a

Sonntag, 24. Juli 2016

rsync

Backup mit Timestamp

rsync -avb --suffix=_`date +%Y%m%d%H%M%S` /home/user/Downloads/rsync/A/ /home/user/Downloads/rsync/B/

Ändert ein File im Startverzeichnis, so wird das im Zielverzeichnis mit einem Zeistempel versehen.

Bsp:
1. Rsync ausführen
1. File 1.txt wird von A nach B kopiert, beide Verzeichnisse haben das identische File 1.txt
2. In Folder A ändert das File 1.txt
3. Rsync ausführen
4. Das File 1.txt wird von A nach B kopiert. das Alte File in B wird mit einem Zeitstempel veresehen.

Backup ohne Timestamp (File wird im Ziel überschrieben)

rsync -av --size-only /home/andy/Downloads/rsync/A/ /home/andy/Downloads/rsync/B/

Webdav mittels Visual-Basic verbinden

VB-Script zum verbinden von Webdav 

NET USE gibt immer viele Fehler

Eine Alternative dazu ist folgednes Script

webdav.vbs
--------------------------------------------------
Set objNetwork = WScript.CreateObject("WScript.Network") 
objNetwork.MapNetworkDrive "I:" , "https://www.ressource.com/path/to/folder/", false, "username", "password" 
--------------------------------------------------



Quelle: http://ss64.com/vb/mapnetworkdrive.html

Syntax 
      objNetwork.MapNetworkDrive(strLocalDrive, strRemoteShare, [persistent], [strUser], [strPassword])

Key
   objNetwork     : A WScript.network object

   strLocalDrive  : The drive letter (e.g. L:)
   
   strRemoteShare : The UNC path to the remote drive \\MyServer\MyPrinter
                    (String value)
   
   persistent     : True/False - store the mapping persistently in the users profile
                    default = false
   
   strUser        :  The user name. (Optional)
   
   strPassword    :  The password. (Optional)

Windows Webdav Dateibegrenzung

Windows begreznt die Dateigrösse normalerweise auf ca. 50 MB. Dies kann man wie folgt umgehen:

Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
In the right pane, right-click the FileSizeLimitInBytes value, and then click Modify.
If you cannot see the FileSizeLimitInBytes value, right-click the blank space in the right pane, click New, click DWORD Value, type FileSizeLimitInBytes, and then click OK.
In the Edit DWORD Value box, click to select the Decimal option. In the box under Value data, type a value that is larger than the size of the file that you want to download. Click OK.
Note The default value for the file size limit is 50000000 bytes.
Quit Registry Editor. Restart the computer.

Sonntag, 15. Mai 2016

Regex Control Charackter without LineBreak, Tabs etc

Steuerzeichen in Regex lassen sich mit :cntrl: suchen, jedoch werden so auch normale Zeilenumbrüche, Tabulatoren etc ersetzt, wenn man diese Leerzeichen behalten möchte kann man den Folgenden String verwenden:

lookaheads
 
(?![\s])[[:cntrl:]]

Quelle: http://stackoverflow.com/a/17328119


Ein paar Steuerzeichen mit der Tastatur erzeugen:
alt+03 -> ETX
alt+04 -> EOT


Quelle: http://www.theasciicode.com.ar/

Samstag, 14. Mai 2016

cyanogenmod 9505

https://dl.twrp.me/jfltexx/

Download:
- http://get.cm/?device=jfltexx
- http://opengapps.org/ (Platform: ARM, Android: 6, Variant: Pico)

Recovery
Mit USB-Verbinden und folgende flashen
1. CM
2. GAPPS

Fehler:

Setup Wizard has stopped
Here is a method that you can do without whiping,

    Boot into TWRP Recovery
    Mount System ( Mount → check System )
    Advanced → File Manager
    Browse to /system/priv-app/Setup-Wizard
    Delete it

how-do-i-remove-gapps-from-cyanogenmod.

Seems like you can remove it without a reinstall

    adb shell
    su
    mount -o rw,remount /system
    rm -R /system/addon.d

Source here : How to fix wrong Google apps
http://android.stackexchange.com/questions/65762/how-do-i-remove-gapps-from-cyanogenmod

Samstag, 2. Januar 2016

Linux automount smb

etc/fstab
//ip/share   /media/asustor_share   cifs credentials=/home/andy/.smbcredentials,iocharset=utf8,sec=ntlm,noauto,user 0 0
 

user= allow user to mount smb...

subl ~/.smbcredentials
username=msusername
password=mspassword

chmod 600 .smbcredentials 



source: https://wiki.ubuntu.com/MountWindowsSharesPermanently