w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Mac Mountain Lion / Macports / Python27: Installed, activated but ImportError
I was having the same problem. What finally worked for me was simply to uninstall and reinstall python through MacPorts. > sudo port uninstall python27 > sudo port install python27 > sudo port select --set python python27 This installed Python 2.7.5 (default, Aug 1 2013, 01:01:17). After uninstalling and reinstalling, make sure to log out of your shell and open new shells. Old shells will still see the same problem.

Categories : Python

macports apache2 install missing pdo drivers
Here is what worked for me: sudo port install php5-sqlite sudo port install php5 +apache2 +sqlite The second line here didn't seem to do anything, but you never know. After restarting I noticed I didn't have imagemagick, which I thought I already had, so sudo port install php5-imagick Now restarting apache2 the "macports" way: sudo port unload apache2 sudo port load apache2 And looking at phpinfo, I have sqlite2 and sqlite (which, confusingly, is sqlite3) drivers enabled for pdo.

Categories : Sqlite

OpenCV Install for Pydev in Eclipse using Macports on OsX Mavericks
I was struggling with this problem today. Here are the steps I followed using macports Install macports and xcode Follow Sam Khans post listed here to install python, relink it in your terminal and then install OpenCV: http://samkhan13.wordpress.com/2012/06/18/using-opencv-with-python-on-your-mac-os-x/ NOTE: At this point you should be able to enter a terminal session and type "python" and then "import cv2" successfully. Open eclipse and click on "eclipse" then "preferences" in the bar menu at the top of the program. In the pop-up that appears click the arrow next to "pydev" to expand the menu then click "Interpreter - Python" Press the "new" button on the right of the window In the pop-up type in the name for this interpreter (I did python27 for my python2.7 version) Next link the p

Categories : Opencv

Getting PyGame to import in Python interpreter after MacPorts install
Ok, so I figured out the problem, and it was my path. I went in and removed the anaconda package with: rm -r ~/anaconda Then, I used macports to basically reinstall the whole scipy stack with: sudo port install py27-wxpython py27-numpy py27-matplotlib py27-scipy py27-ipython This took some time to compile, and when it was finished I went in on the command line and used: sudo port select --set python python27 After that I opened my interpreter and imported all my scientific computing needs without a problem and pygame, which I had installed earlier with macports. I hope this helps someone else in the future. ALSO: when you remove packages like anaconda, make sure and close your terminal and then re-open it or it will still try to use the dependancies of anaconda, which are no l

Categories : Python

How can I install pybrain on Mac OS X Mountain Lion?
Try using the Python package manager pip with the correct permissions: pip install pybrain or clone the repo and build the package git clone git://github.com/pybrain/pybrain.git python setup.py install

Categories : Python

How to install ZendFramework and clt from svn on Mac OS X Lion with the xampp running?
If you are starting a new project, I recommend using Zend Framework 2 not 1. Here are 2 useful links from the ZF2 quick start guide that will help: ZF2 skeleton applicatoin ZF2 tool Try that & let us know how you get on...

Categories : PHP

What version of scipy and matplotlib should I install on Mac Mountain Lion?
It's hard to be 100% sure without a little more information, but I'm 99% sure… Your problem is that you're installing all this stuff for the MacPorts Python, but then trying to run Apple's Python, which doesn't have any of it installed. (Part of the reason I suspect this is that Apple's Python is version 2.7.2, while MacPorts has been on 2.7.5 for a long time now. The other part of the reason is that this is exactly the same kind of problem people have when they install two different Python X.Y versions without realizing that's what they're doing.) If you want to use the MacPorts Python, run /opt/local/bin/python instead of just python. If you know what you're doing, you can change your PATH, or create a symlink, etc., but I suspect you will just confuse yourself further. I person

Categories : Python

Cabal fails to install Idris language on OSX Lion
The first error indicates you should install the LLVM development packages of your distribution (not through cabal) and the second indicates you should install the development package for the GCC libffi library. What Linux distribution are you using? Or are you on Windows/Mac?

Categories : Haskell

Unexpected dylib, la, and pc files with fresh mountain lion install
Do you, by any chance, have TrueCrypt or OSXFuse installed? Because your problem looks like this or this. The TrueCrypt problem is fixed by this script, and if you have OSXFuse, you can just remove it and use homebrew's version instead.

Categories : Osx

scrollbar issue after upgrade to mountain lion vs fresh install
Have you checked the system preference? there you can select how the scrolling should behave visually like Automatically based on mouse or trackpad when scrolling always The first entry should give you your desired behaviour. -Anton

Categories : CSS

Mountain Lion, failed to install ruby on rails [ERROR: Failed to build gem native extension.]
Either download and install 'command line tools' from apples developer download page: https://developer.apple.com/downloads/ or just install xcode through App Store.. and try again. And as mentioned by someone else in the comments, rbenv is a much better and easier way to manage your rubies on Mac OS X, so consider making the switch. to remove rvm from your system do: rvm implode and then restart your shell to make sure you are installing rbenv in a clean environment. for detailed instructions on how to install a decent rails dev environment on mac take a look at the instructions i put together in a blog post here: http://blog.parsalabs.com/blog/2013/08/27/setting-up-a-ruby-on-rails-4-development-environment-on-a-clean-mac-os-x-installation/ they worked for me, hope you will find the

Categories : Ruby On Rails

How to write an Android application to do sysfs read/write.?
Firstly, make sure you have the permission to that sysfs node(Usually you don't, if you are developing a user app). Secondly, I would say usually you don't have to talk to sysfs node directly from Android app.Below app there are Android Framework and HAL levels that did all the abstraction for you. Since not sure about what you are going to do, here is an example I fetched from Android LightsService which directly talk to sysfs node, which might be helpful to you. 216 private static final String FLASHLIGHT_FILE = "/sys/class/leds/spotlight/brightness"; ... 236 try { 237 FileOutputStream fos = new FileOutputStream(FLASHLIGHT_FILE); 238 byte[] bytes = new byte[2]; 239 bytes[0] = (byte)(on ? '1' : '0'); 240 bytes[1]

Categories : Android

How to get to last NTFS MFT record?
The MFT location isn't always fixed on the volume. You should get the starting MFT offset from the boot sector (sector 0 of the volume, you can find the structure online). The first file in the MFT is the "$MFT" file which is the file record for the entire MFT itself. You can parse the attributes of this file like any other file and get it's data run list. When you know the size of each fragment in clusters, parse the last cluster for each 1024 byte record of the last fragment (although I believe a fragmented MFT is rare). The last record in the MFT is the last record in that particular cluster marked "FILE0", if you encounter a null magic number that would be 1024 bytes too far. Or you can just get the file size from it's attributes and calculate the offset to the end of the MFT based o

Categories : Windows

NTFS vs. File Share
Short answer: No. In Windows each file and directory has an ACL controlling access to it. Each file share also has an ACL controlling access to the share. When you access a remote file through a share you are doing so using the credentials used to login to the local computer. (You can connect using different credentials by entering a username/password when connecting). The remote computer tests the supplied credentials against the ACL on the share. Once you are past that, then every file you attempt to access on the remote machine through this connection will be checked using your credentials against the ACL on the file and the share. This allows a file share to offer more restricted access to some files than if the same user were attempt to access them locally. (So you could share file

Categories : Misc

NTFS Journal USN_REASON_HARD_LINK_CHANGE event
As always with the USN, I expect you'll need to go through a bit of trial and error to get it to work right. These observations/guesses may, I hope, be helpful: When the last hard link to a file is deleted, the file is deleted; so if the last hard link has been removed you should see USN_REASON_FILE_DELETE instead of USN_REASON_HARD_LINK_CHANGE. I believe that each reference number refers to a file (or directory, but NTFS doesn't support multiple hard links to directories AFAIK) rather than to a hard link. So immediately after the event is recorded, at least, the file reference number should still be valid, and point to another name for the file. If the file still exists, you can look it up by reference number and use FindFirstFileNameW and friends to find the current links. Comparin

Categories : Windows

NTFS - file record size
It's not actually that much of a waste. You should try to look at what happens when the number of attributes stored in the file record exceeds 1 KB. (by adding additional file names, streams, etc.) It is not clear (to me at least) for different versions of NTFS if the additional attributes are stored in the data section of the volume or in another File Record. In previous versions of NTFS the size of a MFT File Record was equal to the size of a cluster (generally 4KB) which was a waste of space since sometimes all the attributes would take less than 1 KB of space. Since NT 5.0 (I may be wrong), after some research, Microsoft decided that all MFT File Records should be 1KB. So, one reason for storing that number may be backwards compatibility. Imagine you found an old hard drive which stil

Categories : File

What is the difference between HDFS and NTFS and FAT32?
... Because NTFS and FAT aren't Distributed. The advantage of HDFS is that it is. See the HDFS Introduction.

Categories : Hadoop

Where to write bower code to install Alertify?
Why not just use "Inserting into HTML" method written on that site? Include JS <!-- ideally at the bottom of the page --> <!-- also works in the <head> --> <script src="PATH_TO_FILE/alertify.min.js"></script> Include CSS <!-- include the core styles --> <link rel="stylesheet" href="PATH_TO_FILE/alertify.css" /> <!-- include a theme, can be included into the core instead of 2 separate files --> <link rel="stylesheet" href="PATH_TO_FILE/alertify.default.css" /> If you want to use Bower, you should use node.js. You can find info about Bower in its github page.

Categories : Jquery

Viewing Ciphertext of Encrypted File on NTFS (EFS)
The way you open an encrypted file in order to read its raw encrypted contents (e.g. for a backup/restore application) is to use the: OpenEncryptedFileRaw, ReadEncryptedFileRaw, WriteEncryptedFileRaw, and CloseEncryptedFileRaw api functions. Writing the code on the fly, in a hypothetical hybrid language: void ExportEncryptedFileToStream(String filename, Stream targetStream) { Pointer context; res = OpenEncryptedFileRaw("C:UsersIanwallet.dat", 0, ref context); if (res <> ERROR_SUCCESS) RaiseWin32Error(res); try { res = ReadEncryptedFileRaw(exportCallback, null, context); if (res != ERROR_SUCCESS) RaiseWin32Error(res); } finally { CloseEncryptedFileRaw(context) } } function ExportCallback(pbData: PBYTE, pvCallbackCo

Categories : Windows

How does NTFS handle the conflict of short file names?
NTFS won't create two short names like that. The first will be THISIS~1.txt and the second will be THISIS~2.txt. For example, open a command prompt and from the root of C: drive type C:>dir prog* /x /ad<Enter> On a Windows 7 64-bit system you will see output similar to this 03/28/2013 12:24 PM <DIR> PROGRA~1 Program Files 07/31/2013 11:09 AM <DIR> PROGRA~2 Program Files (x86) 12/10/2012 05:30 PM <DIR> PROGRA~3 ProgramData

Categories : Windows

access to ntfs stream for a very long filename fails
As the very helpful page on CreateFile says referring to the lpFileName parameter which specifies the filename: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "?" to the path. Since you are contemplating BackupRead obviously you are wanting to access this stream programatically. If so, test things programatically. Trying all these operations from the command prompt is a crap-shoot and will not establish anything more than the ability to perform such operations from the command prompt. With that in mind, let's try this simple program - boilerplate code removed: #include "stdafx.h" int APIENTRY _tWinMain(HINSTANCE, HINSTAN

Categories : Windows

NTFS sparse file data runs ($UsnJrnl)
No, it means that $UsnJrnl occupies 2576 clusters on disk. Sparse clusters don't occupy any space on disk, if you'd try to read sparse cluster, e.g. cluster 10 in your example, NTFS just returns zeros. Generally, you can't determine start and end cluster of the file, since files can be fragmented - your example says that first 1408 clusters are not allocated on disk at all, then 128 clusters of that file occupy disk clusters 510119 - 510247, then 2448 clusters of the file occupy disk clusters 256 - 2704; so in this case you can't say that file begins by cluster X (on disk) and ends by cluster Y (on disk) - it's possible only if file is not fragmented (when it uses only one cluster run).

Categories : Windows

How to make Gradle stop trying to chmod MANIFEST.MF on an NTFS drive
Gradle is trying to set default permissions for that file, and I can't see a way to stop it from doing that. (You could make it set different permissions, but I guess that won't help.) Under Windows/NTFS this normally works just fine, so it might be a problem with you Linux NTFS driver or configuration.

Categories : Linux

Trying to install Python - excel read package
The reason write package worked fine because there are no version checking code in it. So its essential that you have to install python v2.7, because it seems write package use <2.6 code and read package use >2.6 code. To tie both end , you need only v2.7. So uninstall every python installation ( old and new ) and install v2.7.

Categories : Python

Cannot uninstall MacPorts
This command only uninstalls the (installed) ports, not the MacPorts infrastructure itself. There are instructions for removing Macports here, along with other basics.

Categories : Misc

Create a symbolic link (or other NTFS reparse point) in Windows Driver
There isn't direct API to create reparse points. You need to use ZwFsControlFileZwFsControlFile() to send FSCTL_SET_REPARSE_POINT ioctl with appropriate input buffers and parameters. Don't have example though!

Categories : Windows

Macports selfupdate fails
The version of the Tcl library (specifically the header files, but even so) and the Thread extension library (where the errors occurred, formally) that the code is trying to build are incompatible with each other. The issue is that Thread 2.6 doesn't work with later than Tcl 8.4 without changes: in particular, it requires the command-line option -DUSE_INTERP_ERRORLINE to be passed to the compiler (typically as part of the CFLAGS make variable) to cause a piece of now-deprecated API to be exposed. The other warnings are just that: warnings. (Some broken old compilers have problems with handling const right, so there's still rather too much code that gets it wrong.) I've no idea why you're having a problem though; MacPorts works for me just fine on 10.8.4…

Categories : Xcode

Error Attempting to read from the source install database C:WindowsInstaller*.msi
That error means the MSI (or some previous version with the same ProductCode) was installed on the machine but the cache was destroyed. I've seen this when people msizap (or use the poorly named FixIt tool from Microsoft) to try and yank an MSI off the machine. If msizap was used, the safest thing for testing purposes is to format the machine and start over. If formatting the machine is not possible (or msizap was not used) then try recache/reinstalling the new MSI to try and get the source cache patched up. You can do this using the command-line: msiexec /i new.msi /l*v log.txt That will cause the new.msi to be cached where the old MSI should have been then repair the machine trying to get it into a consistent state.

Categories : Dotnet

How to use a different mirror of macports rather than the offical mirrors?
Open /opt/local/etc/macports/archive_sites.conf as root. Add the following two lines: name local_archives urls http://jog.id.packages.macports.org/macports/packages/ You can also disable all the official archive mirrors by doing like this: name macports_archives name local_archives urls http://jog.id.packages.macports.org/macports/packages/

Categories : Osx

Trouble installing scipy with macports
MacPorts does not touch the system python when installing python modules. It does install these modules for its own version of python, which is in /opt/local/bin/python2.7 by default. You can make it the default python to be run when you type python in your shell using sudo port select --set python python27.

Categories : Python

Error in installing mysql using macports
That article is obviously a bit antiquated. The modern preferred way to start a daemon installed with MacPorts is by using the port load command. sudo port load mysql5-server Stop it by using port unload.

Categories : Mysql

CSV read/write using regex re.sub
You have to pass a string to re.sub() third argument, which can be a line of your reader object. You can already pass to writer the iterable that will do the substitutions: import csv reader = csv.reader(open("input.csv", "rb")) writer = csv.writer(open("output.csv", "wb")) test = 's+(STREET|ST|TRAIL|TRL|TR)s*$' writer.writerows( (re.sub(test, '', line[0], flags=re.M) for line in reader) )

Categories : Python

How read and write to cloudant using PHP
According to How do I make a request using HTTP basic authentication with PHP curl?, you need to set the basic auth credentials outside the URL. Adapting their example to your variable names: curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);

Categories : Misc

CBPeripheralManager read/write
Yes. CoreBluetooth assumes that if you're setting up a peripheral, you wouldn't query the Bluetooth stack to retrieve attributes about yourself, and instead would simply query some internal data structure.

Categories : IOS

Write and read a .ini file in VB.NET
Here's something that will work. Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Using sw As New System.IO.StreamWriter("c:myfile.ini", False) sw.WriteLine("test text") End Using Using sr As New System.IO.StreamReader("c:myfile.ini") Dim Line As String = sr.ReadLine Do While Line IsNot Nothing MsgBox(Line) Loop End Using End Sub

Categories : Vb.Net

How is it possible to write what looks like a read only property?
If you define a class like this: public class YourClass { public string MyProperty { get; private set; } } It will appear as get-only to the outside. Exception probably looks something like this: public class Exception { public Exception(string message) { this.Message = message; } public string Message { get; private set; } }

Categories : C#

PHP session_set_save_handler: read() before write()
From my perspective this seems pretty useless... why would anyone write() or store this information at the END before they could ever get a chance to retrieve it? What do you mean before they got a chance to retrieve it? To retrieve it, the read method is called – and it is called before, so that you already have the info. But somehow this is what you are complaining about …? Am I right in assuming that you don’t have much understanding of how PHP’s session mechanism works at all? You call session_start on top of every script. If PHP finds a session id in the parameters passed to the script, it looks for an existing session with that id, and if it finds one, it reads the data from it. From that point on, you can work with that data – PHP has put it into the super-global

Categories : PHP

Read and Write from File
Your variables are all transient which means they don't get saved/loaded. Get rid of the transient attributes from all your variables. See: Why does Java have transient variables?

Categories : Java

How to read and write shared_ptr?
This is a kind of data serialization problem. Here, you want to serialize your Data that has pointer types within it. When you serialize pointer values, the data they are pointing to is written somewhere, and the pointers are converted into offsets to the file with the data. In your case, you can think of the int values as being written out right after the object, and the "pointer" values are represented by the number of bytes after the object. So, each Data in your file could look like: |total-bytes-of-data| |offset-a| |offset-b| |value[]| If a and b point to the same instance, they would have the same offset. If a and b point to different instances, they would have different offsets. I'll leave as an exercise the problem of detecting and dealing with sharing that happens between dif

Categories : C++

PCIe read write within ISR
According to me your problem is not the FPGA but it is the way your interrupt is being handled. You may want to isolate this problem and ask with proper tags. Don't include PCIe or the FPGA, since there is a high probability that they are not part of your current problem. The PCIe drivers you are using for your SGDMA are different for different FPGAs. Since you are manually calling the functions for read and write to the PCIe-FPGA interface it looks like there might not be an issue with this part (PCIe driver) also. The functions you use will not be known to others, so no point in sharing that in your question also. I will suggest you to read more about IO interrupt handling. Try something other than polling for the interrupt event.

Categories : Linux



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