Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
Im trying to send an HTTPXML request to my ASPx page but its not working. Chrome just says:
Uncaught NetworkError: A network error occurred. (index):86
sendoff (index):86
This is the JS code:
[code]
function sendoff(){
console.log(xmlData);
var xmlString = new XMLSerializer().serializeToString(xmlData);
var xmlStuffs = document.createTextNode(xmlString);
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://192.168.0.6:64550/default.aspx", true);
xmlhttp.setRequestHeader("Content-Type", 'text/html');
xmlhttp.send("test="+xmlString);
}
[/code]
Trying to use [URL="https://github.com/carhartl/jquery-cookie"]this[/URL] with the color picker function (click the "Open Settings" menu)
Posting the PHP source in the website
Need to save the cookie 'setColor' to the clicked color value (that data was built with a foreach array of hex colors) and have it expire never or after a year or something
[URL]http://almost-there.org/new/[/URL]
Bonus points if I can get a clientside fade to the color function with jquery with the onClick as well.
The css to color everything is loaded serverside to client on each page load so clientside colorchanging until page refresh would be super sweet.
Has any other Elpishost-webhosting client had any issues recently? (If so, have you got any memo as to what could be the explanation?)
[QUOTE=lkymky;42840909]words();[/QUOTE]
[del]
You could just give all the a's a class, and then send the background colour when it is clicked.
Something like [URL="http://jsfiddle.net/UnXD9/"]this[/URL]
[/del]
[editline]$date = new DateTime();[/editline]
[del]
[URL="http://jsfiddle.net/UnXD9/6/"]Updated[/URL].
I assume you can just tell php to set the colour with the session... Somehow.
[/del]
[editline]$date->format()[/editline]
[URL="http://jsfiddle.net/UnXD9/8/"]Updated[/URL] again.
Now it should be what you want, with bonus points.
Also, the .animate for the background colour won't work without jquery-ui.
Currently i'm just messing around with design.
Is there anyway to make custom fonts load faster?
Mine takes 5-6 seconds to load up?
[QUOTE=boshuajackman;42849957]Currently i'm just messing around with design.
Is there anyway to make custom fonts load faster?
Mine takes 5-6 seconds to load up?[/QUOTE]
Reduce the amount of weights you are loading in, perhaps
Also certain browsers aren't very good at rendering webfonts fast, so you often get a FOUT ('flash of unstyled text'), I think typekit can help with this from what I remember.
Here's a good article from Paul Irish: [url]http://www.paulirish.com/2009/fighting-the-font-face-fout/[/url]
First time dabbling into some kind of notifications system and ajax itself. But I'm having a hard time actually displaying them correctly.
[CODE] function doAjax() {
$.ajax({
type: "POST",
url: "notifications.php",
data: { id: "<?PHP echo $username; ?>"}
})
.done(function( msg ) {
setTimeout(doAjax,600);
$(msg).appendTo("html")
});
}
[/CODE]Returns with:
[CODE] <script type='text/javascript'>
$(document).ready(function() {
$('#notification0').animate({
bottom:'+=100px',
opacity:'1'
});
$('#notification0').delay(4000).fadeOut(600);
});
</script>
<div id = 'notification0' class = 'notification' style = 'z-index: 50; left: 100px; background-color: #fffe0f; outline: 1px auto #fdc22b;'>
<img style = 'position:absolute; bottom:35%; left: 10px;' src = 'icons/error.png'/>
<p style = 'margin-left: 40px; margin-top: 7px;'>Your Request Test is being <br/> processed by administrator Stubo </p>
</div>
[/CODE]So I'm wondering how I actually show this notification on the page?
(Also forgive the tabulation, my tab key doesn't seem to be working on chrome at the moment)
[QUOTE=gokiyono;42847970][del]
[editline]$date->format()[/editline]
[URL="http://jsfiddle.net/UnXD9/8/"]Updated[/URL] again.
Now it should be what you want, with bonus points.
Also, the .animate for the background colour won't work without jquery-ui.[/QUOTE]
You are fucking awesome! :D
I americanized everything and changed stuff to my classes.
[code]var button = $('.changeColor');
var color;
button.click(function(){
color = $(this).css("background-color");
$(".theBGcolor").animate({backgroundColor: color},500);
$(".theColor").animate({color: color},500);
$.cookie('setColor', color, { expires: 365, path: '/' });
});
if(typeof($.cookie('setColor')) != "undefined"){
color = $.cookie('setColor');
$(".theColor theBGcolor").css("background-color", color);
}[/code]
[code]
//Colors chooseable in the ColorPicker
$colorPick = array(
"#EE5078", "#FF8039", "#FFA533", "#FFC233", "#FFE030", "#FFF933", "#D7FF20", "#15FF3E", "#03BCFF", "#00FF7F",
"#90EE90", "#3CB371", "#00FA9A", "#808000", "#2E8B57", "#FF0000", "#FF4500", "#FF8C00", "#FFA500", "#ED2939",
"#800000", "#A52A2A", "#D2691E", "#FF7F50", "#DC143C", "#E9967A", "#FF1493", "#B22222", "#FF69B4", "#CD5C5C",
"#F08080", "#6495ED", "#008B8B", "#483D8B", "#00BFFF", "#1E90FF", "#ADD8E6", "#20B2AA", "#87CEFA", "#B0C4DE", "#76608A", "#7B68EE", "#4169E1", "#6A5ACD", "#708090",
"#4682B4", "#008080", "#40E0D0", "#0099CC"
);
//If a user has a color in the setColor cookie we read it, otherwise use theColor
if (isset($_COOKIE["setColor"])) $theColor=$_COOKIE["setColor"];
else
$theColor= "#0099FF";
$antiColor= "#111111";
//Build ColorPicker
function colorForm()
{
echo "<!-- Begin colorPicker Function -->\n";
global $colorPick;
echo "<div id='colorPicker'>";
//Set color clientside with jquery, while saving the cookie to be read on next load with PHP
foreach ($colorPick as $v) {
echo "<a class='changeColor' style='background-color:$v'></a>\n";
};
echo "\n<br /></div>";
echo "<!-- End colorPicker Function -->\n";
};
function head()
{
global $pageSeed, $theColor, $antiColor;
echo "\n<!-- head function Start -->\n";
echo "<!-- The Page seed is... " . $pageSeed . "-->\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\n";
echo "<style>
.theColor {color:" . $theColor . ";}
.theLinkColor a:link {color:" . $theColor . ";}
.switch-input:checked ~ .switch-label {background-color:" . $theColor . ";}
/* #navBody li a:hover {color:" . $theColor . ";} */
#navBody li a:hover:after {color:" . $theColor . ";}
.theLinkColor a:visited {color:" . $theColor . ";}
.titleWindow {border: 2px solid " . $theColor . ";}
.theLinkColor a:hover {color:" . $antiColor . ";background-color:" . $theColor . ";}
.theLinkColor a:active {color:" . $antiColor . ";background-color:" . $theColor . ";}
.theBGcolor, table th {color:#222222;background-color:" . $theColor . ";}
#navBody li:before {color:" . $theColor . ";}
</style>[/code]
[URL="http://almost-there.org/new/"]http://almost-there.org/new/[/URL]
Is there a way I can make that ''style'' tag up there that fixes the issue with psudo elements and giving them a color without defining them in a non-dynamic .css document. have javascript read the stylesheet and change colors as needed?
[QUOTE=lkymky;42853007]You are fucking awesome! :D
I americanized everything and changed stuff to my classes.
[code]var button = $('.changeColor');
var color;
button.click(function(){
color = $(this).css("background-color");
$(".theBGcolor").animate({backgroundColor: color},500);
$(".theColor").animate({color: color},500);
$.cookie('setColor', color, { expires: 365, path: '/' });
});
if(typeof($.cookie('setColor')) != "undefined"){
color = $.cookie('setColor');
$(".theColor theBGcolor").css("background-color", color);
}[/code]
[code]
//Colors chooseable in the ColorPicker
$colorPick = array(
"#EE5078", "#FF8039", "#FFA533", "#FFC233", "#FFE030", "#FFF933", "#D7FF20", "#15FF3E", "#03BCFF", "#00FF7F",
"#90EE90", "#3CB371", "#00FA9A", "#808000", "#2E8B57", "#FF0000", "#FF4500", "#FF8C00", "#FFA500", "#ED2939",
"#800000", "#A52A2A", "#D2691E", "#FF7F50", "#DC143C", "#E9967A", "#FF1493", "#B22222", "#FF69B4", "#CD5C5C",
"#F08080", "#6495ED", "#008B8B", "#483D8B", "#00BFFF", "#1E90FF", "#ADD8E6", "#20B2AA", "#87CEFA", "#B0C4DE", "#76608A", "#7B68EE", "#4169E1", "#6A5ACD", "#708090",
"#4682B4", "#008080", "#40E0D0", "#0099CC"
);
//If a user has a color in the setColor cookie we read it, otherwise use theColor
if (isset($_COOKIE["setColor"])) $theColor=$_COOKIE["setColor"];
else
$theColor= "#0099FF";
$antiColor= "#111111";
//Build ColorPicker
function colorForm()
{
echo "<!-- Begin colorPicker Function -->\n";
global $colorPick;
echo "<div id='colorPicker'>";
//Set color clientside with jquery, while saving the cookie to be read on next load with PHP
foreach ($colorPick as $v) {
echo "<a class='changeColor' style='background-color:$v'></a>\n";
};
echo "\n<br /></div>";
echo "<!-- End colorPicker Function -->\n";
};
function head()
{
global $pageSeed, $theColor, $antiColor;
echo "\n<!-- head function Start -->\n";
echo "<!-- The Page seed is... " . $pageSeed . "-->\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\n";
echo "<style>
.theColor {color:" . $theColor . ";}
.theLinkColor a:link {color:" . $theColor . ";}
.switch-input:checked ~ .switch-label {background-color:" . $theColor . ";}
/* #navBody li a:hover {color:" . $theColor . ";} */
#navBody li a:hover:after {color:" . $theColor . ";}
.theLinkColor a:visited {color:" . $theColor . ";}
.titleWindow {border: 2px solid " . $theColor . ";}
.theLinkColor a:hover {color:" . $antiColor . ";background-color:" . $theColor . ";}
.theLinkColor a:active {color:" . $antiColor . ";background-color:" . $theColor . ";}
.theBGcolor, table th {color:#222222;background-color:" . $theColor . ";}
#navBody li:before {color:" . $theColor . ";}
</style>[/code]
[URL="http://almost-there.org/new/"]http://almost-there.org/new/[/URL]
Is there a way I can make that ''style'' tag up there that fixes the issue with psudo elements and giving them a color without defining them in a non-dynamic .css document. have javascript read the stylesheet and change colors as needed?[/QUOTE]
I have to say, I am really loving the bubbles.
[QUOTE=Haskell;42853169]I have to say, I am really loving the bubbles.[/QUOTE]
Its so trippy I <3 them too
Its much better than the previous ''wave'' thing I had before.
[URL]http://almost-there.org/[/URL]
And thier <div> tags! so I can do anything I want with them like add onClick's or add text to them.
I stole the script for them from [URL="http://codepen.io/bh/pen/JBlCc"]here[/URL]
Ill be giving this guy credit after I finish the site and add a 'credits' page
[QUOTE=lkymky;42853242]Its so trippy I <3 them too
Its much better than the previous ''wave'' thing I had before.
[URL]http://almost-there.org/[/URL]
And thier <div> tags! so I can do anything I want with them like add onClick's or add text to them.
I stole the script for them from [URL="http://codepen.io/bh/pen/JBlCc"]here[/URL]
Ill be giving this guy credit after I finish the site and add a 'credits' page[/QUOTE]
Make sure you also comment his name into the code or something. He might get upset and break down if he finds out you used something of his.
[QUOTE=jung3o;42853734][CODE] function doAjax() {
$.ajax({
type: "POST",
url: "notifications.php",
data: { id: "<?PHP echo $username; ?>"}
})
.done(function( msg ) {
setTimeout(doAjax,600);
$("body").append(msg);
});
}
[/CODE][/QUOTE]
Thanks for the help! Worked a treat!
[QUOTE=boshuajackman;42849957]Currently i'm just messing around with design.
Is there anyway to make custom fonts load faster?
Mine takes 5-6 seconds to load up?[/QUOTE]
I havn't ever tried this, read your post and had an idea to use HTML5 offline storage to keep fonts in.
did a google search and found [URL="http://stackoverflow.com/questions/7042834/is-it-possible-to-load-webfonts-through-the-offline-storage-cache-manifest"]this
[/URL]
It will still take a while to load them for the first time but repeat visitors won't have issues.
I'm working with Google Charts API and I cannot, for the god damn life of me, get this fucking Chart to display.
I started with [URL="https://developers.google.com/chart/interactive/docs/quick_start"]Google's Quick Start tutorial[/URL] and then taught myself about the classes and methods that I'm using. Unfortunately, I can't seem to figure out why this code isn't working!!!
[B]
[B]chart.php
[CODE]
[/B][/B]<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type = 'text/javascript'>
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart); // Default graph drawn
var data = [];
var data[0] = new google.visualization.DataTable();
data[0].addColumn('string', 'Date');
data[0].addColumn('number', 'Visits');
<?php
/***** ECHOING DATA TABLE FOR CHART *****/
$looper = 0;
foreach ($visitsOverTime as $dated => $stuff)
{
if ($looper != 0)
{
?>
data[0].addRow['<?php echo($dated); ?>', <?php echo($stuff); ?>];
<?php
}
$looper++;
}
?>
// Set chart options
var options = {
backgroundColor: 'transparent',
colors: ['#4ab0ce', '#56bc76'],
pointSize: 10,
lineWidth: 5,
theme: 'maximized',
curveType: 'function',
// Tooltip hover event text styling
tooltip: {
textStyle: {
color: "#000" },
showColorCode: 'true'},
// Legend position and color
legend: {
textStyle: {
color: '#d8d8d8'},
position: 'in'},
// Title text styling
titleTextStyle: {
color: '#FFF'},
// Vertical axis styling
vAxis: {
textStyle: {
color: '#d8d8d8',
fontSize: 11},
baselineColor: '#8c8c8c',
gridlines: {
count: 10,
color: '#8c8c8c'}},
// Horizontal axis styling
hAxis: {
textStyle: {
color: '#d8d8d8',
fontSize: 10},
gridlines: {
count: 10,
color: '#8c8c8c'}},
animation: {
duration: 1000,
easing: 'out'}
};
var current = 0;
// Create and draw the visualization.
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
function drawChart()
{
// Disabling the button while the chart is drawing.
button.disabled = true;
chart.draw(data[current], options);
// Chart resize function (on window resize)
$(document).ready(function ()
{
$(window).resize(function()
{
chart.draw(data[current], options);
});
});
}
</script>
[B][B][/CODE]
And then I call it on up with a chart_div ID in my html.
All this code does when it runs is show a blank div where the chart should be![/B][/B]
[editline]15th November 2013[/editline]
Any help would be so so so so so greatly appreciated!!
Also, ignore blank CODE box, since I'm not able to edit the post.
Can someone review my code (I'm thinking its under 1k lines) (PHP, JS, HTML, CSS)
and tell me anywhere I should improve, I need to flesh out things with more functions and I know I can implement interfaces in a few spots but I still need to learn how to use interfaces effectively.
If anyone has a question please ask so I can add the parts that make people go "wtf" to my github wiki.
[URL]http://almost-there.org/new/[/URL]
[URL]https://github.com/Almost-There/almostThere[/URL]
I've been doing random programming and had this... idk breakthrough and things started clicking together.
But I'm afraid I'm doing things that are inefficient or silly.
Going to require some assistance over here.
So i got a XenForo forum a game company wants to use but i got more then enough storage and bandwidth to host the entire thing.
However, i want it so when people visit forums.keenswh.com they will be forwarded to the forum which is hosted on my site.
It this possible? And i don't mean that if you visit the URL that you go to the forum which then turns back into its original address.
I would like a new domain, can anyone recommend namecheap.com? They seem quite fair on price, but are they any good?
[QUOTE=Moofy;42902724]I would like a new domain, can anyone recommend namecheap.com? They seem quite fair on price, but are they any good?[/QUOTE]
Yeah, they have good prices and don't give any problems. Plus they often give nice coupons over twitter, newsletter...
And I still have 2/3 connections to my page via non-http refused. FTP not working. IMAP not working. SQL (strangely) working.
While not being able to access my mail is quite uncomfortable, the hosting's lack of any 'we are working on it' is what bugs me most...
Which PHP Framework should I use?
OK So I figured out my problem above, which is that for some reason when I define a variable outside of the drawChart() function, it is not carried into the function.
I've tried defining the DataTable variable 3 different ways:
[CODE]
var data = [];
data[0] = new google.visualization.DataTable();
data[0].addColumn('string', 'Date');
// etc...
[/CODE]
[CODE]
var window.data = []
window.data[0] = new google.visualization.DataTable();
window.data[0].addColumn('string', 'Date');
// etc...
[/CODE]
And then when I finally decided to define the DataTable var inside the drawChart function, it [I]finally[/I] decided to work:
[CODE]
function drawChart() {
var data = []
data[0] = new google.visualization.DataTable();
data[0].addColumn('string', 'Date');
// etc...
}
[/CODE]
Does [B]anyone[/B] know why JavaScript won't let me define a global var outside the drawChart function?
[editline]18th November 2013[/editline]
Another weird thing that I just found is that I can define a plain text variable outside the function, and I will be able to call it from within the function, but none of these DataTable objects are carrying through to the function.
So I see a domain at namecheap.com that has "Special!" for it, so I pay $9 this year and it has crossed $19 out. Does that mean next year it's actually $19?
[QUOTE=Moofy;42905774]So I see a domain at namecheap.com that has "Special!" for it, so I pay $9 this year and it has crossed $19 out. Does that mean next year it's actually $19?[/QUOTE]
Yep. When I bought my .info it was $3.99, and now it's $9.69
...It's still pretty cheap, for what it's worth.
[QUOTE=Coment;42905806]Yep. When I bought my .info it was $3.99, and now it's $9.69
...It's still pretty cheap, for what it's worth.[/QUOTE]
Hm, well I can get a stable $10 at domain.com so I guess it would be better to go with them. However namecheap seems like what everyone chooses, and if everyone recommend it I can't help doing it :v:
[QUOTE=Moofy;42905842]Hm, well I can get a stable $10 at domain.com so I guess it would be better to go with them. However namecheap seems like what everyone chooses, and if everyone recommend it I can't help doing it :v:[/QUOTE]
I guess GoDaddy isn't an option?
[QUOTE=Poo Monst3r;42905867]I guess GoDaddy isn't an option?[/QUOTE]
Never ever ever [B][I]EVER[/I][/B] GoDaddy.
[QUOTE=Moofy;42905884]Never ever ever [B][I]EVER[/I][/B] GoDaddy.[/QUOTE]
Why exactly is that?
[QUOTE=Poo Monst3r;42905889]Why exactly is that?[/QUOTE]
I've only had bad experiences with them.
[editline]18th November 2013[/editline]
And they are pro at censorship :suicide:
[QUOTE=Poo Monst3r;42905889]Why exactly is that?[/QUOTE]
Never used them, but they got in quite a lot of crap when they supported SOPA, and their ads [URL="http://www.youtube.com/results?search_query=godaddy+ad&page=&utm_source=opensearch"]are food for thought[/URL].
Sure, it doesn't affect anyone directly, buuuuuut I could understand some people turning one side or another because of that.
---
And at least one person has had bad experiences with them
[QUOTE=Poo Monst3r;42905889]Why exactly is that?[/QUOTE]
They are pro SOPA. That alone warrants a warning.
Sorry, you need to Log In to post a reply to this thread.