Terminalde
sudo gedit /etc/default/grub
Acilan Gedit te
LINUX_DEFAULT satirina video=hyperv_fb:1600×900 ekleyin
Kaydedip kapattiktan sonra terminalde
sudo update-grub
Open wp-includes/functions.php file and add:
function custom_field_get_post_meta_cb($object, $field_name, $request){ // return get_post_custom(); $metas = get_post_custom($post_id); foreach($metas as $key => $value) { if(sizeof($value) == 1) { $metas[$key] = $value[0]; } } return $metas; } function custom_field_update_post_meta_cb($value, $object, $field_name){ return update_post_meta($object['id'], $field_name, $value); } add_action('rest_api_init', function(){ register_rest_field('post', 'custom_fields', array('get_callback' => 'custom_field_get_post_meta_cb')); });
If you get “Unable to automatically debug ‘XXX.Service’. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server. See help for more information.” message while debugging WCF Service remove “Configure” static function from service.
public static void Configure(ServiceConfiguration config)
{
}
Original file: C# to C++ / Qt T4 generator
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".h" #>
<#@ assembly name="System" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.IO" #>
<#@ assembly name="PATH_TO_REFERENCE_DLL.dll" #>
<#
bool useQTTypes = true;
List
{
typeof(namespace.CLASS1),
typeof(namespace.CLASS2),
typeof(namespace.CLASS3)
};
GetPropertiesAll(ccs, useQTTypes);
#>
<#+
private void GetPropertiesAll(List
{
foreach(Type cc in ccs)
{
GetProperties(ccs, cc,useQTTypes);
}
}
private void GetProperties(List
{
string objectName = t.Name;
WriteLine(“//”);
WriteLine(“// Copyright © ” + DateTime.Now.ToString(“yyyy”) +”, Cihan T. (Generate Date: [” + DateTime.Now.ToString(“yyyy-MM-dd HH:mm:00″) +”])”);
WriteLine(“//”);
WriteLine(“#ifndef ” + objectName.ToUpper() + “_H”);
WriteLine(“#define ” + objectName.ToUpper() + “_H”);
WriteLine(“#include
if(useQTTypes)
{
WriteLine(“#include
}
if(t.IsClass || t.IsInterface)
GenerateClass(ccs, t, objectName, useQTTypes);
else if(t.IsEnum)
GenerateFromEnum(t, objectName, useQTTypes);
WriteLine(“#endif // ” + objectName.ToUpper() + “_H\r\n”);
SaveOutput(objectName + “.h”);
}
private void GenerateClass(List
{
GenerateIncludes(ccs, t, objectName, useQTTypes);
var properties = t.GetProperties().ToList();
WriteLine(“class ” + objectName);
WriteLine(“{“);
WriteLine(“public:”);
WriteLine(“\t” + objectName + “();”);
foreach(var p in properties){
WriteLine(“\tproperty<" + getAsQtProperty(p, useQTTypes) + "> ” + p.Name + “;”);
}
WriteLine(“};”);
}
private void GenerateIncludes(List
{
var properties = t.GetProperties().ToList();
foreach(var p in properties){
bool contains = ccs.Any(cc => cc.Name == p.PropertyType.Name);
if(contains)
WriteLine(“#include <" + p.PropertyType.Name + ".h>“);
}
}
private void GenerateFromEnum(Type t, string objectName, bool useQTTypes)
{
FieldInfo[] memberInfos = t.GetFields(BindingFlags.Public | BindingFlags.Static);
WriteLine(“enum class ” + objectName + “”);
WriteLine(“{“);
for(int i = 0; i < memberInfos.Length; i++){
Write("\t" + memberInfos[i].Name + " = " + memberInfos[i].GetRawConstantValue().ToString());
if(i < memberInfos.Length - 1)
Write(",");
Write("\r\n");
}
WriteLine("};");
}
private string getAsQtProperty(PropertyInfo p, bool useQTTypes)
{
switch(p.PropertyType.Name){
case "String":
return useQTTypes?"QString":"string";
case "Int32":
return "int";
case "Decimal":
return "float";
case "Double":
return "float";
case "Char":
return "char";
case "Byte":
return "char";
case "DateTime":
return useQTTypes?"QDateTime":"DateTime";
case "Boolean":
return useQTTypes?"bool":"BOOL";
case "List`1":
return useQTTypes?"QList<" + getListTypes(p, useQTTypes) +">“:”vector<>“;
case “Dictionary`2”:
return useQTTypes?”QMap<" + getDictionaryTypes(p, useQTTypes) + ">“:”map<"+ getDictionaryTypes(p, useQTTypes) +">“;
default:
return p.PropertyType.Name;
}
}
private string getDictionaryTypes(System.Reflection.PropertyInfo p, bool useQTTypes)
{
return string.Empty;
/*
return string.Join( “, “, p.GetGenericArguments()[0].Select(c => c.GetType().Name).ToList());
*/
}
private string getListTypes(System.Reflection.PropertyInfo p, bool useQTTypes)
{
var a = p.GetType().GetGenericArguments().FirstOrDefault();
if(a != null) return a.Name;
else return useQTTypes?”QObject”:”object”;
}
void SaveOutput(string outputFileName)
{
string templateDirectory = Path.GetDirectoryName(Host.TemplateFile);
string outputFilePath = Path.Combine(templateDirectory, outputFileName);
File.WriteAllText(outputFilePath, this.GenerationEnvironment.ToString());
this.GenerationEnvironment.Remove(0, this.GenerationEnvironment.Length);
}
#>
Sisteminiz cok fazla log uretiyorsa:
https://github.com/cihant/Utils-Helpers/blob/master/AsyncFileAppender.cs
Ornek ayarlar icin:
https://github.com/cihant/Utils-Helpers/blob/master/README.md
Bir klasör içindeki dosyaların her birini ayrı ayrı sıkıştırma işlemini komut satırından 7z kullanarak yapabiliriz.
Dosyaların bulundu klasorde önce backup adıyla bir klasör oluşturun ve bir komut satırı açın.
for /r %X in (*.txt) do "C:\Program Files (x86)\7-Zip\7z.exe" a "%~dpXbackup\%~nxX.zip" "%X" -mx7
komutunu çalıştırın.
txt uzantılı tüm dosyalarınızı sıkıştırıp backup klasörüne atar.
Zaman zaman sunucular/bilgisayarlar arasinda dosya senkronizasyonu gerekiyor. WinSCP ile rahatlikla cozebilirsiniz konuyu.
Oncelikle script in calistirilacagi makinede winscp olmasi gerekiyor. Ben kurmak yerine portable versiyonunu tercih ettim. Portable versiyonunu bir klasore actiktan sonra asagidaki dosyalari olusturup ilgili parametreleri ayarladiktan sonra sync.bat dosyasini calistirdim. Batch file olusturmamin sebebi, herhangi bir sekilde baglanti kesilirse 30 sn. bekledikten sonra tekrar baglanmasini saglamak.
sync.bat
:loop
WinSCP.com/script=winscpscript.txt
timeout /t 30
goto loop
winscpscript.txt
option batch on
option confirm off
open ftpuser@example.com
option transfer binary
keepuptodate -filemask=”|*.bak; *.tmp” local_dir_full_path remote_dir_full_path
exit
VirtualBox uzerine Windows 8 – Windows 10 kurmaya calisirken asagidaki hatayi aliyorsaniz
Your PC needs to restart.
Please hold down the power button.
Error Code: 0x0000005D
Komut satirinda asagidaki komutu calistirmaniz yeterli:
C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata “Sanal Makine Adi” VBoxInternal/CPUM/CMPXCHG16B 1
Step 1. Create role
CREATE ROLE read_only_role
Step 2. Generate sql query for all tables:
SELECT 'GRANT SELECT ON "' + TABLE_SCHEMA + '"."' + TABLE_NAME + '" TO "read_only_role"' FROM information_schema.tables
Step 3: Copy generated sql query from “Results” panel
Step 4: Paste copied sql query and run
Enjoy
Recent Comments