[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/wdg/ - Web Development General
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 249
Thread images: 16
File: 1432504589476.gif (60 KB, 1024x874) Image search: [Google]
1432504589476.gif
60 KB, 1024x874
Death to PHP

> IRC
#/g/wdg @ irc.rizon.net
Web Client: https://www.rizon.net/chat

> Tutorials & Resources
https://www.codecademy.com/ — Learn to code.
https://www.bento.io/tracks — Start here if you’re new.
http://www.theodinproject.com/ — Alternative to above, focused on Ruby on Rails back-end.
https://developer.mozilla.org/en-US/Learn/Choose,_Install_and_set_up_a_text_editor — Choosing a text editor.
https://libraries.io/ — Discover new open source libraries, modules and frameworks.
https://www.coursera.org/browse/computer-science — CompSci courses.

> Getting Hired
https://pastebin.com/4YeJAUbT/ — NEET Guide to Web Development
http://elliotec.com/how-i-got-a-job-in-web-development/

Previous thread: >>51468957
>>
>unironically being a web developerr
>>
>>51494751
>unironically memeposting on 4chan
>>
>wanting to become a web developer
Y'know, I heard of Coprophilia, but I'd never have thought it exists in the programming world, too.
>>
Quick question - can you assign more than one id to something in HTML? I just found out you can assign more than one class to something.

I know id's are supposed to be for one specific thing, but is it possible to do it anyway?
>>
>>51494815
You should definitely use jQuery. It's really great and does all things
>>
File: 1440484010829.png (102 KB, 450x443) Image search: [Google]
1440484010829.png
102 KB, 450x443
>>51494817
>>
Continuing very important comment thread:

>>51491282

who dat
>>
>>51494815
I think there's a jQuery plugin for that.
>>
>>51494815
Nope, but I don't see why you would want to either.
>>
File: 765.jpg (49 KB, 568x378) Image search: [Google]
765.jpg
49 KB, 568x378
>>51494673
Neet squad strikes again :^)
>>
>>51494932
-1 Not enough jQuery
>>
need to write a java app 1 week to impress some people for a job interview.

What should i write?

using Java and Hibernate
>>
I am new to monetizing. How many visitors per month would it take to cover hosting/domain name etc? ~$100 a year.
>>
>>51494815
Ideally you should not be using ids in your CSS. Use them for things like jQuery selectors.

I don't completely follow this advice myself but that is what is recommended.
>>
Please help, I posted in the old thread but no one responded. I need to build an API that collects some information does some calculations and sends out mobile notifications to groups of people. What is the simplest way to do this? Parse, Meteor, Node? This is an MVP so I am looking for development speed as a priority over things like performance.
>>
>>51495516
Node, request module and notification module of choice, most likely just email.
>>
>>51494815
yes it's possible but retarded. if you use javascript or something to select from it, you will only get the first.
>>
>>51495601
I have no problem affording it. I'm just wondering if it would be worth putting ads on my site. If I need a million visitors a month to make $5 then I'd rather just leave them off.

Also I'm just planning ahead. I am going to buy a few domain names on Black Friday and next year I'll have to pay full price to renew them. So I would like to try to at least break even.
>>
>>51495175
some help¿
>>
>>51495845
How about you think of something yourself you fuck, or maybe you're not qualified for said job.
>>
>>51495886
you are mean :(

I got some ideas....I just want some quick shit to see what are you all thinking. But seams to me, you all are pieces of shit.
>>
>>51495969
as i said....pice of shit. Sorry /g/ this guy is here speaking for all you.
>>
>>51494673
>Death to PHP

This guy.
>>
>>51495999
99% of the time you should google you main question, before asking somebody on internetz forums:

"Cool ideas for a java project"
>>
>>51494673
what faggot would troll on Stack Overflow?
>>
File: clientjsmvc.png (102 KB, 528x514) Image search: [Google]
clientjsmvc.png
102 KB, 528x514
When you're developing the client side of a web application powered by a RESTful API backend, what's the standard way to go about it nowadays? As in, what frameworks/libraries do people use?

The fucking industry has paradigm shifts every 3 years and it's too confusing for my little brain. Can you build a frontend application with just React (+ some js libraries)? Is ember 2.0 not a meme?
>>
So codecademy recently added a pro account option?
thoughts?
>>
>>51494673

so im starting to try and teach myself/take courses on general web dev stuff and, i have all the resources for learning to code and all that part down. BUT im worried the graphic design partis going to be really hard for me because i really dont think that im artistically skilled and have no color coordination.

is there anything on that that i can research/look into?
>>
>>51496275
you can do whatever for the client side. it's really up for preference. there's no memes, just learn one and see if you like it really. i personally like ember because im probably autistic and the concepts are a bit easier.
>>
>>51496275
Basically >>51496386
I prefer Backbone without jQuery, because it's light and performant.
>>
Can I have one server with node, python, ruby and php all running different sites?
>>
>>51496787
well yeah
but you probably won't be able to have them all be on example.com
some would probably need to be on
example.com:8080
or
example.com/shit (for php)
>>
When you rent "webhosting" do they just give you a server to ssh into, and you can install any type of server you want and shit? How does it work? I want to write all the code myself, I don't want some prebuilt thing.
>>
Dumb question: Angular js is basically a front endequivalent of Node js?
>>
>>51497315
I'm not an expert or anything, but I'd imagine any front-end javascript framework these days could be considered that. Then again, it's not exclusive to Node.js. As long as you can make API endpoints, you could use Sinatra, Rails, Node.js, PHP, whatever for the backend and use Angular to consume JSON from them.
>>
How would one get the US City/ZipCodes Dataset
from http://www.opengeocode.org/download.php#cityzip into mysql?
>>
How customisable are word press themes? I need to build a classified ads website and was thinking of purchasing one and editing it to my needs. Is it better to get a functional PHP template and edit it?? I have basic html, css and javascript knowledge but no PHP knowledge pls help?
>>
>>51497160
>"webhosting"
That's typically PHP deployment + CPanel. What you probably want is a VPS.
>>51497315
No. Angular is a frontend framework. Node is a runtime extension for V8.
>>
>>51497399
>>51497527

Thanks for answering. I might learn both but I'm trying to choose which one I'll do first (slight chance I won't go through with learning the second choice)
>>
>>51495175
Game of Life.
>>
>>51497527
Thanks. Any suggestions for a VPS? It's basically just for toy projects and stuff.
>>
>>51497712
Ramnode/Digital Ocean $5/month plan.
>>
>>51497483
kek'd at picture
>in case no one get's the joke, an at4 can only be fired once,
>>
>>51497443
in php

<?php
$data = array_map('str_getcsv', file('cityzip.csv'));
unset($data[0]); // first index are headers

$db = new PDO('mysql:host=localhost;dbname=yourdb',
'username',
'password');

$sql = "INSERT INTO zipcodes (state, city, postal)
VALUES (:state, :city, :postal)";

foreach ($data as $zipcode)
{
$stmt = $db->prepare($sql);
$stmt->bindParam(':state', $zipcode[0], PDO::PARAM_STR);
$stmt->bindParam(':city', $zipcode[1], PDO::PARAM_STR);
$stmt->bindParam(':postal', $zipcode[2], PDO::PARAM_INT);
$stmt->execute();
}


it's going to take forever though
>>
>>51497817
I actually screwed up. I meant the state city one, but it looks like they both have what I need anyways.

The csv looks a bit different.

All I need is the state, city, lat and long.

What should I change PDO::PARAM_INT too since there is no param for decimal? String?
>>
>>51497919
Yep, there's no double or float pdo param. You have to use string if you want it. Not that it's a problem just cast it back when you want to use it again
>>
>>51497817


How's this? I want to make sure it's right before I execute.

<?php
$data = array_map('str_getcsv', file('cityzip.csv'));
unset($data[0]); // first index are headers

$db = new PDO('mysql:host=localhost;dbname=yourdb',
'username',
'password');

$sql = "INSERT INTO geodata (state, city, lat, long)
VALUES (:state, :city, :lat, :long)";

foreach ($data as $geocode)
{
$stmt = $db->prepare($sql);
$stmt->bindParam(':state', $geocode[0], PDO::PARAM_STR);
$stmt->bindParam(':city', $geocode[1], PDO::PARAM_STR);
$stmt->bindParam(':lat', $geocode[3], PDO::PARAM_*);
$stmt->bindParam(':long', $geocode[4], PDO::PARAM_*);
$stmt->execute();
}
>>
>>51497817
Google LOAD DATA INFILE
>>
>>51494673
All that picture is missing is indians
>>
>>51498005
>Not that it's a problem just cast it back when you want to use it again
Would I have to do that? Can I keep my lat/long fields as decimal or do I need to change them to varchar?
>>
>>51497919
>>51498168

binding the data type is not really needed in this case since you'll be working locally using data you trust and don't need to verify

$stmt->bindParam(':state', $geocode[0]);


is enough
>>
>>51497644
I'm learning the same thing. Basically MEAN except I'm using PostgreSQL for the database. I think it's a really good way to go personally. I like the structure of Express/Node servers, to me the event loop is kinda hard to understand at first, but once you do, it's almost hard to understand it being done any other way.
>>
If javascript is slow, how is node fast?
>>
>>51498224
Thanks a ton.

By the way, should I used 'state' as an Index?

I need this optimized and...I've never used indexes before.
>>
>>51498346
>I've never used indexes before.
Disregard. Apparently keys are also indexes.


What's everyone working on?
>>
>>51495175
Just make sure to demonstrate all OOP principles.

>>51496275
Angular has the most support by far. If you google a question and stick 'Angular' in front of it, you're guaranteed to get at lest 5 great answers.Angular is on the upward trend and shows no signs of stopping its growth. It will be around for the next decade easily.

>>51496319
You don't need artistic ability, no one expects it from a developer. Don't worry yourself with it really. I've never met a dev who can design and I've never met a designer who could code [well]. But if you want a crash course, codeschool does a principles of design course.

>>51497780
nice

>>51497483
In my experience (4 WP sites). You can tweak the template and styling if you're brave, but overall I've never had one that was friendly to customization.

>>51498324
JS isn't really slow. The projects I have at work are over 100k lines and it spins up in under a second. Also, node is run on a server and isn't single threaded like JS.
>>
Can I run 3 wordpress sites on a AWS server with 4GB RAM and 2 cores? Any good resources on the overhead of WP?
>>
>>51498482
what kind of traffic?
>>
>>51498482
you can run 300 with that configuration, you're good
>>
>>51498490
Less than 25K vist's for each site a day.
>>
>>51494673
>Death to PHP
Why?
>>
>>51498508
So literally a dozen moderate traffic sites will run on a medium ec2 instance? This is good new, Im planning on hosting stuff for a few different client sites. Is WordPress multi good for totally different sites or separate installs?
>>
>>51498324
JS is quite fast. Meme frameworks and jQuery are slow. V8 is one of, if not the fastest dynamic language engine to date. Its closest performance rivals are Java and C#, which are outperformed in some use cases.
>>
is CHAR(1) 1 character or 2?
>>
I have some place holder text in an input field, but I want it to go away when the input field is in focus. How do I do it?
>>
>>51498514
Because Death to PHP
>>
>>51498631
But why?
>>
>>51498571
If they don't change often, install a wp cache/varnish.
>>51498603
Depends on the character set of the field.
>>
>>51498606
You can use onFocus.

Then set value to '';
>>
>>51498606
...the placeholder attribute.
>>
>>51498512
visits or hits? Idk anything about this, but sounds like it would never work
>>
>>51498606
>>51498690
Don't. Use the placeholder attribute
>>
File: 1361233973264.jpg (2 KB, 125x93) Image search: [Google]
1361233973264.jpg
2 KB, 125x93
>>51498606
>>51498743
>>51498760

dammit, I was just in the bathroom and ya'll scooped up an easy one

Yes, placeholder

<input type="text" placeholder="John Doe" />
>>
File: IMG_0729.jpg (2 MB, 1936x2592) Image search: [Google]
IMG_0729.jpg
2 MB, 1936x2592
yfw you don't have to close code tags if the rest of your post is code :)
>>
File: abde6512jw1e3epmdaj1pj.jpg (416 KB, 2048x2048) Image search: [Google]
abde6512jw1e3epmdaj1pj.jpg
416 KB, 2048x2048
>>51498423
Thanks for the response anon, How easy is it to move from a wordpress theme to something more professional later on?
>>
>>51498811
Depends on what you consider more professional. Overall I'd say next to impossible to transfer any code over. I wouldn't dream of it.
>>
>>51498828
I mean like using my word press site as a minimum viable product before creating something more advanced in the future. How easy would it be to migrate all the data
>>
>>51498760
>placeholder attribute
Please tell me this is some HTML5 shit.
>>
>>51498874
You ever used WP before?
>>
>>51498423
>Angular is on the upward trend and shows no signs of stopping its growth

Except the community is going to be divided between Angular 1.X and Angular 2.X.

Except Angular 1.X is dead to the creators.

Except there's nothing that indicates Angular 2.X will continue to dominate the market.
>>
>>51498874
wordpress is a piece of shit.

Are you blogging or something?
>>
>>51498423
>Angular shows promising growth
Have you been following the scene recently at all?

>node isn't single threaded
stop. node is single threaded. that's the whole point of having event-loops.
>>
>>51498940
>Except the community is going to be divided between Angular 1.X and Angular 2.X
Not necessarily. We don't know if it will be worth the big switch. Whether people will switch will depend on whether it's worth switching. Just like now with whether people will switch from angular to ember.

>>51498969
Okay gosh
>>
>>51498898
>>51498947
http://themeforest.net/item/classiads-classified-ads-wordpress-theme/8625840

This what im thinking of getting, If WP is so shit ill have to learn PHP and create it myself ay?
>>
>>51498994
I've worked with something similar. If it isn't your full time job, it's not going to be worth it
>>
>>51498981
if you say something slightly wrong on /g/ you're pretty much worse than hitler so be prepared to get shit on
>>
File: yay.png (34 KB, 642x563) Image search: [Google]
yay.png
34 KB, 642x563
I'm pretty happy right now.

Thanks helpful anons.
>>
>>51499121
Maybe I should have done DOUBLE(6,9);

shit.
>>
>>51499140
(9,6);

I'm just all fucked up today.
>>
>>51499121
what are you going to do with all that useless data that could've been retrieved in real time from a major company api like yahoo?
>>
>>51498969
Node is in fact multithreaded. The single listening thread delegates all asynchronous work to a pool libuv threads.
>>
>>51499182
Geocode APIs have restrictions that I can't abide by.

I've checked with dozens.
>>
>>51499208
that was more about me being a dicky dick

i actually want to know what are you going to do with it
>>
>>51499217
Using Haversine formula to get the distance between a defined city/state and every other city in that state and only returning cities within a certain distance.
>>
>>51499121
>43,000 rows
wut u doin there muhammed?
>>
>>51499196
Then why the hell do you need to setup node for clustering if it supports multi cores by default?
>>
>>51499854
Can you not read? Only async work is multithreaded.
>>
File: distance.webm (628 KB, 1280x720) Image search: [Google]
distance.webm
628 KB, 1280x720
>>51499405
Being cheap and not paying for api access.
>>
>>51499937
lmao how did you get the numbers? I might use them
>>
>>51499937
now make an api
>>
>>51499950
Distance with Haversine. http://www.opengeocode.org/download/haversine/haversine.php.txt

and all of the data came from http://www.opengeocode.org/download/cityzip.zip
>>
>>51495514
>You should not be using ids in your CSS

What? I have never heard this before. Where is this recommended?
>>
>>51496787
Yes, you'll likely be reverse proxying the Python and Ruby apps behind a web server like Nginx to begin with. Your server would run the Python/Ruby/Node/PHP application and your web server would delegate to each based on the URL (example.com/cgi, example.com/fuckingjavascript, example.com/form.php)
>>
>>51497712
lowendbox
>>
>>51496787
to be clear, you will have several "application servers" (one for each language/app) probably all sitting behind a single "web server" (apache/nginx/lighttpd) running on your "server" (the physical machine)
>>
>>51499937
now make it look good
>>
>>51500030
well, css should be reusable and you cannot have same id's on different elements.

you should prefer classes, but you can use ID's if you want
>>
File: 174.gif (2 MB, 224x168) Image search: [Google]
174.gif
2 MB, 224x168
>>51499121
>PR
>>
>>51498571
Whatever you do fucking update your WP/plugins daily, or your sites are all going to say "HACKED BY MOHAMMAD"
>>
>>51500707
srsly? I'm afraid if I update something will stop working
>>
File: fak.png (104 KB, 714x965) Image search: [Google]
fak.png
104 KB, 714x965
>>51500458
Didn't even notice that.

Yes this list is fucked up.

Pic related.


Returning all cities within 20km of selected city and this happened.
>>
File: 20km.webm (548 KB, 1036x720) Image search: [Google]
20km.webm
548 KB, 1036x720
aaand we're good.
>>
>>51500707
Will do! There all going to be ecommerce stuff. Trying to burn free aws credits before they expire.
>>
File: 1436193272868.jpg (38 KB, 362x346) Image search: [Google]
1436193272868.jpg
38 KB, 362x346
After bidding for 2 weeks at Elance. Got myself a client. It's just some PHP and HTML site. Told him I'd do it for 40. It's cheap as fuck but I heard that's how you get your first rating. But now he said if I'd quote, I'd have to give some hourly estimate. Any tips on how much I should charge?
>>
>>51501109
>Elance
Unless you're from a 3rd world country where 40 USD can feed your family of 12 for 3 decades then I don't recommend using elance.

Those freelancers will seriously work for 3 dollars an hour.
>>
>>51501147
I'm just some student. I'm not looking to make a living out of it. I just want to build a portfolio and make some pocket money while I get some clients locally. I also owe someone $100.
>>
How long would it take me to do 375,855,769 queries and store approximately 7,517,115 of those?
>>
>>51501229
queries of what? can't you just try a few k's and see how much time it takes?
>>
>>51501271
nah, I'm running the whole thing.

I wish there was a query progress bar somewhere.
>>
We're supposed to begin learning PHP, starting this friday. What should I expect?
>>
>>51501346
Expect the most retarded spaghetti code imaginable that magically works perfectly.
>>
If you don't hear back from me then that means my computer exploded from 376 million queries and complex trig.

h-here I go
>>
my xampp control panel has stopped working.

Webpage is still running.

Is it working or did it sudoku?
>>
Well, guess I know what happens now.


"Only one usage of each socket address (protocol/network address/port) is normally permitted."

Guess I need to limit and offset.
>>
>>51501587
xampp merely starts the services, they'd still run after you close xampp
>>
>>51501714
It's started to break either way. I'm doing 10000 at a time.
>>
I'm exhausting all of my ports on windows.

Anyone know how I can stop this from happening?
>>
Why is this not working?

I know it's ugly, but it can be just because it is building a table.

while($row = $result1->fetch_assoc()) {
$pulled_lat1 = $row["lati"];
$pulled_long1 = $row["longi"];
$pulled_city1 = $row["city"];
$pulled_state1 = $row["state"];
while ($row2 = $result1->fetch_assoc()) {

Haversine($pulled_lat1, $pulled_long1, $row2['lati'], $row2['longi'], $pulled_city1, $pulled_state1, $row2['city'], $row2['state']);
}

}


It's only running against the first city on the list. It successfully calculated all cities within 200km of that city though.

What did I do wrong? Can't think.
>>
>>51501905
can't understand why are you fetching the same result twice
>>
>>51502045
I changed it. Was just trying something out.

just imagine that is $result2 down there.

I still only does the first city on the list. Either I'm overloading something or my 1st while loop is wrong somewhere.
>>
>>51501905
($row = $result1->fetch_assoc())
double check it
>>
>>51502130
I'm not seeing it.
>>
>>51502232
>while($row = $result1->fetch_assoc()) {
> $pulled_lat1 = $row["lati"];
> $pulled_long1 = $row["longi"];
> $pulled_city1 = $row["city"];
> $pulled_state1 = $row["state"];
> while ($row2 = $result1->fetch_assoc()) {
>
> Haversine($pulled_lat1, $pulled_long1, $row2['lati'], $row2['longi'], $pulled_city1, $pulled_state1, $row2['city'], $row2['state']);
> }
> }
double check it
>>
>>51502242
I tried this. It's what I am comfortable with.

Still no luck.


$sql = "SELECT * FROM geocode";
$sql2 = "SELECT * FROM geocode";
$result1 = mysqli_query($conn,$sql);
$result2 = mysqli_query($conn,$sql2);


$returnedisbroken=false;

if ($result1->num_rows >0) {
while($row = $result1->fetch_assoc()) {

while ($row2 = $result2->fetch_assoc()) {

Haversine($row['lati'], $row['longi'], $row2['lati'], $row2['longi'], $row['city'], $row['state'], $row2['city'], $row2['state']);
}

}
}



Whatever you see, I'm not seeing atm.
>>
>>51502264
I'm not seeing it either, that's why I said to double check it.

There is probably something wrong with your conditional statement because otherwise it should continue to work after the first one.
>>
>>51502291
I'm so confused right now.

$sql = "SELECT * FROM geocode";
$sql2 = "SELECT * FROM geocode";
$result1 = mysqli_query($conn,$sql);
$result2 = mysqli_query($conn,$sql2);


$returnedisbroken=false;

if ($result1->num_rows >0) {
while($row = mysqli_fetch_array($result1,MYSQLI_ASSOC)) {

while ($row2 = mysqli_fetch_array($result2,MYSQLI_ASSOC)) {

$lat1 = $row['lati'];
$lat2 = $row2['lati'];
$lon1 = $row['longi'];
$lon2 = $row2['longi'];
$state1 = $row['state'];
$state2 = $row2['state'];
$city1 = $row['city'];
$city2 = $row2['city'];

$R = 6372.8; // Radius of the Earth in Km

// Convert degress to radians and get the distance between the latitude and longitude pairs
$dLat = deg2rad($lat2 - $lat1);
$dLon = deg2rad($lon2 - $lon1);

// Calculate the angle between the points
$a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($dLon/2) * sin($dLon/2);
$c = 2 * asin(sqrt($a));
$d = $R * $c;

// Distance in Kilometers
$distance = round($d,0);

if ($distance >= 100) {

}

else {

$fuckshitup = "INSERT INTO distancecalc (state1, state2, city1, city2, distance) VALUES ('$state1', '$state2', '$city1', '$city2', $distance)";
$resultfinale = mysqli_query($conn,$fuckshitup);
}



}

}
}
>>
I know basic MySQL, should I try Portgresql?
>>
Even using a large SQL server online and it's still only returning 68 results.

wtf is this shit?
>>
>>51499140
>>51499161
alter the columns then idiot
>>
and I can't even ask on stackoverflow because their code block function is a legit piece of shit.

>>51502858
I did that like 5 hours ago, fucker.
>>
Having a load of problems with something after rewriting my code. Either I can access the canvas from doSomething or gamePiece.img, but never both. I can't figure out how to acess both from inside doSomething

JS:
var gamePiece = {
img: new Image();
img.src: "picture.jpg";
};

function doSomething(thing, action) {
action(thing)
//or action.call(thing)
};

var GameDisplay = {
size = 480;

drawBoard: function(){},
drawPiece: function(piece) {
var canvas = document.getElementById("pieces");
var ctx = canvas.getContext("2d");
canvas.width = this.size;
canvas.height = this.size;

var draw = function(p) {
var img = p.img;

var x = (this.canvas.width/2);
var y = (this.canvas.height/2);

ctx.drawImage(img, x-10, y-10, 20, 20 * img.height/img.width);
};
doSomething(piece, draw);
}
};
>>
>>51503194
Forgot to add

GameDisplay.drawPiece(gamePiece);
>>
>>51503194
Do you usually separate object literal elements with semicolons or is that some brew of JS I'm not familiar with (Typescript, Coffee, etc)?
>>
>>51503386
It was a hackjob where I cut out a bunch of irrelevant code so it could be slightly more legible.

I guess I fucked shit up
>>
>>51503429
Well, that's basic syntax. Object literal pairs are separated by commas.

You can always run your code in the console to check this stuff fast, at least it will highlight some errors if the code is not valid.
>>
>>51503465
Those errors aren't there in my code. They came from trying to condense it down for here.

My problem is scope
>>
Offered money to solve my php while loop on craigslist.

No ones responded.

I guess I just broke php.
>>
>>51501229
Dude, use MySQL's LOAD DATA, if you are the same guy of the csv files.
And for that amount of records it will take a lot of time anyways, use the console for small benchmarks.
>>51501346
Expect outdated tutorials, and bad practices in copy-pasted code. Check the language reference in the official website first.
>>51502264
Perhaps you want to do a JOIN instead
>>
>>51503536
I'm confused. How would a join help?
>>
Is there a built-in server for java on linux?
I was starting php's with command php -S localhost:8000 and wonder if there is something like that for java too
>>
>>51503194
Omg. I'm retarded.
>canvases are block elements
>it was below the little window I was looking at my site with

Fuck me. I spent like 3 hours breaking shit when it worked like the first time
>>
>>51503586
Nevermind, just limit your results to 3 records, and var_dump them (and run both queries in phpmyadmin).
>>
>>51503647
object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(4) ["lengths"]=> NULL ["num_rows"]=> int(3) ["type"]=> int(0) } 
object(mysqli_result)#3 (5) { ["current_field"]=> int(0) ["field_count"]=> int(4) ["lengths"]=> NULL ["num_rows"]=> int(3) ["type"]=> int(0) } 
>>
>>51503681
Well, there are 3 results for each query as expected (you shouldn't load all the records unless you have a reason). What is the problem you are getting?
>>
>>51503707
The first while loop runs one time. The second while loop runs through all rows as expected.
>>
>>51500030
Run your css file through any css linter
>>
>>51503723
Are you sure? Can you add a row counter/ID in the table?
>>
>>51503707
Here's a better look at everything.

http://pastebin.com/2BBpcppU

I can't figure it out yet. While loop just stops.
>>
File: group tabs.png (327 KB, 1516x1048) Image search: [Google]
group tabs.png
327 KB, 1516x1048
someone should make an addon for this
>>
>>51503744
Just added. It ran through the entire table.


Now I'm even more confused.
>>
>>51503750
Perhaps your data does not have enough cities with less than 100 kilometers of distance between them. Replace the insert with an echo, and add a different echo at the end of each iteration.
>>
>>51500043
Ok. I was just making sure. I already have apache and nginx and php working together on it.
>>
>>51502264
O(n^2) with 400 million queries

Dis gon be good
>>
>>51503770
This was the result.

It's only going based off of the first city in the list and then it stops.

http://pastebin.com/aNxZvqiY
>>
>>51502576
Yeah. Its the future.

Mostly just learn the differences with the set up. After that it is pretty much the same.
>>
>>51503820
Fetch all records first, then loop again, just in case.

But you don't need to store the distances, these can be calculated on the fly (however, restrict the query to a country, for faster results).
https://stackoverflow.com/questions/1006654/fastest-way-to-find-distance-between-two-lat-long-points
https://github.com/mnisjk/MySQL-distance-between-GPS-coordinates/blob/master/DISTANCE.sql
>>
>>51503761
That would actually be pretty dope.
>>
>>51503860
The query is US only. States are indexed.

I'm already using Haversine formula.

The reason I'm wanted to do this is so I can select queries based on distance from city/state instead of having to pull the entire database and run haversine.
>>
>>51503889
You can filter by city and state in the coordinates' query too.
>>
>>51503900
This ignores people that live on state borders though.
>>
>>51503908
Yes, that's one of the problems. Since this is US only, you can skip the state search unless specified by the user.
>>
>>51503886
>>51503761
suggest it to the mozilla devs, if a lot of people ask for it, maybe they'll implement it.

https://input.mozilla.org/en-US/feedback/firefox?
>>
>>51503915
I guess it comes down to

>each user calling 39k rows and running trig on server
or
>each user finding their indexed city state distances through a few hundred million rows.

Not sure which is better, honestly.
>>
>>51503915
Guess I can just revert to
>>51500806
>>
I'm looking for a newbie php framework that has a good starting guide. As well as tacking care of my mysql connections.

Suggestions?
>>
>>51503980
You can restrict the query to a box, as explained in the stackoverflow discussion:
and locations.lat between X1 and X2 
and locations.Long between y1 and y2

The box would be in this case 200 km of distance.
>>
>>51504011
Genius, definitely doing that.

I can just roughly ballpark.

+- 20 on each should be good I think?

I'm not pretending to know anything about lat/long, I'm an MGRS kind of guy.
>>
>>51504073
Nope, more math
https://stackoverflow.com/questions/2839533/adding-distance-to-a-gps-coordinate
>>
>>51504146
fak, I hate math.

I should be able to do +10 long -10 lat AND -10 long +10 lat to give me a nice box to work with and less than 1/50th-ish the rows.
>>
Boom, found it
Can put in distances and everything.

SELECT * FROM Places WHERE acos(sin(1.3963) * sin(Lat) + cos(1.3963) * cos(Lat) * cos(Lon - (-0.6981))) * 6371 <= 1000;
>>
https://try.github.io/levels/1/challenges/1
>>
where to get mozilla source-code?
>>
I want to display an image when I click on a button. But I want to display it on the same page where the button is located. How do I achieve that ?
I'm working with ASP.NET MVC and C#.
Any code ideas ?
This is what I have so far but it opens the image in a separate cshtml.
<input type="button" value="Create" onclick="location.href='@Url.Action("DrawChart")'" />
>>
>>51501803
Stop being such a slut
>>
>>51504978
https://archive.mozilla.org/pub/firefox/releases/
>>
>>51501803
you have over 65k services listening? story pls
>>
>>51503953
Mozilla is more interested in removing features at the moment.
>>
>>51505756
cheers
>>
can I use <?php on in the *.php files or do I add it to the .html
>>
Serious question. If i really want to make something out of Web Development, what should i learn?

>HTML/CSS/JS?

What is big on the WebDev business?
>>
>>51500707
This happened at some marketing startup I worked at all the time. The second I took over managing our web stuff and stopped with the handsoff cpanel bullshit everything was fine.
>>
>>51506588
All three of those together are the absolute minimum set of requirements.
>>
should I learn python
>>
>>51505950
What do you mean by this? Usually, only .php files are processed by the PHP interpreter. Putting a <?php into an html file just outputs that (unless you, for no reason, configure it to also process .html files, which would be idiotic).

Also, pretty much NEVER mix HTML and PHP code in the same file. PHP as a templating language simply doesn't work. If you absolutely have to use Ramus' barf language, you HAVE TO use a framework.
>>
>>51505740
This is going to be easy and obvious once the HTML dialog element gets supported by more browsers than Chrome and Safari.

At the moment, things like these are... ass. You need to place an absolutely positioned container element outside of your main content (so that a relatively positioned element doesn't mess it up), make it invisible and add an image tag to it.
When you click your button, change the href of the img tag to your image and make the container visible.
>>
>>51507483
alright, thanks
>>
>>51506729
if you know how to program, no
you can just google it when the time comes
if you dont know how to program, then yea
>>
File: please stop.jpg (79 KB, 848x480) Image search: [Google]
please stop.jpg
79 KB, 848x480
I have to make a php7 mvc framework for my course by the end of the week /g/ am I fucked (cant use ready frameworks, needs to have identification, the full package etc etc)?
Can you point me to some tutorial/guide/resource (doesn't need to be php7...)
I haven't written anything in php in an year, and I don't need it otherwise
tl;dr PHP MVC Framework good tutorial?
>>
>>51508195
https://github.com/panique/huge
>>
>>51508195

its moderately basic

i'm assuming you need code help and not mvc help.

sadly i forgot the upload the newer version before my laptop died, but i built a crazy rest API thingy a while ago, which might give you some inspiration on how to dynamically call and load things. (i've since moved to laravel)

https://github.com/CrimsonDove/SleepyPhp


PS: what exactly is new in php7 besides spaceships
>>
>>51508396
i will look into that, thanks
>>51508475
thanks, yes, I am accustomed to mvc, but php... god damn...
>functions can declare return type
>>
>>51506588
All 3. Then learn PHP with WordPress and you'll have a job until the Internet evolves.

>>51505772
I didn't have 65k open at that time. Opened them afterwards and everything went smoothly.
>>
>>51508597
WELCOME TO PHP 7

unless someone told me wrong

i've been using it since i was 14, and still find it really annoying, i know it sucks
>>
>>51508667
what does learning WordPress mean
>>
>>51508697
PHP 7 since you were 14?


inb4 b&
>>
>>51508748
no php in general

it getting return hints in 7 after all these fucking years
>>
>>51508667

Oh you mean like

https://github.com/Automattic/wp-calypso
>>
>want domain
>domain expired
>30 day grace period so have to wait
>finally day has arrived to get domain
>was renewed for another year

>domain not for sale
>6 years of absolutely nothing on the domain

What the hell is this guy doing? A .me domain would go alright but nothing can beat a .com
>>
>>51508883
No, I mean like https://wordpress.org/
>>
>>51508907
hoarding it or a company want to use it in their local network only.
>>
>>51508994
Damn. Just emailed him. It's such a good domain.
>>
>>51508883
Calypso is not a Wordpress replacement yet, just a react.js admin interface to a wordpress instance hosted in private servers.
>>
so is visual studio code the new thing now? why are so many people suddenly using it?
>>
>>51509254
idk, it takes lots of ram
>>
>>51509254
It went open source and started supporting extensions, but many were already using it (including me)
>>
Query of the year.

SELECT * FROM geocode WHERE acos(sin(radians(36.375883)) * sin(radians(lati)) + cos(radians(36.375883)) * cos(radians(lati)) * cos(radians(longi) - (radians(-103.018826)))) * 6371 <= 200;
>>
>>51509433
I've seen worse in production at work.
>>
>>51508907
Just emailed him

"Hello, now i dont want sell. Thanks!"

Looks like I'm back to the drawing board.
>>
How should I go about making a personal website?

It would pretty much consist of my music, pictures, and "blog" posts. I guess it would be an archive of everything I've done in the past. Should I just make a clone of 4chan and post things there?
>>
>>51509668
use wordpress.
>>
>>51509646
sue him
>>
>>51509668
tumblr
>>
>>51509698
i hate the layout, plus I just want it for myself

>>51509677
I used that for school, it always looked ugly as fuck.

Would a 4chan clone be a bad idea?
>>
>>51509776
an imageboard is not a blogging software.
>>
>>51509776
>Would a 4chan clone be a bad idea?
Yes.

Just use WordPress for your blog.
>>
>>51509801
>>51509817
What exactly would by bad about it? I'm seriously considering it, but I'm not sure how to get started.
>>
>>51509887
Because it would look like ass bruh
>>
>>51509433
It is missing the box restrictions, so it can run faster..
>>
>>51509920
2ch and 4chan look great though
>>
>>51509936
blogs are not imageboards dawg

shit would look very functional, not very pleasing
>>
>>51509921
I don't get the math for that.
>>
>>51509967
alright, forget the blog part. Lets just say its for me and a few close friends. Is the source code for 4chan or futaba out there or will I have reverse engineer the code?
>>
We need better domain name regulation.

This is fucking ridiculous.
>>
>>51510070
monopoly
>>
>>51508746
He means learning how to template and make plugins for it since all the normies use it for now.
>>
Why is it that so many websites, especially mobile ones, often have these extremely laggy scrolling action buttons at the bottom of the page?

How the fuck are they so laggy? Do these people not know about position:fixed?
Fixed should literally be the easiest thing to scroll in a performant way because the position of the component does not change at from, the the view of the viewpoint. Why would you make some javascript hack that seems to manually position the element with debounce (muh performance!)?

Am I missing something?
>>
>>51510108
Mobile devices work differently. The browsers are still shitty for many of them. Mine doesn't update until I take my finger of the screen, then the bar will snap in place.

>>51510094
I went through about 20 and they were all placeholder PLSBUY websites that have been held since 1996
>>
>>51510070
why
>>
>>51510169
jews
>>
>>51510176
because any .com that anyone will remember is already snatched up and for sale for 2000 dollars.


>>51510192
This one guys name in the whois was literally Shalom.
>>
>>51510246
so what. you want everyone to lose their domain names now so you can get yours?
and who cares about the TLD anyway.
>>
makes me angry, internet could be flourishing
>>
they just block it
>>
>>51510263
>so what. you want everyone to lose their domain names now so you can get yours?
Yes. Exactly.

brb registering n15ni214pni2pn4.xyz because it will be worth a billion in 200 years.
>>
>>51497712
amazon aws has free tier vpns available
>>
Let's say you wanted fatass.com but it was taken.

Would fatass.me be a good alternative since it kind of goes with it?

Would the casual Internet person type fatass.me.com?

and yes, I know .net are poverty domains.
>>
>>51510638
do you think you'll do better at marketing your name than fatass.com? then any tld would do.
might aswell make sure you're not getting sued.

if not pick a completely different name.
>>
>>51510673
The whole business is web-based, so it kind of makes sense to include the full web address in the marketing.


Shit, anything besides .com is going to confuse people. I know they will just Google it anyways, but saying "visit fatass dot M E" compared to "visit fatass.com" would confuse a lot of people.
Thread replies: 249
Thread images: 16

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.