72 Discussion / Question Topics

Remove Filter
Member Avatar for James_43

Hi all, I'm having a lot of trouble with building a network for my virtualised OS's. The server has two physical NICs for LAN and WAN. The host has IP 10.0.0.1. I use the following iptables to bridge them. iptables -t nat -A POSTROUTING -o wan -j MASQUERADE iptables -A …

Member Avatar for James_43
0
404
Member Avatar for James_43

Hi all, I'm using the Laravel framework to create an application, and have a database question. I have a table called `posts`. I have been pulling the 10 most recent rows from here and making use of an offset variable for pagaination. Now however I also have a table `media` …

Member Avatar for James_43
0
162
Member Avatar for James_43

Hi all, Say I have a table called "posts" with thousands of records. For each user, I want to display the top 10 most recent posts. I would normally use: `select * from posts order by created_date desc limit 10` However, doesn't this select ALL records and then removes all …

Member Avatar for ryantroop
0
192
Member Avatar for James_43

Hi all, Submitting forms to PHP is easy with Ajax. But what if I wanted to design my website to allow for JS-free web browsers? If I call a PHP file with Ajax, I might get an error message in return to dynamically add to the page, but if I …

Member Avatar for jacks009
0
235
Member Avatar for James_43

Hi all, I have a text box. When users press enter, it triggers the submit function: commentContent.keydown(function(e){ if(commentContent.is(":focus") && (e.keyCode || e.which) == 13 && !e.shiftKey) { e.preventDefault(); commentForm.submit(); } }); This then prepends the content of the text box into the HTML. `commentsHere.prepend(commentData);` However, when I search for this …

Member Avatar for James_43
0
14K
Member Avatar for James_43

Hi All, Relatively new to JS, but something strange is happening. I have one function: var commentContent = $('textarea.comment-box#comment'); commentContent.keydown(function(e){ if((e.keyCode || e.which) == 13 && !e.shiftKey && commentContent.is(":focus")) { e.preventDefault(); commentForm.submit(); } }); Which works absolutely fine. If the object is focused and I press Enter, the submit function …

Member Avatar for hielo
0
226
Member Avatar for James_43

Hi all, I've been trying to create a friendly time function for a while, it's purpose should be quite obiovus from the code below. Currently, it outputs "expired" for everything. I am so utterly confused from visualising the code and trying to figure out where the times lie in relation …

Member Avatar for James_43
0
309
Member Avatar for James_43

Hi all, In PHP just wondering if anyone knows whether one method of creating multiple indexes within an array is more efficient / preferable to another? ` $listing['one'] = $x; $listing['two'] = $y; $listing['three'] = $z; ` or: $listing = [ ['one'] => $x, ['two'] => $y, ['three'] => $z …

Member Avatar for James_43
0
196
Member Avatar for James_43

Hi all, wondering if the following is possible. A MS Exchange server is connected to an Outlook client. Would it be possible to capture sent/recieved emails and add them to a database using PHP. I would like to investigate whether I could use this functionality to create a small email …

Member Avatar for rproffitt
0
217
Member Avatar for James_43

Hi all, Problems trying to login with Facebook on a website. The issue is that it works for me, but when I add other tests in the App settings, it doesn't work for them, they are getting the error: `Facebook SDK returned an error: Cross-site request forgery validation failed. The …

Member Avatar for James_43
0
376
Member Avatar for James_43

Hi all, Something disturbing is happening... I make an AJAX call to a page and it returns unprocessed PHP, not HTML. However, when I navigate to the page manually, the PHP is processing as expected. This must be a huge security vulnerability? My AJAX call is: $('#forgot').click(function(e){ e.preventDefault(); lFormContainer.load("ajax/?page=authenticate/username"); }); …

Member Avatar for James_43
0
680
Member Avatar for James_43

Hi all, I'm running into a problem with PHP and mysql. I run a mySQL query, which returns the following object: `mysqli_result Object ( [current_field] => 0 [field_count] => 2 [lengths] => Array ( [0] => 1 [1] => 186 ) [num_rows] => 1 [type] => 0 )` I then …

Member Avatar for rubberman
0
290
Member Avatar for James_43

Hi all, I currently have two tables that look like this: COMMENTS +----+-------------------------+--------------+---------+---------------------+----------+ | ID | comment | profile_post | creator | created | approved | +----+-------------------------+--------------+---------+---------------------+----------+ | 1 | This is a test comment | 3 | 1 | 2016-02-26 12:26:36 | 1 | | 2 | 0 | …

Member Avatar for Nutster
0
169
Member Avatar for James_43

Hi all, I was recently reading an interesting article about setting up an SSH honeypot to track malicious activity (article avaliable here http://www.symantec.com/connect/articles/analyzing-malicious-ssh-login-attempts) The article mentions that after an attacker gained SSH access to a server, they installed an IRC bot. Now, my knowledge of IRC is very limited, but …

Member Avatar for James_43
0
321
Member Avatar for James_43

Hi all, I am running a mySQL database on a webserver hosting multiple Wordpress installations. It seems that database is getting swamped with memory and going into a continual loop of shutting down and restarting. A reboot fixes the issue temporarily, but I have no idea what I can do …

Member Avatar for James_43
0
542
Member Avatar for James_43

A theoretical question about connecting to hidden services through PHP. Say I am writing an application on the clearnet that relies on data stored within a mySQL database that is hosted on a hidden Tor service. How would I initiate this connection? Some brief research has pointed me towards the …

Member Avatar for cereal
0
1K
Member Avatar for James_43

Hi all, I am doing some basic experimenting with ENCOG ANN, but am having issue following a simple walthough. At this stage I am simply trying to grab data from a CSV and normalise it. My code is: string filename = "spots.csv"; var format = new CSVFormat(',', ' '); IVersatileDataSource …

Member Avatar for Christian_7
0
493
Member Avatar for James_43

Hi all, In all my time with PHP I have only ever seen one way of adding a variable onto the end of the string: $string = "hello" . $variable; However, recently I came across another method, which was used in the context of constructing a mySQL query. Can someone …

Member Avatar for diafol
0
432
Member Avatar for James_43

Hi all, I just have a question about how PHP works. Say I have several classes that I call but don't `unset()` once I've finished with them, how long will the server hang onto that data. Is it completely dependant on the client connection to the server? Similarly, I understand …

Member Avatar for jkon
0
206
Member Avatar for James_43

Hi all, just a quick question. I believed that `$('#value')` was a jQuery function equivalent to `document.getElementById('value')` however, in the code below, only the second function gives the desired result. Can someone explain why this is? $('#value').value = "1"; document.getElementById("value").value = "1";

Member Avatar for AleMonteiro
0
223
Member Avatar for James_43

I'm having some real trouble running some basic queries that I should be able to run easily. I have a table called settings. When I query `SELECT * FROM settings` I get the output: +----+-----------------+--------------------------------+ | ID | key | value | +----+-----------------+--------------------------------+ | 1 | view | default | …

Member Avatar for James_43
0
397
Member Avatar for James_43

Hi all, I'm having some serious issues with AJAX forms. I'm currently using jQuery 2.2.0 and the jQuery Form plugin. I have a simple php file: <?php if(isset($_POST)): print_r(json_encode($_POST)); endif; ?> I have a simple html form: <form method="post" id="regform"> <input id="login_name" name="login_name" type="text" > <input id="login_password" name="login_password" type="text" > …

Member Avatar for James_43
0
235
Member Avatar for James_43

Hi all, I have two square <div> containers one under the other. When I click a button, I would like the second <div> to fade on top. Because the top <div> is transparent, the bottom <div> needs to be hidden first. I have given the second div a Z-index of …

Member Avatar for James_43
0
510
Member Avatar for James_43

Hi all, I have an array of objects that looks like this: object(stdClass)[2] public 'statuses' => array (size=97) 0 => object(stdClass)[3] public 'metadata' => object(stdClass)[4] public 'iso_language_code' => string 'en' (length=2) public 'id' => int 700797209428668416 1 => ... n => ... I a simply trying to iterate through the …

Member Avatar for James_43
0
223
Member Avatar for James_43

hi all, I am trying to make an array that looks like this: Array ( [status] => [MERGE0] => removed@email.address [merge_fields] => Array ( [MERGE1] => James [MERGE2] => doe ) ) In my code, there is an undefined number of [merge_fields], so I am using the code below to …

Member Avatar for diafol
0
147
Member Avatar for James_43

Hi all, I am trying to get a for loop to cycle through, sleep, and then keep going until a specified time. I'm running into memory errors and unsure whether this is legitimate, or because its created a memory leak. My code is: $currentTime = time(); $time = time(); while …

Member Avatar for Taywin
0
225
Member Avatar for James_43

Hi all, I'm using nginx to host multiple servers on one terminal through virtual hosts. Each one needs to be able to send emails, but I am unsure how to specify which account to use when I call the php mail() function. Should I be specifying in the nginx configs …

Member Avatar for Tonc
0
1K
Member Avatar for James_43

Hi all, I am aiming to create an array with the same structure as this: Array ( [798D25C0DEABD] => Array ( [quantity] => 1 ) [40B2B0FA3D222] => Array ( [quantity] => 1 ) ) The code I am using is therefore: for($i = 0; $i < count($response); $i++) { $ph[] …

Member Avatar for James_43
0
335
Member Avatar for James_43

hi all, I have been coding a payment gateway using a company called SwipeHQ. Using their APIs I have programatically created products from my website and make sure they stay updated. However, I'm now completely stuck about how to have my checkout navigate to their payment form and then return …

Member Avatar for cereal
0
411
Member Avatar for James_43

Hi all, Been really trying to get a grips with objects in PHP. I think my lack of understanding isn't helping here! Basically, with the help of another user here I managed to filter some object values and add them a nice array. I used the following code: $i = …

Member Avatar for jkon
0
281
Member Avatar for James_43

Hi all, I have a fairly limited understanding of how objects work exactly, but basically I have: `$response[] = $html->data->identifier;` Which I would think stored the values as an array, but when I try to add something to that array with: `$response[] = array('quantity' => $itemsinfo['qty']);` I get the error …

Member Avatar for paulkd
0
267
Member Avatar for James_43

Hi all, So I've never really understood the php mail function, but I've tried to set up msmtp after failing a bit with postfix. The problem I get now is when I go to send an email I get an error "unpexted TLS packed recieved". My account conf is: account …

0
106
Member Avatar for James_43

Hi all, my understanding was that Nginx doesn't do any caching unless you tell it to. However, for some reason, all my filles are being cached, and so the website doesn't respond to change in css or js files etc. I thought that the below server{} code would help: location …

0
116
Member Avatar for James_43

Hi all, Brand new to nginx, but it seems to be the rising star, and suited to hosting high volumes like I'm doing. However, I'm having trouble setting up the config files. A day of google searching hasn't really helped. My nginx.conf looks like: events { worker_connections 768; # multi_accept …

Member Avatar for James_43
0
256
Member Avatar for James_43

Hi all, I have a HTML video within a div that is 100% width of the page. I want the video fill the container and crop the height to fit. But so far I cannot get the video to expand at all! I'm simply using: .video { width:100%; } and …

Member Avatar for James_43
0
3K
Member Avatar for James_43

Hi all, I am tying to have a page header transparent with the background blurred behind it. So far, for some reason, the blur overlay is only blurring the logo in the header, but nothing else?? my HTML is: <div class="overlay-blur"> <div class="page-header"> <img src="http://test.com/wp-content/uploads/2015/11/Strong-Links.jpg" class="logo"/> </div> </div> And CSS: …

Member Avatar for James_43
0
686
Member Avatar for James_43

Hi all, I'm very very new when it comes to JavaScript, but I understand it's what I need to solve my problem. Basically, I have a PHP script that takes a while to process (several minutes). This script is linked from my homepage and when the script finishes it redirects …

Member Avatar for James_43
0
11K
Member Avatar for James_43

Always get really confused when dealing with timezones... I have a string `8/11/2013`, which I apply the following code: $firstDate = new DateTime($rawData[$backdate][0]); $firstDate = $firstDate->format('d/m/Y'); The issue is that PHP seems to think that the '11' is the day, when it's actually the month (I'm in NZ). When I …

Member Avatar for James_43
0
199
Member Avatar for James_43

Hi all, quite a strange problem here. I have a csv file with rows: 20/12/2011 4.75 4.75 4.53 4.55 94.74 432.98 4.57 21/12/2011 4.38 4.38 4.38 4.38 20.9 91.54 4.38 22/12/2011 4.19 4.19 4.17 4.17 8.54 35.71 4.18 23/12/2011 3.86 4.35 3.84 4.22 149.49 625.81 4.19 24/12/2011 4.33 4.33 4.33 …

Member Avatar for James_43
0
278
Member Avatar for James_43

Hi all, I'm working with a function that only accepts values between 0 and 1, so I need to scale my data first. The first part involved in this is calculating the high/low values of my inputs. I pass this into a function that churns out X and Y values …

Member Avatar for James_43
0
117
Member Avatar for James_43

Hi all, I have an array $pTimeseries with 365 items inside it. I use a simple for statement, as below: //Add TimeStamp to Historic Data for($i = 0; $i < (count($pTimeseries)); $i++) { $pTimeseries[$i][1] = $rawData[$i + $backdate][0]; } In my Apache error logs I get "Undefined offset: 366" all …

Member Avatar for James_43
0
128
Member Avatar for James_43

Hi all, For some reason, a white edge has appeared down the side of my website. It was never there before. The web suggested I should make sure to reset margins etc to 0 at the top of my stylesheet, which I already do. The edge is not due to …

Member Avatar for James_43
0
206
Member Avatar for James_43

Hi all, I've been trying to follow the basic Apple developer tutorial, where you create a food tracker app. I can not get one part of the code to work, and I can't see why. Not only is it exactly the same as in the example, but searches online also …

Member Avatar for James_43
0
807
Member Avatar for James_43

Hi all, I have a multidimensional array [0]:[0], [1], [2], [3] and I want to try and find the min and max values of each index of that array over the whole array. I am using: for ($i = 0; $i < count($input); $i++) { $string1[] = $input[$i][1]; $string2[] = …

Member Avatar for James_43
0
180
Member Avatar for James_43

Hey there, Over the past few weeks as an excerise I've been trying to create a C# image viewer. At the moment I have one window, with a list of images displayed in a ListBox. When I the F5 button, a second window pops up at fullscreen, and I want …

Member Avatar for James_43
0
1K
Member Avatar for James_43

Here's a fun one... How would you solve a basic simultanous equation with PHP? I have an array with a range [high,low] of [378,395] and I want to normalise the data in that array between the values of [-1, 1]. From that, using `x => ax + b`you get the …

Member Avatar for jkon
0
620
Member Avatar for James_43

Hi all, I am using a for statement to generate lots of arrays, example: Array ( [0] => 2 [1] => 395.0 [2] => 0.33 ) Array ( [0] => 3 [1] => 394.0 [2] => 0.81 ) But, I want to have them all within 1 array, example: Array …

Member Avatar for James_43
0
303
Member Avatar for James_43

Hi all, I am able to pull data from a CSV file into a string array using the following code. public static string[,] ReadCSV(string filename) { //Read Text string whole_file = System.IO.File.ReadAllText(filename); //Split into Lines whole_file = whole_file.Replace('\n', '\r'); string[] lines = whole_file.Split(new char[] { '\r' }, StringSplitOptions.RemoveEmptyEntries); //Calucluate Rows …

Member Avatar for ddanbe
0
285
Member Avatar for James_43

I am using a mySQL query in PHP to pull content from rows into an array. A simple for statement is then displaying this data: for ($i = 0; $i < ($num_rows); $i++): //Find Author Name $query = 'SELECT firstname, lastname FROM vd_users WHERE id = ?'; $statement = $mySQL_con->prepare($query); …

Member Avatar for James_43
0
224
Member Avatar for James_43

Hi there, I'm still fairly new to programming. Would someone be able to explain exactly how different windows should be used in MS Visual Studio? It seems that variable sharing between different windows is problematic. So does that mean that if you are trying to do multiple things on one …

Member Avatar for ddanbe
0
287

The End.