w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Boot Debian with Android
You can use Script Manager (https://play.google.com/store/apps/details?id=os.tools.scriptmanager) to run script with the following contents at boot: #!/system/bin/sh deb s Use your own parameters to "deb" to launch whatever service you need. In this case I've started the ssh server.

Categories : Android

git - dual boot ubuntu and windows with separate data partition
I'm guessing there's an issue with line endings. You probably have commited your code with windows line endings and when you checked out the code in ubuntu git converted those to unix style line endings. Take a look at this page Dealing with line endings

Categories : Windows

What is changelog.Debian.gz file during debian packaging?
When packing in debian, inside your project directory there's a directory named debian, which is where we keep files regarding instructions of how to pack your software, as well as relations with other packages, etc. We can call it you package control files. Among them, there's one called changelog, which looks like this: mypackage (version-revision) unstable; urgency=low * Changelog messages -- Your Name <your@email.com> Mon, 13 Aug 2012 14:09:01 -0300 (...) This file is used by the packaging software (dpkg-buildpackage) to know the name and version of your package. It also has info like the mantainer, changelogs, etc. After you build the package and install it, this file will be located at /usr/share/doc/mypackage/changelog.Debian.gz compressed in gzip format. You can che

Categories : C++

Eclipse, Macos 10.8 and C++11
Rather than using g++, one can use clang++. I used the answers Error when compiling some simple c++ code, clang 3.1 can't see unique_ptr? and How to compile a C++0x code on Eclipse CDT on mac? as guides to come up with the following steps: change the compiler in the Project->Properties->C/C++ Build -> Settings -> Gcc C++ Compiler -> Command (change g++ to clang++). in Project->Properties->C/C++ Build -> Settings -> Gcc C++ Compiler -> Miscellaneous, append -std=c++11 -stdlib=libc++ to the flags. do the same as one for the linker under C/C++ Build -> Settings -> Gcc C++ Linker -> Command in Properties->C/C++ Build -> Settings -> Gcc C++ Linker -> Miscellaneous, add -stdlib=libc++ to the Linker flags. in Properties->C/C++ General -> Preprocessor Include Paths, Macros,etc -> Providers

Categories : Eclipse

How to change JRE for PhpStorm on MacOs
Quoting from the "Selecting the JDK version the IDE will run under" article in the Knowledge Base posted on March 27, 2013 Mac OS X At the moment all our products require Apple JDK 1.6 to be installed in order to run on Mac. JDK 1.7 from Oracle is not officially supported yet and has known problems that stop us from using it by default. Oracle JDK 1.7.0_40 has added support for Retina and works much better than previous versions on Mac. You are welcome to give it a try in case you have any problems with Apple JDK. To force running under JDK 1.7 edit /Applications/.app/Contents/Info.plist file, change JVMVersion from 1.6* to 1.7* : <key>JVMVersion</key> <string>1.7*</string> See this answer for the known problems with JDK 1.7. IDEA_JDK envir

Categories : Osx

Error with new gcc48 on macos
As suggested in the hints, I got rid of all the outdated -I/'s and set up the clang++ compiler as in Eclipse, Macos 10.8 and C++11 There were some clashes with between my code and the stl, but they were easy to hunt down from the console output.

Categories : Osx

Launching app in foreground with Qt under MacOS X
Use QProcess instead, but make sure that rather than using the path to the executable as the object to run, pass it to the open command as an argument. Something like this: - QString cmd = QString("open %1").arg(fullpath); // may need QUrl::fromLocalFile(fullpath) QProcess::startDetached(cmd); Without using 'open', it will also open up behind other applications. Note that you could also use the execute function, if you want to wait for the program to finish. Also, with the open command, I think you only need to pass the path to the app bundle, rather than full path to its executable in Contents/MacOS. Either should work.

Categories : Osx

pop-up message on macos programing
The class you're looking for is NSAlert. Information on this class can be found in its class reference here. And here is an example of its usage: NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@"Some awesome message text"]; [alert addButtonWithTitle:@"OK"]; [alert runModal];

Categories : Xcode

MacOS Terminal: how to use a seccond ssh key?
The way to use several ssh keys is to use a ~/.ssh/config Host serverKey1 Hostname server1 # or ip address of server1 User serverUser IdentityFile ~/.ssh/id_rsa Host serverKey2 Hostname server1 # or ip address of server1 User serverUser IdentityFile ~/.ssh/id_rsa.gitlab You then need to use an scp-syntax for your ssh url: git clone serverKey1:/my/repo git clone serverKey2:/my/repo serverKey1 and serverKey2 are entries in your ~/.ssh/config file in order to pass to ssh the right server, user and identify file (public and private keys) If those private keys are password-protected, you would still need to add them. You can see more at this atlassian help page: "Configure multiple SSH identities for GitBash, Mac OSX, & Linux".

Categories : Osx

How can I eject a CD from MacOS with Python?
Have you tried using a system call? Mac OS X Eg. Try this in your Terminal python -c 'import os; os.system("drutil tray open")' I just tried this on my MacBook Pro, let me know if this helps! Code: import os os.system("drutil tray open") Source: http://osxdaily.com/2007/03/26/quick-tip-eject-media-from-the-command-line/ Linux import os os.system("eject -t cdrom") Source: http://opentechlab.blogspot.com/2009/06/play-with-cdrom-in-linux.html Windows Using "cytpes" module: import ctypes, time # open the CD tray ctypes.windll.winmm.mciSendStringW("set cdaudio door open", None, 0, None) # try closing the tray ctypes.windll.winmm.mciSendStringW("set cdaudio door closed", None, 0, None) Source: http://www.daniweb.com/software-development/python/threads/72834/handling-cd-dri

Categories : Python

All uniform locations are "-1" on MacOS X
First thanks to @umlum for debug help.I managed to pin down the issue.It has to do with multiple OpenGL context.My program is plugin in Adobe AfterEffect(AE).AE during runtime spawns its own contexts at will.In my code each time I render OpenGL stuff I was enabling my context like this (MaxOS X): _context = CGLGetCurrentContext() ; CGLSetCurrentContext(_context); Calling the first line appeared to be grave mistake!What happens (probably) is that at the time I am trying to access the (supposedly mine) current context, it is already not my context but one of AE contexts which the program manages independently. _context = CGLGetCurrentContext() - I commented this line and it seems to be working now. I figured it all out by using glGetActiveUniform() Running it I found that m

Categories : Osx

SDL framework include on MacOS Qt
I don't know why it had previously worked, but let's note the following: Addition of the framework to the LIBS only takes care of linking, not compilation. You don't need the INCLUDEPATH, it's not necessary. You need to add the frameworks path for both the linker and the compiler: // The directory where some frameworks are installed. There must // exist SDL.framework as a subdirectory of that directory. // It's simply to avoid typing the path twice. // It's a user variable, not interpreted by qmake SDL = -F/Library/Frameworks // Let the C/C++ compiler know where to find the frameworks. // This is so that when you include <xyz/foo>, it'll be replaced // by $$SDL/xyz.framework/Headers/foo // $$var is replaced by qmake by the contents of var QMAKE_CFLAGS += $$SDL QMAKE_CXXFLAGS += $$

Categories : Qt

Printing a document on macos
you should search for "print apple event" when looking up the internet about your problem. As far as I understand you have to open the document in default application and send this application this event. This can be done with apple script or osascript in bash. regards, Robert

Categories : Osx

Need to move a limited # of files on MacOs
Your ls command is failing because the shell expands your file pattern to so many matching files that their names in aggregate exceed the limit of a single command line. But do not despair, because you can simply replace your use of ls with find: find unprocessed -name '*.pdf' | head -n 99 > flist

Categories : Linux

macos statically linking libstdc++ with g++ 4.7.2
I think exceptions are a bit broken with GCC on Mac OS X: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45486 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42159

Categories : Osx

MacOS dot file delete for MS-DOS devices
Here is my clumsy answer to the Question posted above. The main drawbacks are lack of much error handling or commenting, and the complexity level for non-technical users who need to learn about making shell scripts executable. If it could all be done in an AppleScript, it might be much more useful for a wide range of users baffled by the dotfile problem. Here's the Readme.txt file I've shared with the two scripts below: noMacOSdots.app -Introduction- Sometimes you may want to share files with an MS-DOS or Microsoft Windows user, or a non-Apple product such as a TV or media player. The problem is that all disk devices including USB sticks that have been attached to a MacOS computer or other Apple device will have files placed on them by MacOS that are invisible to MacOS u

Categories : Linux

How to use command "at" to execute shell in MacOS
Using at Your use of at appears correct. The command is executed at 2 minutes in the future. The command is not executed repeatedly so that is why the file is not touched at any time other than the time that now + 2 minutes evaluates to. If you are having problems getting at to run commands make sure you have the atrun Launch Control agent enabled and runing. See man atrun for more information about that. Better Scheduled Command Execution If you just want something executed when you log in then System Preferences > Users > Login Items is a good place. Rename your shell scripts with .command as their extension though if you do that. I'm not sure if it is required but it's what the OS seems to prefer for such scripts. Otherwise try cron to provide more control over job execution or use

Categories : Osx

Spawned process limit in MacOS X
Just to answer my own question here. This appears to be related to how MacOS X will dynamically expand a pipe from 16K to 32K to 64K (and so on). My basic workaround was to prevent the pipe from expanding. It appears that whenever you fill the pipe completely the OS will expand it. So, when the kqueue triggers that I can write into the pipe, and indicates that I have 16384 bytes available to write, I simply write 16384 - 1 bytes. Basically, whatever it tells me I have available, I write at most (available - 1) bytes. This prevents the pipe from expanding, and is preventing my code from encountering the condition where a write() to the pipe would block (even though the pipe is non-blocking).

Categories : Osx

Fail to install lxml in MacOS 10.8.4
Turn out xmlversion.h is not included in compilation path even though it is in PATH. Modify the C_INCLUDE_PATH env fix the error for me: C_INCLUDE_PATH=/usr/local/Cellar/libxml2/2.9.1/include/libxml2:$C_INCLUDE_PATH

Categories : Python

Java errors on MacOS 10.8.4 using MatLab2013a
A Java update last month ago pretty much destroyed most Java based programs on Macs (including Matlab for me). The update at this link fixed it for me. http://support.apple.com/kb/DL1572 (OS X 10.7, 10.8+)

Categories : Java

Advantages of CFNetwork over BSD sockets & GCD on iOS and MacOS?
If you don't need cellular or VPN-on-demand, then I can't really think of a reason you'd have to use CFNetwork, but a wise man once told me: "Use the highest level abstraction that gets the job done." CFNetwork is a higher level API than BSD sockets, and GCD dispatch_io. On the other hand, "Go with what ya know." If you're more comfortable working in the BSD sockets or GCD dispatch_io idioms, by all means, go forth and prosper.

Categories : Sockets

MacOS kernel, .kext and devices in /dev
To create a /dev entry a Kext would normally use IOxxxBSDClient (e.g. Serial, Media, etc). You can use ioreg -l, and look for it, like so: ... (this would be the parent class) ... | +-o IOSerialBSDClient <class IOSerialBSDClient, id 0x100000385, registered, matched, active, busy 0 (0 ms), retain 5> | | { | | "IOClass" = "IOSerialBSDClient" | | "CFBundleIdentifier" = "com.apple.iokit.IOSerialFamily" | | "IOProviderClass" = "IOSerialStreamSync" | | "IOTTYBaseName" = "Bluetooth-Serial-1" | | "IOSerialBSDClientType" = "IORS232SerialStream" | | "IOProbeScore" = 1000 | | "IOCalloutDevice" = "/dev/cu.Bluetooth-Serial-1" | | "IODialinDevice" = "/dev/tty.Bluetooth-Se

Categories : Osx

gcc on MacOS: Strange threading error
I found the solution: If I create the pthread with a larger stack it no longer crashes. I must say that the gdb-warning was very unclear and didn't seem to point at running out of stack space at all (a debugger should be able to detect this right?) Anyway, this code solves it: size_t stacksize = 0; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_getstacksize(&attr, &stacksize); pthread_attr_setstacksize(&attr, max(stacksize, 1024 * (1024 + 512)); pthread_t wxmt; pthread_create(&wxmt, &attr, mainThread, NULL); As it turns out, the default stack size for pthreads on a Mac is only 512 kB (on Linux it's 8 MB!) - this code increases it to 1.5 MB (1 would probably have sufficed, but since the errors that occur are really strange and I want to avoid havin

Categories : C++

Using c++11 in MacOS X and compiled Boost libraries conundrum
After a lot of research, I learned the following: Everything on MacOS X is built using stdlibc++ (including everything you install with homebrew -- which was my case) stdlibc++ that comes with gcc 4.2 does not implement many of the features of c++11. Examples are unordered_map, to_string, stoi, ... only libc++ does. libc++ is installed in MacOS by XCode. Conclusion: If you're using c++11, you have to use -stdlib=libc++. If you want to use boost or any other library, you have to recompile them with -stdlib=libc++ as well. So I downloaded boost sources from their website, and compiled using the following command line: bootstrap.sh && b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install If you use Homebrew, you can do it with and it will do the r

Categories : C++

cl-opengl under SLIME on MacOS crashing SBCL... bug?
It sounds like a thread support issue with SWANK The :fd-handler option changes the way SWANK communicates from the default, which is to use separate threads for communication, to using a loop approach (http://www.common-lisp.net/projects/slime/doc/html/Communication-style.html). There used to be quite a few complaints about using SBCL with threading on Mac OS, these were largely fixed from the look of it; maybe SWANK is having similar issues? I'm not 100% sure this is the sole cause of your problems, but it's the best explanation I could find.

Categories : Opengl

Change MacOS X mouse cursor Image
You can override -(void) resetCursorRects for a NSView subclass. Something like this: -(void) resetCursorRects { [super resetCursorRects]; // define cursor image and cursorRects NSRect move = NSMakeRect((reg1UserStart + REGION_RESIZE_SIZE),REGION_Y_LOCATION, (self.reg1UserLength - (REGION_RESIZE_SIZE*2)), REGION_HEIGHT); NSRect resizeStart = NSMakeRect(self.reg1UserStart, REGION_Y_LOCATION, REGION_RESIZE_SIZE, REGION_HEIGHT); NSRect resizeEnd = NSMakeRect(((self.reg1UserStart + self.reg1UserLength) - REGION_RESIZE_SIZE), REGION_Y_LOCATION, REGION_RESIZE_SIZE, REGION_HEIGHT); [self addCursorRect:move cursor:[NSCursor openHandCursor]]; [self addCursorRect:resizeStart cursor: [NSCursor resizeRightCursor]]; [self addCursorRect:resizeEnd cursor:[NSCursor res

Categories : Osx

Why is my Netbeans (7.3.1.) blurry with MacOS (10.x) and Retina display?
First you need Java SE 6 - the old one. You can download it here. Then you have to say your Netbeans to use the right java version like described here: go to /Applications/NetBeans/, click on the file Netbeans 7.3, open its context menu and select the option "Show Package Contents". In the package, navigate to /Contents/Resources/NetBeans/etc and edit the file netbeans.conf. Uncomment the variable netbeans_jdkhome and set its value like that: netbeans_jdkhome="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home". That's it. If you are developing in java you may now run into following error: Unsupported major.minor version 51.0 So keep reading this article: go to the menu Tools / Java Platforms to see a dialog as shown in the figure below.

Categories : Java

Uninstall postgresql on MacOs Lion Mountain
You don't have to remove the version Apple ships. I have been using MacPorts to run various custom builds of PostgreSQL on OSX. It takes a little effort to make it "just work" (PATH and PG environment variables) but I never had to remove Apple's copy of Postgres. I also keep a VM (VirtualBox) of a pretty minimal Debian install with Postgres running. I can do all my testing against the VM with a change of PG variables or JDBC URL. It's not as performant as running on the host but it is really clean for development.

Categories : Osx

Double value with comma on MacOS - system locale
Try setlocale(LC_ALL, 'C'); if that doesn't work, check the return value and the effect with echo setlocale(LC_ALL, 'C'), " "; echo 4*atan(1), " "; e. g.

Categories : PHP

Multiprocessing Qt app: How can I limit it to a single icon in the MacOS/X Dock?
Call QSystemTrayIcon::hide(). If that doesn't work, here are some things you can try: Use NSApplication's setActivationPolicy: method Way 1: [NSApp setActivationPolicy: NSApplicationActivationPolicyAccessory]; Way 2: [NSApp setActivationPolicy: NSApplicationActivationPolicyProhibited]; OR Use LSUIElement (LSUIElement=1). You can also put this in your pfile: <key>LSUIElement</key> <string>1</string> or make Qt do it for you. There is also some discussion about OSX menus on the Qt forums. In addition, you could try to use QFocusEvent to check when the app loses/gains focus and then update menus accordingly. Sources Start a GUI process in Mac OS X without dock icon How to create a helper application (LSUIElement) that also has a (removable) dock icon Ho

Categories : Osx

three.js dual viewports only one displays
Needed the following statement (in the javascript init function) to prevent renderer clearing its buffer after rendering the first viewport:- renderer.autoClear = false

Categories : Javascript

column pk dual varchars or int?
If you add a surrogate autoincrement integer column, you still need a unique index on the JobID, SubJobID columns. This is the natural primary key. It may not add much value except using more disk and memory to store the extra column. Saying that, if the composite (JobID, SubJobID) index is used in child tables as a foreign key, it can make more sense to use one. 10000 rows here could have 10 million child rows: then the varchar overhead matters. However, there is no truth in anything you read that says Thou shalt always have an identity/autoincrement primary key It is an implementation decision for performance depending on the design.

Categories : SQL

Function dual to std::move?
If you can manipulate T you could template the constructor. #include <iostream> using namespace std; class B { int x; public: B (int i) : x(i) { } B (B && b) : x(b.x) { cout << "B moved (" << x << ")" << endl; } B (B const & b) : x(b.x) { cout << "B copied (" << x << ")" << endl; } }; class A { B b; public: template<typename TB> A (TB && init_b) : b(std::forward<TB &&>(init_b)) { } }; B foo (void) { B x(3); return x; } int main (void) { A a1(foo()); B b1(4); A a2(b1); return 0; } Prints B moved (3) B copied (4) As far as I understand reference collapsing you should come out with a constructor A(B&) forwarding to the copy constructor of B and a A(B&&a

Categories : C++

Dual authentication mode
It is possible technically. The classic Mode doesn't requires much effort and can be implemented more or less easily. However when in integrated mode , some careful work is required to achieve the same. Check one post here which may be of help to you for getting started.

Categories : Asp Net

Dual divs on the same place
When I click on About me the "slide down div" will slide down and show the about me section. And when I click on contact the contact section will be showed...) How can I make this, and I'm a beginner when it comes to coding and hopefully this can be solved with a simple line of code... Actually, this can be done with a simple line of code! Change your "About me" link to this: <a href="#AboutMe">About Me</a> And, create a div like this: <div id="AboutMe">This is about me!</div> When you click the link, your browser will scroll to the AboutMe div. JsFiddle: http://jsfiddle.net/NmrbP/11/

Categories : Javascript

MacOS, how to delete unused service item in Keyboard Shortcuts
Look in ~/Library/Services or /Library/Services In the Finder, ~/Library is now an invisible folder by default in Mountain Lion. Of course, people can google for "Mac show hidden files" and find a command to enter into the command-line to make all files and folders visible. As a programmer, I like being able to see everything. Unix Command: defaults write com.apple.Finder AppleShowAllFiles TRUE Reference: http://osxdaily.com/2009/02/25/show-hidden-files-in-os-x/

Categories : Osx

Get selected values in a dual listbox PHP
This is the weird code: function listbox_selectall(listID,isSelect) { var listbox=document.getElementById(listID); for(var count=0;count<listbox.options.length;count++) { istbox.options[count].selected=isSelect;//<-- ? } } Maybe, you wanted to say: listbox.options[count].selected=isSelect; You said, that only 1 value from "destination" is submitted to PHP. To allow multiple values to be submitted, add [] to the names of the <select>-s: <SELECT id="s" size="10" name="source[]" multiple> <SELECT id="d" size="10" name="destination[]" multiple> Also, there is no need to use name attribute for options. You don't use it anywhere.

Categories : PHP

Best Practice for Dual Layouts in Rails 3
It seems to me an admin might be doing different things with a user than an end user would be doing so different controllers may not be completely unDRY. However, if they are completely the same and you just want to have a different layout, then you can just set your layout based on the current user. Something like this would work: layout :determine_layout def determine_layout return 'admin' if current_user && current_user.admin? 'application' end

Categories : Ruby On Rails

Dual play frameworks on the same system
There is answer for similar problem dedicated for mac/unix. In Win you can create symlinks pointing to the proper version of Play directly in the instance folder

Categories : Java

Has anyone had success with ADT on a (dual-booted) Chromebook?
Are you sure you installed the driver correctly? If so, try switching Nexus 7's usb mode from storage mode to pics transfer??/view?? mode(forgot the exact name here). Hopefully it does help.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.