« first day (700 days earlier)      last day (4248 days later) » 

12:00 AM
{% set result.ImageWidth = 160*(result.ImageWidth/result.ImageHeight) %}
The error is: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected token "punctuation" of value "." ("end of statement block" expected)
I'm actually thinking it doesn't like that I'm setting a value in an array....
 
Do you really need to do that in a template? Can't you do it in PHP?
 
@DaveRandom I could...
I actually was able to figure it out....weird workaround though...
{% set result = result|merge({'ImageWidth': '160*(result.ImageWidth/result.ImageHeight'}) %}
 
...and that kind of thing is why you shouldn't do it in the template ;-)
 
@DaveRandom :-) I supposed. I'm converting over a site, so normally I would put this stuff in the controller...
 
12:23 AM
Where there some changes made in Twig? Earlier I had
/**
	 * @return array
	 */
	public function getFunctions()
	{
		return array(
			'url' => new \Twig_Function_Method( $this, '_url' ),
		);
	}
And it was working fine, but now it wants Twig_FunctionInterface
Further more, Twig_Function_Method extends Twig_Function and abstract class Twig_Function implements Twig_FunctionInterface
So why the hell Catchable fatal error: Argument 2 passed to Twig_Environment::addFunction() must implement interface Twig_FunctionInterface, instance of Twig_Filter_Method given?
Sorry. My mistake. Fixed it.
 
12:44 AM
http://stackoverflow.com/questions/12433596/mysql-syntax-error-1064
 
12:58 AM
@UnoMeinAme I finished my RegEx and posted it as an answer if you are interested :-)
 
@ShaquinTrifonoff looking at it :)
I actually just realized that there is one complication that i need - either to the existing regex or as a separate one
 
@UnoMeinAme So if the string doesn't match, it should use the other RegEx?
 
beginning of the line, one to three digits or alphas, followed by a dot
so the regex should catch stuff like 25. blahblah and turn it into %%25.|blahblah
and "A. some other stuff" -> %%A.|some other stuff"
depending on whether it's easier to add it to the existing regex or to create a new one - I would then either run these sequentially or just run the one that would cover both scenarios
but both would be applied to the same set of strings
 
@UnoMeinAme So if the existing RegEx condition isn't met, then the next one should be applied?
 
@ShaquinTrifonoff well, it's going to be one or the other, because the first one requires that the string start with either ( or [
so probably it's easier to just have two sequential ones, so as not to make the ( or [ optional and then redefine the whole thing
 
1:06 AM
@UnoMeinAme It's easy enough to just add a third part to the main body of @ShaquinTrifonoff's regex that does not require braces
 
I've made the second RegEx now, anyway...
<?php
// 25. blahblah => %%25.|blahblah
// A. some other stuff => %%A.|some other stuff
function do_replace($string) {
	$regex = '/(\d{0,3}|[a-z]{1,3})\.\s*(.*)/i';
	return preg_replace($regex, '%%$1.|$2', $string);
}
$strings = array('25. blahblah', 'A. some other stuff');
foreach($strings as $string) echo do_replace($string) . PHP_EOL;
?>
So now we need to either combine them with an if statement, or modify the existing one. Modifying the existing one is the best way to go.
 
no
lol
 
dave and shaquin - you are gods
 
So, now I'll just have to modify the existing one.
@UnoMeinAme Can the second one have HTML tags too?
 
actually you're right. yes, it can :)
so very similar to the existing one, but if braces are used, then the period is optional. otherwise, the period is mandatory
 
1:12 AM
@UnoMeinAme Well, that just makes it a bit easier to merge them.
 
shaquin - looks like your second script does not take into account that it must only work with the beginning of the line
 
@UnoMeinAme Okay, but I'm going to (try to) modify the first anyway.
 
@UnoMeinAme Are the HTML tags limited to <b>, <i> etc or could it be something with attributes? Like <span class="whatever"> or something? Also, could there be multiple nested tags like <b><i>123</i></b>? If either of those things are true we're veering dangerously close to the dreaded "parsing HTML with regex"....
 
If we get too close to parsing HTML with RegEx, we might have to add PHP DOM manipulation too.
 
let's not overcomplicate this. it's probably only going to be just simple separate tags
so no nested and no attributes
 
1:18 AM
@UnoMeinAme Where is the data coming from?
 
data is taken after being processed after being received from simple html dom
 
@UnoMeinAme So is the data coming from an HTML form?
 
Right I need to , @UnoMeinAme you should probably give @ShaquinTrifonoff the accept for the question as he has now provided a better, more reliable answer than mine, and is continuing to improve it.
Night all
 
thanks again dave, night
 
@DaveRandom Night. I can keep working on it as it is only 1:21pm.
 
1:21 AM
@ShaquinTrifonoff the data is being scraped of various websites
but then only some strings are being parsed into an array
and then this array is being processed
one of the things done to the array is the addition of this %%$1|$2 stuff for strings that match a certain format
the alphas can be both lower and uppercase if that makes a difference
 
@UnoMeinAme It doesn't make a difference, as we have the /i flag (it stands for 'case **i**‮‭nsensitive').
 
i added this to the initial code:
if ($str=$str1) {
$str1= preg_replace('/(\d{0,3}|[a-z]{1,3})\.\s*(.*)/i',"%%$1.|$2",$str1);
}
$str is what's received by the function
$str1 is after it goes through the first regex
works other than it also looks in the middle of the lines
 
If you are going to use two regular expressions, use this:
function do_replace($string) {
	$regex = '/(\((?:<([a-z])>)?(\d{0,3}|[a-z]{1,3})(?:<\/\2>)?(\.)?\)|\[(?:<([a-z])>)?(\d{0,3}|[a-z]{1,3})(?:<\/\2>)?(\.)?\])\s*(.*)/i';
	$result = preg_replace($regex, '%%$1|$8', $string)
	if($result) {
		return $result;
	} else {
		// other RegEx here
	}
}
 
i'll be happy to use a single regex if you help me :)
 
@UnoMeinAme I'm working on it now.
 
1:35 AM
i won't bug you then. thank you so much for your help
 
@UnoMeinAme You're welcome.
 
1:58 AM
hey guys... just started php and am loving it :)
I have a question if anyone want to help me

http://stackoverflow.com/questions/12433845/html-form-indentation
 
I read your question but I don't understand it
 
@user1656125 You should use MySQL via PDO rather than text files to store your data.
 
the performance is better, right? However I haven't gotten to sql yet and just decided to make this application for practice. I can also modify it for sql later and just want to get it running with .txt
 
@user1656125 Fair enough.
 
shaquin, do you know how to include a file without making the html visible
@shaquin
 
2:11 AM
@user1656125 So the file is in HTML format, and you want it do display as HTML, or do you want to only display the text?
 
I have a script.. and below it is a form. I want to pass a value fromthe script to another file without passing the form :|
I'm redirecting users from a login page to a new page and want to bring their username so as to customize the page
 
@user1656125 You should use sessions.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah
haven't learned nothin about that yet
session storage?
 
<?php
// Login page
session_start();
$_SESSION['username'] = 'username';
?>

<?php
// Other page
session_start();
echo 'Welcome ' . empty($_SESSION['username']) ? 'Guest' : $_SESSION['username'];
?>
@user1656125 See above --^
 
@Shaquin THANKS BROHAN!!!!!
what other languages do you know? just curious :)
 
2:18 AM
@user1656125 The first language I learned was VBA, then I learned HTML, CSS, JavaScript, and VB.NET. I also know a small amount of Windows batch scripting and ActionScript.
 
@ShaquinTrifonoff i hope i'm not being overly presumptuous. Any luck with that regex? Thank you
 
@UnoMeinAme I'm still working on it. It's tricky making the brakets/parens optional, as it seems to mess up the text after the number.
 
that's why i thought two separate ones could be an easier solution
 
Example: %%(25)|%%| %%|b%%|l%%|a%%|h%%|b%%|l%%|a%%|h%%|
 
this is because you're not checking that the regex should only work in the beginning of a line
so for examples, "blahblahblah (23) holy smokes" should not trigger any replace
 
2:24 AM
Yeah, I think I will make it two separate regex's.
 
Does anyone have much experience with Codeigniter, specifically sending post data via a form and via ajax on the same page?
 
<?php
function do_replace($string) {
    $regex = '/(\((?:<([a-z])>)?(\d{0,3}|[a-z]{1,3})(?:<\/\2>)?(\.)?\)|\[(?:<([a-z])>)?(\d{0,3}|[a-z]{1,3})(?:<\/\2>)?(\.)?\])\s*(.*)/i';
    $result = preg_match($regex, $string);
	if($result) {
		return preg_replace($regex, '%%$1|$8', $string);
	} else {
		$regex = '/(\d{0,3}|[a-z]{1,3})\.\s*(.*)/i';
		$result = preg_match($regex, $string);
		if($result) {
			return preg_replace($regex, '%%$1.|$2', $string);
		} else {
			return $string;
		}
	}
}
$strings = array(
 
/me bows down to the almighty @ShaquinTrifonoff
 
2:40 AM
Hey. I want to do something in PHP and not so how to search for it. I know how to do basic PHP classes but I seen some frameworks do stuff like $myObject->sessions->create(); It's like a class has another class inside of it.... Anyone know what's that call? I want to find a good tutorial/blog post to make my own classes like that.
 
I have a session question of my own and was about to watch this videohttp://www.youtube.com/watch?v=WuZBQ706thI&list=EC442FA2C127377F07&index=73&‌​feature=plpp_video
maybe it will be of help?
After a user clicks a link can the name of the link be stored in $_SESSION?
 
Well my question isn't really about sessions. More about classes. Could be $myObject->account->create($username, $password);
I know how to do $accounts->create($username, $password); but have so many classes. Would love a neater single object for most of the stuff and a $object->SOMECLASS->DOSOMTHING();
 
oops, it still works on stuff in the middle of the string
 
hmm. I think I have an idea on how to do it. $object->session would be a normal varable but of another class... hmm. Maybe that's what need.
 
it also transforms "Ottawa." into "Ott%%awa.|"
 
2:49 AM
@UnoMeinAme Hmm...
@UnoMeinAme What do you mean by that?
> it still works on stuff in the middle of the string
 
if the match happens anywhere but immediately after the very beginning of the string, it should be ignored
so for example "text (1) text" -> should not be altered
another example is "ottawa." - for some reason it has been replaced with Ott%%awa.|
2008. has been turned into 2%%008.|
it doesn't happen with all dots in the middle of the line, but I can't see the method to the madness
the important thing is that if we have a match in the middle, it should not be processed
 
@UnoMeinAme Okay, I'm looking that up now :-)
This is an improvement: $regex = '/^(\d{0,3}|[a-z]{1,3})\.\s*(.+)$/i';.
@UnoMeinAme That was easy, I just needed to add ^ to the start of both regexes.
RegEx #1: $regex = '/^(\((?:<([a-z])>)?(\d{0,3}|[a-z]{1,3})(?:<\/\2>)?(\.)?\)|\[(?:<([a-z])>)?(\d{0,3}|[a-z]{1,3})(?:<\/\2>)?(\.)?\])\s*(.*)/i';
 
woohoo!
it works
thank you thank you thank you
 
RegEx #2: $regex = '/^(\d{0,3}|[a-z]{1,3})\.\s*(.+)$/i';
 
perfect! just what i need.
 
3:03 AM
@UnoMeinAme I'll edit my answer, then.
 
is it ok to link your own questions in here, in an effort to spark conversation and potentially resolve the issue faster?
 
@OliverHyde It is. People do it all the time.
 
0
Q: How to resolve strange conflict between form post and ajax post?

Oliver HydeOn the one page, I am trying to use ajax to edit existing values. I am doing this by using jQuery Inline Edit and posting away the new data, updating the record and returning with success. This is working fine. Next I have implemented the ability to add new records, to do this I have a form at...

 
0
Q: Package or Binding files to custom format

Abel JojoWarm Wishes to all, I thank all for the support from you!. I am doing my UG, So I don't know the technical word to get details. What i need to know is: I have to develop an application which handles videos, images, text. I have read that the apk file of android is a package that consist of src,...

 
When clicking a link <a href="doesn't matter">NAME</a>

IS it possible to pass NAME into session storage? If not any idea for a workaround?
in $_SESSION ?
 
3:12 AM
@user1656125 Why do you need to do that?
 
@ShaquinTrifonoff can you please modify the second part of the script so that it would be either ALL capital or ALL lower case letters before the dot
otherwise it catches stuff like Mr., Mrs, No.
 
@UnoMeinAme Should the first be like that too?
 
no the first one is in braces, so it's fine
 
@UnoMeinAme Done. $regex = '/^(\d{0,3}|[a-z]{1,3}|[A-Z]{1,3})\.\s*(.+)$/';
 
0
A: How to display validation error near textbox

ert3a few things, one you can just post against the page itself not great to have DB functions and the like in user reachable areas so check out includes and use them to reference the single page. Then make a simple variable and slide it into your form as such <? echo $error ?> and set err...

 
3:17 AM
@Shaquin for my dumb little messaging app. When I sign in I am displaying links of registered users names that link to the same php file where I can converse with that user
 
hey guys basic question up (yes i am hunting around for these) good time to lay down some advice on a fool
 
@UnoMeinAme Are there any other changes you want made?
 
@UnoMeinAme Dn't like how you're hoggin Shaquin lol
.. cerealy
 
@user1656125 You should use a form, and instead of links, use submit buttons with different names (probably the same as the user's name). Then you can get the name of the button clicked.
 
@Shaquin yeah yeah... I've already thought of workarounds.. just wondering if it was possiblEH.. thanks braaah!
 
3:21 AM
@user1656125 You can always style the buttons with CSS to make them look like a link.
 
true dat... saw that post ;)
THANKS BROOOOOOOOOOOOOOO
just really getting into CS and LOVING IT :D
feel like circle jerking
 
for the record, CS and CSS are totally different things
although it could be argued that Counter-Strike and Counter-Strike Source are similar, I beg to differ
 
HAHAAAAAAAAAAAAAAAAAAAA
 
that joke caught me totally offgaurd
@ShaquinTrifonoff You are a saint! I was about to create an input text field and just type it but tI think I will go with the buttons. THANKSSSSSSSS
@netcoder that was funny!!!!
 
3:29 AM
@user1656125 Star it :-)
 
3:57 AM
Anyone here? Haha
 
4:24 AM
@ZachReed There is probably someone here.
 
@ShaquinTrifonoff it doesn't catch the tags in the second one, does it?
 
4:45 AM
@ShaquinTrifonoff i have probably abused your patience, but i just discovered another possible pattern that I would like to process... are you finished with me or can i ask?
 
@UnoMeinAme Sure, you can ask.
 
^(number 1-3 digits)(space)(blahblah) -> %%(number)|(blahblah)
 
you are a miracle man :)
 
hi any one has javascript knowledge here
 
4:55 AM
@rahul Try the JavaScript room.
 
Hello friends i have one problem £37.91 this my value and it will display like £37.91 how can i get it in original format
 
@ShaquinTrifonoff caught another one. need a small fix for the first one. if it's an alpha in the braces, then at least one space is required, not optional, so that the function does not replace stuff like: "[a]ny sign"
 
@Jalpesh Try setting the content-type to UTF-8.
@UnoMeinAme Okay.
 
ok
i will try that
 
@UnoMeinAme That's a hard one.
 
5:07 AM
i thought that'd be the easiest to implement
what if you do at least one mandatory space for both numbers and alphas - would that be easier?
 
Probably.
 
most probably there will never be a legitimate situation with [1]blahblah anyway
from looking at your code, wouldn't it be somewhere in \s* - so that it's not 0 or more instances but 1 or more?
i don't know how to do it though :)
 
i am use utf8_encode($price) but not get any thing@ShaquinTrifonoff
same problem still i am geting
 
@Jalpesh What server config are you using?
 
i am use MySQL charset: UTF-8 Unicode (utf8)
@ShaquinTrifonoff
 
5:13 AM
@UnoMeinAme I changed \s* to \s+. ideone.com/Cl1ug
@Jalpesh That's good. Have you tested it in a different browser?
 
no i am check on firefox let me check then i will inform you @ShaquinTrifonoff
same problem in the crome
this is my problem @ShaquinTrifonoff
 
@ShaquinTrifonoff woohoo!
 
@ShaquinTrifonoff

for ($x=1; $x<count($rec); $x++) {
$usrBtnNm = usrName($x);
echo "<input type=\"submit\" name=\"usrName($x)\" value=\"$usrBtnNm\"></input>";
}

My function is not evaluating in name :(
 
@user1656125 Try name="user" instead. Then you should be able to get the value with $_POST['user'].
@Jalpesh What host are you using?
 
i am try it on my local host.@ShaquinTrifonoff
 
5:20 AM
no I need the name to be the result of the function
 
hi ppl
 
@ShaquinTrifonoff
 
hey @olli !!!!!!!!!
 
@Jalpesh Using Apache?
 
yes
@ShaquinTrifonoff
 
5:22 AM
4
A: Replace £ with £

cbuckleyThis is an issue with trying to display UTF-8–encoded data as non–UTF-8. You need to make sure that all character encodings are consistent, and if not then you're converting between them appropriately. The easiest way is to ensure that absolutely everything is in UTF-8. This includes: The data ...

@Jalpesh --^
 
@ShaquinTrifonoff above $usrBtnNM is equal to the function and it evaluates but the function doesn't
 
@user1656125 Try echo '<input type="submit" name="user" value="' . $usrBtnNm . '" />';.
 
@ShaquinTrifonoff I don't want the name to be a constant, that piece is inside a loop and I'm trying to give the different buttons different names from a function
for ($x=1; $x<count($rec); $x++) {
$usrBtnNm = usrName($x);
echo "<input type=\"submit\" name=\"usrName($x)\" value=\"$usrBtnNm\"></input>";
}
but usrName($x) was printing on the button
sry let me clarify
for ($x=1; $x<count($rec); $x++) {
$usrBtnNm = usrName($x);
echo "<input type=\"submit\" name=\"$usrBtnNm\" value=\"usrName($x)\"></input>";
}
from that code I just sent every button is saying (i.e has a value of) usrName($x)
which is a function of mine that returns a string that I want to evaluate and be the value of the button
 
@user You don't need the same value for name and value, have you tried setting name to user?
 
that is how I am setting it up
I want the name and value to be the same
in addition I want the to be a function
but my function is not evaluating in the "" it's interpreting it as a string
 
5:32 AM
@user1656125 Evaluating what?
 
for ($x=1; $x<count($rec); $x++) {
$usrBtnNm = usrName($x);
echo "<input type=\"submit\" name=\"$usrBtnNm\" value=\"usrName($x)\"></input>";
}
value=\"usrName($x)\"
 
why is this wrong:
SELECT * FROM courses INNER JOIN courses ON courses.subject = subjects.id WHERE subject = ? AND id = ?
 
usrName() inside there is a function
usrName($x) inside value=\"usrName($x)\" is a function
 
echo '<input type="submit" name="' . $usrBtnNm . '" value="' . $usrBtnNm . '" />';
@user
 
but the value of ALL my buttons are saying usrName($x) .. not saying what the function should evaluate to
yes that works.. but isn't there a way for me to call the function within the quotes? I swear I had it working earlier
 
5:35 AM
@user1656125 You can't evaluate a function inside a string, you have to store the result first, or use string concatenation (... name="' . usrName($x) . '" value="...).
 
haha... right
 
could you help me?
 
thanks @ShaquinTrifonoff
!!!!!
 
I currently have this SELECT * FROM courses WHERE subject = ? AND id = ? INNER JOIN subjects ON courses.subject = subjects.id but it won't wor
k
the error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN subjects ON courses.subject = subjects.id' at line 1
how I could fix it?
@Shaquin could you see it?
 
It looks like you can't use ON for INNER JOIN.
 
5:39 AM
ok. but how I could fix it then
I think the issue is caused by the WHERE
I now changed it to this:
`SELECT * FROM courses INNER JOIN subjects ON courses.subject = subjects.id WHERE subject = ? AND id = ?`
stupid SO why it won't format...
 
so you can't evaluate function within a string but variables can be evaluted within a string?
why?
 
and the error message is:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous'
so what could cause the problem actually?
 
SELECT * FROM courses INNER JOIN subjects WHERE courses.subject = subjects.id AND subject = ? AND id = ?
@Olli Does that work? --^
 
@ShaquinTrifonoff
so you can't evaluate function within a string but variables can be evaluted within a string?
why?
 
@user1656125 See Here
 
5:44 AM
@Shaquin no, it won't. PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous'
 
@Olli What is your table structure?
 
@Shaquin courses: id subject course finished finished_period finished_year required plann‌​edoptin yrpos1 yrpos2 yrpos3
subjects: id subjectname subjectnameshort
the courses.subject and subjects.id should be "linked" together
`?
 
@ShaquinTrifonoff i have another unrelated regex question. hope you can help.
there are two interrelated types of strings that I will be looking for
the first one is "<a href="#_ftn4" name="_ftnref4" title="">[4]</a>"
the second one is "<a href="#_ftnref4" name="_ftn4" title="">[4]</a> (1948), 79 F. Supp. 664."
from the first one I need to fish out as separate strings "#_ftn4","_ftnref4" and "[4]"
from the second one I need to fish out " (1948), 79 F. Supp. 664."
 
@UnoMeinAme I'll look at that when I've sorted out @Olli's SQL problem :-)
 
thanks
 
5:53 AM
@Olli Try SELECT * FROM courses WHERE subject = ? AND id = ? INNER JOIN subjects WHERE courses.subject = subjects.id
 
@Shaquin no, it won't work
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN subjects WHERE courses.subject = subjects.id' at line 1'
 
@Olli I'll set up the same database structure on my computer and find what works.
 
ok.
 
6:08 AM
@Shaquin Hey! I already got it working by this: SELECT * FROM courses, subjects WHERE courses.subject = subjects.id AND subject = ? AND course = ?
do you think its ok?
 
@Olli Yeah, I thought you didn't need the JOIN. :-)
 
yep :)
is there more clever way to do this:
$possibleyrs	= "";
	if($yrpos1 == "yes"){$possibleyrs .= "1";}
	if($yrpos2 == "yes"){$possibleyrs .= "&nbsp;2";}
	if($yrpos3 == "yes"){$possibleyrs .= "&nbsp;3";}
I think it's too ccomplex now
?
 
<?php
$possibleyrs = '';
$vars = array(
	$yrpos1,
	$yrpos2,
	$yrpos3
);
$values = array(
	'1',
	'&nbsp;2',
	'&nbsp;3'
);
$length = count($vars);
for($i = 0; $i < $length; $i++) {
	if($vars[$i] == 'yes') $possibleyrs .= $values[$i];
}
echo $possibleyrs;
?>
 
but that's even longer? :D
and I still think about the formatting
the numbers should have &nbsp; after and before them
 
@Olli It makes it much more maintainable for large lists of data, or data that you don't know the length of.
 
6:15 AM
ok
but now it causes problem when the 1 is not visible
then it comes &nbsp;2
 
hello @ShaquinTrifonoff i have still same problem i not got the solution of my question my data is come form the 'ISO-8859-1' this format and i want to display the '£' symobol
 
but it should only 2
@Jalpesh &pound;
 
and i ma write data in xml so i am not use &pound becuase '&' sign is not allowed in xml file
*am
@Olli
@ShaquinTrifonoff
 
@Olli
<?php
$possibleyrs = '';
$vars = array(
	$yrpos1,
	$yrpos2,
	$yrpos3
);
$values = array(
	'1',
	'2',
	'3'
);
$length = count($vars);
for($i = 0; $i < $length; $i++) {
	if($vars[$i] == 'yes') {
		if($i > 0) $possibleyrs .= '&nbsp;';
		$possibleyrs .= $values[$i];
	}
}
echo $possibleyrs;
?>
 
if i am try to use it will gives me "XML Parsing Error: not well-formed"
@Olli
@ShaquinTrifonoff
 
6:20 AM
@Shaquin ok. quite clever
@Jalpesh use UTF-8 ?
 
and i am write data in xml file using php
 
yes, can you use UTF-8
 
i am try to write in utf-8 but my data come from ISO-8859-1 and i am try to write it in the utf-8 then it will display some unknown character
@Olli
@ShaquinTrifonoff
 
@Jalpesh Did you try utf8_encode when writing the data to the file?
 
yes but not working @ShaquinTrifonoff
 
6:33 AM
@Jalpesh Is the actual file encoded as UTF-8?
 
I am deploying a website on an embedded device. To save space I am gzipping all the static text content and saving that way in files. I want to directly pass through them to browser with Content-Encoding: gzip. Do you think all browser supports gzip? or is there any gotcha?
 
@ShaquinTrifonoff Not using any apche. size is only 8M
 
@shiplu.mokadd.im That Apache page has info about gzip browser support.
 
I am not concered about bandwith I am concerned about saving space.
how about mobiel browsers?
Specially smarphones?
 
6:41 AM
2
Q: GZip with Mobile Browsers

danpI'm targetting a couple of web projects at mobile users, and noticed that some of the standard tools (JS libraries, json transfers, xml etc) are quite heavy for mobile data plans. I'd like to be able to implement gzip'd resources, and probably mod_deflate/mod_gzip to try and reduce the amount of...

@shiplu.mokadd.im --^
 
My idea is to save it as gzipped file and server by just fpassthrough. if server does not send Accept gzip, I'll uncompress it on the fly.
 
@UnoMeinAme Why don't you use PHP DOM to get the href and name?
 
no reason other than i don't know what it is :)
i used some regex constructor, and it looks like i can get the vars from the string
pretty silly code, i'm sure :)
function footnote($txt) {
$re1='<a href=\"';
$re2='(.*)'; # Variable Name 1
$re3='\" name=\"';
$re4='(.*)'; # Variable Name 2
$re5='\" title=\"\">';
$re6='(.*)'; # Variable Name 3
$re7='<\/a>';
$re8='(.*)'; # Variable Name 4

if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8."/is", $txt, $matches)) {
$var1=$matches[1][0];
$var2=$matches[2][0];
$var3=$matches[3][0];
$var4=$matches[4][0];
return array ($var1, $var2, $var3, $var4);
}
}
 
6:51 AM
@UnoMeinAme Ha ha, yes :-)
 
@ShaquinTrifonoff so I've created a bunch of buttons, how do I know when they're clicked
 
@user1656125 Well, the form will be submitted, and will go the page specified by action on the form. In the page specified by action=, you can get the values by using $var = $_POST['user'];.
 
I'm wondering where to check for that because after I create the buttons it exists a larger loop
echo '<form action="index.php" method="post">';
for ($x=1; $x<count($rec); $x++) {
$usrBtn = usrName($x);
//$_SESSION[$usrBtn]=$usrBtn;
echo "<input type=\"submit\" name=\"$usrBtn\" value=\"$usrBtn\"></input>";
}
echo '</form>';
for ($i=1; $i<count($rec); $i++) {
if (isset($_POST['usrName($i)'])) {
$_SESSION[0] = usrName($i);
echo $_SESSION[0];
}
}
the above doesn't work
how should I send you the entire code if you want to look at it? jsfiddle?
@ShaquinTrifonoff
 
@user1656125 If it is all PHP, use Codepad or IDEOne. If it has HTML too, put it on Pastebin.
 
It says here doesn't work!!!!!!!!!!!!!!!!! at the part
@ShaquinTrifonoff What I am trying to do is store the value of the button of peoples names in $_SESSION when I click the button
*trying to store the name of the button I click in $_SESSION
wow I'm getting tired.. must code on... fisrt some orange juice @ShaquinTrifonoff
 
7:04 AM
@Shaquin I changed it a little
function formatVars($vars, $values){
	$possibleyrs = '';

	$length = count($vars);
	for($i = 0; $i < $length; $i++) {
		if($vars[$i] == 'yes') {
			if($i > 0 && $i !== $length-1){ $possibleyrs .= ',&nbsp;'; } elseif($i == $length-1) { $possibleyrs .= '&nbsp;ja&nbsp;'; }
			$possibleyrs .= $values[$i];
		}
	}
	return $possibleyrs;
}
and now it inputs , 2 ja 3 instead of 2 ja 3
how I could achieve that
Shaquin?
@Shaquin ?
 
stackoverflow.com/questions/12341375/… - was my mistake. I misunderstood what the OP wanted to do.
 
7:26 AM
@Olli Sorry, I went to get something to eat too :D
 
ok, could you look it now? :D
 
@Olli Yes, I'll look now :-)
 
@ShaquinTrifonoff that bit of code i posted, if there are TWO links in the same line, it merges them - so it takes the first <a href and spans it all the way until the last </a>. How do I change that regex to only do the first occurrence?
should I report the code?
 
7:45 AM
@Shaquin but I would like it to display yrpos2,&nbsp;yrpos3&nbsp;and&nbsp;yrpos5
how that would possible?
 
@Olli This should work: codepad.org/OK9icOHW
 
ok.will try it
@Shaquin could you see this site fybmp9vq.c4-suncomet.com/lukio
please click the first yellow box
which has 1 inside it
then click some numbers after "Suoritettu vuonna" text
and please see the dev console
network tab there
will you get any sense of it
 
@Olli What ID?
 
id= get attribute
 
@Olli I see.
 
7:56 AM
it should 1.1
 
@Gordon You wrote that comment about a year ago, and now you're ing it? :P
 
@Gordon thanks for the link about PRG ,i did not know about it
 
@MadaraUchiha well, I just came across it and apparently, it didnt get cv'ed back then so I'll bump it now :)
@fluty you're welcome
 
@Gordon Well, you should cv it yourself (I'm the only voter as of now)
 
@MadaraUchiha I cant. You can only cv once
 
7:58 AM
Oh, right :D
 
@Olli In the AJAX request (in the Network tab), id is 1.1 for me.
 
yes
but after you click some numbers after "Suoritettu vuonna" text
then it should still be 1.1
but it changes
 

« first day (700 days earlier)      last day (4248 days later) »