Web Development Questions That Don't Need Their Own Thread v2
3,079 replies, posted
[QUOTE=AMD 32;33836260]How would you guys make the little triangle thing on the bottom of this?
[img]http://gyazo.com/9d449fb08d4c77faa04505226cdfb782.png[/img][/QUOTE]
I'd use the :before / :after selectors with border triangles.
( [url=http://nicolasgallagher.com/pure-css-speech-bubbles/]like this[/url] )
Is it possible to communicate with a TCP protocol using raw Javascript? The protocol is predefined, so I can not make use of WebSockets.
I've done some research and it seems the only way to do it, is using Flash or Java as a bridge. Is that true?
Yes. Or you could make a proxy server.
Can PHP retrieve [code]$_POST['someotherfield'];[/code] from a jquery submited form for e.g.
[code]
$.post('assets/main/status.php?update=status&type=post&authid='+usruniquekey+'&privacy=0', function(data) {
})
[/code]
[code]
<textarea class="textarea usrnewstatus" name="someotherfield" placeholder="What's on your mind?" autocomplete="off" onkeyup="AutoExpand(this)"></textarea>
[/code]
[QUOTE=kragmars102;33846494]Can PHP retrieve [code]$_POST['someotherfield'];[/code] from a jquery submited form for e.g.
[code]
$.post('assets/main/status.php?update=status&type=post&authid='+usruniquekey+'&privacy=0', function(data) {
})
[/code]
[code]
<textarea class="textarea usrnewstatus" name="someotherfield" placeholder="What's on your mind?" autocomplete="off" onkeyup="AutoExpand(this)"></textarea>
[/code][/QUOTE]
Yes, why wouldn't it?
It doesn't work for some odd reason.
[QUOTE=kragmars102;33849362]It doesn't work for some odd reason.[/QUOTE]
The $.post AJAX method in jQuery needs to have the post values passed through it, like this:
[code]
$.post('assets/main/status.php?update=status&type=post&authid='+usruniquekey+'&privacy=0', [b]{someotherfield: $('.usrnewstatus').val() }[/b], function(data) {
});[/code]
Then this would work:
[code]$_POST['someotherfield'][/code]
Of course, you'll want to perform all validation server-side.
[url=http://api.jquery.com/jQuery.post/]See this[/url] for more info on the $.post method
You're a lifesaver, thanks!
I've got a quick question. I've been looking for a small project that I could do, part time.. whenever I had a spare 5-10 minutes. I'm in the US on an internship and I want to document all the shit that differs from my home country (engerland).. just for shits and gigs.
For instance, Geezer... means the complete opposite in American English as it does in British English. You want a shopping trolley? well no one will know what you mean.. You take Multi vitamins.. when in the US you take Multhai Vhitamins.
I've been dieing to use PDO for some time now and I feel like it would be something easy and fun to do.. because when I return to the UK, I'll have to write a x-thousand word report on my experiences and stuff.
So anyway, my questions is... How would [B]you[/B] display tabular data? Like:
----------------------------
|This ............= That
|Geezer..........= Oldman
|Salad Creme .= Unknown
|Marmite .......= Unknown Shit
Without the use of <table><tr>?
I know that tables are still perfect for displaying tabular data but I don't feel like using them.
I was thinking of 2 divs 50% width, float them both left. 20-30px margin in between them.. and when an 'entry' or whatever you want to call them only has 1 entry filled in, it spans 100% of the container?
I have 0 design skills and this, to me, just seems like the best option.
What do you guys think?
If you just want to avoid using html tables, you could try CSS tables.
[code]
<div id="css-table">
<div class="col"><p>Example1</p></div>
<div class="col"><p>Example2</p></div>
</div>
[/code]
then the CSS
[code]
#css-table {
display: table;
}
#css-table .col {
display: table-cell;
width: 25%;
padding: 10px;
}
#css-table .col:nth-child(even) {
background: #ccc;
}
#css-table .col:nth-child(odd) {
background: #eee;
}
[/code]
Though I really wouldn't recommend this because it's basically the same thing and I don't think it's compatible with some versions of IE. The div method you talked about seems fine, you could text-align one of the columns so the text of one is next to the other.
[QUOTE=atl101;33854516]If you just want to avoid using html tables, you could try CSS tables.
[code]
<div id="css-table">
<div class="col"><p>Example1</p></div>
<div class="col"><p>Example2</p></div>
</div>
[/code]
then the CSS
[code]
#css-table {
display: table;
}
#css-table .col {
display: table-cell;
width: 25%;
padding: 10px;
}
#css-table .col:nth-child(even) {
background: #ccc;
}
#css-table .col:nth-child(odd) {
background: #eee;
}
[/code]
Though I really wouldn't recommend this because it's basically the same thing and I don't think it's compatible with some versions of IE. The div method you talked about seems fine, you could text-align one of the columns so the text of one is next to the other.[/QUOTE]
Using [code]display: table;[/code] is still making it a table, yeah.
If you use [CODE]display: block;[/CODE] however, it is mimicking a table layout, but isn't a table.
[QUOTE=zzlawlzz;33796040]What's a good place to learn Ruby / RoR?[/QUOTE]
Don't learn Ruby via Rails.
Learn Ruby first, get good with it and [i]then[/i] learn Rails.
Currently, I have some links inside this div id, gallery. Here's the CSS.
[code]
#gallery {
postition:relative;
width:40%; min-width:280px;
height:200px;
padding-left:50px;
padding-top:10px;
background:#224466;
-moz-border-radius-bottomright: 50px;
border-bottom-right-radius: 50px;
-moz-border-radius-bottomleft: 50px;
border-bottom-left-radius: 50px;
opacity:0.80;
filter:alpha(opacity=80);
}
[/code]
However, when I try to float the div by adding: [code]float:left;[/code] all of the links inside the gallery div stop working. Does anyone know why this would happen? Also, there are no other properties defined for 'a' elements in the stylesheet.
Add float left to the links inside the div
are pages a thing of the past now? i rarely see a new commercial website that uses pages to differentiate content. all i see now is different coloured backgrounds when scrolling down. is this web 3.0?
I don't think it's web 3.0, people these days are amazed by fancy animations. I however like it simple and static.
a lot sites nowadays just need 1 page, that's all
I'm in need of ruby tutorial.
[editline]23rd December 2011[/editline]
codeschool did not teach me anything. it sucked.
[QUOTE=zzlawlzz;33860933]I'm in need of ruby tutorial.
[editline]23rd December 2011[/editline]
codeschool did not teach me anything. it sucked.[/QUOTE]
If you found tryruby.org hard, the problem might be somewhere between the chair and the keyboard, to be honest. Try going over it again and see if it sticks.
Right..Not much experience over here, but wondering if you could all help out with this.
Quite simply, we're trying to make a video feed on a website...so far, we have the basics down, where we just get the video title and link...
Quite simply, the feed we are using looks like [url=http://gdata.youtube.com/feeds/base/users/CreatureCarlSlave/newsubscriptionvideos[/url]
And we'd like it to look something similar to [img]http://img10.imageshack.us/img10/2750/230f6b9f95d64545b7cc446.png[/img]
I've found a few RSS to HTML things, which include the thumbnails, but they are using the fullsized ones from the feed, and I don't know how to resize them to a managable size.....
Sorry if this is too much to ask.
You can use php to take the image and resize it, however you have to completely remake the image through php. I've done that for my thumbnails on [url]http://ezyimg.info[/url]
In PHP and XHTML website:
I have html form consisting of 10 fields and submit button, and I have php below and it says:
if(thing1 != thing2){
echo("Sorry, values do not match!");
}
- That's for example.
But when I load page, it displays it straight away, that text I mean, without even user entering anything. I need some kind of way to reset all fields 100% completely each time page loads?
[QUOTE=arleitiss;33868937]In PHP and XHTML website:
I have html form consisting of 10 fields and submit button, and I have php below and it says:
if(thing1 != thing2){
echo("Sorry, values do not match!");
}
- That's for example.
But when I load page, it displays it straight away, that text I mean, without even user entering anything. I need some kind of way to reset all fields 100% completely each time page loads?[/QUOTE]
if (isset($_POST)) {
your code
}
or
if (!empty($_POST)) {
your code
}
At least that's what I was taught, don't know if there is a better way.
isset checks if the variable exists; empty checks its value.
[php]
<?php
$var1 = 0;
$var2 = 1;
if( isset( $var1 ) )
{
echo "var1 isset";
}
if( isset( $var2 ) )
{
echo "var2 isset";
}
if( isset( $var3 ) )
{
echo "var3 isset";
}
if( !empty( $var1 ) )
{
echo "var1 !empty";
}
if( !empty( $var2 ) )
{
echo "var2 !empty";
}
if( !empty( $var3 ) )
{
echo "var3 !empty";
}
[/php]
that would output
[code]
var1 isset
var2 isset
var2 !empty
[/code]
[editline]23rd December 2011[/editline]
an empty value is considered (i think) 0, "", null, FALSE, array(), or "0"
[QUOTE=mobrockers2;33869319]if (isset($_POST)) {
your code
}
or
if (!empty($_POST)) {
your code
}
At least that's what I was taught, don't know if there is a better way.[/QUOTE]
Or both. Depending on PHP settings, having only !empty may result in an error if the variable is not defined.
[QUOTE=Dragory;33873678]Or both. Depending on PHP settings, having only !empty may result in an error if the variable is not defined.[/QUOTE]
It will always emit a notice, which might be hidden.
How would I go about setting up FTP on my VPS? Can't seem to get it working.
[editline]24th December 2011[/editline]
Running Debian 5 64 Bit
[editline]24th December 2011[/editline]
When I connect via SSH (PuTTY) and hit 'ftp' it gives me ftp> just fine, but when I try to 'open <my domain>' it says 'connection refused'.
I did an 'sudo apt-get install ftp' and it told me it's already at the newest version.
[editline]24th December 2011[/editline]
Basically what I want to do is create an account with limited privileges so my to-be-developed file-upload app won't use the root user.
Quick question. If I have something like the following:
[php]class X
{
private $test;
public function whatever()
{
$this->test = new Blah();
}
}[/php]
How would I access the variables/methods of class X from within class "Blah" that is in a variable of class X? Or is that even possible without passing class X's reference in Blah's constructor or something?
How to avoid HTML form text fields expanding when typing?
I have a neat table with values and such, but when I start typing it expands by about 1px right and 1px up which makes whole table fucked up.
[QUOTE=arleitiss;33891183]How to avoid HTML form text fields expanding when typing?
I have a neat table with values and such, but when I start typing it expands by about 1px right and 1px up which makes whole table fucked up.[/QUOTE]
Giving it an exact width/height should work.
Sorry, you need to Log In to post a reply to this thread.