eliminate rows from bed file - shell

I produced a bed file like this
Simple_repeat KQ420259.1 45090 45150 (TTAT)n . +
Simple_repeat KQ420259.1 46815 46864 (TG)n . +
Simple_repeat KQ420259.1 47062 47104 (GT)n . +
SINE/tRNA-Deu KQ420259.1 49227 49290 AmnSINE2 . +
Simple_repeat KQ416943.1 112522 112609 (ATAC)n . +
Simple_repeat KQ416943.1 113250 113283 (ACA)n . +
Simple_repeat KQ416943.1 113283 113358 (ACT)n . +
Simple_repeat KQ416943.1 117308 117357 (AC)n . +
Simple_repeat KQ416943.1 117357 117435 (ACAC)n . +
Simple_repeat KQ416944.1 117964 118025 (TATG)n . +
DNA/TcMar KQ416944.1 121083 121651 HSMAR1 . +
Low_complexity KQ416944.1 124929 124970 A-rich . +
and I would to eliminate all the rows containing KQ416943.1 . I don't know if exists a way to do it preserving the order. I'll appreciate your help. Thank you

try this:
grep -v "KQ416943.1" yourfile.txt > output.txt

Related

Convert Query from Codeigniter to Laravel 8

How to write this query in laravel? this query was used in Codeigniter
$ci->db->query("SELECT ratings.rating_id," . $table . "." . $namefield . " as thenamefield,ROUND(AVG(ratings.rating_num),2) as rating
FROM ratings," . $table . " WHERE " . $table . "." . $idfield . " = ratings.rating_id GROUP BY rating_id
ORDER BY rating DESC LIMIT " . $limit . "");
try this
$select_part = $table . "." . $namefield;
DB::table('ratings')
->select('ratings.rating_id',DB::raw("{$select_part} as thenamefield"),DB::raw("ROUND(AVG(ratings.rating_num)2) as rating"))
->crossJoin($table)
->whereRaw("{$select_part} = ratings.rating_id")
->groupBy("rating_id")
->orderByRaw("rating DESC")
->limit($limit)
->get();

How to get file name in Laravel without a path file

I'm trying to upload an image file to the database. But, when it posted, it shows a full path of the image file (I use the getClientOriginalName() to get the filename).
DSController.php
public function createDS2(Request $request)
{
//dd($request->all());
$imgName1 = $request->file('opsi_a')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_a')->extension();
$imgName2 = $request->file('opsi_b')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_b')->extension();
$imgName3 = $request->file('opsi_c')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_c')->extension();
$imgName4 = $request->file('opsi_d')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_d')->extension();
$data = new DS2;
$data->pertanyaan = $request->input('pertanyaan');
$data->opsi_a = $request->file('opsi_a')->move(public_path('image'), $imgName1);
$data->opsi_d = $request->file('opsi_b')->move(public_path('image'), $imgName2);
$data->opsi_b = $request->file('opsi_c')->move(public_path('image'), $imgName3);
$data->opsi_c = $request->file('opsi_d')->move(public_path('image'), $imgName4);
$data->kunci = $request->input('kunci');
$data->save();
return redirect('ds2');
}
the image file in the database will show something like this :
C:\xampp\htdocs\admin_kuis\public\image\hiu_press.png-1614165665.png
how I can just save the hiu_press.png-1614165665.png in my database?
The same way as #zia-yamin but different syntax.
$imgName1 = $request->file('opsi_a')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_a')->extension();
$imgName2 = $request->file('opsi_b')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_b')->extension();
$imgName3 = $request->file('opsi_c')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_c')->extension();
$imgName4 = $request->file('opsi_d')->getClientOriginalName() . '-' . time() . '.' . $request->file('opsi_d')->extension();
$request->file('opsi_a')->move(public_path('image'), $imgName1);
$request->file('opsi_b')->move(public_path('image'), $imgName2);
$request->file('opsi_c')->move(public_path('image'), $imgName3);
$request->file('opsi_d')->move(public_path('image'), $imgName4);
$data = new DS2;
$data->pertanyaan = $request->input('pertanyaan');
$data->opsi_a = pathinfo($imgName1, PATHINFO_BASENAME);
$data->opsi_b = pathinfo($imgName2, PATHINFO_BASENAME);
$data->opsi_c = pathinfo($imgName3, PATHINFO_BASENAME);
$data->opsi_d = pathinfo($imgName4, PATHINFO_BASENAME);
$data->kunci = $request->input('kunci');
$data->save();
return redirect('ds2');
Use This Code:
if ($request->hasFile('file_name')) {
$file_name = $request->file('file_name');
$file_name = time() . $file_name->getClientOriginalName();
}
store your file full path in $stored_file variable and then use this one:
$data->opsi_d = $request->file('opsi_b')->move(public_path('image'), pathinfo($imgName2)['basename']);
Also, you can use:
$file = Input::file('image');
$fileName = $file->move(public_path('image'), $imgName1->getOriginalFileName());
$fileName->image = $fileName ->getRealPath();

How to prevent ducplicate tickets aqnd therads in osTicket

Since around March of this year our osTicket system started posting duplicate tickets and duplicate threads.
I've tried everything method I know of to troubleshoot and identity where and why this is occurring. I've even implemented a catch condition to check the db tables prior to inserting tickets and threads to see if the contents of the $vars[]'s match what is already in the DB tables.
No success to solve this problem whatsoever.
I've Googled it and see where this issue has been in existence and dates back a number of years.
Does any one have a solution on how to stop osTicket from consistently creating ducpliate tickets and threads?
I tried the following from piecing together suggestions others have made out there in the various osTicket up through v1.10. Here is the code I tried. It actually worked for 2-days straight, then began to fail again yesterday.
Inserted around line 2498 in ./include/class.ticket.php right before if($errors) return 0;.
/**
* J.Doe added to intercept duplicate ticket entries.
* Updated: 2017-06-12
* #author John Doe <jd#example.com>
*/
$sql1='
SELECT ticketID FROM ost_ticket
WHERE
source = "' . $vars['source'] . '"
AND topic_id = "' . $vars['topicId'] . '"
AND url = "' . $vars['url'] . '"
AND priority_id = "' . $vars['priorityId'] . '"
AND duedate = "' . date( 'Y-m-d H:i:s', strtotime( $vars['duedate'] . ' ' . $vars['time'] ) ) . '"
AND team_id = "' . $vars['assignId'] . '"
AND subject = "' . $vars['subject'] . '"
AND dept_id = "' . $vars['deptId'] . '"
AND email = "' . $vars['email'] . '"
AND name = "' . $vars['name'] . '"
';
$sql2='
SELECT id FROM ost_ticket_thread
WHERE
staff_id = "' . $vars['assignId'] . '"
AND poster = "' . $vars['name'] . '"
AND title = "' . $vars['subject'] . '"
AND body = "' . $vars['message'] . '"
';
$res1=db_query($sql1);
$res2=db_query($sql2);
if( ( $res1 && db_num_rows( $res1 ) ) || ( $res2 && db_num_rows( $res2 ) ) ) {
header( 'Location: http://example.com/workorders/' );
exit;
}
//Any error above is fatal.
if($errors) return 0;

How can i overlay window subfile as400

this is the dds for my screen:
<pre>
<code>
A DSPSIZ(27 132 *DS4)
A R ASSUME
A ASSUME
A OVERLAY
A 1 3' '
A R SFLSEL SFL
A SFLNXTCHG
A SEL 1A B 4 2VALUES(' ' '1')
A 43 DSPATR(ND)
A 43 DSPATR(PR)
A FLDFET 8Y 0O 4 5EDTWRD(' / / ')
A FLDUSE 10A O 4 37
A FLDHOR 6Y 0O 4 28EDTWRD(' : : ')
A FLDFEC 8Y 0O 4 17EDTWRD(' / / ')
A FLDPER 20A H
A R CTRSEL SFLCTL(SFLSEL)
A CF03(03 'Salir')
A KEEP
A OVERLAY
A SFLCSRRRN(&RRN)
A 80 SFLDSP
A 81 SFLDSPCTL
A 82 SFLINZ
A 83 SFLCLR
A 40 SFLEND(*MORE)
A SFLSIZ(9999)
A SFLPAG(0008)
A WINDOW(*DFT 13 50)
A WDWBORDER((*COLOR BLU))
A WDWTITLE((*TEXT 'Intro = Continuar -
A F3 = Salir') *CENTER *BOTTOM)
A WDWTITLE((*TEXT 'CONSULTAR REVISION-
A ES PASADAS') *CENTER)
A NBR 4S 0H SFLRCDNBR(CURSOR)
A RRN 5S 0H
A 1 2'Op. 1=Seleccionar'
A COLOR(BLU)
A 2 2'Op Fecha Trab Fecha Gen Hora -
A Usuario '
A 3 2'==================================-
A =============='
A COLOR(WHT)
A MSGERR 30A O 1 20COLOR(RED)
</code>
</pre>
but for any razon always delete te background screen, i need to show the select but not delete the before screen.
i try several way to do that KEEP on control, ASSUME, OVERLAY, PUTOVR, RSTDSP *YES, and nothing work, please help me.
You might verify if the background screen was compiled with RSTDSP(*YES) or not. If not, try setting the attribute with the CHGDSPF command.
The problem is you require a separate record the uses OVERLAY and ASSUME. You do not have to display this record or reference it at all, it just has to be in the display file.
For example:
0017.70 A*--------------------------------------------------------------*
0017.80 A . . . . . . R BLKLN24
0018.00 A . . . . . . . . . . . . . . . . . . ASSUME
0018.10 A . . . . . . . . . . . . . . . . . . OVERLAY
should work.

Magento add category description in top navigation dropdown

I'm having problem in adding category description to top navigation. I'm using custom extension magento extension (got it from http://web-experiment.info/webandpeople-custom-menu-extension.html)
So far i went to navigation.php file and changed
$html.= '<a class="itemMenuName level' . $level . $active . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . ' </span></a>' ;
To
$html.= '<a class="itemMenuName level' . $level . $active . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . $description . ' </span></a>' ;
but still i'm getting only category name.
You can get the complete code in http://puck.ro/Navigation.txt
I thought this is not the right way of doing this!!
Did anyone tell me the exact way of doing this?
Thanks in advance.
I used this to grab the descriptions
$category_data =Mage::getModel('catalog/category')->load($id);
$category_data_des = $category_data->getDescription();
then just added in the loop like so
$html[] = '<span>'.$category_data_des.'</span>';

Resources