w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Extract ip addres and other stuff from a bind log string using python
Try this one (just added #d+ after the IP address saving group): "(.*?) queries.*client (.*?)#d+: query: (.*?) IN" DEMO: >>> s = '09-Sep-2013 10:22:42.540 queries: info: client 10.12.12.66#39177: query: google.com IN AXFR -T (10.10.10.11) ' >>> re.search("(.*?) queries.*client (.*?)#d+: query: (.*?) IN", s).groups() ('09-Sep-2013 10:22:42.540', '10.12.12.66', 'google.com')

Categories : Python

sqllite 3.7.17 compilation error under FreeBSD
Yasir is right in that you should be using the ports of all of the already-ported software you need. If you aren't administrating the server yourself, you ought to be able to ask the admin(s) to install the databases/sqlite3 port for you. Back to your actual question, it is difficult to know, why the fchmod is not declared in your case -- it is declared in <sys/stat.h>. Perhaps, you are using Makefile generated on one platform (Linux?) to build sqlite on a different platform (FreeBSD)? You should not do that -- configure needs to run locally. But, again, do not build it yourself...

Categories : Sqlite

Getting destination/if IP addres from accept()?
The getsockname() call on the socket returned by accept() will give you the address of the local end of the connection. The best way to determine the interface is probably just to match up the local IP address from getsockname() against the interface addresses.

Categories : C

Why it the F postfix needed here to avoid an error?
Because floating point numbers are by default of type double. To make it a float you append an F. You are getting error in the below assignment: float f = 3.4028235E38; because a double as more precision than a float. So, there is a possible loss of precision. I would have expected just the opposite as floating point literals are by default double and should be more precise. Let's check the binary representation of your number till double precision: 0x47EFFFFFE54DAFF8 = 01000111 11101111 11111111 11111111 11100101 01001101 10101111 11111000 Now since float is a single precision 32-bit floating point value. It can't store all the double values, which are double precision 64-bit floating point values.

Categories : Java

Infix to Postfix conversion error
It looks like you're using the Shunting-yard algorithm, but there are a few things you're doing incorrectly. First of all, after the meat of the algorithm runs you still have to print out the remaining contents of the stack and check for mismatched parens. As the wiki article says: When there are no more tokens to read While there are still operator tokens in the stack: If the operator token on the top of the stack is a parenthesis, then there are mismatched parentheses. Pop the operator onto the output queue. This is easy enough to add to your code, just add something like this after the for loop: while(!isempty(&s)) { ch = pop(&s); if(ch == ')' || ch == '(') { printf(" Mismatched parens "); break; } printf("%c",ch); } B

Categories : C

How to get an addres of AF_INET6 socket with recvfrom
You pass the pointer of the sockaddr_in6 (type-casted) and the size of the sockaddr_in6 structure as arguments: struct sockaddr_in6 in6; socklen_t len6 = sizeof(in6); recvfrom(sock, buf, buflen, (struct sockaddr *) &in6, &len6); Since you pass in the correct length to the function, it will work.

Categories : C++

infix to postfix using stack error in updating top variable
in main function add these three lines after for loop End.and remove top=POP(stack,top); inside for loop. while(top!=-1) top=POP(stack,top); printf(" "); modified main function: int main() { char string[15],ch; int top=-1,i; printf("Enter the infix operation: "); gets(string); fflush(stdin); for(i=0;string[i]!='';i++) { ch=string[i]; if( ((ch>='a') && (ch<='z'))||((ch>='A') &&(ch<='Z')) ) { printf("%c",string[i]); } else { ch=string[i]; top=PUSH(stack,top,ch); } } while(top!=-1) top=POP(stack,top); printf(" "); return 0; }

Categories : C

error in the given code for infix to postfix conversion for input containing more than 2 operands
Indent your code In the stack trace: at Test.convert(Test.java:21) Is this line: if(check(exp.charAt(i))>check(exp.charAt(i-1))) So I think you mean: if (check(exp.charAt(i)) > check(s1.peek())) Now "The method check(char) in the type Test is not applicable for the arguments (Object)" is raised, so parameterized your Stack. That is, change: Stack s1=new Stack(); To (in Java 7): Stack<Character> s1 = new Stack<>();

Categories : Java

How to skip Invalid Email Ids in Postfix and prevent it from throwing error
You can activate/configure postfix ability of *address_verification* (see also http://www.postfix.org/ADDRESS_VERIFICATION_README.html) to block unknown sender.

Categories : Java

Simple python validation library which reports all validation errors instead of first failed?
I have used jsonschema before and it is exactly able to do what you want it to do. It also does exception based error reporting if you want, but you can also iterate through all validation errors found in the doc, I've written a short example program which uses your schema (see the Json Schema V3 Spec) and prints out all found errors. Edit: I've changed the script so it now uses a custom validator which allows you to roll your own validation, the code should be self explanatory. You may look up the jsonschema source for infos on extend and how validators are extended/coded. #!/usr/bin/env python2 from jsonschema import Draft3Validator from jsonschema.exceptions import ValidationError from jsonschema.validators import extend import json import sys schema = { "type": "object", "r

Categories : Python

BeanCreationException Error creating bean … ClassFormatError … javax/validation/Validation need sustain
Add the javax.validation dependency to the pom.xml, also make sure that you already don't have any jar linked to your application with the classes of this jar. <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version> </dependency>

Categories : Spring

INotifyDataErrorInfo Entity-Level Validation. How to raise a Validation.Error event?
Event Validation.Error is an RoutedEvent and its always raised once your validation returns false in a binding. <StackPanel Validation.Error="OnError"> <TextBox Text="{Binding PropertyName, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" /> </StackPanel> Inside your code behind of MainWindow you will need something like this: public void OnError(object sender, ....) { .... }

Categories : C#

Remote validation MVC 4.0 : multiple fields validation does not clear error
A similar question was asked here. The solution is to use a helper method as described by Kiff.

Categories : Asp Net Mvc

LD_DEBUG on FreeBSD
I believe you will have to turn rtld debugging on in the source code in order for LD_DEBUG to have effect on FreeBSD. So, the short answer is -- no, LD_DEBUG does not do anything unless you rebuild runtime linker with -DDEBUG. That said, there's still a lot of useful info that runtime linker can produce. See rtld man page for the details: http://www.freebsd.org/cgi/man.cgi?query=rtld

Categories : Debugging

Compiling Qt5 in FreeBSD console
Some effort has been made for that. The compiler requirement is GCC 4.6. There's also some discussion about Qt5 and BSD on Qt Project website. They say the X11 version is compatible with BSD, but you must compile it from source.

Categories : Qt

How to set JAVA_OPTS for tomcat on FreeBSD?
I suspect that the server process on the machine is not picking up right Java OPTS. Please try to find the process on the server and check the parameters being passed. In Linux, its usually be ps -ef | grep tomcat or ps -ef | grep java to find out the process and verify the JVM parameters. Edit 1: the is a sample output of the command to find process, which might indicate the java opt parameter values: local-vm-1 [5]:ps -ef | grep tomcat tomcat 4141 1 0 07:38 ? 00:01:33 /apps/mw/jdk/1.6.0.17-64bit/bin/java -Dnop -Xms1024m -Xmx1024m -server -DTC=testplatform -DWMC_ENV =test -XX:MaxNewSize=112m -XX:NewSize=112m -XX:SurvivorRatio=6 -XX:PermSize=256m -XX:MaxPermSize=256m -Dsun.net.inetaddr.ttl=0 -DLISTEN_ADDRESS=wsx -test-vm-dtcp-1.managed.com -Djavax.net.ssl.

Categories : Java

Send keys to FreeBSD in VirtualBox
It's possible that VirtualBox is filtering the keys, since it's stateful as to whether or not the keyboard and mouse are bound to the VM or to the host and VBox's UI. You might be able to hack this by generating a mouse click event in the middle of the console display to make sure VBox has bound the keyboard to the VM, and then start the send keys. Also, Vbox has a scripting system. If you can't get this to work, maybe you could use that to get done what you need.

Categories : C#

SO_BINDTODEVICE option support for FreeBSD
You can use sendto if you are working with IPv6, see this example. Unfortunately this doesn't work with IPv4. As antiduh said, you can use libpcap to capture packets, provided you have access to /dev/bpf (which is usually restricted to root).

Categories : Sockets

OpenJDK 7 2011 port for FreeBSD 6.3
You may try the packages under packages-current, later versions are available and probably compile on 6.3 Riken Current Package Repository . You are unable to compile on the older versions because you might need to update the libc++ libraries which are required by the older versions.

Categories : Java

FreeBSD : Definition of BUS_TEARDOWN_INTR not found
It is a generated function by sys/tools/makeobjops.awk. Look at sys/kern/bus_if.m for the source. You can see the generated code in GENERIC/bus_if.h in your object directory after a kernel build. (or substitute your kernel name for GENERIC if you've changed it.) The function also has a man page. type: man 9 BUS_TEARDOWN_INTR To read the documentation.

Categories : C

SQLite3 on freebsd - compilation of first program
You need to tell gcc where to look for includes, and you need to tell it to link against sqlite's library, which is probably called libsqlite.so You're looking for something along the lines of gcc -I /usr/local/include -lsqlite test.c.

Categories : C++

Order of linkinkg libc and libpthread on FreeBSD
Compile and link using the option -pthread. Note the missing "ell". Update: -pthread instructs all tools involved in creating a binary (pre-processor, compiler, linker) to take care that the application/library to be build runs as intended. (This obviously is only necessary if the source makes use of any member(s) of the pthread_*-family of functions.) Whereas -lpthread links a library called libpthread, nothing more and nothing less. The difference in detail is implementation specific. Note: if -pthread has been specified -lpthread is not necessary as well as not recommended to be specfied.

Categories : Gcc

How to remotely regain wheel group on FreeBSD?
I would say you're hosed, but there are a few things you can try: su to another user that is in the wheel group. Obviously, you need such a user ssh as root. This is unlikely to work, since by default you can't ssh with root use sudo if you have it installed and configured work with the virtual machine provider to give you a secure console (one that allows root login) Again, the first 3 are pretty unrealistic since they won't work using the "default" FreeBSD install. The last one is probably your best bet.

Categories : Misc

cassandra 1.2 fails to init snappy in freebsd
The problem is that there is no FreeBSD library included in the snappy JAR file that comes with Cassandra. Install the archivers/snappy-java port, delete the snappy-java JAR file that came with Cassandra, and copy /usr/local/share/java/classes/snappy-java.jar into Cassandra's lib directory.

Categories : Cassandra

freebsd 9.1 apache-mpm php5 child segmentation fault
The first step in investigating crashes is to obtain the stack from the core-dump. Obtaining core-dump of Apache may be tricky -- because they are often disabled by default. But it can be done. Now, the fact that it works on Windows is not, actually, proof, that it is not the php-code -- whatever the problem is, it may be triggered by the "just right" sort of racing between threads. The OS, the number of CPUs, and other factors all affect the results of a race... And finally, are you sure, you are using thread-safe (zts) version of PHP itself?

Categories : PHP

How to create mode_rewrite rule on Apache Server FreeBSD 8.1
Assuming, you want users to enter the shorter url this.domain.com/index and serve the php at this.domain.com/html/folder/index.php; add the following rules to the .htaccess at root /. Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^this.domain.com$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ html/folder/$1.php [L] I'm not sure what you mean by changing your domain to something else. this.domain.com can be changed to that.domain.com or addon-domain.com but would make sense only if their DNS point to the same server (to serve shared content). Otherwise, it's like an external redirect to some other site. RewriteCond %{HTTP_HOST} ^this.domain.com$ [NC] RewriteRule ^(.*)$ http://that.doma

Categories : Apache

FreeBSD newbus driver loading succesfully but cant create /dev/** file and debugging
I guess printf works fine, but I prefer to use device_printf as it also prints the device name, and will be easier when looking through logs or dmesg output. Also leave multiple debug prints and check the log files on your system. Most logs for the device drivers are logged in /var/log/messages. But check other log files too. Are you running your code on a virtual machine? Some device drivers don't show up their device files in /dev if the OS is running on a virtual machine. You should probably run your OS on actual hardware for the device file to show up. As far as I know, you can't see the output in dmesg if you cannot find the corresponding device file in /dev but you may have luck with logs as I mentioned. The easiest way to debug is of course using the printf statements. Other than

Categories : Debugging

Struts 2 json validation return error Json when validation correct
You must use RequiredString Validator instead of Required Validator. RequiredString is for text fields only, Required is for all the other fields <validators> <field name="name"> <field-validator type="requiredstring" > <message>You must select a name</message> </field-validator> </field> </validators> Link to the official documentation RequiredStringValidator checks that a String field is non-null and has a length > 0. (i.e. it isn't ""). The "trim" parameter determines whether it will {@link String#trim() trim} the String before performing the length check. If unspecified, the String will be trimmed.

Categories : Validation

Installing python-flask gives Error [python setup.py egg_info failed with error code 1]
You can always got to pypi and download packages manually. https://pypi.python.org/pypi/Flask And then put the flask folder into the C:Python33libsite-packages. The problem you have is that the installer is not made for python3. This makes me think that they did not prepare flask for python 3 which makes me guess that if you install flask under Python 3 you will have more problems. But you can try and be lucky.

Categories : Python

Getting error on validation error when signin / signup are on home page
class SessionsController < ApplicationController def create @user = User.find_by_email(params[:session][:email].downcase) if @user && @user.authenticate(params[:session][:password]) sign_in @user redirect_back_or user_path(current_user) else flash.now[:error] = "Invalid email/password combination" @user = User.create(email: params[:session][:email], password: params[:session][:password]) @showerror = true render 'static_pages/home' end end end you should use instance variable @user,because in view @user is used when register failed.

Categories : Ruby On Rails

Python ttk entry validation with hex value
Assuming there are no special characters in the string (like $ or 0x): def OnValidateCheckSum(self, P, d): valid_hex_char = lambda c: c in 'abcdef0123456789' return (len(P) < 5) and (all(valid_hex_char(z) for z in P.lower()))

Categories : Python

Use of $ in postfix expression
In this case, I am certain the operator is exponentiation. 8 3 4 + - 3 8 2 / + * 2 $ 3 + is: 8 3 4 + - = 1 3 8 2 / + = 7 1 7 * = 7 7 2 $ = 49 49 3 + = 52. Or maybe 7 2 $ = 128 128 3 + = 131. Depends on how your instructor defined the operator.

Categories : Database

operator++ postfix is not declared
If vec1 and vec2 are vectors, they don't have increment operators. They're containers. You need to use iterators to traverse them. Something like: auto it1 = vec1.cbegin(), it2 = vec2.cbegin(); while ( prefix_length < 3 and it1!=vec1.cend() and it2!=vec2.cend() and equal(*it1++, *it2++) ) ++prefix_length;

Categories : C++

PHP force transport into PostFix
Take a look at php.ini file /etc/php5/apache2/php.ini on debian: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = me@example.com Uncomment sendmail_from: and set it to your needs. Make sure you do: service apache2 restart or service httpd restart to change take effect. Hope it helps, Mirko

Categories : PHP

Postfix statistics of each user, how do?
Try using postfix-logwatch # Sample Usage perl postfix-logwatch --nosummary --nodetail --limit envelopesenderdomains='2 1:10: 2:8:' /var/log/maillog # Command says Give 2 level output in which give top ten domains in level one( 1:10:) and top 8 users in each domain ie. level two ( 2:8: ) ****** Detail (2) ********************************************************************************** 72488 Envelope sender domains ----------------------------------------------------------------- 14055 intranet.domain1.com 6912 domain1-owner 1203 owner 486 cmowner 370 sysaduser 219 cowner 185 towner 175 autoowner 167 cpanel-owner ... 8867 live.com 8867

Categories : Linux

Overloading postfix operator ++
Non-member overloads also use a dummy int parameter to distinguish them: friend void operator++(Number&); // prefix friend void operator++(Number&, int); // postfix Note that some people might expect these to emulate the behaviour of the built-in operator by returning, respectively, the new and old values: Number& operator++(Number& fst) { fst.number=fst.number+1; return fst; // reference to new value } Number operator++(Number& fst, int) { Number old = fst; ++fst; return old; // copy of old value }

Categories : C++

Send mail using php and postfix
PHP runs on the server. onClick executes Javascript on the CLIENT machine. You can NOT directly invoke PHP functions via Javascript code, or vice versa. What you're doing can be accomplished with a simple form: <?php if ($_SERVER["REQUEST_METHOD"] == 'POST') { $to = $_POST['to']; $text = $_POST['text']; mail($to, .....); } ?> <form method="POST" action=""> <input type="text" name="to" /> <input type="text" name="text" /> <input type="submit" /> </form> There is no need to use Javascript at all.

Categories : PHP

Emails with same domain does not go out from postfix
Check the settings in your /etc/postfix/main.cf file, specifically the setting for virtual_mailbox_domains. If your domain is in this line, but another server is the MX for your domain, then this would explain the problem - i.e. the postfix server thinks it's handling incoming mail for your domain, but the MX records say otherwise.

Categories : Email

Postfix with ip address instead domain name
As far as I know there is no way to make postfix send mail to the Internet without FQDN. It can be set up to exchange mail between local users, though, but that's obvoiusly won't help you. The reason behind it is quite simple: vast majority of the mail servers are verifying peer's identity on SMTP connection using reverse DNS lookup. If your IP has no nice DNS name assigned, then your mail is quite likely to be considered a spam. So even you will manage to bypass FQDN requrement your recipients still may not receive your mails. It can be even dangerous, as your IP may get stuck into spam lists after that. I see two options for your here: Wait for the correct domain name to be associated with your IP Or use mailbox on an established public service like gmail or hotmail to send mails from

Categories : PHP

alias_maps in postfix like GMail does
Postfix and virtualmin both support alias "like" gmail with simple config. Just go to "System Information > Postfix Mail Server > General Options" (http(s)://<yourserver>:<vitualminport>/postfix/general.cgi). Search for "Separator usernames / address extensions" field (press ctl+f and type "address extensions", for quick search) and fill it with "+". Alternatively you can edit /etc/main.cf and place a line like recipient_delimiter = +

Categories : Email



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