w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why SessionComponent::write() works on a mate's computer, but not on mine?
SessionComponent::write() should not be called statically So why do you do it? :) Either use it properly as documented: $this->Session->write() inside the correct scope (controller/component), of course. or use the static CakeSession access: CakeSession::write() anywhere else in your APP.

Categories : Cakephp

should I let mongodb make use of the new hard disk in this way?
Unfortunately this one will not be that straightforward. Even if you succeed with the mounting it will not move the files at all. What you can do is to mount the disk elsewhere (mkdir /var/lib/mongodb1, mount /dev/sda3 /var/lib/mongodb1) stop mongo copy the files from /var/lib/mongodb to /var/lib/mongodb1 (only helps if the new disk is bigger) reconfigure mongo to use as db dir the new directory or swap the names with mv commands start mongo if everything went fine, mongo started and so on,(check it first!!!) you can delete the old data. If you have a disk which is the same size so with moving the data you will run into the same problem, if you need larger space then a single disk you should play around with RAID and/or LVM and more disks.

Categories : Mongodb

RoboCopy , Virtual Hard Disk, or other?
I got the answer from a different thread. Basically, we are creating a Microsoft VHD (virtual Hard Disk) and filling in the files with RoboCopy and shipping the VHD. See: Unzip too slow for transfer of many files

Categories : Apache

Reading boot Sector of the hard disk
The boot sector of the disk contains not ASCII data, but code. With high probability, one of the first bytes will be NULL and remaining possibly not printable codes (such as CR, LF, etc.). Trying to print the buffer by INT 10h, which prints ascii codes, and ending on 0 will result probably with nothing displayed at all. You should convert every byte of the buffer to hexadecimal string and then print these strings to the display. This way you will get simple hex dump of the boot sector.

Categories : Assembly

How can i add some bat files to my project so i will not need them anymore on the hard disk?
// create the dxdiag.bat file using (StreamWriter sw = new StreamWriter("dxdiag.bat")) { sw.WriteLine("........."); // ...... } Process proc = new Process(); proc.EnableRaisingEvents = true; proc.StartInfo.UseShellExecute = false; proc.StartInfo.FileName = "dxdiag.bat"; proc.StartInfo.CreateNoWindow = true; proc.Start(); proc.WaitForExit(); proc.Close(); //delete the file File.Delete("dxdiag.bat");

Categories : C#

which widget to use to show hard disk sectors as hexadecimal?
How do they achieve this in a single scroll area It is not a "single scroll area" containing the entire disk. It is a scrollbar and dynamically generated content for whatever disk content you are showing at the time. Simply calculate the position based on the scroll location (unless your screen is 10000's of pixels tall, however, you will not be able to place the cursor EXACTLY on the disk sector you want). also provide the undo functionality in that.... Undo functionality, I expect (I haven't looked at the code) is done by holding "address changed, old value" in some sort of container. Pretty much the same way you'd do undo information for any other large dataset. which widget should be used to display such a huge amount of data.???? One which shows text and allows yo

Categories : C++

I want to use powershell to map a network hard disk on a remote machine
PSExec is not short for "PowerShell exec", it's "process exec". You cannot execute an PowerShell cmdlet directly from it. To use PSExec to execute a PowerShell command remotely, you must do the following (untested, as I don't have psexec): psexec \func2_web1 powershell.exe -command -nologo "New-PSDrive -Name x -PSProvider FileSystem -Root \argentodrops -Persist" Or, if you want to go the remoting route from within your local PowerShell session: invoke-command -computername func2_web1 -scriptblock {New-PSDrive -Name x -PSProvider FileSystem -Root \argentodrops -Persist} With the latter, you may have "double-hop" issues that need to be resolved via CredSSP.

Categories : Powershell

How to get the total size of hard disk of Windows machine?
Look at GetDiskFreeSpaceEx(), which has an lpTotalNumberOfBytes output parameter. It is subject to per-user disk quotas, though. If you need the raw byte size of the physical disk, use CreateFile() to open a handle to the desired disk and then use DeviceIoControl(), specifying the IOCTL_DISK_GET_LENGTH_INFO control code, to get the disk's total byte size.

Categories : Windows

Why when loading html file from the hard disk through WebBrowser not everything is shown?
When you download the page, you download the source code of that page. However, when your browser downloads the page, there are a lot of stuff downloaded along with the HTML. For instance, there are JavaScript files, CSS files (for styling) and more. Even if you download them as well, you may need to modify your HTML to link those files to the HTML with a relative or absolute path (depending on your needs). In other words, the web page is not shown as you expect because the attachments are not downloaded and linked to the HTML. Update When you set the source of the document, the attached documents (css, js, etc.) relative to the HTML are not found and therefore not used in the web page. For instance: <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/stackoverflow/all.cs

Categories : C#

With PowerShell, is there a way to make an external hard disk attached to host available to VM?
I don't use Win8, so this is entirely untested. Judging from the description of Add-VMHardDiskDrive something like this might work, though: $usbdisk = gwmi Win32_DiskDrive | ? { $_.PNPDeviceID -like 'USBSTOR*' } Add-VMHardDiskDrive -VMName MyWin7PC -ControllerType IDE -ControllerNumber 0 ` -ControllerLocation 1 -DiskNumber $usbdisk.Index

Categories : Powershell

Serving Static content from local hard disk in jboss as 7
As of my knowledge, we dont have an option to access static files on the hard disk through JBOSS AS 7.1. The solution I have tried was , I have created a dummy web application and I have been storing the files into the dummy web application. Once the files are stored over there, they are accessed with URL pointing to newly created dummy web application. Though this is not the correct way for this kind of access, I find no other way for this. Pl. let me know if any other ideal way exists... Thanks....

Categories : Java

Write files into randomly non-contiguous hard disk positions
I think that the only way to do this is using some low-level OS commands No... RandomAccessFile has .seek(): final RandomAccessFile f = new RandomAccessFile(someFile, "rw"); f.seek(someRandomLong); f.write(...); Now, it is of course up to you to ensure that writes don't collide with one another. Another solution is to map the file in memory and set the buffer's position to some random position before writing.

Categories : Java

windows azure virtual machine hard disk backups
Azure attached disks, just like the OS disk, is stored as a vhd, inside a blob in Azure Storage. This is durable storage: triple-replicated within the data center, and optionally geo-replicated to a neighboring data center. That said: If you delete something, it's instantly deleted. No going back. So... then the question is, how to deal with backups from an app-level perspective. To that end: You can make snapshots of the blob storing the vhd. A snapshot is basically a linked list of all the pages in use. In the event you make changes, then you start incurring additional storage, as additional page blobs are allocated. The neat thing is: you can take a snapshot, then in the future, copy the snapshot to its own vhd. Basically it's like rolling backups with little space used, in the event

Categories : Azure

How can I resume connection between SQL Server and physical files after hard disk disabling?
Lets start saying that you are in a very bad shape and you should check your physical server ASAP. IMO, the best thing to do is backup the files as-is just in case you can't do anything else then one of the following options restart SQL Server service delete the broken database restore restore back ups to the latest transaction point If the above is impossible. restart SQL Server service hope that things will work

Categories : Dotnet

getting size of multiple files located inside the hard disk using python
if item < 1000: size = str (item) + 'K' if item > 1000: #this will never execute #since you have already asserted that item < 1000

Categories : Python

Read Streaming Excel file which is not saving content to hard disk
There is approch you can follow: open temp.xls with readonly flag with standard way: Workbooks.Open Method Perform your traitement on data. Peraphs copying content to another Workbook. detect changes on temp.xls using FileSystemWatcher Class and reopen it as 1st point Another thing can be useful is to detect end of process from abc.exe. Maybe it is only by detect non-existance of temp.xls or non-existance of abc.exe in table of process (via ManagementEventWatcher Class). Anyway at this point you should sniff everything passing thru temp.xls.

Categories : C#

To find duplicate files on a hard disk by technique other than calculating hash on each file
You may want to use multiple levels of comparisons, with the fast ones coming first to avoid running the slower ones more than necessary. Suggestions: Compare the file lengths. Then compare the first 1K bytes of the files. Then compare the last 1K bytes of the files. (First and last parts of a file are more likely to contain signatures, internal checksums, modfication data, etc, that will change.) Compare the CRC32 checksums of the file. Use CRC rather than a cryptographic hash, unless you have security measures to be concerned about. CRC will be much faster.

Categories : File

Provide uploading files, write the file on hard disk, get full path (string) to add in database CakePHP
While this may not give you a direct solution in CakePHP, you had asked for some ideas. I've outlines some pros and cons of storing a file on the filesystem (along with some other approaches) in this post. Hope that helps...

Categories : PHP

Eclipse issue with linuxmint
I found 2 links to fix the eclipse issue: http://blog.nanthrax.net/2012/07/change-tab-font-in-eclipse-juno/ https://bugs.launchpad.net/linuxmint/+bug/1168281 But still the toolbar icons are large. At least it looks better. If I find the full fix i'll edit my post.

Categories : Eclipse

How to detect the disk full error and let program resume after getting free disk space
Check the return value of each call to fprintf() and fwrite(). If either call returns a negative value, check errno to see if errno is equal to ENOMEM or EDQUOTA. If so, you're probably out of disk space. As for resuming the operation as if nothing ever happened; that's a little bit harder; you'll need to keep track of what data you successfully wrote to the disk, so that after you've notified the user and they've indicated that it's time to try again, you can resume writing that data from the point at which the error occurred. That means keeping the state of the write in a structure of some sort (i.e. not just on the stack) so that you can return from your writing-function and then resume it later on. (Either that, or do the writing in a separate thread, and have the thread notify th

Categories : C++

Mongodb exists after claiming that there is no disk space while disk was not full
This is a bug in MongoDB. As of today it remains unresolved. The best advice I can give you is to ensure you have plenty of available disk space at all times.

Categories : Mongodb

AIX 7.1 failed disk, need to figure out what physical disk this is?
Use diag. $ diag <enter> Task Selection Hot Plug Task SCSI Hot Swap Manager Identify a Device Attached to a SCSI Hot Swap Enclosure Device It should blink the LED of the device you requested.

Categories : Misc

Cloning an OS disk onto a smaller disk
Acronis Clone Disk worked for me with some options settings, set the move method to Manual and then we get the option to "Change Disk Layout" and control how the unused space from the bigger disk will be shrunk when moving to smaller disk.. The destination disk is fine and bootable now!

Categories : Misc

PasswordBox does not assume style
Somehow Border within ControlTemplate of PasswordBox does not take MyControlBorder style. When you modify MyPasswordBox style like this... then it will work. <Style x:Key="MyPasswordBox" TargetType="{x:Type PasswordBox}"> <Setter Property="Height" Value="30" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Control}"> <Border Name="Border" BorderBrush="DarkKhaki" Background="White" BorderThickness="1" CornerRadius="10"> <ScrollViewer x:Name="PART_ContentHost" /> </Border> </ControlTemplate> </Setter.Value> </Setter> I know it's not the best solution... but I can't figure out why MyControlBorder is not applied. It doesn't

Categories : Wpf

Can I assume PHP's time() and MySQL's NOW() will be the same?
No, they are not the same since the server's times may be different (maybe just some msec but maybe a whole timezone) and there are always (small but existent) delays in processing. Use SELECT.

Categories : PHP

WiX Toolset - check for all installation prerequisites at once (conditional installation)
The WiX Condition element when used under a Fragment or Product element represents an entry in the LaunchCondition Table and is processed by the LaunchConditions Action. The behavior you see is a limitation of that underlying feature. Here's a blog article I wrote about this 7 years ago: Short Comings of LaunchConditions Sadly, Microsoft has never taken my recommendations for improvement. So instead of using the Condition element you'll have to write your own custom table and custom action to do the processing. I have sample code for this in InstallScript and C# but I've never written it in C/C++. Here is a stripped down example in InstallScript. Read it as pseudocode for refactoring in C/C++. You'll need to also create the custom table used by the SQL query, define and schedule

Categories : Wix

Is it safe to assume errno to be always positive?
Your program's exit status is limited to 0..255, so if those return statements are from the main() program, the high order bits are irrelevant. The C standard (ISO/IEC 9899:2011 §7.5 Errors <errno.h>) says: errno which expands to a modifiable lvalue201) that has type int and thread local storage duration, the value of which is set to a positive error number by several library functions. 201) The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue resulting from a function call (for example, *errno()). The C standard expects errors to be positive. POSIX (IEEE Std 1003.1, 2013 Edition) states for <errno.h>: The <errno.h> header shall define the following macros which shall expand to integer constant expressions

Categories : C

What can we assume is an invalid email address?
If you use Regular Expression you'll have a lot less trouble. There are email validation patterns which validate your email address. Pattern pattern = Pattern.compile("([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})?"); Matcher matcher = pattern.matcher(yourEmailAddress); if(matcher.matches()){ //do something }else { //tell the user it didn't match }

Categories : Javascript

Any way to make it assume transient unless explictly told otherwise?
With JPA, as soon as a class is annotated with @Entity, all its attributes are automatically mapped to a table. If you do not need to map an attribute, you can use the @javax.persistence.Transient annotation or the java transient keyword. So this is the default behavior of hibernate as JSR states.

Categories : Java

Laravel: belongsTo() relation assume one-to-many relationship instead of one-to-one
You need to define the relationship. You can define 'different' relationships on the perspective. The ->belongsTo() function is an inverse function - but you havent defined anything on the users table - so it is wrongly assuming the inverse is one-to-many. Just add this to your users class: class Users extends Eloquent { public function pages() { return $this->hasMany('Pages'); } }

Categories : PHP

Mongoose: What can I assume about my data in the event of an error
Your intuition is correct. If there is an error during a multi-document update, you may have a situation in which some of the documents have flag == true and others have flag == false.

Categories : Node Js

Is it always safe to assume that values of ..stream::int_type are >= 0 except for eof
First let look at the more general case of basic_stringstream. You can't assume that eof() is negative (I see the constraint nowhere and the C standard states The value of the macro WEOF may differ from that of EOF and need not be negative.) In general, int_type comes from the trait parameter and the description of int_type for character traits doesn't mandate that to_int_type returns something positive. Now, stringsteam is basic_stringstream<char> and thus use char_traits<char>; eof is negative but I haven't found a mandate that to_int_type has to non-negative values (it isn't in and I see no way to deduce it from other constraints), but I wonder if I miss something as my expectation was that to_int_type(c) had to be equivalent to (int)(unsigned char)c -- it is the

Categories : C++

Gem installation error during MYSQL gem installation in ruby
You need to install mysql before installing mysql gem. Follow this link on how to install mysql on windows

Categories : Mysql

Does PHP if statement assume you are checking for 'true' if left blank?
if($variable) is pretty much saying if($variable != null && $variable != false && $variable != 0) So as long as the variable is set and not equal to 0 or false it will be evaluated as true "and if so is it 'good programming' to leave it blank or should you finish off the statement for the sake of not cutting corners?" if you are trying evaluate exactly equal to true, it is cutting corners, but it is pretty common to use if($variable) to confirm that $variable is defined with a value

Categories : PHP

undo git update-index --assume-unchanged
I assume (heh) you meant --assume-unchanged, since I don't see any --assume-changed option. The inverse of --assume-unchanged is --no-assume-unchanged.

Categories : GIT

Can we assume unicode symbols displayed well across all Android devices
Can I assume it will work well under all different devices with different language settings? As long as you use the font in your assets folder and not any native implementation, then yes.

Categories : Android

With HTML5 url input validation assume url starts with http://
if you don't want the browser validation (it can vary between browsers) you can add the following novalidate attribute <input type="url" name="someUrl" formnovalidate="formnovalidate"> else you might want to be more transparent about prefixing http:// by simply adding once someone starts to type or even to have http:// already typed into the box on the page load (credit to editor who rightly points out that novalidate applies to form, while above overrides that, debit to creditor for approach to edit ;)

Categories : HTML

Install Perl modul with assume yes for given options non-interactively
To prevent the CPAN client from asking whether to install prerequisites, start it in interactive mode and enter the commands: o conf build_requires_install_policy yes o conf prerequisites_policy follow o conf commit The commit command is optional, but it will update the default configuration, which I suspect is what you want. Without it, you may or may not (depending on whether autocommit is enabled in your CPAN config) need to make this change every time you want to do a prompt-less installation. These changes will deal with all of the CPAN client's routine questions about whether to install dependencies. For distributions which have questions embedded in their install scripts, you may also want to add o conf inactivity_timeout 60 to set how long it will wait for a response befor

Categories : Perl

When calling dealloc from a UIView with ARC, can I assume ivars are still retained?
From http://clang.llvm.org/docs/AutomaticReferenceCounting.html A class may provide a method definition for an instance method named dealloc. This method will be called after the final release of the object but before it is deallocated or any of its instance variables are destroyed. The superclass’s implementation of dealloc will be called automatically when the method returns. So [super dealloc] is called after calling the subclass dealloc implementation.

Categories : IOS

How to Fix Weird C++ Codes that Assume the Relative Ordering of Class Members
I am not aware of any tool that solve your problem, but I would define a class which supports all operators for int type and which overloads ampersand operator so that the result of the operator cannot be casted to a pointer. Then I'd use this class instead of int in your class member definitions and look at places where compiler gives errors. Something like class IntWrapper { public: IntWrapper() { } IntWrapper(const int x) { } // don't care about implementation as we operator int() const { return 0; } // want compile-time errors only IntWrapper& operator ++() { return *this; } IntWrapper& operator ++(int) { return *this; } ... void operator &() const { } // make it void so it would cause compiler error }; And then: class B { public: IntWrappe

Categories : C++

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