Is there a way to get DVD region code from command line (linux/ubuntu 9.10)?
I want to script this action and store the region code (and other data about DVD) in a log.
I'm trying to read a comment that is stored in a mysql table. For some reason I always get a parse error on the last line of the file even if the last line is blank. I'm not sure if it's relevant but the connect.php works for putting the comment into the database. I'm using wampserver to host it and coding it by hand.
I think that's it's something to do with the while loop, when I comment out the while(){ and the } near the end I just get a few missing variable errors as you would expect. I'm quite new to php coding so I'm pretty sure the problem will be something simple that I've either missed or not understood properly.
Anyway, here's my code:
<?php
include "connect.php";
?>
<?php
$sql = "SELECT * FROM main";
$result = mysql_query($sql) or die("Could not get posts from table");
while($rows=mysql_fetch_array($result)){
?>
<table bgcolor="green" align="center">
<tr>
<td></td>
</tr>
<tr>
<td><strong> <? echo $rows['name']; ?> </strong></td>
</tr>
<tr>
<td> <? echo $rows['email']; ?> </td>
</tr>
<tr>
<td> <? echo $rows['comment']; ?> </td>
</tr>
</table>
<?
}
?>
Thanks for the help. :)
Lets us consider the following program :
#include <stdlib.h>
int main(int argc, char **argv){
int a,b;
if (argc != 3)
return -1;
a = atoi(argv[1]);
b = atoi(argv[2]);
a = b ? a/b : 0;
return a;
}
The task is to crash the program by providing arguments in command-line.
Hi,
I am using the code from this tutorial to parse a CSV file and add the contents to a database table. How would I ignore the first line of the CSV file? The controller code is below:
def csv_import
@parsed_file=CSV::Reader.parse(params[:dump][:file])
n = 0
@parsed_file.each do |row|
s = Student.new
s.name = row[0]
s.cid = row[1]
s.year_id = find_year_id_from_year_title(row[2])
if s.save
n = n+1
GC.start if n%50==0
end
flash.now[:message] = "CSV Import Successful, #{n} new students added to the database."
end
redirect_to(students_url)
end
Hello:
How can I break long lines when writing c++ code in vim? For example, if I have something like
56 fprintf(stderr, "Syntax error reading recursion value on
57 line %d in file %s\n", line_count, filename);
I get the following compile errors:
:56:25: warning: missing terminating " character
:56: error: missing terminating " character
:57: error: stray ‘\’ in program
:57:37: warning: missing terminating " character
:57: error: missing terminating " character
I'm a vim newbie.
Thanks!
I need perl script to compare line from file1 with file2 and copy to final file, something like this:
File1.txt:
ASPO01
ASPO02
ASPO03
File2.txt:
ASPO01 2013-11-10 19hrs
ASPO10 2013-11-09 24hrs
ASPO02 2013-11-08 10hrs
ASPO16 2013-11-05 9hrs
ASPO17 2013-11-06 6hrs
ASPO03 2013-11-07 15hrs
ASPO18 2013-11-02 25hrs
...
Search into File2 and copy to final file called final.log, like this:
final.txt:
ASPO01 2013-11-10 19hrs
ASPO02 2013-11-08 10hrs
ASPO03 2013-11-07 15hrs
Thanks for all good friends can help me!!!
I have dictionary like
d = {'user_id':1, 'user':'user1', 'group_id':3, 'group_name':'ordinary users'}
and "mapping" dictionary like:
m = {'user_id':'uid', 'group_id':'gid', 'group_name':'group'}
All i want to "replace" keys in first dictionary with keys from second (e.g. replace 'user_id' with 'uid', etc.)
I know that keys are immutable and i know how to do it with 'if/else' statement.
But maybe there is way to do it in one line expression?
I am trying to create a Exception class to get and send errors from client to server. I want to catch exception in javascript function and push the details to the web service to write to database.
But i couldn't get how to get which function/line throwed this exception. Is there any way to solve this?
I have a bunch of text files where I want to add a line ending after each period.
I'm wondering if there is a way to do this by doing replacing all periods with a \n\n, assuming I have the right encoding (unix).
Anyone know how I would do this? Replace .'s with \n\n and then save as a different file?
Thanks!
I am trying to get a table of icons appear on the same line as the header.
In the HTML below, the icons appear on a separate line.
I tried using 'top' attribute to move the table, but this is not a good solution because then there's an ugly space between the icons table and the rest of the document. How can I fix this?
<html>
<head>
<style type="text/css">
#action-icons
{
float:right;
position:relative;
border:0;
}
</style>
</head>
<body>
<h1 class="edit">Bla bla</h1>
<table id="action-icons">
<tbody>
<tr>
<td><img width="64" height="64"/></td>
<td><img width="60" height="60"/></td>
</tr>
<tr>
<td><img width="36" height="36"/></td>
<td><img width="36" height="36"/></td>
</tr>
</tbody>
</table>
<table width="100%" class="tasksgrid">
<tbody>
<tr>
<th class='taskcell'>One</th>
<th class='taskcell'>Two</th>
</tr>
</tbody>
</table>
</body>
</html>
How can view the execution line used by netbean v6.8 to execute my java application when I press the run program button (right pointing green arrow)? I'm looking for something like:
java -cp build/class Main
I'm trying to make the jump to java IDE developement from 15 years writing c and c++ with vi. I'm starting with netbean since it seems to have the best vi key bindings.
I can't seem to figure out why the following code doesn't produce a new line in my text file - neither does using \n etc either - any ideas what could be wrong?
$data = $name . ' | ' . $_POST['comment'] . PHP_EOL;
//write to file
$f = file_put_contents('posts.txt', $data, FILE_APPEND);
Hi...Imagine that i have on a txt this:
Hello
SLB
3
1324
how can i get the 3rd line? fgets or fscanf?
and imagine on a txt this:
8;9;10;12
how can i print the numbers separeted?
Is there a way to reconstruct the command line arguments passed to Java within a Java program, including the JVM options and classpath option?
I have a Java program that needs to restart the JVM and manipulate its bootclasspath (i.e. trying to override some system classes). I use the libc system method to invoke the new JVM.
I'm open for better approaches, but Java agents isn't an option.
How can i define each menu item in different line?
Right now if I'm adding 4 items they will get the form of 2X2. Is there a way to add them differently? Like 1 item and 3 below it? or 1X4 ?
Hi guys,
I am parsing command line options in Perl using Getopt::Long. I am forced to use prefix - (one dash) for short commands (-s) and -- (double dash) for long commands (ex. --input=file), but problem is, that there is one special option (-r=) so it is long option for its requirement for argument, but it has to have one dash (-) prefix not double dash (--) like other long options. Is possible to setup Getopt::Long to accept these?
Hello;
Why can't I start a line using a parenthesis followed by the keyword new?? For example:
(New <custom_obj>).foo(var)
In that case is obvious that I'm trying to avoid creating a named instance of the the <custom_obj> because I know that I'll only be using it at that sentence.
Note that actually creating a named instance is not a problem for me... I just wanna know the reason why this is not possible.
Hi,
do you know what is the easiest way to move selected region or line (if there is no selection) up or down in emacs? I'm looking for the same functionality as is in eclipse (bounded to M-up, M-down).
Thanks
Hello,
I am using a regular expression search to match up and replace some text. The text can span multiple lines (may or may not have line breaks).
Currently I have this:
$regex = "\<\?php eval.*?\>"
Get-ChildItem -exclude *.bak | Where-Object {$_.Attributes -ne "Directory"} |ForEach-Object {
$text = [string]::Join("`n", (Get-Content $_))
$text -replace $RegEx ,"REPLACED"}