w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
can __RequestVerificationToken_Lw__ be stolen ? Are they really secure?
when you use AntiForgeryToken there will be a hidden input generated for you on the page, and asp.net will check it with the cookie or if the cookie is disabled with urls query strings, and it is safe, and this AntiForgeryToken thing is different for every user, can't be stolen

Categories : C#

Char stolen by regex
[^#] will eat one character that is not #. In your case, that is your V character. If your regex engine supports look-ahead, you can probably use that to determine whether the next character after the initial # will be a whitespace (do not include in recognized headline text or anything else except for a # (do include in recognized headline text). Otherwise, the probably easier way to go would most likely be to include the whitespace in the capturing group and trim the string afterwards in your host language: /^#((?:s|[^#]).*?)s*#* +/m This will consider the initial series of # signs finished as soon as either a whitespace or a non-hash sign is found (both of which are included in the capturing group). (Note that I'm using the (?:) syntax for the inner non-capturing group, which might

Categories : Regex

Server-side checking if cookie stolen
Yes, there is a way. It is called Secure Cookie Protocol. You are using SSL right? (because if you're not, this entire conversation is pointless). Well, you encrypt the cookie, but using the SSL session identifier. Assuming that SSL gives you adequate endpoint security (strong ciphers, etc), SCP should protect your data and allow you to tell when another SSL session tries to use the same cookie (because the sessionid changes, and therefore the MAC will change). key = HMAC(user name|expiration time, secret_key) cookie = user name|expiration time|encrypt(data, key) cookie = cookie | HMAC( user name|expiration time|data|sessionid, key) So basically, you're creating a unique verification code based on the SSL session identifier. Note that REMOTE_ADDR or user agent never factors in. The

Categories : Security

How measure time stolen from virtual machine, in Scala/Java?
I doubt these tools would be virtual machine aware. I suggest polling System.nanoTime() periodically and when you see a jump in time, your thread was not running. You could even do something like jHiccup which just waits for a milli-second and times how long that took. Note: this can show very poor results even if the box is idle for virtual machines, so you have to tune it for your machine.

Categories : Java

How to host server from laptop?
connect to 127.0.0.1 instead of your public ip. 127.0.0.1 is called localhost, and always points to your own machine. That way it doesn't matter if any NAT routing firewalls or anonymous proxy servers are hiding your local network IP from whatismyipaddress.com

Categories : Python

Resolution on my laptop and pc for my program
Instead of Windows Forms, you should use WPF, it solve that kind of issue. Look at Resolution independent or monitor size independent WPF apps. You can with VS'12 create WPF UI with C++/CLI it can provide an easy integration of your C++ native code.

Categories : C++

AS3 slow webcam with 1080p on i3 laptop
The simple truth is that Flash's performance is not good enough for realtime video applications. Maybe lag would be better if you could attach your webcam to StageVideo (GPU decoding) instead of using the old Video class. Or you could simply lower the resolution... If you want to develop realtime video applications you should take a look at Cinder, or OpenFrameworks instead. Both use C++ and performance is amazing. I have personally done projects involving 4k video on multiple monitors with Cinder. Another option would be using Max MSP, much more powerful than Flash in terms of video performance, and you program visually using nodes and boxes.

Categories : Actionscript

How can i redirect my laptop mic to gsm modem input..?
It is not that easy. You see, the modem hardware in a laptop is not connected to the audio system in any way. So there is no physical way to route the output of the sound chip to the telephone line connected to the modem. However, some modems support a AT+VTX command that allows you to send uncompressed, 8-bits sampled audio at 8 kHz. That should let you do what you want to achieve. Wikipedia explains the basics of this approach nicely.

Categories : Java

sending data from PIC to laptop via bluetooth
You can use two HC-05 Serial Port Bluetooth Module. You can find a lot of tutorials like this explaining how to deal with them.

Categories : Windows

Emulating an XBox 360 controller from (not for, from) a laptop
If you have access to a development console and the SDK I could help you out, the task is essentially impossible with a retail console and your laptop or xbox would require some hardware modifications to work properly, unless you want to connect via a USB. It might be more plausible then. Regardless, if you have access to the proper software I might be able to lend you a hand.

Categories : C#

Viewport userscalable for laptop/desktop
The viewport meta tag doesn't affect desktop browsers. It is purely for targeting mobile browsers. You can use the following CSS to try and prevent text zooming in desktop browsers: <style type="text/css"> -webkit-text-size-adjust:none; -ms-text-size-adjust:none; -moz-text-size-adjust:none; text-size-adjust:none; </style> However, this is experimental only and widely unsupported; See Moz Developer Network:https://developer.mozilla.org/en-US/docs/Web/CSS/text-size-adjust Personally, I think that preventing a user from zooming in a browser will lead to awful accessibility. Some users need to zoom in to consume content on the web. If you're interested in creating a webpage that functions correctly and is still accessible, check out the W3 accessibility guidelines: http://www

Categories : HTML

USB transfer speed between tablets and laptop
if your using a USB hub from you Mac it will slow down but not by much. Its because you will be using more bandwidth of the USB XHCI Host Controller. So the devices needs to split speeds to how ever many locations you are copying to and files copying concurrently. Also the CPU needs to work slightly harder therefore slowing down other processes. However on ADB the difference is negligible. You will not be able to tell I'm pretty sure this is the case anyways

Categories : Android

decimal to ip adress
inet_ntoa is specified as taking its input in network byte order. You are providing the input in host byte order, which on x86 systems is backward (little endian vs. big endian). You need to pass the decimal address through htonl first.

Categories : C

Setting up Java compiler on Windows laptop
It looks correct. Did you restart the Command prompt every time you changed the PATH variable ? Also there's supposed to be only one path variable, so you're supposed to edit the existing one, entries are separated by a semi-colon (;).

Categories : Java

Algorithm for touch detection on laptop touchpads?
I am not touchpad expert, but here a some ideas: Pressed keyboard keys shortly before and after touchpad (TP) event; Series of events starting from tapping, (not moving); If TP is capable to tell area of touching: big area is touched (palm, not a finger);

Categories : Algorithm

Java Robot class working in laptop but not pc
Surely the simple answer to this is not to cheat at games? Try adding e.printStackTrace() to your catch block and look to see if there are errors on the pc version and not on the laptop.

Categories : Java

ip adress change notifications
I would personally just poll the IP however frequently you find appropriate (once a second should be fine), using the code found here, and just store the previous occurrences result, see if it changes. What I would really recommend is setting up a simple delegate class that does this for you and will send a custom event to whatever class may need those updates. It should be pretty straight forward, especially considering it seems like you have some experience. UPDATE I have posted some code below that will create a delegate that will call back to whatever class once it detects any change in IP. Note there may be some errors/typos as I am not in front of a computer with XCode currently, but you should get the general idea. IPChangeNotifier.h #import <UIKit/UIKit.h> @protocol I

Categories : IOS

111-222-1933email@adress.tst hacker
I am not an expert in php, but I think PDO by itself does not protect you from sequel injections when you take input from the user. you still have to use the PDO method quote to protect yourself. http://php.net/manual/en/pdo.quote.php

Categories : Security

How to find country from ip adress?
Here is what I'd do: Using a HTTP transfer, query the site, and buffer the results Convert it into a String Use a splitting algorithm on it to make into an array. Check if the 0th element of the array equals 'OK' If not, bail out. If so, check the third and fourth elements for country code, and country name respectively.

Categories : C#

Can I run an app on a real device (iPhone) from a laptop (mac) with Appium - WebDriver?
The absolute path is a filepath to an application on your Mac that Appium will grab and install before starting the test you are trying to run. Currently the way that people are making this work for getting Mobile Safari open is using an absolute path to a program like SafariLauncher which opens Mobile Safari for you. After that happens you can retrieve the window handle of the webview within Safari and start running normal WebDriver commands. This workaround is discussed at length here. I can confirm that it works, but the timing of all these components working together is a bit janky, speaking from my testing experience. For reference, I believe these are the capabilities that I used to get myself up and running. capabilities.setPlatform(Platform.valueOf("MAC")); capabilities.setBrows

Categories : Java

Connect local rails app on my laptop to heroku database
Try something like this production: adapter: postgresql encoding: utf8 database: DB_NAME_FROM_HEROKU username: USERNAME_FROM_HEROKU password: PASSWORD_FROM_HEROKU host: HOSTNAME_FROM_HEROKU # something like ec2-xxx-xx-xxx-xxxx.compute-1.amazonaws.com sslmode: require to get the values, you need to run the following command $ heroku pg:credentials DATABASE Then start your app in production env $ rails s -e production Since the database is hosted on the internet, expect lot of latency & general lack of responsiveness when working with running on local machine connected to database in the cloud. PS: Ensure schema version of your local app matches exactly with remote database on heroku. Otherwise, there is a chance of dataloss when running migrations

Categories : Ruby On Rails

Thermal Printer - Laptop via FTDI Basic Board and C#
It looks to me like your wiring might not be correct. TX (transmit) on the FTDI board should be connected to RX (receive) on the printer. Likewise, RX (receive) on the FTDI board should be connected to TX (transmit) on the printer. See this tutorial for an example with further explanation: https://www.sparkfun.com/tutorials/224

Categories : C#

W3C geolocation API's watchPosition isn't working on GPS-equipped laptop when offline
I had this same problem using a Getac laptop with a gps chip. I extensively tested Chrome 33.0.1750.117, Firefox 27.0.1, IE 11.0.9600.16518 and Opera 20.0 and found that none of them use the local GPS chip. All of them instead call out to either Google or MS's location api. I guess this is because the browser implementors assumed that desktop operating systems like Windows and OSX do not have local GPS chips accessible to them. If they do not have an Internet connection, they cannot get their location. On iOS and Android, they made a different choice in their browser implementations and do in fact use the local GPS. The only solution I found for the laptop/desktop use case if you want get results from the local GPS chip is to integrate with it directly using GpsGate, which is a program y

Categories : Google Chrome

I'm not able to get any Linux Distro work on my Samsugn laptop. Any suggestions?
If the hardware support for your laptop is not great on any Linux distribution, you can try out virtualization (vmware, virtual box, ...). With help of this software you install your favourite Linux distribution in a 'virtual machine' and can use it from within Windows.

Categories : Linux

using QT process to get sensor information from the laptop using command line
process->start("sensors | grep "Core""); The problem here is that the start function takes the first parameter as the program to execute and then passes subsequent parameters to the program as arguments, so the | grep and "Core" are being passed to the sensors command, which is then complaining because it doesn't know what to do with those arguments. One way to solve this is to call sensors and get the returned information with readAllStandardOutput(). You can then either use the Qt string functions to search for the information you want, or if you set the standard output file with setStandardOutputFile, you can then call QProcess with grep on the that file. (Note QTemporaryFile may be of use here). However, the simplest way would be to create a small command line script that calls

Categories : C++

Joomla 2.5 not limit one vote per IP adress
Actually, Joomla! 2.5 only stores the last voter's IP address per item. If another vote comes from a different IP address, the user with the original IP address can vote again. This behavior is defined in /components/com_content/models/article.php, circa line 308. if ($userIP != ($rating->lastip)) { $db->setQuery( 'UPDATE #__content_rating' . ' SET rating_count = rating_count + 1, rating_sum = rating_sum + '.(int) $rate.', lastip = '.$db->Quote($userIP) . ' WHERE content_id = '.(int) $pk ); if (!$db->query()) { $this->setError($db->getErrorMsg()); return false; } } else { return false; } Changing it involves core file hacking. One thing that you can do make the test in the if clause alwa

Categories : Joomla

Getting the ip adress of the user connected to asp application
Here's the converted C# code from the similar question @jamieHennerley suggested. protected string GetIPAddress() { System.Web.HttpContext context = System.Web.HttpContext.Current; string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(ipAddress)) { string[] addresses = ipAddress.Split(','); if (addresses.Length != 0) { return addresses[0]; } } return context.Request.ServerVariables["REMOTE_ADDR"]; }

Categories : C#

extract email adress from csv file
Please adjust the regular expression if needed (S+@S+ probably too simple): grep -o -P 'S+@S+' input.csv From man grep: -o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. -P, --perl-regexp Interpret PATTERN as a Perl regular expression (PCRE, see below). This is highly experimental and grep -P may warn of unimplemented features. To sort and skip duplicates: grep -o -P 'S+@S+' input.csv | sort -u

Categories : Linux

Once SSHd into my windows laptop, Putty doesn't recognize python
Figured it out. I found this link: http://cs.nyu.edu/~yap/prog/cygwin/FAQs.html#bashrc which really helped. I went to the /usr/bin folder, then typed ln -s /cygdrive/c/Python27/python.exe and now I can type "python myfile.py" when ssh'd through PuTTY and it works!

Categories : Python

Copied my asp.net project folder to open it in my laptop, and css stoped working
I think one common mistake is having mismatching paths when you copy from one machine to another (at least in my workarea it is!) did you double check the paths to your CSS in code and filesystem? if the ASP.Net engine cant find the files it wont be able to use them.

Categories : Asp Net

Android mobile not detecting wireless network created on my laptop
Ad Hoc networks are not supported natively by Android devices, unless you get your device rooted and make some tricks in the underlying linux system. There are a lot of pages talking about that: http://dev.gadgeticworld.com/how-to-connect-android-devices-to-adhoc-network/ http://www.pcadvisor.co.uk/how-to/google-android/3372947/connect-android-phone-ad-hoc-network/ http://code.google.com/p/adhoc-on-android/ You can try this at your risk: http://www.arenddeboer.com/wifi-ad-hoc-enabler-for-android

Categories : Android

i am trying to make an ajax request from my phonegap app to servlet running on my laptop,
Are you using 127.0.0.1 or localhost for your IP? If so, you will need to use the actual IP of your machine when testing the app. This is because when you load the app into a device or simulator, 127.0.0.1 will resolve to the actual device or emulator itself, not your machine. (If using Android emulator, you can use 10.0.2.2 to get to your localhost on the machine, see http://developer.android.com/tools/devices/emulator.html#emulatornetworking).

Categories : Ajax

Why multi-touch events using touchpad (laptop) is not working in this Qt program?
To make touch events work add the following to your MainWindow: MyWidget *myWidget = ...; setCentralWidget(myWidget); In the MyWidget constructor add: setAttribute(Qt::WA_AcceptTouchEvents); //grabGesture(Qt::PinchGesture); //setAttribute(Qt::WA_InputMethodEnabled); //setFocusPolicy(Qt::WheelFocus); setAttribute(Qt::WA_StaticContents);

Categories : Qt

Render google map in wordpress, based on adress
You can edit the template file for these pages and embed a google map similarly to this example: https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple Note that it'll be better to perform geo coding of all addresses once, and save the coordinates in different custom field for each page -- that way you won't need to create geocoding request on each page load. Here is untested code that should be close to what you need: <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <!-- in the body --> <div id="map-canvas"></div> <script> (function () { var map = new google.maps.Map(document.getElementById('map-canvas'), { zoom: 8, center: new google.maps.L

Categories : Javascript

Sending form, only hash to url adress Symfony2
The reason is that when you render your forms you don't set appropriate action for the form. Instead you put "#" and that's why you got it. So all you need is change action attribute in your form elements. For exampe in author view change: <form action="#" method="post" {{ form_enctype(form) }}> into <form action="{{ path('url_author') }}" method="post" {{ form_enctype(form) }}>

Categories : Forms

EXC_BAD_ACCESS (code = 2, adress = 0x0) while changing value of boolean
BOOL *returnvalue = NULL; /* ... */ *returnvalue = YES; You first create a pointer to BOOL. You set the address it's pointing to to NULL. Then you try to set the value of the address it's pointing to to YES. Or short: You try to write at adress 0x00. That won't work. You want to use BOOL. The primitive type, without a pointer. - (BOOL) createLogin:(NSInteger *)user_id usr: (NSString *)username pwd: (NSString *)password date: (NSDate *)last_login{ BOOL returnValue = NO; /* ... */ returnValue = YES; /* ... */ return returnValue; }

Categories : Objective C

Increment a vector adress and assign it to a pointer
numbers++ is the equivalent of numbers = numbers + 1 However, numbers here is an array and you cannot modify the address of an array. lvalue doesn't mean a "left value"

Categories : C

a customer with more than one possible physical adress, how to design database schema?
One easy way to do it is to set up a customer and an address table. Keep all address fields in the address table and all demographic fields for the customer in the customer table: CUSTOMER TABLE id field1 field2 etc.. ADDRESS TABLE id customer_id type //billing, shipping, etc. street1 street2 city etc... You can then join the two tables in your queries and then select which address type you need at a given time. You would also likely have an unique index on the customer_id and type fields in the table.

Categories : Mysql

How to pass unknown URL value from browser adress to javascript source url?
You can get the window.URL and perform some regex to get the parameters. A nice function I have found: function gup( name ) { name = name.replace(/[[]/,"\[").replace(/[]]/,"\]"); var regexS = "[\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } Then you can add the whole script tag from within javascript like so <script> var oHead = document.getElementsByTagName('HEAD').item(0); var oScript= document.createElement("script"); oScript.type = "text/javascript"; oScript.src="other.js"; oHead.appendChild( oScript); </script> Where you can add your variables in the oScript.src Source Source2

Categories : Javascript

Android Socket doesn't connect to laptop server - but local Java program can
Oh boy this is silly and embarrassing. Basically I was using the wrong IP address (192.168....). In Windows, use ipconfig (Linux: ifconfig), and choose the IP address corresponding to Wireless LAN (wlan). I was using another IP address corresponding to a virtual machine or some crap. Hope this helps someone else in the future, I hate these kind of issues.

Categories : Java



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