I'm following this tutorial for a project at work, and I was wondering if there is a way to create several lines on the same graph? At the moment I can;t do this without moving the other line along.
This is the code I have so far
d = {}
counter = 0
for lines in words:
counter += 1
for word in text1:
if word not in words:
d[word] = [counter]
else:
d[word].append(counter)
print(word, d[counter])
words = my text file
text1 is my misspelled words
But this gives me an error. What I want to do is print the word and the line number e.g.
togeher 5 7
Hi, I am wondering what this line of code mean?
b = (gen_rand_uniform()>0.5)?1:0;
The gren_rand_uniform() is a function to generate random 0 and 1 numbers. However I don't get the meaning for >0.5 and 1:0.
I know this is supposed to be a basic question, please bear with me.
Thanks!
You can declare and initialize an array with integers in one line as following:
int[] myArray = new int[{...}];
How can I do this with an ArrayList, if possible?
How can I achieve a result like somebody would expect it according to the following code example:
// assuming: void myFunction( int* arr );
myFunction( [ 123, 456, 789 ] );
// as syntactical sugar for...
int values[] = { 123, 456, 789 };
myFunction( values );
The syntax I thought would work spit out a compile error.
How can I define an argument array directly in the line where the function is called?
I would like to perform checking on the following:
VALID LINES;
/**/ some code
*/ some code /** dsfsdkf sd**/
NOT VALID LINES;
/**/ //some code
*/ /***/ //somecode
So basically if there is a line of code outside a comment it is valid, otherwise not.
What would be the best way to tackle this kind of validation?
Note:
For */ I assume that the /* has been opened some lines before.
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 use the command line sqlite3 executable to check queries I make from my code.
Is there a way to read in pragma statements or other session setup (".mode csv" for example) when the executable starts up?
I know I can do a ".read " once I'm in, but that's tedious.
I need to make a SOAP webservice call to https://sandbox.mediamind.com/Eyeblaster.MediaMind.API/V2/AuthenticationService.svc?wsdl and to use the operation ClientLogin while passing through the parameters: ApplicationKey, Password, and UserName. The response is UserSecurityToken. They are all strings.
Here is the link fully explaining what I am trying to do:
https://sandbox.mediamind.com/Eyeblaster.MediaMind.API.Doc/?v=3
How can I do this on the command line? (Windows and/or Linux would be helpful)
Thanks!
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.
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. :)
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 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 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 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!
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);
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>
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.
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?