w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
What is the standard conforming way to decide what will be returned by what() from a class inherited from std::system_error without duplicating data?
I don't know of an "elegant and portable" solution, but I don't think there is anything wrong with the solution you propose in the question, which is to make your own copy of what_arg. The exception object will not last very long: typically, only long enough to unwind the stack. Furthermore, the string in what_arg is not likely to be very long, given that a megabyte of what is not going to be very readable. And finally, the exception object will only be created in exceptional circumstances, so the "unnecessary" duplication of a small string is not going to have any noticeable impact on your program's performance. Basically, the class designers have chosen to make the class's state opaque, and -- to put it bluntly -- you don't trust them to produce a usable result (a readable message) fro

Categories : C++

What is the size of a class when it is inherited from a class which has all its members private in c++?
If you were to have non-private methods in your base class they could access and change the private members, therefore the members still exist as any sub-classes can call the non-private methods. Private means private, not don't include. Why have private members in a class with no methods?

Categories : C++

Move semantics, standard collections, and construction time address
This has nothing to do with move constructors. The issue is std::vector. When you add a new item to that vector, it may reallocate its memory, and that will cause all the DeviceDependant objects to be transferred to a new memory block internal to the vector. Then new versions of each item will be constructed, and the old ones deleted. Whether the construction is copy-construction or move-construction is irrelevant; the objects effectively change their address either way. To make your code correct, DeviceDependant objects need to unregister themselves in their destructor, and register themselves in both copy- and move-constructors. You should do this regardless of what else you decide about storage, if you have not deleted those constructors. Otherwise those constructors, if called, will d

Categories : C++

why do structure's data members memory allocated from lower to higher address in stack growing higher to lower
One advantage is that Operating System is able to easily check whether overflow occurs in a process(program). Heap segment is usually growing from lower to higher when stack is growing from higher to lower. if two segment is gradually grow to be overlapped, OS can detect overflow in the process. Here is a diagram for memory layout of C programs. Hope this help. Also, such choice depends on OS designer. If you are a beginner, just don't care about it. Think easy.

Categories : C

Buddypress Show a members most recent post in members loop
Somebody provided me with a great fix for this: <?php $user_id = bp_get_member_user_id(); $query = new WP_Query( 'author=' . $user_id ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); //display title the_title(); //display content the_content(); ?> <a href="<?php the_permalink(); ?>"> <img src="<?php the_field('featuredimage'); ?>" alt="" /> </a> <?php } } //reset for next member wp_reset_postdata(); ?>

Categories : Wordpress

Subscribing inherited methods to events in a constructor, then calling that constructor in an inherited class
new public void myEvent() This creates a new event. You don't want that. Make the event virtual in the base class and use override instead of new here.

Categories : C#

boost.python exposing members of members
I'm assuming you get B::someObj filled in somehow, or accessing a potentially random pointer will crash your code. Given that condition, you must expose both A and B to access A through B. I tested the following code and it compiles and works as expected: #include <boost/python.hpp> #include <boost/shared_ptr.hpp> struct A { int intVal; char charVal; }; struct B { A* someObj; }; static boost::shared_ptr<B> create_b() { boost::shared_ptr<B> retval(new B); retval->someObj = new A; //<< WARNING: leakage ahead retval->someObj->intVal = 3; retval->someObj->charVal = 'a'; return retval; } BOOST_PYTHON_MODULE(test) { using namespace boost::python; class_<A, A* >("A") .def_readonly("intVal", &A::intVal) .def_r

Categories : C++

Type Members and Value Members of a Scala Class
Value members (or rather term members) are class members that represent some value. These are: defs, vals, vars and inner objects. Type members are members that represent a type. These are inner classes, traits and abstract types or type aliases (declared or defined with keyword type). abstract class A { // examples of term members val someVal = 5 var someVar = 0 def someMethod(someParam: Int) = someParam * 2 object someInnerObject // examples of type members type SomeTypeAlias = List[String] type SomeAbstractType trait SomeInnerTrait class SomeInnerClass } I don't know if there is anything more significant to say about this classification. I hope someone can give some more general explanation if there is one.

Categories : Scala

How to use bp-members/bp-members-functions.php in child theme
There is a better way (future proof) way of doing it. You can use a filter: http://codex.wordpress.org/Function_Reference/add_filter If you would like to change the email subject you can use: bp_core_signup_send_validation_email_subject To change the email body, use: bp_core_signup_send_validation_email_message

Categories : Wordpress

How to have inherited DataRow class so inherited DataTable can have DataTable.NewRow()
If you can't simply use a DataTable with a single DataColumn of type int per @Tim's suggestion in the comments, then consider creating a typed DataTable. With a typed DataTable you can define column names and types as well as a number of other DataTable features and behaviors including how NewRow() works. A demonstration doing this can be found in this article over at codeproject.com: How to Manually Create a Typed DataTable A nice thing about typed DataTable is you don't need to 'indirectly' reference columns by index or by column name, you can reference columns using property notation with Visual Studio's Intellisense helping you out. Here's an example: var intDataTable = new YourTypedDataTable(); YourTypedDataRow row = intDataTable.NewRow(); row.Temp = 100; intDataTable.Rows.Add(

Categories : C#

Pointers to members of members or an alternative?
Not sure if I get the problem right. Just as you could reach members i, f with a PTM you can do the same with S. You don't need a separate funcition to access s and s2: a single function will do with an extra argument of type S A::*. Or if the types must be variable, you can extend your read function something like: template<typename Stream, typename Class, typename Type, typename Class2, typename Type2> void read(Stream& s, Class& out, Type Class::*member, Type2 Class2::*member2) { s >> ((out.*member).*member2); } and use it like read(stream, a, &A::s, &S::u); (I don't have compiler at hand to test it, it may need some touch-up)

Categories : C++

Show members of members group
Have you looked at function bp_group_has_members in buddypressp-groupsp-groups-template.php ? You can't pass a string '$group' to bp_group_has_members. Try: $this_id = bp_get_group_id(); echo "group id is: " . $this_id; // make sure there is a value here. $has_members_str = "group_id=" . $this_id; if ( bp_group_has_members( $has_members_str ) )

Categories : Wordpress

Buddypress - getting members loop to print members in specific order by specific criteria
It's hard to do right now. But BuddyPress 1.8 should contain extra filsters and hooks in BP_Query (that is used to get members/groups) and I think it will be possible. BP 1.8 beta was released - take a look. According to that post: bp_has_groups() and bp_has_activities() now accept a meta_query parameter (#3521). This means you can filter a group or activity query based on groupmeta or activitymeta, using the very same meta_query syntax familiar from WP_Query.

Categories : Wordpress

Access Voilation at address 00407518 read of address C3EF9FFE on form close?
Your stomping on your strings...change to move(arr1[ind],user[1],length(user)); ind:=ind+length(user); move(arr1[ind],s1[1],length(s1)); ind:=ind+length(s1); move(arr1[ind],ip[1],length(ip));

Categories : Delphi

How to check if address is contained in a continent or close to another address in android google maps api v2?
For the start I assume you are familiar with the GeoCoder and / or GeoCoding API to get the addresses for your locations. If you use the GeoCoder you will get a List of Address objects. The Address class provides some methodes to get the country or city name f.e. These methods you can use for your filter. The Location class includes the methods distanceBetween() and distanceTo(). These you can use to check the distance between your locations.

Categories : Android

Address and Address Range Syntax search memory when using windbg to do debug
The L refers to the length of the range to search so using 0012ff40 as starting range, plus 32 bytes would give end address of 0012ff5f (remember it includes the starting address). To answer your second part the -d flag tells WinDbg the type of the object, in this case DWORD which will be 32-bit unsigned integer

Categories : Debugging

Display webpage address in browser address field which is loaded into iframe
You can't. What if http://fakebanksitewithrealbanksiteiniframe.com could just display http://yourbank.com?

Categories : Asp Net

What could cause Magento to change new address back to default address on Paypal redirect?
I had a similar bug and maybe its the same with you. If you select an address as your default address in the address book it screws up the one page checkout. Say I have 3 people in my address book: John, Suzy and Bill. One day I happen to be in my address book and I select John as my default billing and shipping address. Then I go to my cart, order some items, select John as billing, and select ship to a different address. On the next step I select Suzy as my ship to address. I click next to go to the shipping method step, but whoa, wait! Suzy's address has been overwritten and replaced with Johns address. Its exactly the same issue posted about here (although I dont think the guy understands what happened, but the screenshots are the same result): http://www.magentocommerce.com/boards/

Categories : Magento

what 's the difference between application's enter point address and excuteable start address
Terminology is fuzzy but I think I know what you are talking about. A language needs runtime support. Standard for C and the C++ languages is the CRT. The CRT needs to be initialized before the program can start running. Opening stdout and stdin, initializing static objects, setting up signals, that sort of thing. Two basic ways that's done, the compiler can inject a call to the initialization code in the main() entrypoint of the program. Before the rest of the code inside main(). That's typical for simple operating systems that don't have a fancy loader. Both the entrypoint and the executable start address are the same. Also the reason why the language standard forbids recursing main(). Or it can be done by setting the executable start address to the runtime initialization funct

Categories : C++

DNS lookup failed: address 'your.proxy.com' not found: [Errno -5] No address associated with hostname
**Error that I get** - scrapy crawl Linkedin **2013-07-29 11:37:10+0530 [Linkedin] DEBUG: Retrying <GET http://www.linkedin.com/nhome/> (failed 1 times): DNS lookup failed: address 'your.proxy.com' not found: [Errno -5] No address associated with hostname.** **To see if the Name space was resolved, I tried -:** nslookup www.linkedin.com #works nslookup www.linkedin.com/uas/login # I think the depth of pages within a main website, does not resolve, and is normal right ? Then I also tried to see if the error could have been due to Name Server not resolving and appended the Nameservers as below . echo $http_proxy #gives http://username:password@your.proxy.com:80 You have a proxy set: http://username:password@your.proxy.com:80. Obviosly, it doesn't exist in Internet: $ nslookup y

Categories : Python

Is the memory address returned by malloc/calloc from virtual address space?
All addresses you see in user space applications are virtual addresses. Physical addresses are only of concern to the kernel. The mapping from virtual to physical addresses is complex, given that: Not all virtual addresses have physical addresses at all. (For instance, pages that are unmapped, lazily zero-filled, or swapped out have no physical address.) Physical addresses may change without warning (e.g, if a page is swapped out and back in, or if a shared page is copied). Outside of some very unusual situations (mostly having to do with messing around with hardware), you should not care about physical addresses.

Categories : C

Get User's IP Address in a Share Point Web Part not giving valid IP address
Use this, string ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(ip)) { ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } Or use string ipAddress = Request.UserHostAddress

Categories : C#

Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2) (Errno::EADDRINUSE)
You can run rails server with specified port by console instead of NetBeans IDE. I think NetBeans also can set ports, but I didn't used this IDE for long time and forgot it.... In your project folder first. If you are using Rails 2.* > ruby script/server -p 3001 If you are using Rails 3+ > rails s -p 3001 -p XXXX is the port you will use, you can specify a port that is different with another user's. Hope it helps.

Categories : Ruby On Rails

How do you parse a street address from a single cell in Excel into individual cells when the address format isn't consistent?
I guess you can do a combination of MID & FIND to extract parts of the address, e.g. =IF(IFERROR(MID(A1,1,FIND(",",A1,FIND(",",A1)+1)),1)=1,MID(A1, 1, FIND(",",A1)-1),MID(A1,1,FIND(",",A1,FIND(",",A1)+1)-1)) will extract the address from cell A1, depending of the number of commas it finds (1 or > 1). ZIP and state won't be too difficult following the above mentioned pattern. I think the problem is extracting the city as you don't know where to set the limit between the city name and the street unless you have a finite set of street types, e.g. ct, st, way etc.

Categories : Excel

how is virtual address translated to its physical address on backing store?
This is OS-specific, but many implementations share logic with memory-mapped file features (so that anonymous pages actually are memory-mapped views of the pagefile, flagged so that the content can be discards at unmapping instead of flushed). For Windows, much of this is documented here, on the CreateFileMapping page

Categories : C

How to pass address of BOOL to a method accepting address of VARIANT_BOOL?
The solution is that you should not use a cast for this because BOOL is typedefed to int and VARIANT_BOOL is typedefed to short and so they most likely will have different sizes. Declare a VARIANT_BOOL variable and pass its address, then interpret the result.

Categories : C++

windbg:Getting source code file at give address like "u address"
If You have the source code of debugging code why would You like to browse/view it from windbg? Source mode makes debugging very simple but windbg is not a "code browser". If You want to see the source code at the given address simply check what function "covers" this address e.g.: kd> uf fffff800`02be05d0 nt!NtOpenFile: fffff800`02be05b0 4c8bdc mov r11,rsp ... fffff800`02be05d0 458953e0 mov dword ptr [r11-20h],r10d Then ctrl-o and open your source code that contains this function(your func ofc unless You work for microsoft :D) and browse it in windbg.

Categories : Debugging

Find Computer Name,Operating System name of a given IP address or MAC address In java
import java.util.Map; public class EnvMap { public static void main (String[] args) { Map<String, String> env = System.getenv(); for (String envName : env.keySet()) { System.out.format("%s=%s%n", envName, env.get(envName)); } } } I guess you need the following properties: COMPUTERNAME OS regarding MAC Addrss and IP Address you have 2 options: use InetAddress ip; try { ip = InetAddress.getLocalHost(); System.out.println("Current IP address : " + ip.getHostAddress()); } catch (UnknownHostException e) { e.e.printStackTrace(); } or use ipconfig/ifconfig output but I'll leave the choice it to you

Categories : Java

Get real url address that user typed in address bar in browser
RawUrl only contains the server path, without the domain, which seems to be the most interesting part for you. In that case, it seems like a duplicate of What's the best method in ASP.NET to obtain the current domain? Here the solution was to use Request.Url.Host

Categories : C#

Apache + WSGI: Address already in use: make_sock: could not bind to address
If you get: Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed. then it means you haven't enabled the mod_wsgi module in Apache and so it isn't loaded. That or you are running an ancient Apache 1.3 version, although that is highly unlikely as don't think you can even get mod_wsgi binary packages for such an old Apache version now. As to port usage, you obviously can't have Apache and uWSGI using the same one, so you need to set them up with different ports.

Categories : Apache

Amazon Route 53 to map an address like https://my-elb-address:88888/my-app-name
There's a few problems with that: First, DNS cannot include port numbers. Second, DNS cannot include a path. Third, the maximum port number is 65535, so even if DNS did let you add a port number, that port number is too high. You'll probably want to just send your domain directly to the server. Use apache to reverse proxy 80/443 to 8080/8009 (glassfish default ports for http/ajp), and just add a mod_rewrite rule that redirects / to /my-app.

Categories : Amazon

Is anyone get Address-Sanitizer (known as asan or -fsanitize=address) work for iOS?
I finally get the asan work for me with my friend's help. move all c/c++ code to a new target (cocoa lib target) of xcode project. make the project build and run normally as it was a single app before separate c/c++ codes to a lib. build llvm. ref http://blog.wadetregaskis.com/tot-clang-llvm-in-xcode/ add a clang option to xcode. for convenient you can use this template: http://blog.wadetregaskis.com/tot-clang-llvm-in-xcode/ . change clang path to the clang just build in the previous step. change the lib target in the xcode to use the new clang/llvm, add a cflag -fsanitize=address. then build, if some api (such as opengl/system video function) is reported not supported, then you can put it into the app project, your clang doesn't support compiling it. if you pass the compile, it will rep

Categories : IOS

Email Support section with the users address as "From address"
You cannot do what you are doing, because the SMTP server is not allowing you to "impersonate" the user's email address for sending to the system. And thank goodness this is the case or else people would be spamming/spoofing the heck out of everyone under someone else's name. Why are you trying to have it appear that the user is sending an email to the application? Why not just have a support section of your application where users can "submit" requests for support to the system and then if you want to send emails out to the users, then your scenario will work, but just in reverse (where the system is the From address and the user is the To address).

Categories : C#

IPv6 address as the domain portion of an email address
You are right to look at RFC4291 for the IPv6 address format. However, for SMTP (and thus for any other email software handling addresses) you should also look at Address Literals in RFC5321. The one you want is probably "IPv6-address-literal".

Categories : Email

Validating IP address and ip address ranges delimited by semicolon
Explode them by ;, and then trim the array values to remove the spaces. That way, you can make sure both the spaced-version and non-spaced versions of the user input is treated equally. $parts = explode(';', $text); $parts = array_map('trim', $parts); //or $parts = array_map('trim', explode(';', $text)); //check if IP is valid For validating the IP, you don't need a regular expression. PHP already has a built-in function filter_var() which does exactly what you want. $parts = array_map('trim', explode(';', $text)); foreach ($parts as $ip) { if(strpos($ip, '-')) { list($range1, $range2) = explode('-', $ip); // validate IP range here } elseif (filter_var($ip, FILTER_VALIDATE_IP) ) { echo "$ip is valid<br/>"; } } That should get you s

Categories : PHP

Excel: Search for a cell address, then use that address in a function
I wrote it down a bit quickly, so there might be something shorter ^^; =IF(ISNUMBER(SEARCH("Successful",VLOOKUP("*"&A1&"*",Sheet1!A:A,1,0))),"Success","Fail") The innermost function is VLOOKUP and will look for the corresponding cell in Sheet1 containing 'dog' (case insensitive). It will return the value The dog failed. Now, the next formula is SEARCH (a case insensitive version of FIND) and will look for Successful. The rest should be relatively easy to understand :)

Categories : Excel

SVN Changed IP Address - External files pointing to old IP Address
Ok, I managed to solve the problem. The issue was actual that SVN_EDITOR was not set up. So I to set it up I used the following command: export SVN_EDITOR=nano and then I was able to edit the reference using the following command: svn propedit svn:externals .

Categories : Svn

How to save postal address and address that are similar using hibernate?
You don't have to care about if these addresses are the same or not. Once you save an entity by using session.save(), that entity becomes managed. So the second save() won't do anything if the entity has already been saved. EDIT: Address addr = new Address(); user.setAddress(addr); user.setPostalAddress(addr); I am setting the same address to both address and postalAddress. Then if you do this: session.save(user.getAddress()); session.save(user.getPostalAddress()); or do this (after defining cascade="persist" on the association): session.save(user); then Hibernate will insert only one row to address table and set the same id to user.address and user.postalAddress columns.

Categories : Hibernate

Physical address of the address returned by kmalloc
You're right, kmalloc is returning a virtual address, not a physical one. The memory map you linked to is describing the virtual memory map, not the physical memory map. A virtual address typically is translated to a physical address by the MMU when you access data at the address. What the virtual address translates to depends on the memory map specified by the kernel. The memory map you linked to shows how Linux does the mapping. It is saying, if you have a virtual address between 0xffff880000000000 and 0xffffc7ffffffffff, it is mapped to somewhere in physical memory (we don't know where exactly nor do we care unless we're doing DMA).

Categories : Linux

WCF Service Base Address vs endpoint address
baseAddress is just that, the base address for your endpoints (unless specified explicitly). So every <endpoint> will inherit from <baseAddress> (which is why they are usually "" and "mex"). e.g. <baseAddresses> <add baseAddress="" /> </baseaddresses> ... <endpoint address="" contract="MyService.IMyContract" ... /> <endpoint address="mex" contract="IMetadataExchange" ... /> You now have two endpoints: - service endpoint - metadata endpoint By exempting the <baseAddress> you're requiring the <endpoints> to both be fully qualified (including the mex (which is not)). e.g. <baseAddresses></baseaddresses> ... <endpoint address="net.tcp://

Categories : C#

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