FAQ Database Discussion Community


Get position of last character in a substring

php,string,substring,echo
$big = "new york city"; $small ="or"; $pos = strpos($big, $small); echo $pos; Returns 5 but I want it to return 6 which is the position of "r". Thanks in advance...

valve's SOURCE loading screen

html,echo,steam
<div class="userDet"> <?php echo "Welcome to the server, $steamid! </br>" echo "Map: $map</br>" echo "Enjoy your stay." ?> </div> while this works loading it up locally, when i connect to it on my webiste i get the following error: Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ':'...

How to stop 'echo' from caching

linux,echo
I run the following: echo -n apache2.conf | sha256sum >> 02b957c917c42d01d99ed42e020415b3d5049c4b8945c65363fa8467bb4e0c6e I then make a change to the apache2.conf file and run the command again, expecting a different hash, however it is the same hash which leads me to believe that echo is caching the file in that shell memory....

printing an variable of an object that's inside an array that's inside an object

php,arrays,object,for-loop,echo
Well, ive been trying to get my crm to print multiple contacts for each company but i cant get it to work Company is a class,companycontactis a class //class called company function __construct($idklanten,$naam,$adres,$postcode,$stad,$contacten){ $this->idklanten=$idklanten; $this->naam=$naam; $this->adres=$adres; $this->postcode=$postcode; $this->stad=$stad; $this->contacten=$contacten; } //class called contact function __construct($idcontactklanten,$voornaam,$tussenvoegsel,$achternaam,$tel,$email,$klantID){...

ADB echo gives “No such file or directory”

android,echo,adb
I'm trying to write text to a file with adb and stumble on some problems. If I do it in two steps, like this: adb shell echo "hello" > /sdcard/temp/hello.txt it works. But if I try to do it on one row like this: adb shell echo "hello" > /sdcard/temp/hello.txt...

How to echo an image according to the value in the database?

php,database,echo
I have 3 group of images, productimage, productimage2, productimage3. Some product have image in all 3, but some only have 1 or 2 images. Those with 1 or 2 images, will produce an extra empty box. this is my echo coding, <?php echo "<img class='productimg' src='img/" . $product[ "productimage"] ....

Include Once inside an Echo

javascript,php,jquery,list,echo
I'm trying to echo out a php file which includes only HTML of an Option list as in this example: if (mysqli_num_rows($result) > 0) { echo '<div> Select an option:' include_once("sortedlist.php") '</div>'; } It need's to be echo'ed out because I'm adding the content via AJAX RESPONSE TEXT... is it...

PHP-How to echo my own table header using this code?

php,html,mysql,echo
I am new at programming php. Ive been using this code to echo mysql database to and HTML table. However this code echo's the table header's from the database. I want to echo my own html code in the table heather. In other words I want to imput my own...

include once inside echo [closed]

php,string,include,echo
I have two headers which I'd like to display according to account type; "a" for admin type and "b" for regular user type. I already have the enum set 'a','b'. Now, for the php after connecting to the database, I have: <?php while ($row = mysql_fetch_array($sql)){ $name = $row["name"]; $accounttype...

PHP: Echoing a JQuery Alert from case statement

javascript,php,html,echo,alert
I am trying to echo a JQuery alert from PHP. The method I am using is to echo the entire script tags and then the JQuery within it. JQuery is working because alerts elsewhere work. the JQuery library is loaded before the code i am trying so it is not...

How to echo an str_replace only if array exists in results

php,foreach,echo,str-replace
I'm very amateur when it comes to PHP, so hopefully this makes sense. I have the following foreach loop that fetches all of the "credits" that are linked to a music artist using that artist's id (mixer, producer, arranger, composer, etc). I want to be able to replace the different...

PHP how to echo an image and text file from each subfolders as a table

php,html,include,echo
I'm totally new to PHP and not an Advanced web developper but I really like to learn. My problem is the following: I want to make a projects page which would show every projects located in subfolders. In clear, that page would include a thumbnail and a two lines description...

iOS: JSON pars error when using return instead of echo in PHP service file

php,ios,json,echo,afnetworking-2
I have following HTTP request with AFNetworking: NSMutableDictionary *dictionary = [NSMutableDictionary new]; [dictionary setObject:@"login" forKey:@"request"]; [dictionary setObject:@"q" forKey:@"userName"]; [dictionary setObject:@"q" forKey:@"password"]; DDLogDebug(@"LoginView - login - Dictionary: %@", [dictionary description]); AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager setRequestSerializer:[AFJSONRequestSerializer serializer]]; [manager...

echo HINDI language word stored in an array in PHP script

php,utf-8,echo,meta,hindi
I am trying to echo hindi script words stored in an array. The output is getting displayed when i use print_r() but not when i use echo. The code is below. what changes do I need to make? <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <?php $base_arr=array("सूर्योदय","कँगन","ख...

Echo ' ' vs echo()

php,echo
its my first question on stackoverflow. I was reading PHP and MYSQL Web Development book and wondered: there is no difference at all between echo ' ' and echo()? right?

echo HTML that contains data from MySQL (whitespace)

php,jquery,mysql,string,echo
I am trying to output a dynamic table, that works with JQuery Just to get rid of the "" signs I tried declaring another variable: $rowname = $row["name"]; And then have that row name saved in the data-bubble, which would be used by JQuery. echo '<tr id='.$current_row.' data-bubble={"part":"'.$rowname.'"}>'; The JQuery...

loop for file location until file exists in bash

bash,file,loops,while-loop,echo
I have created this function: function promptFile() { while true; do read -p "Please provide a full path [q to quit]: " file if [ $file == q ]; then echo "Exiting.." return 1 fi if [ ! -f $file ]; then echo "File does not exist, please try again"...

Laravel echo strange characters

php,laravel,echo
Hey i wan't to echo something with belongsTo but the output gives me some strange characters back. class Leviews extends Entity { public $table = 'reviews'; public function ravatar() { return $this->belongsTo('User', 'author', 'username')->select('avatar'); } now when i echo the data with {{ $item->ravatar }} im getting this {"avatar":"avatars\/1.jpg"} and...

Pop up not showing! PHP echo+alert

php,echo,alert
Can someone explain to me why my alert is not working? It was fine some days ago, but suddenly it stopped showing, the thing is that only ONE is broken. Please, see the code below, the "echo ..." inside the IF(){ does not work, while the "echo..." outside the IF(){...

How to echo the source code of multiple files using file_get_contents PHP?

php,html,directory,echo,file-get-contents
<textarea placeholder="Source code of file" class="source"> <?php echo ($thesource) ?> </textarea> <?php $blacklist = array("one.jps", "two.txt", "four.html"); if ($handle = opendir('.')) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && !in_array($entry, $blacklist)) { $thesource = file_get_contents($entry); echo "<div class='post' <p>$entry</p> </div> ";...

Cannot mimic the action of `echo` command in C code

c,bash,serial-port,echo,cat
I have written a couple of bash script files that communicate via two serial ports. One script can be thought of as a receiver and the other as a transmitter. The receiving script reads and displays data line by line until it reads the character sequence <break>. It then stops...

How can I colour the output of printf %s in shell?

shell,colors,escaping,printf,echo
I have some ASCII art over multiple lines of a printf command eg: printf %s ' \ / \ / \/ ' and I would like to make each line a different colour. I have tried the obvious \e[31m but this doesn't work because I need the printf command to...

PHP : echo Multidimensional Array

php,arrays,codeigniter,multidimensional-array,echo
i have an array output like this : Array ( [2015-01-23] => Array ( [0] => Array ( [orgdate] => 2015-01-23 [origin] => india ) [1] => Array ( [orgdate] => 2015-01-23 [origin] => us ) [2] => Array ( [orgdate] => 2015-01-23 [origin] => england ) [3] => Array...

Cyfe not allowing php string in custom widget table

php,echo
I am making a dashboard using http://www.cyfe.com/ where i want to have a table containing some of my GA data.Under New widgets->custom->Private URL-> then configure widget->chart type->table I referred Cyfe in tables section example Sales Rep,Revenue($),Sales Jane Doe,100132,213 Crystal Smith,52035,102 Jack Carter,10342,54 Mona Junior,5413,21 Homer Simpson,100,1 in to my php...

print filenames into scripts in bash

bash,printf,echo
How do you print each name of a file from a directory into a string and make make new scripts? to print each file name for i in `ls new_manifest*`; do echo $i; done but when I try and print the rest of the string with $i like this is...

Bash output limited to echo only

linux,bash,shell,backup,echo
I am writing a bash script to handle by backups. I have created a message function controller that uses functions to handle email, log and output. So the structure is as: message_call(i, "This is the output") Message Function -> Pass to email function --> Build email file -> Pass to...

Declare a php constant within a php variable

php,string,variables,echo,constants
I have the following code: <?php $background_holder = echo get_bloginfo('template_directory');'/images/banner.jpg';?> background-image: url("<?php echo get_theme_mod('header_background_image', $background_holder;); ?>"); I'm trying to set a constant for the $background_holder and then add it to the background image variable. I'm sure I've just written something slightly wrong, but currently this does nothing....

PHP/MySQL An issue with echoing comments [TODO: DELETE] [closed]

php,mysql,database,while-loop,echo
I got this comment viewer script. And I'm requesting help to find an issue why it's not working. PHP doesn't show any errors. I don't know what wrong with it. My MySQL databases looks like this: comments { authorid, content, _when, } users { id, firstname, name, nickname, password }....

Echoing data from MySQL

php,mysql,count,echo,add
I have a Table in MySQL that stores data as such: Name Amount Time Person 1 1 Time Person 2 1 Time Person 3 1 Time Person 1 1 Time Person 2 1 Time Person 3 1 Time Person 1 1 Time I want to echo these reults so they...

Php code does not come out from MySQL Database properly

php,mysql,while-loop,phpmyadmin,echo
I was try to loop PHP CODE data from MYSQL database, but it looks different when it's echo'd out. HERE IS MY PHP CODE: <?php mysql_connect("localhost","root",""); mysql_select_db("myweb"); ?> <table width="100%" border="1"> <?php $query=mysql_query("SELECT * FROM right_widgets ORDER BY right_widgets_id ASC"); while($rows2=mysql_fetch_assoc($query)) { $right_widgets_id=$rows2['right_widgets_id']; $func_name=$rows2['func_name']; $active_status=$rows2['active_status']; ?> <tr> <td><?php echo $func_name;...

Batch loop/output issue

loops,batch-file,count,output,echo
I was bored so I tried writing simple code that generates a text document with a list of numbers starting from 1 and counts forever. This code here says "Echo is OFF" on the first line, "10" on the second line, "11" on the third, and so on. Why does...

(BATCH) Add new lines to text files from Echo

file,batch-file,text,echo
I'm average at Batch and am trying to create a fun program just to see what I can do. I thought it was be cool to have security logs and thought it could echo out .txt logs every time a command is processed, for example: echo %date%, %time%: Started program...

How to echo out the contents of text files in a directory based on the date that it was last modified?

php,date,echo
I have created a directory with the following files located within: index.php one.txt - Hello two.txt - Ok three.txt - Goodbye four.txt - Cool Everything in bold tells you what those text files contain. What I am trying to do is echo out all of the contents of the text...

How can I echo implode the $result with, and on the same line, without function applied?

echo,implode
How can I echo implode the $result with, and on the same line, without function applied? The code I have so far is: else { echo implode('<br/>', array_map('convertToBinaryString, $result)); } which produces: 00000 00001 00011 and so on, the NOT binary variants are: 0, 1, 3, etc.... i'd like it...

Bash reads files multiple times & output isn't right

bash,file,variables,for-loop,echo
I'm having a problem with reading multiple files and gathering info out of those files. Those files have an input like: File1: number1 text number2 text number3 text File2: number4 text number5 ... I only want to get the numbers out of every file, and those numers need to be...

echo from sql to table

php,sql,table,select,echo
i need to select some data from mysql and echo them into a table, i have 20 entries which i want to echo them into 5by4 table i can select them like this <?php $sql = "SELECT player FROM `prize` WHERE inviter='$player'"; $result = $conn->query($sql); if ($result->num_rows > 0) {...

PHP: How to use function to either echo result or to save it in a variable (partially working)

php,function,variables,echo
I am new to PHP and hope someone can help me with this. I have the following function to which I can pass an itemID (unique integer) which it will then use to return the corresponding translation from a previously created array (this is just the final part). PHP function...

Best way to echo variable in PHP [closed]

php,variables,echo
From what I've read, it isn't possible to echo more PHP code within an echo so I'm after a solution to the following: Basically, if the 'closed_state' column in my DB equals 'yes', display a link with a variable on the end else display a different link with a variable...

Re-order array or print from specific position

php,arrays,order,echo
If I have the following array: $array = array( "01" => "0", "02" => "0", "03" => "0", "04" => "0", "05" => "0", "06" => "0", "07" => "0", "08" => "0", "09" => "0", "10" => "0", "11" => "0", "12" => "0" ); how can I order...

PHP: echo item from array by its value instead of by its array index

php,arrays,key,echo
I have an array with two values stored for each item, the first one called "ID" and the second one called "en". The ID values are unique integers and the en values are text. Now I would like to echo a specific item from the array referring to it by...

Bash Echo command behaves unexpectedly in a while loop

mysql,bash,variables,while-loop,echo
I am in the process of cleaning up a user database for a client. I have the list of users that need to go, and am checking to see if they have any media that they've created before removing them. This is a very simple script, and the problem is...

Echo Selected base on $_GET value from a dynamic select box

php,echo,selected
I want to make the select box as selected value from the GET variable. Here is my code: <select name="suraNo" id="suraNo" required="required"> <option value="">-Select-</option> <?php do { ?> <option value="<?php echo $row_SuraList['suraNo']?>"> <?php echo $row_SuraList['suraNo']?>. <?php echo $row_SuraList['suraNameBN']?> </option> <?php } while ($row_SuraList = mysql_fetch_assoc($SuraList)); $rows = mysql_num_rows($SuraList); if($rows >...

why do print and echo behave differently in a “for” loop [duplicate]

php,for-loop,printing,echo,behavior
This question already has an answer here: How are echo and print different in PHP? [duplicate] 6 answers If I use print in this code: <?php for($i = 1; $i <= 3; print $i . "\n") { $i++; } ?> I see as output this: 2 3 4 But...

Using in PHP [duplicate]

php,echo,shorthand
This question already has an answer here: What does '<?=' mean in PHP? 8 answers I was upgrading a client's site the other day and noticed that the previous developer had used <?=$foo?> to echo out variable $foo in the code. I know from my days in VBScript that...

overwrite log which is currently in use from shell script

bash,shell,logging,echo,close
I have bash script which redirects all output to the log: /etc/the_watcher.sh &> /tmp/wlog.txt & Inside the script when time is coming I need to clean and overwrite it, without closing. I do it next way: echo "log restarted after sending." > /tmp/wlog.txt After that log really becomes empty, this...

Local URL is added

php,iframe,echo,soundcloud
So, I'm trying to do this to echo all my Soundcloud tracks stored in my database (by URL). When the last echo is called, the URL is: /End/public/https://api.soundcloud.com/tracks/121291880&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_rep I don't want the "/End/public/". Why is this happening? In the first echo (echo $musicArray[0]['url'];), the URL is correct (without /End/public). End...

How can I pass the redirection operator '>' as an argument for execv?

c,echo,io-redirection,execv
In the linux terminal, I can type echo hello! > /path/to/file I thought I would be able to do the same thing using execv: #include <stdio.h> #include <unistd.h> #include <fcntl.h> int main(void){ char *write_cmd[] = { "echo", "hello!", ">", "/path/to/file", NULL}; if (fork() == 0){ execv("/bin/echo", write_cmd); } else{ sleep(1);...

Wordpress Loop (the_content)

php,wordpress,class,echo
I'm creating a theme using wordpress, but i'm a little confused how php the_content(); works. In the example below, the function retrieves all the content for a single post. This is wrapped in a div 'entry-content'. This allows me to style the content <div class="entry-content"> <?php the_content(); ?> </div><!-- .entry-content...

Unix piping - echo and cat

bash,unix,echo,cat,piping
I am having trouble with the following command in Unix Bash Shell: echo "This is some text" | cat dashes - dashes "dashes" is a file containing the line of text: "---------------------------------" From my understanding, the left command's stout stream becomes the right commands stdin stream. What I expected to...

echo -e working improperly in shell script

shell,echo
I am using following script for the file which has a format that looks something like this: abc efg|hig yxf xnc xbs xnd|shc|ehc|xoc and I want the output as something like this: abc efg abc hig yxf xnc xbs xnd xbs shc xbs ehc xbs xoc and the script is...

How to echo user input and skip over punctuation and spaces? (Language C)

c,loops,echo
I've already got the part of my program that echoes user input to work, but my code seems to ignore the while line where I specify not to echo the characters in the array if they are spaces or punctuation. My code is as follows: #include <stdio.h> int main() {...

How print the result of a command with echo?

bash,echo
I want to know how print my Full Name with: awk -F: '($1==U){print $5}' U=$LOGNAME /etc/passwd per example, but with echo command with some words on sides: e.g. : Hello Diogo Saraiva, happy to see you again Where Diogo Saraiva is my Full Name which I have in Ubuntu records....

Configuring client throughput in simple TCP server

python,tcp,server,echo,tcpclient
I was given a sample project which goes like this: Client A connects to server B. A sends packet to B, B returns the same packet to A. Client A sending throughput is configurable Measure turnaround time per packet. Now step 3 is what is confusing me. Using python, the...

Php: about echoing a null variable

php,echo
I'm currently learning php using Murach (the book, published in 2010). One of the exercises has these statements: <label>Investment Amount:</label> <input type="text" name="investment" value="<?php echo $investment; ?>"/><br /> <label>Yearly Interest Rate:</label> <input type="text" name="interest_rate" value="<?php echo $interest_rate; ?>"/><br /> <label>Number of Years:</label> <input type="text" name="years" value="<?php echo $years; ?>"/><br />...

echo div class 'last' in for each loop

php,class,echo
Good morning all. Just having a little issue with a foreach loop, where I am echoing a div class="related-product', and would like to target the last div, to a 'class="related-product last". <?php $relatedProd = explode(';', $row['relatedProd']); if (sizeof($relatedProd) > 0) { echo '<h4>Hello World!</h4>'; } foreach ($relatedProd as $key =>...

html bold tag ignored by browser using php

php,jquery,html,string,echo
i have got a ajax script that inputs data into a sql table, and on submit i provide a modal with a message that displays $name of the person i am having trouble with echoing the $name variable with the bold tag in php here is how i am using...

Place PHP variables inside div

php,string,variables,echo
This may be a simple question but I don't quite know how to search for it. I am running a loop that pulls a bunch of wordpress posts. In that loop, I want to create a div that displays the variables (a div for each post), with some text formatting....

execvp() never finishes on pipe

c,printf,pipe,echo,execvp
I am taking an OS course and writing a shell. And I encountered a problem about execvp() and pipe. The following code is a simplified version of the code where problem happens. static pid_t command_exec(command_t *cmd, int *pass_pipefd) //the function that executes commands. this function will be called multiple times...

Get current session info using separate linked php file

php,html,mysql,session,echo
These are the only times Select shows up in the file. . . . function GetUserFromEmail($email,&$user_rec) { if(!$this->DBLogin()) { $this->HandleError("Database login failed!"); return false; } $email = $this->SanitizeForSQL($email); $result = mysql_query("Select * from $this->tablename where email='$email'",$this->connection); if(!$result || mysql_num_rows($result) <= 0) { $this->HandleError("There is no user with email: $email"); return...

Changing echo to show on multiple lines?

php,echo
i am trying to replace if(strlen($prod_name) > 30) {echo substr($prod_name,0,30)."...";}else {echo $prod_name;}?> with a string that instead of substr the $prod_name to just use another line. That moment when your not sure if your going full on retarded or not.....

echo json to textfile removes double quotes

python,linux,echo,simplejson
I'm trying to write a json dumps string using linux bash shell echo in a text file. My problem is it removes all double quotes. example code. d = {"key": "value"} "echo %s > /home/user/%s" % (simplejson.dumps(d), 'textfile')) Output in textfile {key: value} It removes all double quotes so I...

Add text to a file in between after a particular string

bash,command-line,awk,echo
I have build.gradle file. I need to search for a string android { and if found; on the next line it should echo some contents as echo "signing config={..SOME CODE.....} > build.gradle. Is this possible. Using the above code I could echo code from command line , only at the...

Shell programming - reading and outputting the contents of found file

bash,shell,find,echo,username
I'm attempting to create a shell script that will find a file, read that file, output the contents of that file and sorting the contents by username. The text file that the script is finding will simply contain a list of usernames and processes. For examples the usernames will look...

How To Echo Values Stored As Array in MYSQL?

php,mysql,arrays,echo
Hello Currently I have a MYSQL DB in which I post form data into. I then USE PHP to echo the data out and see the form info. Recently I added a check box and the values of the check box get stored as an ARRAY. When I go to...

Echo commented lines into a properties txt file

linux,echo
Is there any way we can redirect commented data into txt files using echo command? For eg: echo #abcd1 abcd2 abcd3 >> newFile.txt I need to comment out the entire block that I am redirecting into the text file. Hence, after executing echo, the newFile.txt should look like: #abcd1 #abcd2...

DOS/Windows xmlstarlet usage with a String instead of a xml file

command-line,echo,call,xmlstarlet
can xmlstarlet be used with a String instead of a xml file? e.g.: xmlstarlet sel -t -v "/*" "<pathlist><path>C:\file.txt</path></pathlist>" instead of xmlstarlet sel -t -v "/*" pathlist.xml or how else could i realize with a string ? when i echo the string and pipe it to xmlstarlet it does not...

How to echo search results in php

php,search,mysqli,echo
I've been trying for days to create a simple search engine to search for information in my database. The table is myisam and I get search results when using mysql to search directly in phpmyadmin. So the problem seams to be with the PHP. When searching all I get is...

Concatenated String Echos Out of Order in PHP

php,mysql,echo,string-concatenation
I have a problem with this short script that has been killing me for the past day. I am trying to concatenate a value from a mysql database table into a string and the output is out of order. Consider the following code: $result = mysqli_query($con, "SELECT something FROM table");...

Echo a message after an if statement and display it near the dropdown list

php,echo,message
I have an if statement to check that the first year from the Start Year drop down list that i have is smaller than the year in the End Year drop down list. For this reason I want whenever the Start Year is bigger than the End Year to display...

Enable a single escape sequence in echo

bash,escaping,echo
In my bash script I need to echo a tab (this happens in a loop) echo -e "$first\t$last" Unfortunately, $last might contain some escape sequences, as \n, which should be preserved. Is there any way to enable only the tab escape sequence? I'd rather not decrease performance significantly since my...

Windows Command Prompt :echo a variable without double quotes

windows,echo,command-prompt
How can i echo a variable in Windows Command Prompt without the double quotes? I want to use a One-Liner in terminal and no batch script. something like : set myvar="somevalue" and now i want to echo %myvar% and get somevalue instead of "somevalue". Is this possible at all?...

Create text file using echo in command prompt

command-line,command,echo,command-prompt
I'm creating a hello_world.txt in the desktop using echo in command prompt and this is my input. echo hello world > C:\Users\user\Desktop\hello_world.txt The first code works, then I try %userprofile% if example, I want to give it to another user. echo hello world > C:\Users\%userprofile%\Desktop\hello_world.txt Doesn't work. Any simple echo...

Color echo in batch files [duplicate]

batch-file,echo
This question already has an answer here: How to have multiple colors in a Windows batch file? 12 answers How do I add color to echo in Batch? I'd just like echo to say something like echo <Colorful text here> ...

Whats the difference between “echo” and “!echo” in bash?

linux,bash,terminal,command,echo
What the difference between the command echo and !echo? I think that with !echo it concatenates with the previous command but I'm not sure....

PHP is breaking my code

php,mysql,select,mysqli,echo
I'm trying to deploy a site but I get errors when the PHP/MySql code goes on the server. It worked fine in development but not in production. My code gets down to here, with no problems: <div class="content"> <section class="col1"> <h1>Read reviews or write us one</h1> </section> <section class="col2"> <button...

Echo css style.overflow property with javascript

javascript,jquery,css,overflow,echo
solved with @jcubic code: "To get the value use $("#expand"+idxpand).css('overflow');" I want to get the property of overflow. alert(document.getElementById("expand"+idxpand).style.overflow); Onclick if div overflow is set to hidden, expand the content . If is not set to hidden, set to overflow:hidde. $('<div id="expand'+xpndid+'" style="position: relative;overflow-y: hidden; max-height: 255px;"></div><a href="#" onclick="idxpand='+xpndid+'; expandimg();"...

How to force “echo *” to print items on separate lines in Unix?

shell,unix,echo
Is * some variable? When I do echo * it lists my working directory on one line. How can I force this command to print each item on a separate line?

Display first 100 characters from the table using echo

php,mysql,echo
Afternoon, beautiful weather isn't it? Well anyways.. Here is my problem: (see photo) http://prntscr.com/7drmc5 ofcourse this isnt very user friendly, im trying to only display the first 100 characters of the field, with a break. here is my code: echo '<tbody> <tr class="server glossed site"> <td class="rank hidden-sm hidden-xs"> '.$rank.'</td>...

How to make new line when using echo to write a file in C

c,linux,file,echo,system
hi ı am triying to take the data of files in a folder with system function this is the code char path[100],command[120]; scanf("%s",&path); sprintf(command,"echo $(ls %s) > something.txt",path); system(command); but when I look to the something.txt there is no new line. This is the output, all on one line with...

bash permission denied: Can't echo to the stdin of a running process?

bash,unix,process,pipe,echo
I'm trying to echo a command to the stdin of a running process, thus: echo -en '<Hex Command>' | /proc/<pid>/fd/0 but I'm denied permission. I tried wrapping it within sudo sh -c but faced the same error. What am I doing wrong? Edit: As a follow up question, if I...

PHP include leaving invisible character footprint

php,json,include,echo
I am setting up a game server on my dedicated server using PHP and I have run into this problem. I have a script that I run to get the game state as JSON. To save bandwidth and processing time, I decided that on the update script, I want to...

Gnuplot: plotting from string skips the first line

string,plot,echo,gnuplot,popen
Here's my minimal Gnuplot script: data="3.000000\t49.200000\n3.500000\t42.800000\n4.000000\t37.800000\n4.500000\t33.800000\n5.000000\t30.400000\n5.500000\t28.000000\n" plot '< echo -e '.sprintf('"%s"', data) using 1:2 title 'there is no data point for x=3.0?' w linespoints In my actual script, of course, I populate the data string in a different way (using the stats command), so saving the data to a file...

instead of not printing anything batch file prints echo is off

batch-file,syntax,echo
I have a very little problem, which gets on my nerves. I wrote a program for locking folders and I gave it the option to change the password as well as the tipp, however, if no tipp is typed, I want it to just print nothing. Instead it says "echo...

Can a received DatagramPacket be used to be sent again?

java,echo,datagram
I am testing a UDP echo server, is the following code correct? DatagramSocket s = ... DatagramPacket p = new DatagramPacket(new byte[512], 512); ... s.recieve(p); s.send(p); My question is, can I send the DatagramPacket just as I recieved it? According to the java specification, the contructor I used constructs a...

A bash command that adds newlines to *.cpp and *.h (or any specified filetypes)?

bash,append,echo,newline
I tried running echo "\n" >> *.cpp *.h But I got *.cpp: Ambiguous. A simple command would do, but added bonus if it only adds it to non-empty files that don't end with newline already...

echoing webpage title from the defined list

php,echo,title
I got a way to display custom page titles using include fuction. Header: <title><?php echo $pageTitle ?></title> Include: <?php $pageTitle = "Pets:"; include '../header.php'; ?> So as to handle titles easier I'd like the name to come from the predefined list: <?php define('ANIMAL', 'Dog'); ?> How do I add 'ANIMAL'...

Echo of time not displayed at end of batch file

batch-file,time,echo
Here is my batch file: @echo off set start=%time% echo %start% for /d %%i in (*) do ( mkdir "%1\%%i" cd %%i for %%j in (*.mp4) do ( echo "%1\%%i\%%j "..\ffmpeg32" -loglevel panic -i "%%j" -c:v libx264 -preset fast-crf 50 -c:a copy -y "%1\%%i\%%j" ) cd .. ) set end=%time%...

Why is my networked Java code skipping the output on every other round?

java,network-programming,echo
I have a threaded java client/server pair, and it's behaving really strange . Here is the server side : public class sample_server { private static int port=4444, maxConnections=0; // Listen for incoming connections and handle them public static void main(String[] args) { int i=0; try{ ServerSocket listener = new ServerSocket(port);...

Echo Image from get PHP [closed]

php,echo
I know it may sound stupid, but im trying to echo an image that i get his name from the url, i dont get anything only the alt text of the image. This is my code <?php $url = $_GET["userpic"]; $DisplayImg = "./Imagenes/".$url.".jpg"; ?> <html> <body> <img src="<?php echo $DisplayImg;...

Why is my ajax call returning null

javascript,php,jquery,ajax,echo
So I am doing an ajax call, that is working, to grab some xml from my REST API. When I echo the results I get, JQuery is saying that the return from ajax is null. When I var_dump the results instead, the information is accepted by JQuery, but is obviously...

Django: Real-time logging to browser

django,echo,real-time
In PHP, I used to be able to use the echo command and see scripts in real time. For example: Applying settings to 001... * a second later * Applying settings to 002... This would be shown to the user in the browser. Is there anyways I can use a...

PHP5: How come an included function always echoes first if I call it?

php,include,echo
I've got two files here: ToBeIncludedFile.php <?php function printOut(){ echo "World!"; } ?> MainFile.php <?php include("ToBeIncludedFile.php"); echo "Hello ".printOut(); ?> I would expect "Hello World!". Instead I get this: "World!Hello ". I know if I write return instead of echo, then everything is fine. Is it because I'm echoing a...

PHP Echo specific column multi dimensional array

php,arrays,multidimensional-array,echo
I'm experimenting with a multidimensional array in PHP with strings as values. I want to echo all the values of one single column, instead of all values of all columns. First i create the array! $test = array ( array("hoge", "bomen", "vangen"), array("moeten", "we", "rekening"), array("voor", "deze", "tijd") ); ``...

What is the difference between “echo” and “echo -n”?

bash,command-line,echo,osx-mavericks
The manual page on Terminal for echo -n is the following: -n Do not print the trailing newline character. This may also be achieved by appending `\c' to the end of the string, as is done by iBCS2 compatible systems. Note that this option as well as the effect of...

How to call an array using a string in PHP

php,arrays,echo
I would like to echo a bunch of arrays in numerical order, I tried using WHILE method but lacks the knowledge on how to combine strings to call a variable and get the value inside the array. $ins1 = array ( "select" => array ( "1" => "1" ), "note"...

Bash Echo String $“$value” versus “$value” versus in method $“${@}”

string,bash,printing,echo
To be specific, I'm using $ bash --version GNU bash, version 3.2.25(1)-release (i386-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. I'm reading some old bash code and there are a lot of inconsistencies with how strings are displayed and passed around. I understand that echoing a string with newline characters...

search multidimensional array with mixed data types, echo back result

php,search,multidimensional-array,echo
I have a php array with mixed data types (arrays, ints, strings). I want to search the array for a match contained within an array of mixed data types as show below. my test array $arrActors =[0 => [ 'actorName' => "heath ledger", 'actorAlias' => [], 'actorGender' => 1, 'actorNoms'...

Totalling values with the same order name

sql-order-by,echo
I have table in mysql with columns "name" and "views". I want sum views from serial whose name is in "name" column and display list of serials with views by echo from the most popular.

Echo command cuts new lines

bash,echo,command-prompt,prompt,cat
I'm trying this command in my prompt to get all results into one file: $ echo $(apt-cache search nano) > search But, they are writing in a one line: $ cat search alpine-pico - Simple text editor from Alpine, a text-based email client libboost-chrono-dev - C++ representation of time...

Maven version number output in echo rounds up value

bash,maven,echo
I am trying to get the version number of my maven project using the following line of code below in Command Line. But when I try set it as a value in my bash script using version_num = $(...) it stays rounding it up to a value of 1 when...