Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
 Gem I wrote not executable on linux, but seems to work on windows I replaced spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } with spec.executables = ["getDartPortalAndInitBuild"] And now it functions. I am not sure why the rake install worked correctly, but there it is. Categories : Linux Windows executable with linux shell script inside A Linux shell script should start with #!. A Linux ELF executable should start with x7FELF. If a Windows executable cannot start with these bytes your dream is not possible. I believe that PE (the binary format of Windows executable) cannot start with these (but I am not sure). Hence your universal installer single file is an impossible dream. On Linux, you could consider playing with binfmt_misc or shar. Read Levine's Linkers and Loaders book, and elf(5) & execve(2) Linux man pages. Categories : Linux Why Linux kernel memory subsystem is named slab A slab, in common usage, refers to a big flat block of solid material. By analogy, a slab allocator manages large, contiguous chunks of memory, dividing them into smaller pieces for allocation. Categories : Linux Unknown file permissions for executable bit - Linux What's unknown about them? From the ls man page: The next three fields are three characters each: owner permissions, group permissions, and other permissions. Each field has three character positions: 1. If r, the file is readable; if -, it is not readable. 2. If w, the file is writable; if -, it is not writable. 3. The first of the following that applies: S If in the owner permissions, the file is not exe- cutable and set-user-ID mode is set. If in the group permissions, the file is not executable and set-group-ID mode is set. s If in the owner permissions, the file is exe- cutable and set-user-ID mode is set. If in the Categories : Linux What are the alternatives to Windows security subsystem in .NET winforms applications Once I worked in a WinForm application which was supposed to run on intranet, each user would log into the application....and this application was using centralized web service to authentication and other CRUD operation....The service was mediator between WinForm app and DB. The approach given in code project article which u mentioned in question...is also fine. Anyway I also got curious here....As you said u are about to start development in .Net 4.0 Winform.....I would like to understand why you made this choice over WPF? What reasons u got to favor WinForm in your scenario ? Categories : Sql Server VS2010 uses a console window in a Qt application (/SUBSYSTEM:WINDOWS) So after a cup of coffee I came to the following solution. Debug and Release build don't open a background console. Take a look at the WIN32 tag and the LINK_FLAG for Debug/Release/RelWithDebugInfo: if(MSVC) add_executable(client WIN32 ${SRC_CLIENT}${HDR_UI_CLIENT} ${HDR_RSC_CLIENT}) target_link_libraries(client server${QT_QTMAIN_LIBRARY} ${QT_QTGUI_LIBRARY}${QT_QTCORE_LIBRARY}) set_target_properties(client PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") set_target_properties(client PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS") set_target_properties(client PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") set_target_properties(client PROPERTIES RELWITHDEBINFO "/SUBSYSTEM:WINDOWS") set_target_properties(client PROPERTIES MINSIZEREL "/SUBSYSTEM:WINDOWS") els Categories : Visual Studio 2010 Exec(Linux). How it functions internally? Linux executable attributes(rlimit) The RLIMIT_CORE is used to place a limit on the amount of info that coredump is allowed to produce, before it is aborted. Once this limit is hit, no more info is logged and the message Aborting Core is logged to the console. From the man page of core : A process can set its soft RLIMIT_CORE resource limit to place an upper limit on the size of the core dump file that will be produced if it receives a "core dump" signal. Use setrlimit() to configure RLIMIT_CORE to a larger value to obtain complete coredumps. The most common format of executables/shared-objects is ELF. On Linux, the dynamic loading and linking of these shared-objects is performed by ld.so ld.so is loaded in the address space of a newly created process (by exec in this case) and executed first. This is possible as Categories : Android How to use a relative executable to build a file on windows? The syntax is wrong, you should create a .bat file receiving two parameters from sublime and do all the processing in the .bat file. source for F:fooSublimeText2_x64DataPackagesBuild SystemsMy Python.sublime-build { "working_dir": "path\to\your\batch\file", "cmd": ["build-py.bat", "$file_path", "$file"] } source for batch file @echo off setupenv cd %1 python -u %2 Categories : Python Windows Server 2008 R2: Compiler executable file csc.exe cannot be found Please, send complete stack trace, just like this below: "[InvalidOperationException: Compiler executable file csc.exe cannot be found.] System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary2 provOptions, String compilerExecutable) +8675071 Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames) +739 Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources) +3293761 Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources) +64 HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.Compile(String fileName, String[] sources, IEnumerable1 assembliesToReference) +1252 Hibernating Categories : Asp Net Apache / XAMPP for Windows incorrectly treats file as executable In xamppapacheconfhttpd.conf, there should be a line like: AddHandler cgi-script .cgi .pl .asp Simply comment out this line like so: #AddHandler cgi-script .cgi .pl .asp and restart Apache. If you want to keep the .cgi and .asp handlers, just delete .pl from the line. Perl will actually still work even if you do this. Categories : Javascript Linux/Unix - Setting default file/folder permissions using ACL, executable permission not setting? It's not setting the execute bit because files are only created with execute permission if the application explicitly requests it. Since it makes no sense to make an .html file executable, whatever program created it did not request execute permission to be added, so it has no execute permission. Consequently, execute permission from the default ACL effectively only applies to directories, not to files. As for why the default group is not set to ftp, this is more subtle. The default ACL is just that -- an ACL. It's not a default group ownership. As such it shows up not in ls but in getfacl: # mkdir public # setfacl -R -m u::rwx,g:ftp:rwx,d:g:ftp:rwx,o::rx public/ # getfacl public # file: public # owner: root # group: root user::rwx group::r-x group:ftp:rwx mask::rwx other::r-x defa Categories : Linux Generate Linux executable on QtCreator I've found a solution a long time ago so I'm posting it. Maybe it could be useful. I've used Cygwin and Crosstools. This makes me able to cross-compile for Linux while being under Windows. Categories : Linux Eclipse - Common Preference settings file(.epf) for Linux and Windows No, because JAVA_HOME could point to, well, anything--1.3, 1.7, who knows? You want complete and conscious control over what's in a project's Java Build Path and complete isolation from the OS if you want your projects to be portable. It's ok to have the preferences refer to things unique to the machine, you can change those on other machines, it's the settings in the projects that you don't want tied a specific machine. Start by setting their Java Build Path to use an Execution Environment to find its JRE. Categories : Eclipse Loading a Linux formatted text file using a C++ windows application This has nothing to do with Linux versus Windows. You can use >> to perform formatted input of whitespace-separated fields: string s; while (ss >> s) record.push_back(s); To skip whitespace explicitly, use std::ws; to disable whitespace skipping, use std::noskipws. Categories : C++ BufferedRead reading binary file differently on Linux vs Windows The javadoc for BufferedReader says: Reads text from a character-input stream Text! Not binary! Use, for instance, a BufferedInputStream instead. Or go the full way to java.nio and use a FileChannel and map your file in memory (and have a look at what ByteBuffer has to offer -- for instance you have a .asCharBuffer() to read chars and you can alter endianness as well) Categories : Java Linux Redhat Command Execution via executable files Yes. Use BASH, the shell common to most Linux distributions. You will find the "Advanced BASH scripting Guide" useful. Categories : Linux Get linux executable load address (__builtin_return_address and addr2line) You can use the dl_iterate_phdr() on Linux to determine the load address of each dynamically loaded object: #define _GNU_SOURCE #include #include int callback(struct dl_phdr_info *info, size_t size, void *data) { printf("%s @ %#lx ", info->dlpi_name, (unsigned long)info->dlpi_addr); return 0; } int main() { dl_iterate_phdr(&callback, NULL); return 0; } Categories : C Linux desktop file Exec doesn't used the user session this question is similar to .bashrc not read when shell script is invoked from desktop shortcut either initialize your environment in ~/.bash_profile instead of ~/.bashrc OR make your *.desktop file call a wrapper that initializes your environment - e.g. by sourcing ~/.bashrc (or whatever script is responsible now). the second solution is more specific (does not effect all other unrelated launches of your shell) in should thus be preferred. Categories : Python How to force a Linux C Executable to access the disk for fetching data You can flush the memory cache by doing this (as root): sync echo 3 > /proc/sys/vm/drop_caches The various values drop_caches accepts are: To free pagecache: echo 1 > /proc/sys/vm/drop_caches To free dentries and inodes: echo 2 > /proc/sys/vm/drop_caches To free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches You'll need 3 to drop everything. Categories : C Access denied for user 'apache'@'localhost' (using password: YES) in linux when csv file uploading Either the user apache@localhost doesn't exist on your MySQL server, or the password you are using is wrong. Either way, you need to set up the security on your Mysql server properly. There's a tutorial on creating MySQL users here Categories : Mysql Write C++ on Windows but use Linux System calls through a Linux emulator You've already tagged your question with Cygwin. That seems like the best solution for what you want. Cygwin is basically a collection of programs which emulate a GNU/LInux environment through the use of a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality. Here's the link to the documentation for its API Edit: Most of the Cygwin source code that I've looked at is written in C++ and makes system calls using MS Windows API to do provide the *nix emulation. The source is well written and very readable (even to to a non-C++ programmer such as myself). I think using Cygwin would be a good transition from programming on Windows to a GNU/Linux environment. Categories : C++ Windows Lua to executable srlua is distributed as source only, so you have to compile it first (see this answer for suggestions on getting a free C compiler). BTW, Cygwin is not necessary at all. The aforementioned link will lead you to instructions to install TDM-GCC, a Windows port of GCC compiler that will create executable files which only depend on Windows default system libraries. Once you have a C compiler in place and you have compiled srlua, you will have two executable files glue.exe and srlua.exe. This latter is only a stub, used by srlua.exe to generate the final executable by joining it with your Lua script. Assuming your script is myscript.lua and you want to create an executable named myexe.exe you must invoke glue.exe from the command line as follows: glue.exe srlua.exe myscript.lua myexe.exe Categories : C How to run C++ executable in Windows PE? First of all, since the question is tagged "c++" and you mention C++/CLI several times, I assume that "Visual Basic 2010" is a typo for "Visual Studio 2010". But either way, whether you've written the application in Visual Basic (VB.NET) or C++/CLI, the problem is exactly the same. My guess is the executable can't run without certain dependencies that aren't loaded at this environment, but I need it to work in a PE. That's exactly correct. You've written an application that targets the .NET Framework. Somewhat like Java applications requiring a JVM, .NET applications require that the .NET Framework be installed in order to run (or a compatible alternative implementation, like Mono). Unfortunately, Windows PE does not support the .NET Framework. Note that it is irrelevant whether you Categories : C++ Location of Git Executable for Jenkins on Windows This is not a problem with git not being found but that putty has not yet been told that it can trust the ssh-key presented by the repository sshd server. Run a manual git command first on the Jenkins server, so you can say yes to accept the host key, and then try again. Categories : Windows Ant can't find a executable in the Windows path You want to find where Doxygen is currently installed on your system. Then make a property with that value, so it can be overridden by people that installed doxygen somewhere else. Categories : Ant What actually happens when Windows installs something? Why not run the executable standalone? This depends on how you have designed and planned your deployment: Let us say you have planned to have all your application dependencies in the same folder, and you have no dependencies on external assemblies, then you can develop your app and all its dependencies and put them in same folder. Now you can distrbute same folder, assuming you do not want to check for any pre-condition for running your app, now your app does not really require any installer. Also make sure your app does not depend on any registry entries etc. However most apps can not be like that, they would like to make sure the system is right, it has right version of windows, right dependencies are pre installed, and there are certain locations only where the app needs to be installed and only there it can work. Or the ap Categories : Windows Installer for Python Executable on Windows I developed a Python/GTK/OpenGL based desktop application in the past and in order create the executable and an installer I've used PyInstaller + NSIS. NSIS is what you're asking for: it's quite flexible, you may want to give a try. Categories : Python How to make c program as executable in windows 7 You need to link with the runtime library which contains the startup function and all other standard functions. Why not skip the preprocessor and assembler step, and go directly to object file? And also use gcc when linking which will add the needed extra libraries automatically? Or for simple single-source-file programs go directly to executable? Either $gcc hello.c -c -o hello.o$ gcc hello.o -o hello Or $gcc hello.c -o hello Categories : C cannot write file after user is logon on windows The task scheduler runs as a specific system user, not as the user that just logged on. This means your code doesn't have the permission to change the user's files. While you can specify the user which task scheduler should use, you can't say "current user". You have two options: Put the file into the Autostart folder where it will be executed by the login code as the user. Change the permissions of the file that you intend to write and give the scheduler user write permission. Categories : Python Set file owner to non-existing user/SID in windows Turns out you need SE_RESTORE_NAME token privilege. You can adjust your process token with the following: BOOL TakeSecurityPriv(LPCTSTR szPriv){ BOOL bReturn = FALSE; HANDLE hProcToken = (HANDLE)0; if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&hProcToken)){ TOKEN_PRIVILEGES tpTokPriv; if (LookupPrivilegeValue(NULL,szPriv,&tpTokPriv.Privileges[0].Luid)){ tpTokPriv.PrivilegeCount = 1; tpTokPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; if (AdjustTokenPrivileges(hProcToken,FALSE,&tpTokPriv,0,NULL,0)){ bReturn = TRUE; } } } return bReturn; } Then you can add the following to the beginning of main in my example: if (Tak Categories : C++ Cakephp case sensitive controller name causing trouble in my linux hosting Windows filesystem is case insensitive while linux and mac are case sensitive. So if you are developing on windows then deploy to linux, if you don't have the correct case for your filenames you will get errors. Categories : PHP Windows batch script containing binary executable Converting a binary file into Base64 is easy enough, as .Net contains the handy Convert class. Like so, # Set up paths$binSrcPath = "C:Program Files (x86)Notepad++ otepad++.exe" $b64DstPath = "C: emp otepad++.exe.b64" # Read the source binary as byte array$binData = Get-Content -Path $binSrcPath -Encoding Byte # Convert the bytes into a base64 encoded form$base64 = [System.Convert]::ToBase64String($binData) # Save the encoded data set-content$b64DstPath $base64 Now that the encoded binary is saved, let's convert it again to binary. Like so, # Paths first$b64DstPath = "C: emp otepad++.exe.b64" $binDstPath = "C: emp otepad++.exe" # Read the encoded data$dataToBase64 = get-content $b64DstPath # Decode the base64 encoding$decodedData = [System.Convert]::FromBase64String($base6 Categories : Windows Timeout for user decision in windows batch file You can try the choice /T:c,nn command, if you are on Vista or later: Waits for the user to choose one of a set of choices. CHOICE [ /C[:]choices ] [ /N ] [ /S ] [ /T[:]c,nn ] text /C:choices Specifies allowable keys. Default for English versions is YN /N Do not display choices an ? at end of prompt string. /S or /CS Treat choice keys as case sensitive. Up to (and including) the Resource Kit versions, use /S. In Windows 7 use /CS. /T:c,nn Default choice to c after nn seconds. text Prompt string to display. Categories : Windows delphi, windows impersonation as user to copy a file The first suggestion is that you do not have permissions to access the network directory, or the file in question. These could be access permissions or copy permissions (or both). Check that you have permissions to both of these. Categories : Windows How to check if a Windows executable is running in a Session 0 process? GetCurrentProcessId and ProcessIdToSessionId are your friends. Categories : C++ How can I compile a python 3.3 program (which uses pygame) into a Windows executable? I found this, it might not work: 3to2 1.0 Then you can use py2exe on the code. Categories : Python wkhtmltopdf binary is not found or not executable - Windows & CakePHP I managed to solve this by including the full path to the wkhtmltopdf binary Configure::write( 'CakePdf', array( 'engine' => 'CakePdf.WkHtmlToPdf', 'options' => array( 'print-media-type' => false, 'outline' => true, 'dpi' => 96 ), 'margin' => array( 'bottom' => 15, 'left' => 50, 'right' => 30, 'top' => 45 ), 'binary' => 'C:' . DS . 'wkhtmltopdf' . DS . 'wkhtmltopdf.exe', 'orientation' => 'landscape', 'download' => false ) ); Categories : PHP Convert VBA Script to run as VBS file windows or some type of script on a linux box At Ken's proding, I was able to plod through my error with google's help. Thanks Ken. Here is my reworked code that works as a vbs script Option Explicit Public Sub IE_Check() Dim i Dim g Dim x Dim IE Dim objElement Dim objElement2 Dim Colobj1 Dim Colobj2 Dim Colobj3 Dim FindText1 Dim FindText2 Dim FindText3 Dim TTime Dim dteWait Dim fso Set fso = CreateObject("Scripting.FileSystemObject") ' Declare a TextStream. Dim stream ' Create a TextStream. Set stream = fso.OpenTextFile("C:log.txt", 8, True) TTime = Time Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate "http://yahoo.com" While IE.ReadyState < 4 FindText1 = 0 Wend FindText1 = InStr(1, IE.Document.body.innerhtml, "Internet Explorer cannot display the webpage") If FindText1 Categories : Vba Ruby Ocra executable fatal error on different windows version I had same problem. Build application with Ruby-x64. When I build application with ruby-x32, problem was gone. I think OCRA take current Ruby and include to aplication package. Windows XP dosen't support x64 app. Categories : Ruby How to copy only file permissions and user:group from one machine and apply them on another machine in linux? How about this? #!/bin/bash user="user" host="remote_host" while read file do permission=$(stat -c %a $file) # retrieve permission owner=$(stat -c %U $file) # retrieve owner group=$(stat -c %G $file) # retrieve group # just for debugging echo "$file@local: p = $permission, o =$owner, g = $group" # copy the permission ssh$user@$host "chmod$permission $file" < /dev/null # copy both owner and group ssh$user@$host "chown$owner:$group$file" < /dev/null done < list.txt I am assuming that the list of the files is saved in "list.txt". Moreover you should set the variables "user" and "host" accordingly to your setup. I would suggest to configure ssh to have "automatic login". Otherwise you should insert the password twice per loop. Here Categories : Shell