problem
stringlengths
26
131k
labels
class label
2 classes
Difference between APIView class and viewsets class? : <p>What are the difference between <strong>APIView</strong> class and <strong>viewsets</strong> class ? I am following <a href="http://www.django-rest-framework.org/" rel="noreferrer">Django REST-framework</a> official documentation. I think it lack examples.</p> <p>Can you explain the above difference with a suitable example. </p>
0debug
static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->capabilities & CODEC_CAP_EXPERIMENTAL && strict > FF_COMPLIANCE_EXPERIMENTAL) { fprintf(stderr, "%s '%s' is experimental and might produce bad " "results.\nAdd '-strict experimental' if you want to use it.\n", codec_string, codec->name); codec = encoder ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) fprintf(stderr, "Or use the non experimental %s '%s'.\n", codec_string, codec->name); ffmpeg_exit(1); } return codec->id; }
1threat
two foreign keys referencing the same primary key.Is it in normal form? : Will the table be in normal form if in a table there are two foreign keys referencing the same primary key from another table?
0debug
closed item set in data mining with R : I'm new to data mining with R and i want to find frequent itemsets of a data set using arules package .i found this example but it doesn't work for me . ID=c("A123","A123","A123","A123","B456","B456","B456") item=c("bread", "butter", "milk", "eggs", "meat","milk", "peas") library(arules) trans <- as(split(df$item, df$ID), "transactions") the result that i want is : # items transactionID # 1 {bread,butter,eggs,milk} A123 # 2 {meat,milk,peas} B456 i'm getting this error :"Error in df$item : object of type 'closure' is not subsettable" any idea for solving this error or another way for getting item set ??
0debug
How can I solve the error 'TS2532: Object is possibly 'undefined'? : <p>I'm trying to rebuild a web app example that uses Firebase Cloud Functions and Firestore. When deploying a function I get the following error: </p> <pre><code>src/index.ts:45:18 - error TS2532: Object is possibly 'undefined'. 45 const data = change.after.data(); </code></pre> <p>This is the function:</p> <pre><code>export const archiveChat = functions.firestore .document("chats/{chatId}") .onUpdate(change =&gt; { const data = change.after.data(); const maxLen = 100; const msgLen = data.messages.length; const charLen = JSON.stringify(data).length; const batch = db.batch(); if (charLen &gt;= 10000 || msgLen &gt;= maxLen) { // Always delete at least 1 message const deleteCount = msgLen - maxLen &lt;= 0 ? 1 : msgLen - maxLen data.messages.splice(0, deleteCount); const ref = db.collection("chats").doc(change.after.id); batch.set(ref, data, { merge: true }); return batch.commit(); } else { return null; } }); </code></pre> <p>I'm just trying to deploy the function to test it. And already searched the web for similar problems, but couldn't find any other posts that match my problem. </p>
0debug
Jav- cant get "calculate again " to work. : I'm fairly new to Java so I'm having a hard time spotting my mistakes. I wrote a rock, paper, scissors game that had a play again feature. I thought I could copy it and it would work but it doesn't. This assignment is for a circle calculator. I got the main part to work I just need it to ask the user if they want to calculate another circle. Thanks in advance! package circleapp; import java.util.Scanner; public class CircleApp { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String answer; String calcAgain; do{ System.out.print("Enter a radius: "); double radius = sc.nextDouble(); //Diameter=2*radius double diameter= 2*radius; System.out.println("Diameter: " + diameter); //Circumference= 2*PI*radius double circumference= Math.PI * 2*radius; System.out.println( "Circumference: "+circumference) ; //Area= PI*radius*radius double area = Math.PI * (radius * radius); System.out.println("Area: " + area); //Would the user like to calculate again? System.out.print("Would you like to enter another circle? (Y/N)"); calcAgain = sc.nextLine(); } while (calcAgain.equalsIgnoreCase("Y")); } }
0debug
why is does the sound does not play? : func gameOver() { UserDefaults.standard.set(score, forKey: "recentScore") if score > UserDefaults.standard.integer(forKey: "highscore") { UserDefaults.standard.set(score, forKey: "highscore") } let menuScene = MenuScene(size: view!.bounds.size) view!.presentScene(menuScene) } brain.exe has stopped working why is the sound not playing? I have implemented the sound into the project but the program does not play any sound only shows the game over why is that so?????? soundWIRDSPIELEN += 1 if soundWIRDSPIELEN == 1 { run(SKAction.playSoundFileNamed("lose", waitForCompletion: true)) } soundWIRDSPIELEN -= 1 if soundWIRDSPIELEN == 0 { gameOver() } }
0debug
If statement doesnt work (python) : When I try to apply this if statement, for i in (1,14197): if (slope[i] <= 5): slope[i]=0 nothing gets changed. I read that there might be a problem with the float type of the Dataframe. So one way would be to change the dtype and then apply the if statement. But isnt there a more elegant way?
0debug
Creating Delete Query in Laravel : I'm kind of new using laravel. I created delete function but it doesnt work as I wanted to. Here are the codes in view, controller as well as routes. Could you guys tell me what was wrong in the code? Thanks View: <div class="btn-group"> <a class="btn btn-info" href="{{ URL::to('/delete_data_tanah/{id}') }}"><i class="fa fa-close" onclick="return confirm('Are you sure you want to delete this data?');">----</i></a> </div> Controller: public function delete($id){ \App\Tbl_object::where('id_objects', '=', $id)->delete(); return redirect('/list_tanah')->with('Success', 'Data telah dihapus'); } Routes: Route::post('/delete_data_tanah/{id}', 'formulir_tanah@delete');
0debug
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **open_inputs_ptr, AVFilterInOut **open_outputs_ptr, void *log_ctx) { int index = 0, ret = 0; char chr = 0; AVFilterInOut *curr_inputs = NULL; AVFilterInOut *open_inputs = open_inputs_ptr ? *open_inputs_ptr : NULL; AVFilterInOut *open_outputs = open_outputs_ptr ? *open_outputs_ptr : NULL; do { AVFilterContext *filter; const char *filterchain = filters; filters += strspn(filters, WHITESPACES); if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx)) < 0) goto end; if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0) goto end; if (filter->input_count == 1 && !curr_inputs && !index) { const char *tmp = "[in]"; if ((ret = parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx)) < 0) goto end; } if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx)) < 0) goto end; if ((ret = parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs, log_ctx)) < 0) goto end; filters += strspn(filters, WHITESPACES); chr = *filters++; if (chr == ';' && curr_inputs) { av_log(log_ctx, AV_LOG_ERROR, "Invalid filterchain containing an unlabelled output pad: \"%s\"\n", filterchain); ret = AVERROR(EINVAL); goto end; } index++; } while (chr == ',' || chr == ';'); if (chr) { av_log(log_ctx, AV_LOG_ERROR, "Unable to parse graph description substring: \"%s\"\n", filters - 1); ret = AVERROR(EINVAL); goto end; } if (open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) { const char *tmp = "[out]"; if ((ret = parse_outputs(&tmp, &curr_inputs, &open_inputs, &open_outputs, log_ctx)) < 0) goto end; } end: if (open_inputs_ptr) *open_inputs_ptr = open_inputs; else avfilter_inout_free(&open_inputs); if (open_outputs_ptr) *open_outputs_ptr = open_outputs; else avfilter_inout_free(&open_outputs); avfilter_inout_free(&curr_inputs); if (ret < 0) { for (; graph->filter_count > 0; graph->filter_count--) avfilter_free(graph->filters[graph->filter_count - 1]); av_freep(&graph->filters); } return ret; }
1threat
Goroutine: time.Sleep or time.After : <p>I wonder what is the better way to do a wait in a goroutine, <code>time.Sleep()</code> or <code>&lt;-time.After()</code>? What's the difference between the two and how to make choices? Thanks.</p>
0debug
void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) { int64_t nb_sectors = bdrv_nb_sectors(bs); *nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors; }
1threat
Add a method to invoked in another methed that is complied : I'm trying to figure this out: I have a complied class file named A.class that have method A and I have another class file that I can edit called B.class that contains method B and I can't edit the class A even if I have the java file and I need to invoke method B when method A is invoked like the method A called method B.
0debug
Bogus float inequality due to compiler optimization? : <p>I found that some straightforward code results in an unexpected (and incorrect) inequality comparison on GCC 4.6.1 vs Visual Studio (2008 &amp; 2012) or Clang 7.3.0 on OSX.</p> <p>Here's a reduced snippet:</p> <pre><code>typedef float ftype; struct Foo { ftype v; Foo(): v(16.0f / 60.0f) {} ftype val() const {return v * 60.0f;} }; void bar() { Foo f; ftype v = f.val(); if (v != f.val()) printf("inequal"); } </code></pre> <p>If ftype is typedef'd as double then the problem doesn't occur. Could this be something to do with compiler inlining? Perhaps actually returning a double instead of a float?</p>
0debug
How can put a text in a scene if games finish? : My problem is: I play a game , and I want that if you lose , **inmediately in the top of the screen must appear a text with "Record: X"** , I don't want change scene or something, no, **I want only put a text in the top of screen in the same scene**, like in _Stack_ Is possible? My code for example is a 2 objects with collision, and when they collision, i want put this text in the top. ``public class Colision : MonoBehaviour {`` public Text points; int contador=0; int Veces_Pequeño=0; void OnCollisionEnter(Collision col){ if ( col.gameObject.name == "Cube") { col.gameObject.SetActive (false); } if ( col.gameObject.name == "Cube1") { col.gameObject.SetActive (false); } ``}``
0debug
Inserting a record in sql server database using session in aspnet with c# : Hey guys I'm trying to insert a record in sql server 2014 database using asp.net with c#. I have implemented session for my gridview data, I'm trying to insert that session into databse, but when I click the button "book", only the top url changes [![url bar pic][1]][1] [1]: https://i.stack.imgur.com/S4olu.png the record isnt getting inserted into database nor my Label(Errorm) is changing to gg, thanks in advance **.aspx file** <%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="hotels.aspx.cs" Inherits="Hotel_Mangement.hotels" %> <asp:Content ID="Content1" ContentPlaceHolderID="hotels" runat="server"> <div class="destinations"> <div class="destination-head"> <div class="wrap"> <h3>Hotels</h3> </div> <!---End-destinatiuons----> <div class="find-place dfind-place"> <div class="wrap"> <div class="p-h"> <span>FIND YOUR</span> <label>HOTEL</label> </div> <!---strat-date-piker----> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <script> $(function () { $("#<%= txtstart.ClientID %>").datepicker(); }); </script> <!---/End-date-piker----> <!---strat-date-piker----> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <script> $(function () { $("#<%= txtend.ClientID %>").datepicker(); }); </script> <!---/End-date-piker----> <div class="p-ww"> <form> <span> City or Area</span> <asp:DropDownList ID="dl1" runat="server" class="dest" required="This field cannot be blank"> <asp:ListItem Selected="True">Location</asp:ListItem> <asp:ListItem>Mumbai</asp:ListItem> <asp:ListItem>Goa</asp:ListItem> <asp:ListItem>Delhi</asp:ListItem> <asp:ListItem>Ahmedabad</asp:ListItem> <asp:ListItem>Jammu</asp:ListItem> <asp:ListItem>Jharkhand</asp:ListItem> <asp:ListItem>Kerala</asp:ListItem> <asp:ListItem>Bhuj</asp:ListItem> <asp:ListItem>Bengaluru</asp:ListItem> <asp:ListItem>Kalyan</asp:ListItem> </asp:DropDownList><br /> <br /><span> Check-in</span> <asp:TextBox ID="txtstart" runat="server" class="date" required="This field cannot be blank"></asp:TextBox> <span> Check-out</span> <asp:TextBox ID="txtend" runat="server" class="date" required="This field cannot be blank"></asp:TextBox><br /> <br /> <span> Number of rooms</span> <asp:DropDownList ID="dlrooms" runat="server" required="This field cannot be blank"> <asp:ListItem Selected="True">Select number of rooms</asp:ListItem> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> </asp:DropDownList><br /><br /> <span> Number of members</span> <asp:DropDownList ID="dlmumbers" runat="server" required="This field cannot be blank"> <asp:ListItem Selected="True">Select number of members per room</asp:ListItem> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> </asp:DropDownList> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Search" OnClick="Button1_Click" /> </form> </div> <div class="clear"> </div> </div> </div> <!----//End-find-place----> </div> <div class="criuse-main"> <div class="wrap"> <div class="criuse-head1"> <h3>CHEAPEST HOTELS</h3> </div> </div> </div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:RegisterConnectionString15 %>' SelectCommand="SELECT * FROM [hotels_main]"></asp:SqlDataSource> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" > <ItemTemplate> <div ID="div1" runat="server"> <div class="criuse-main" > <div class="wrap"> <div class="criuse-grids"> <div class="criuse-grid"> <div class="criuse-grid-head"> <div class="criuse-img"> <div class="criuse-pic"> <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("ImagePath") %>' Height="350px" width="1000px"/> </div> <div class="criuse-pic-info"> <div class="criuse-pic-info-top"> <div class="criuse-pic-info-top-weather"> <p>33<label>o</label><i>c</i><span> </span></p> </div> <div class="criuse-pic-info-top-place-name"> <h2><span><%#Eval("hotel_location") %></span></h2> </div> </div> <div class="criuse-pic-info-price"> <p><span>Starting From</span> <h4><%#Eval("price") %> $</h4></p> </div> </div> </div> <div class="criuse-info"> <div class="criuse-info-left"> <ul> <li><a class="c-hotel" href="#"><span> </span><%#Eval("rooms_available") %></a></li> <li><a class="c-air" href="flight.aspx"><span> </span> Air Ticket</a></li> <li><a class="c-fast" href="#"><span> </span> Guest per room:<%#Eval("max_guest") %></a></li> <li><a class="c-car" href="#"><span> </span> Car for All transfers</a></li> <div class="clear"> </div> </ul> </div> <div class="clear"> </div> </div> </div> <div class="criuse-grid-info"> <h1> <a href="hotels_main.aspx?id=<%#Eval("hotel_id") %>" ><%#Eval("hotel_name") %></a></h1> <p><%#Eval("s_desc") %> </p> </div> </div> </div> </div> </div> </div> </ItemTemplate> </asp:Repeater> <center> <div> <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" class="myGridClass" AutoGenerateColumns="False"> <AlternatingRowStyle BackColor="White" /> <EditRowStyle BackColor="#7C6F57" /> <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#E3EAEB" /> <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingCellStyle BackColor="#F8FAFA" /> <SortedAscendingHeaderStyle BackColor="#246B61" /> <SortedDescendingCellStyle BackColor="#D4DFE1" /> <SortedDescendingHeaderStyle BackColor="#15524A" /> <Columns> <asp:TemplateField HeaderText="HotelName"> <ItemTemplate> <asp:Label ID="lblhotelname" runat="server" Text='<%# Bind("hotel_name") %>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="HotelLocation"> <ItemTemplate> <asp:Label ID="lblhotellocation" runat="server" Text='<%# Bind("hotel_location") %>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Price"> <ItemTemplate> <asp:Label ID="lblprice" runat="server" Text='<%# Bind("price") %>' ></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label> <br /> <form> <asp:Button ID="book" runat="server" Text="Book now" class="d-next" OnClick="book_Click" /> </form> <asp:Label ID="lprice" runat="server" Text="Label" Visible="False"></asp:Label> <asp:Label ID="lcheckin" runat="server" Text="Label" Visible="False"></asp:Label> <asp:Label ID="lcheckout" runat="server" Text="Label" Visible="False"></asp:Label> <asp:Label ID="lmembers" runat="server" Text="Label" Visible="False"></asp:Label> <asp:Label ID="lrooms" runat="server" Text="Label" Visible="False"></asp:Label> <br /> <asp:Label ID="Errorm" runat="server" Text="Label"></asp:Label> </div> </center> </div> </asp:Content> **.aspx.cs** using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace Hotel_Mangement { public partial class hotels : System.Web.UI.Page { SqlConnection con = new SqlConnection(@"Data Source=RISHIK\SQLEXPRESS;Initial Catalog=Register;Integrated Security=True"); protected void Page_Load(object sender, EventArgs e) { GridView1.Visible = false; /*div1.Visible = true; */ con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from hotels_main"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); con.Close(); book.Visible = false; } protected void Button1_Click(object sender, EventArgs e) { string query = "select hotel_name, hotel_location ,price from hotels_main where hotel_location='" + dl1.Text + "' "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); GridView1.Visible=true; con.Close(); if (ds.Tables[0].Rows.Count == 0) { Label1.Visible = true; Label1.Text = "No data found"; book.Visible = false; } else { /* div1.Visible = true;*/ Label1.Visible = false; book.Visible = true; DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new System.Data.DataColumn("HotelName", typeof(String))); dt.Columns.Add(new System.Data.DataColumn("HotelLocation", typeof(String))); dt.Columns.Add(new System.Data.DataColumn("Price", typeof(String))); foreach (GridViewRow row in GridView1.Rows) { Label lblhotelname = (Label)row.FindControl("lblhotelname"); Session["hotelname"] = lblhotelname.Text; Label lblhotellocation = (Label)row.FindControl("lblhotellocation"); Session["hotelocation"] = lblhotellocation.Text; Label lblprice = (Label)row.FindControl("lblprice"); Session["price"] = lblprice.Text; dr = dt.NewRow(); dr[0] = lblhotelname.Text; dr[1] = lblhotellocation.Text; dr[2] = lblprice.Text; dt.Rows.Add(dr); } Session["check_in"] = txtstart.Text.ToString(); Session["check_out"] = txtend.Text.ToString(); } } /*private void SendGridInfo() { } Session["GridData"] = dt; Response.Redirect("WebForm2.aspx"); } */ protected void book_Click(object sender, EventArgs e) { con.Open(); string insertQuery = "Insert into hotelbook_details values('" + Session["USER_ID"].ToString() + "','" + Session["hotelname"].ToString() + "','" + Session["hotelocation"].ToString() + "','" + Session["check_in"].ToString() + "','" + Session["check_out"].ToString() + "','" + Session["price"].ToString() + "')"; SqlCommand cmd1 = new SqlCommand(insertQuery, con); cmd1.ExecuteNonQuery(); con.Close(); Errorm.Text = "gg"; } } }
0debug
iscsi_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov, int flags) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; bool fua = flags & BDRV_REQ_FUA; if (fua) { assert(iscsilun->dpofua); } if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) { error_report("iSCSI Error: Write of %d sectors exceeds max_xfer_len " "of %d sectors", nb_sectors, bs->bl.max_transfer_length); return -EINVAL; } lba = sector_qemu2lun(sector_num, iscsilun); num_sectors = sector_qemu2lun(nb_sectors, iscsilun); iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (iscsilun->use_16_for_rw) { iTask.task = iscsi_write16_task(iscsilun->iscsi, iscsilun->lun, lba, NULL, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, fua, 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_write10_task(iscsilun->iscsi, iscsilun->lun, lba, NULL, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, fua, 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov); while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } iscsi_allocationmap_set(iscsilun, sector_num, nb_sectors); return 0; }
1threat
CRAN check warning: Dependence on R version '3.4.3' not with patchlevel 0 : <p>I am submitting my R package to CRAN, and am receiving a warning from the CRAN servers that does not appear when I run <code>R CMD CHECK --as-cran</code> locally on the package tarball prior to uploading to CRAN. This causes my package to fail the automatic CRAN check.</p> <p>This is the warning:</p> <pre><code>* checking DESCRIPTION meta-information ... WARNING Dependence on R version '3.4.3' not with patchlevel 0 </code></pre> <p>My DESCRIPTION file contains this line:</p> <p><code>Depends: R (&gt;= 3.4.3)</code></p> <p>What does this warning mean? Thanks!</p>
0debug
How to achieve test isolation with Symfony forms and data transformers? : <p><strong><em>Note:</strong> This is Symfony &lt; 2.6 but I believe the same overall issue applies regardless of version</em></p> <p>To start, consider this form type that is designed to represent one-or-more entities as a hidden field (namespace stuff omitted for brevity)</p> <pre><code>class HiddenEntityType extends AbstractType { /** * @var EntityManager */ protected $em; public function __construct(EntityManager $em) { $this-&gt;em = $em; } public function buildForm(FormBuilderInterface $builder, array $options) { if ($options['multiple']) { $builder-&gt;addViewTransformer( new EntitiesToPrimaryKeysTransformer( $this-&gt;em-&gt;getRepository($options['class']), $options['get_pk_callback'], $options['identifier'] ) ); } else { $builder-&gt;addViewTransformer( new EntityToPrimaryKeyTransformer( $this-&gt;em-&gt;getRepository($options['class']), $options['get_pk_callback'] ) ); } } /** * See class docblock for description of options * * {@inheritdoc} */ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver-&gt;setDefaults(array( 'get_pk_callback' =&gt; function($entity) { return $entity-&gt;getId(); }, 'multiple' =&gt; false, 'identifier' =&gt; 'id', 'data_class' =&gt; null, )); $resolver-&gt;setRequired(array('class')); } public function getName() { return 'hidden_entity'; } /** * {@inheritdoc} */ public function getParent() { return 'hidden'; } } </code></pre> <p>This works, it's straightforward, and for the most part looks like like all the examples you see for adding data transformers to a form type. Until you get to unit testing. See the problem? The transformers can't be mocked. "But wait!" you say, "Unit tests for Symfony forms are integration tests, they're supposed to make sure the transformers don't fail. Even says so <a href="http://symfony.com/doc/current/form/unit_testing.html" rel="noreferrer">in the documentation</a>!"</p> <blockquote> <p>This test checks that none of your data transformers used by the form failed. The isSynchronized() method is only set to false if a data transformer throws an exception</p> </blockquote> <p>Ok, so then you live with the fact you can't isolate the transformers. No big deal? </p> <p>Now consider what happens when unit testing a form that has a field of this type (assume that <code>HiddenEntityType</code> has been defined &amp; tagged in the service container)</p> <pre><code>class SomeOtherFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder -&gt;add('field', 'hidden_entity', array( 'class' =&gt; 'AppBundle:EntityName', 'multiple' =&gt; true, )); } /* ... */ } </code></pre> <p>Now enters the problem. The unit test for <code>SomeOtherFormType</code> now needs to implement <code>getExtensions()</code> in order for the <code>hidden_entity</code> type to function. So how does that look?</p> <pre><code>protected function getExtensions() { $mockEntityManager = $this -&gt;getMockBuilder('Doctrine\ORM\EntityManager') -&gt;disableOriginalConstructor() -&gt;getMock(); /* Expectations go here */ return array( new PreloadedExtension( array('hidden_entity' =&gt; new HiddenEntityType($mockEntityManager)), array() ) ); } </code></pre> <p>See where that comment is in the middle? Yeah, so for this to work correctly, all of the mocks and expectations that are in the unit test class for the <code>HiddenEntityType</code> now effectively need to be duplicated here. I'm not OK with this, so what are my options?</p> <ol> <li><p>Inject the transformer as one of the options</p> <p>This would be very straightforward and would make mocking simpler, but ultimately just kicks the can down the road. Because in this scenario, <code>new EntityToPrimaryKeyTransformer()</code> would just move from one form type class to another. Not to mention that I feel form types <em>should</em> hide their internal complexity from the rest of the system. This option means pushing that complexity outside the boundary of the form type.</p></li> <li><p>Inject a transformer factory of sorts into the form type</p> <p>This is a more typical approach to removing "newables" from within a method, but I can't shake the feeling that this is being done just to make the code testable, and is not actually making the code better. But if that was done, it would look something like this</p> <pre><code>class HiddenEntityType extends AbstractType { /** * @var DataTransformerFactory */ protected $transformerFactory; public function __construct(DataTransformerFactory $transformerFactory) { $this-&gt;transformerFactory = $transformerFactory; } public function buildForm(FormBuilderInterface $builder, array $options) { $builder-&gt;addViewTransformer( $this-&gt;transformerFactory-&gt;createTransfomerForType($this, $options); ); } /* Rest of type unchanged */ } </code></pre> <p>This feels ok until I consider what the factory will actually look like. It will need the entity manager injected, for starters. But what then? If I look further down the road, this supposedly-generic factory could need all sorts of dependencies for creating data transformers of different kinds. That is clearly not a good long-term design decision. So then what? Re-label this as an <code>EntityManagerAwareDataTransformerFactory</code>? It's starting to feel messy in here.</p></li> <li><p>Stuff I'm not thinking of...</p></li> </ol> <p>Thoughts? Experiences? Solid advice?</p>
0debug
How to get only the value from an array of objects in javascript with out mention it's key? : <p>I have an array of object like:</p> <pre><code>var customerArr = [ { name:'Tarmizi', address: 'Bintaro' }, { name:'Imam', address: 'Pejaten' }, { name:'gugi', address: 'Depok' }, { name:'een', address: 'Bintaro' } ]; </code></pre> <p>The result I want to is: </p> <pre><code>Tarmizi Imam gugi een </code></pre> <p>I can get the result like above with:</p> <pre><code>for(customer in customerArr){ console.log(customerArr[customer].name); } </code></pre> <p>But in my case the object of array I get from json array by uploading excel file with header has space.</p> <p>So, I need to get the value of array with out mention of it's key.</p> <pre><code>for(customer in customerArr){ console.log(customerArr[customer].name &lt;-- with out .name); } </code></pre> <p>Thank a lot before</p>
0debug
bootstrap not working on rails 4 : i'm having problems with my app,i can't see any bootstraps effects on my rails app it looks the same. i have done bundle install,but i can't see any difference in it.this is my first time using bootstrap here is my gemfile source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.5.1' gem 'bootstrap-sass', '~> 3.3.6' gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :development, :test do gem 'sqlite3' # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' end group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' end group :production do gem 'pg' gem 'rails_12factor' and my application js // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require bootstrap-sprockets //= require turbolinks //= require_tree . and my application css This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require_tree . *= require_self */
0debug
How to read output from cmd.exe using CreateProcess() and CreatePipe() : <blockquote> <p>How to read output from cmd.exe using CreateProcess() and CreatePipe() </p> </blockquote> <p>I have been trying to create a child process executing <code>cmd.exe</code> with a command-line designating <code>/K dir</code>. The purpose is to read the output from the command back into the parent process using pipes. </p> <p>I've already got <code>CreateProcess()</code> working, however the step involving pipes are causing me trouble. Using pipes, the new console window is not displaying (like it was before), and the parent process is stuck in the call to <code>ReadFile()</code>.</p> <p>Does anyone have an idea of what I'm doing wrong?</p> <pre><code>#include &lt;Windows.h&gt; #include &lt;stdio.h&gt; #include &lt;tchar.h&gt; #define BUFFSZ 4096 HANDLE g_hChildStd_IN_Rd = NULL; HANDLE g_hChildStd_IN_Wr = NULL; HANDLE g_hChildStd_OUT_Rd = NULL; HANDLE g_hChildStd_OUT_Wr = NULL; int wmain(int argc, wchar_t* argv[]) { int result; wchar_t aCmd[BUFFSZ] = TEXT("/K dir"); // CMD /? STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; printf("Starting...\n"); ZeroMemory(&amp;si, sizeof(STARTUPINFO)); ZeroMemory(&amp;pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&amp;sa, sizeof(SECURITY_ATTRIBUTES)); // Create one-way pipe for child process STDOUT if (!CreatePipe(&amp;g_hChildStd_OUT_Rd, &amp;g_hChildStd_OUT_Wr, &amp;sa, 0)) { printf("CreatePipe() error: %ld\n", GetLastError()); } // Ensure read handle to pipe for STDOUT is not inherited if (!SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0)) { printf("SetHandleInformation() error: %ld\n", GetLastError()); } // Create one-way pipe for child process STDIN if (!CreatePipe(&amp;g_hChildStd_IN_Rd, &amp;g_hChildStd_IN_Wr, &amp;sa, 0)) { printf("CreatePipe() error: %ld\n", GetLastError()); } // Ensure write handle to pipe for STDIN is not inherited if (!SetHandleInformation(g_hChildStd_IN_Rd, HANDLE_FLAG_INHERIT, 0)) { printf("SetHandleInformation() error: %ld\n", GetLastError()); } si.cb = sizeof(STARTUPINFO); si.hStdError = g_hChildStd_OUT_Wr; si.hStdOutput = g_hChildStd_OUT_Wr; si.hStdInput = g_hChildStd_IN_Rd; si.dwFlags |= STARTF_USESTDHANDLES; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; // Pipe handles are inherited sa.bInheritHandle = true; // Creates a child process result = CreateProcess( TEXT("C:\\Windows\\System32\\cmd.exe"), // Module aCmd, // Command-line NULL, // Process security attributes NULL, // Primary thread security attributes true, // Handles are inherited CREATE_NEW_CONSOLE, // Creation flags NULL, // Environment (use parent) NULL, // Current directory (use parent) &amp;si, // STARTUPINFO pointer &amp;pi // PROCESS_INFORMATION pointer ); if (result) { printf("Child process has been created...\n"); } else { printf("Child process could not be created\n"); } bool bStatus; CHAR aBuf[BUFFSZ + 1]; DWORD dwRead; DWORD dwWrite; // GetStdHandle(STD_OUTPUT_HANDLE) while (true) { bStatus = ReadFile(g_hChildStd_OUT_Rd, aBuf, sizeof(aBuf), &amp;dwRead, NULL); if (!bStatus || dwRead == 0) { break; } aBuf[dwRead] = '\0'; printf("%s\n", aBuf); } // Wait until child process exits WaitForSingleObject(pi.hProcess, INFINITE); // Close process and thread handles CloseHandle(pi.hProcess); CloseHandle(pi.hThread); printf("Stopping...\n"); return 0; } </code></pre>
0debug
static void submit_pdu(V9fsState *s, V9fsPDU *pdu) { pdu_handler_t *handler; if (debug_9p_pdu) { pprint_pdu(pdu); } BUG_ON(pdu->id >= ARRAY_SIZE(pdu_handlers)); handler = pdu_handlers[pdu->id]; BUG_ON(handler == NULL); handler(s, pdu); }
1threat
void qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque) { RAMBlock *block; rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { func(block->host, block->offset, block->used_length, opaque); } rcu_read_unlock(); }
1threat
static inline int usb_bt_fifo_dequeue(struct usb_hci_in_fifo_s *fifo, USBPacket *p) { int len; if (likely(!fifo->len)) return USB_RET_STALL; len = MIN(p->len, fifo->fifo[fifo->start].len); memcpy(p->data, fifo->fifo[fifo->start].data, len); if (len == p->len) { fifo->fifo[fifo->start].len -= len; fifo->fifo[fifo->start].data += len; } else { fifo->start ++; fifo->start &= CFIFO_LEN_MASK; fifo->len --; } fifo->dstart += len; fifo->dlen -= len; if (fifo->dstart >= fifo->dsize) { fifo->dstart = 0; fifo->dsize = DFIFO_LEN_MASK + 1; } return len; }
1threat
How to write htaccess : <p><a href="http://127.0.0.1:8887/mysite/Products/?cat=Daily%20Needs&amp;subCat=Cosmetics&amp;brand=Ponds&amp;prodName=Winter&amp;sz=2&amp;sw=1349" rel="nofollow noreferrer">http://127.0.0.1:8887/mysite/Products/?cat=Daily%20Needs&amp;subCat=Cosmetics&amp;brand=Ponds&amp;prodName=Winter&amp;sz=2&amp;sw=1349</a></p> <p>i want an htaccess which can change it to look like <a href="http://127.0.0.1:8887/mysite/Products/" rel="nofollow noreferrer">http://127.0.0.1:8887/mysite/Products/</a> </p> <p>also it should keep the query intact so that i can use it in the page</p>
0debug
static int decode_hextile(VmncContext *c, uint8_t *dst, const uint8_t *src, int ssize, int w, int h, int stride) { int i, j, k; int bg = 0, fg = 0, rects, color, flags, xy, wh; const int bpp = c->bpp2; uint8_t *dst2; int bw = 16, bh = 16; const uint8_t *ssrc = src; for (j = 0; j < h; j += 16) { dst2 = dst; bw = 16; if (j + 16 > h) bh = h - j; for (i = 0; i < w; i += 16, dst2 += 16 * bpp) { if (src - ssrc >= ssize) { av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n"); return -1; } if (i + 16 > w) bw = w - i; flags = *src++; if (flags & HT_RAW) { if (src - ssrc > ssize - bw * bh * bpp) { av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n"); return -1; } paint_raw(dst2, bw, bh, src, bpp, c->bigendian, stride); src += bw * bh * bpp; } else { if (flags & HT_BKG) { bg = vmnc_get_pixel(src, bpp, c->bigendian); src += bpp; } if (flags & HT_FG) { fg = vmnc_get_pixel(src, bpp, c->bigendian); src += bpp; } rects = 0; if (flags & HT_SUB) rects = *src++; color = !!(flags & HT_CLR); paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride); if (src - ssrc > ssize - rects * (color * bpp + 2)) { av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n"); return -1; } for (k = 0; k < rects; k++) { if (color) { fg = vmnc_get_pixel(src, bpp, c->bigendian); src += bpp; } xy = *src++; wh = *src++; paint_rect(dst2, xy >> 4, xy & 0xF, (wh >> 4) + 1, (wh & 0xF) + 1, fg, bpp, stride); } } } dst += stride * 16; } return src - ssrc; }
1threat
static int parse_pair(JSONParserContext *ctxt, QDict *dict, QList **tokens, va_list *ap) { QObject *key = NULL, *token = NULL, *value, *peek; QList *working = qlist_copy(*tokens); peek = qlist_peek(working); if (peek == NULL) { parse_error(ctxt, NULL, "premature EOI"); goto out; } key = parse_value(ctxt, &working, ap); if (!key || qobject_type(key) != QTYPE_QSTRING) { parse_error(ctxt, peek, "key is not a string in object"); goto out; } token = qlist_pop(working); if (token == NULL) { parse_error(ctxt, NULL, "premature EOI"); goto out; } if (!token_is_operator(token, ':')) { parse_error(ctxt, token, "missing : in object pair"); goto out; } value = parse_value(ctxt, &working, ap); if (value == NULL) { parse_error(ctxt, token, "Missing value in dict"); goto out; } qdict_put_obj(dict, qstring_get_str(qobject_to_qstring(key)), value); qobject_decref(token); qobject_decref(key); QDECREF(*tokens); *tokens = working; return 0; out: qobject_decref(token); qobject_decref(key); QDECREF(working); return -1; }
1threat
How to switch between two activities? : I have two activities 1. rfidReaderActivity 2.TravelActivity When I read the card i go to the TravelActivity and calculate startingLocation(latitude,longitude) and go back to previous activity(rfidReaderActivity) Then again when i read the card I need to go to the TravelActivity and this time i will calculate destination and distance traveled. So how it can be done to switch between them, considering that the TravelActivity is not destroyed. Please explain, i have poor understanding about activityLifecycle.
0debug
How to use a two dimensional array in function declaration statement? : <pre><code>void sort(int [],int); </code></pre> <p>This is how I usually use a single dimensional array(i.e: <code>int []</code> ) inside a function declaration statement for programs like sorting and it works fine without any problem</p> <p>But for my matrix addition program when I use a two dimensional array(i.e:<code>int [][]</code> ) inside a function declaration statement with the similar format <code>void mat(int [][],int [][],int ,int); </code>Iam getting some error messages like:-</p> <p>1.multidimensional array must have bounds for all dimensions except the first.</p> <p>2.invalid conversion from 'int (*)[10]' to 'int' [-fpermissive].</p> <p>So my question is how to write a two dimensional array inside a function declaration statement.</p> <p>Below I have attached my full Matrix addition program using functions:-</p> <pre><code>#include&lt;stdio.h&gt; void mat(int [][],int [][],int ,int); int main() { int a[10][10],b[10][10],m,n,i,j; printf("Enter the rows and coloumns: "); scanf("%d %d",&amp;m,&amp;n); printf("\nEnter the elements of 1st Matrix:"); for(i=0;i&lt;m;i++) for(j=0;j&lt;n;j++) scanf("%d",&amp;a[i][j]); printf("\nEnter the elements of the 2nd Matrix:"); for(i=0;i&lt;m;i++) for(j=0;j&lt;n;j++) scanf("%d",&amp;b[i][j]); mat(a,b,m,n); } void mat(int a[10][10],int b[10][10],int m,int n) { int i,j,c[10][10]; for(i=0;i&lt;m;i++) for(j=0;j&lt;n;j++) c[i][j]=a[i][j]+b[i][j]; printf("\nThe addition of the 2 Matrix is :"); for(i=0;i&lt;m;i++) { printf("\n"); for(j=0;j&lt;n;j++) printf("%d",c[i][j]); } } </code></pre>
0debug
static ssize_t qio_channel_websock_decode_header(QIOChannelWebsock *ioc, Error **errp) { unsigned char opcode, fin, has_mask; size_t header_size; size_t payload_len; QIOChannelWebsockHeader *header = (QIOChannelWebsockHeader *)ioc->encinput.buffer; if (ioc->payload_remain) { error_setg(errp, "Decoding header but %zu bytes of payload remain", ioc->payload_remain); return -1; } if (ioc->encinput.offset < QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT) { return QIO_CHANNEL_ERR_BLOCK; } fin = (header->b0 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN) >> QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_FIN; opcode = header->b0 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE; has_mask = (header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_HAS_MASK) >> QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_HAS_MASK; payload_len = header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_PAYLOAD_LEN; if (opcode == QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE) { return 0; } if (!fin) { error_setg(errp, "websocket fragmentation is not supported"); return -1; } if (!has_mask) { error_setg(errp, "websocket frames must be masked"); return -1; } if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) { error_setg(errp, "only binary websocket frames are supported"); return -1; } if (payload_len < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT) { ioc->payload_remain = payload_len; header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT; ioc->mask = header->u.m; } else if (payload_len == QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT && ioc->encinput.offset >= QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT) { ioc->payload_remain = be16_to_cpu(header->u.s16.l16); header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT; ioc->mask = header->u.s16.m16; } else if (payload_len == QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_64_BIT && ioc->encinput.offset >= QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT) { ioc->payload_remain = be64_to_cpu(header->u.s64.l64); header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT; ioc->mask = header->u.s64.m64; } else { return QIO_CHANNEL_ERR_BLOCK; } buffer_advance(&ioc->encinput, header_size); return 1; }
1threat
guild is not defined Javascript, node.js and discord.js : **Hey :-)** I was searching for an solution pretty long now. I get an error while exeuting this code: const now = new Date(); bot.on("guildMemberRemove", member => { console.log(member.user.username + ' left from a Server at ' + now + `Just watch the logs on the server`) }); Any help there? :-) Greetings and have a nice day!
0debug
iOS ,Objective-c,Image from gallery : when I upload the image on image view it selected from gallery and display on image view but when I click back button and again open push to the image view controller that image is empty, what should I do to remain same image on image view after logout also? I have used this code - (void)viewDidLoad { NSString *myGrrabedImage1=@"myGrrabedImage1.png"; NSArray *path=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDirectory1=[path objectAtIndex:0]; NSString *fullPathToFile1=[documentDirectory1 stringByAppendingPathComponent:myGrrabedImage1]; NSData *data=[NSData dataWithContentsOfFile:fullPathToFile1]; [[self teacherImg]setImage:[UIImage imageWithData:data]]; [data writeToFile:fullPathToFile1 atomically:YES]; } - (IBAction)selectImg:(id)sender { pickerController = [[UIImagePickerController alloc]init]; pickerController.delegate = self; [self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; UIImage * img = [info valueForKey:UIImagePickerControllerEditedImage]; teacherImg.image = img; [self presentViewController:pickerController animated:YES completion:nil]; } - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { NSData *data=UIImagePNGRepresentation(teacherImg.image); NSString *myGrrabedImage1=@"myGrrabedImage1.png"; NSArray *path=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDirectory1=[path objectAtIndex:0]; NSString *fullPathToFile=[documentDirectory1 stringByAppendingPathComponent:myGrrabedImage1]; [data writeToFile:fullPathToFile atomically:YES]; imagePicker.allowsEditing = YES; imagePicker.delegate = self; [[self teacherImg]setImage:image]; [self dismissViewControllerAnimated:YES completion:nil]; }
0debug
Updating kubernetes helm values : <p>I'd like to update a value config for a helm release on my cluster.</p> <p>Something like </p> <p><code>helm update -f new_values.yml nginx-controller</code></p>
0debug
setCenter not working in angular2-google-maps : <pre><code>import { GoogleMapsAPIWrapper } from '@agm/core'; import { Component, Input } from '@angular/core'; @Component({ selector: 'core-map', styleUrls: [ './map.component.scss' ], templateUrl: './map.component.html', }) export class MapComponent { constructor( public gMaps: GoogleMapsAPIWrapper ) {} public markerClicked = (markerObj) =&gt; { this.gMaps.setCenter({ lat: markerObj.latitude, lng: markerObj.longitude }); console.log('clicked', markerObj, { lat: markerObj.latitude, lng: markerObj.longitude }); } } console output: Object {lat: 42.31277, lng: -91.24892} </code></pre> <p>Also have tried panTo with the same result.</p>
0debug
Change the color of cancel button in UIAlertController with preferredStyle: .ActionSheet : <p>Is it possible to change the color of cancel button to red , i know we can by using Destructive style</p> <pre><code> let cancelActionButton: UIAlertAction = UIAlertAction(title: "Cancel", style: .Destructive) { action -&gt; Void in print("Cancel") } </code></pre> <p>but i want the cancel button separately , like this <a href="https://i.stack.imgur.com/ll5uy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ll5uy.png" alt="enter image description here"></a></p>
0debug
React stateless component this.refs..value? : <p>I don't know if I'm doing this correctly... If I want to get value from an input I use this.refs.whatever.value.trim() but if that input is a stateless function component how do I do retrieve the value onSubmit?</p> <p>I know this isn't correct now after researching but how are you supposed to get value from these input fields?</p> <pre><code>import React, {Component} from 'react' import {InputField} from '../components/forms/InputField' import {Button} from '../components/forms/Button' export default class SignupWrapper extends Component { _handleSubmit(e) { e.preventDefault(); const email = this.refs.email.value.trim(); const password = this.refs.password.value.trim(); const confirm = this.refs.confirm.value.trim(); console.log({email, password, confirm}); } render() { return ( &lt;form id="application-signup" onSubmit={this._handleSubmit.bind(this)}&gt; &lt;InputField type={'email'} name={'email'} text={'email'} helpBlock={'email is required'} ref="email" /&gt; &lt;InputField type={'password'} name={'password'} text={'password'} helpBlock={'password is required'} ref="password" /&gt; &lt;InputField type={'password'} name={'confirm'} text={'confirm password'} helpBlock={'password confirmation is required'} ref="confirm" /&gt; &lt;Button type={'submit'} className={'btn btn-primary'} text={'signup'} /&gt; &lt;/form&gt; ) } } </code></pre> <p>this is the stateless inputfield</p> <pre><code>import React from 'react' export const InputField = (props) =&gt; ( &lt;div className="form-group col-xs-12"&gt; &lt;label htmlFor={props.name}&gt;{props.text}&lt;/label&gt; &lt;input type={props.type} name={props.name} className="form-control" data-stripe={props.stripe} /&gt; &lt;span className="help-block"&gt;{props.helpBlock}&lt;/span&gt; &lt;/div&gt; ) </code></pre>
0debug
Can you please look into screenshots (Excel sheets) : [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/ElFlO.png Hi, I don't why my excel workbooks have total 4 sheets but vba shows total 5 sheets in same workbook.
0debug
C# read the name of the connected microphone : <p>How can I read in a winform the names of the connected recording device and of the standard recording device?</p>
0debug
Debugging multiple GDB files : <p>I am debugging a C++ code which is divided into multiple files. The code which I am debugging has 6 errors in total, both syntax and logical. I have found one error but I could not figure out a way to solve the rest. I have referred to multiple online sources including but not limited to YouTube (Bucky C++), Tutorial's Point, Geeks for Geeks and more.</p> <p>My code is in this <a href="https://onlinegdb.com/SkpueFgUN" rel="nofollow noreferrer">link</a>.</p> <p>Any help here would be greatly appreciated!</p>
0debug
How to get mac addresses of clients connected to a router through an external request : <p>The situation is that I have to scan mac addresses of clients(portable ones) connected to multiple routers. I want to set up a server that can make an external request (or some networking tool to scan) all the routers to fetch the required data.</p> <p>P.S.: I do know about nmap scan, but for that, the server also has to be connected to same router, and I can't fetch/scan from other routers.</p>
0debug
Why is win32 API non-portable? : <p>I know that win32 API is written in C language and also why Qt is portable?</p> <p>Could someone explain this to me?</p>
0debug
How to add pug to angular-cli? : <p>Anyone having luck adding .pug to angular-cli?</p> <p>I tried to do npm install pug --save, but I don't know where to change the .pug rendering instead of .html.</p> <p>Link for the angular-cli is <a href="https://github.com/angular/angular-cli">here</a></p> <p>Please share a short tutorial, that would help a lof of people :)</p>
0debug
Toggle button in WPF : <p>I am new to wpf . I want to create toggle button like </p> <p><a href="https://i.stack.imgur.com/pIhyh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pIhyh.png" alt="Toggle button"></a></p> <p>how can I achieve this. should I need to use two buttons and on click of each I need to disable other one. or there is anything else like toggle button in wpf. what is best way to achieve this.. any suggestion appreciated.Thanks</p>
0debug
Upload images in html : <p>I am trying to create a control panel for a web site, so i am trying that my client can upload his pictures for the store, and also a little description, can you give an idea of how can i do that? I am new doing this</p>
0debug
PHP inheritance contruct function didn't work : Please check my isssue i make a script but $contractempsal variable didn't work. i want employee salary but i got error. please check. Follow is my code:- <?php class baseemp { protected $firstname; protected $lastname; public function getfullname() { return $this->firstname .''. $this->lastname; } public function __construct($first,$last) { $this->firstname="$first"; $this->lastname="$last"; } } class fulltimeemp extends baseemp { public $monthlysal; public function monthlysalary() { $this->monthlysal/12; } } class contractemp extends baseemp { public $hourlyrate; public $totalhours; public function monthlysalaryy() { $this->hourlyrate * $this->totalhours; } public function __construct($hourrate,$totalhoursd){ $this->hourlyrate="$hourrate"; $this->totalhours="$totalhoursd"; } } $fulltimeemployee = new fulltimeemp("kannu"," singh"); $contractempsal = new contractemp("400","5"); echo $fulltimeemployee->getfullname(); echo $contractempsal->getfullname(); ?> So, this is my code. please check and tell me where i am wrong Thanks Please check my isssue i make a script but $contractempsal variable didn't work. i want employee salary but i got error. please check.
0debug
Write a sequence without having 0 at any place in javascript : <!doctype html> <html> <body> <script> //this will be real amount rows i need to generate member id for //var quantity =13000; // for testing we can use 20 var quantity =20; var perpackcards = 99; //this is how much total member ids should be var totalrows = quantity * perpackcards; var memberIdprefix = 'M'; var alphaStart = ''; var memberIdStart = 2111111; // i have to achieve sevral other goals, so that i need to run loop this way, loop inside loop. for (i = 0; i < quantity; i++) { for(j = 0; j < perpackcards; j++) { var result = parseInt(memberIdStart) + j; //console.log(memberIdStart+'--'+j); console.log(result); } memberIdStart += 100; } </script> </body> </html> I am trying to generate a sequence using member id, so this code outputs the member is like this : Output i am getting : 2111111 2111112 2111113 2111114 2111115 2111116 2111117 2111118 2111119 2111120 2111121 2111122 2111123 2111124 2111125 2111126 2111127 2111128 2111129 2111130 2111131 2111132 2111133 2111134 2111135 2111136 2111137 2111138 2111139 2111140 2111141 2111142 2111143 2111144 2111145 2111146 2111147 2111148 2111149 2111150 2111151 2111152 2111153 2111154 2111155 2111156 2111157 2111158 2111159 2111160 2111161 2111162 2111163 2111164 2111165 2111166 2111167 2111168 2111169 2111170 2111171 2111172 2111173 2111174 2111175 2111176 2111177 2111178 2111179 2111180 2111181 2111182 2111183 2111184 2111185 2111186 2111187 2111188 2111189 2111190 2111191 2111192 2111193 2111194 2111195 2111196 2111197 2111198 2111199 2111200 2111201 2111202 2111203 2111204 2111205 2111206 2111207 2111208 2111209 2111211 2111212 2111213 2111214 2111215 2111216 2111217 2111218 2111219 2111220 2111221 2111222 2111223 2111224 2111225 2111226 2111227 2111228 2111229 2111230 2111231 2111232 2111233 2111234 2111235 2111236 2111237 2111238 2111239 2111240 2111241 2111242 2111243 2111244 2111245 2111246 2111247 2111248 2111249 2111250 2111251 2111252 2111253 2111254 2111255 2111256 2111257 2111258 2111259 2111260 2111261 2111262 2111263 2111264 2111265 2111266 2111267 2111268 2111269 2111270 2111271 2111272 2111273 2111274 2111275 2111276 2111277 2111278 2111279 2111280 2111281 2111282 2111283 2111284 2111285 2111286 2111287 2111288 2111289 2111290 2111291 2111292 2111293 2111294 2111295 2111296 2111297 2111298 2111299 2111300 2111301 2111302 2111303 2111304 2111305 2111306 2111307 2111308 2111309 2111311 2111312 2111313 2111314 2111315 2111316 2111317 2111318 2111319 2111320 2111321 2111322 2111323 2111324 2111325 2111326 2111327 2111328 2111329 2111330 2111331 2111332 2111333 2111334 2111335 2111336 2111337 2111338 2111339 2111340 2111341 2111342 2111343 2111344 2111345 2111346 2111347 2111348 2111349 2111350 2111351 2111352 2111353 2111354 2111355 2111356 2111357 2111358 2111359 2111360 2111361 2111362 2111363 2111364 2111365 2111366 2111367 2111368 2111369 2111370 2111371 2111372 2111373 2111374 2111375 2111376 2111377 2111378 2111379 2111380 2111381 2111382 2111383 2111384 2111385 2111386 2111387 2111388 2111389 2111390 2111391 2111392 2111393 2111394 2111395 2111396 2111397 2111398 2111399 2111400 2111401 2111402 2111403 2111404 2111405 2111406 2111407 2111408 2111409 2111411 2111412 2111413 2111414 2111415 2111416 2111417 2111418 2111419 2111420 2111421 2111422 2111423 2111424 2111425 2111426 2111427 2111428 2111429 2111430 2111431 2111432 2111433 2111434 2111435 2111436 2111437 2111438 2111439 2111440 2111441 2111442 2111443 2111444 2111445 2111446 2111447 2111448 2111449 2111450 2111451 2111452 2111453 2111454 2111455 2111456 so as you can see this is all in sequence, but now i want to achieve all trimmed zeros, like if this number got any zero, it should move to next sequence which is not having zero. Like if it after moving ahead of 9, it shouldn't show 10 instead it should show 11, 1,2,3......8,9,11.....19,21....59,61.....99,111.... because 101, 102 again including zeros, so it should be having 111 directly. then 198,199...211.... as can't keep 201,202. go gaps are undefined. not an fixed interval. tried a lots things. getting closer but not correct at all. **Output i want :** 2111111 2111112 2111113 2111114 2111115 2111116 2111117 2111118 2111119 2111121 2111122 2111123 2111124 2111125 2111126 2111127 2111128 2111129 2111131 2111132 2111133 2111134 2111135 2111136 2111137 2111138 2111139 2111141 2111142 2111143 2111144 2111145 2111146 2111147 2111148 2111149 2111151 2111152 2111153 2111154 2111155 2111156 2111157 2111158 2111159 2111161 2111162 2111163 2111164 2111165 2111166 2111167 2111168 2111169 2111171 2111172 2111173 2111174 2111175 2111176 2111177 2111178 2111179 2111181 2111182 2111183 2111184 2111185 2111186 2111187 2111188 2111189 2111191 2111192 2111193 2111194 2111195 2111196 2111197 2111198 2111199 2111211 2111212 2111213 2111214 2111215 2111216 2111217 2111218 2111219 2111221 2111222 2111223 2111224 2111225 2111226 2111227 2111228 2111229 2111231 2111232 2111233 2111234 2111235 2111236 2111237 2111238 2111239 2111241 2111242 2111243 2111244 2111245 2111246 2111247 2111248 2111249 2111251 2111252 2111253 2111254 2111255 2111256 2111257 2111258 2111259 2111261 2111262 2111263 2111264 2111265 2111266 2111267 2111268 2111269 2111271 2111272 2111273 2111274 2111275 2111276 2111277 2111278 2111279 2111281 2111282 2111283 2111284 2111285 2111286 2111287 2111288 2111289 2111291 2111292 2111293 2111294 2111295 2111296 2111297 2111298 2111299 2111311 2111312 2111313 2111314 2111315 2111316 2111317 2111318 2111319 2111321 2111322 2111323 2111324 2111325 2111326 2111327 2111328 2111329 2111331 2111332 2111333 2111334 2111335 2111336 2111337 2111338 2111339 2111341 2111342 2111343 2111344 2111345 2111346 2111347 2111348 2111349 2111351 2111352 2111353 2111354 2111355 2111356 2111357 2111358 2111359 2111361 2111362 2111363 2111364 2111365 2111366 2111367 2111368 2111369 2111371 2111372 2111373 2111374 2111375 2111376 2111377 2111378 2111379 2111381 2111382 2111383 2111384 2111385 2111386 2111387 2111388 2111389 2111391 2111392 2111393 2111394 2111395 2111396 2111397 2111398 2111399 2111411 2111412 2111413 2111414 2111415 2111416 2111417 2111418 2111419 2111421 2111422 2111423 2111424 2111425 2111426 2111427 2111428 2111429 2111431 2111432 2111433 2111434 2111435 2111436 2111437 2111438 2111439 2111441 2111442 2111443 2111444 2111445 2111446 2111447 2111448 2111449 2111451 2111452 2111453 2111454 2111455 2111456 It shouldn't have any zeros, and once skipped any zero, it should move to the next sequence which is not having any zero too.
0debug
static int mpegts_set_stream_info(AVStream *st, PESContext *pes, uint32_t stream_type, uint32_t prog_reg_desc) { int old_codec_type= st->codec->codec_type; int old_codec_id = st->codec->codec_id; if (old_codec_id != AV_CODEC_ID_NONE && avcodec_is_open(st->codec)) { av_log(pes->stream, AV_LOG_DEBUG, "cannot set stream info, codec is open\n"); return 0; } avpriv_set_pts_info(st, 33, 1, 90000); st->priv_data = pes; st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = AV_CODEC_ID_NONE; st->need_parsing = AVSTREAM_PARSE_FULL; pes->st = st; pes->stream_type = stream_type; av_log(pes->stream, AV_LOG_DEBUG, "stream=%d stream_type=%x pid=%x prog_reg_desc=%.4s\n", st->index, pes->stream_type, pes->pid, (char*)&prog_reg_desc); st->codec->codec_tag = pes->stream_type; mpegts_find_stream_type(st, pes->stream_type, ISO_types); if ((prog_reg_desc == AV_RL32("HDMV") || prog_reg_desc == AV_RL32("HDPR")) && st->codec->codec_id == AV_CODEC_ID_NONE) { mpegts_find_stream_type(st, pes->stream_type, HDMV_types); if (pes->stream_type == 0x83) { AVStream *sub_st; PESContext *sub_pes = av_malloc(sizeof(*sub_pes)); if (!sub_pes) return AVERROR(ENOMEM); memcpy(sub_pes, pes, sizeof(*sub_pes)); sub_st = avformat_new_stream(pes->stream, NULL); if (!sub_st) { av_free(sub_pes); return AVERROR(ENOMEM); } sub_st->id = pes->pid; avpriv_set_pts_info(sub_st, 33, 1, 90000); sub_st->priv_data = sub_pes; sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; sub_st->codec->codec_id = AV_CODEC_ID_AC3; sub_st->need_parsing = AVSTREAM_PARSE_FULL; sub_pes->sub_st = pes->sub_st = sub_st; } } if (st->codec->codec_id == AV_CODEC_ID_NONE) mpegts_find_stream_type(st, pes->stream_type, MISC_types); if (st->codec->codec_id == AV_CODEC_ID_NONE){ st->codec->codec_id = old_codec_id; st->codec->codec_type= old_codec_type; } return 0; }
1threat
С Sharp ternary operator. Dont understand one moment : Why after the variable result becomes zero it again increases by 1 to 5 each time? for (int i = 5; i >= -5; i--) { result = i >= 0 ? i : -i; Console.Write("{0}\t", result); } output: 5 4 3 2 1 0 1 2 3 4 5 https://i.stack.imgur.com/bWy2Y.jpg
0debug
How to remove all the list in python : I have some list like this [picture][1]. now I want to remove all of [] list. how can I do? [1]: https://i.stack.imgur.com/oTcNR.png
0debug
How to get data from api which is based on id in angular 5? : I'm using angular 5. I write bellow `http.get` method to get data from api in angular 5. I want to get the url of image to use this in my slider. getImages(){ this.httpclient.get('blabla/banner.php').subscribe((result) => { this.images = result; console.log(this.images); }) } but I'm getting data from api which id based below is my response { status:"success", img:[ { id:"1", banner:"blabla/img.jpg" }, { id:"2", banner:"blabla/img2.jpg" }, { id:"3", banner:"blabla/img3.jpg" } ] } I'm beginner to angular please help. Thank you.
0debug
From the user's input total the odd and even numbers. input numbers in between 0 to 99 : <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int i,t,x[20], even, odd, prime; cout &lt;&lt; "Enter 20 integer numbers from 0 to 99: "&lt;&lt;endl; for (i=1;i&lt;=20;i++) { cout &lt;&lt; "Input " &lt;&lt; i &lt;&lt;":"; cin &gt;&gt; x[i]; } cout &lt;&lt; "\nPrime numbers are: " &lt;&lt; endl ; prime=1; for (i=2; i&lt;=20 ; i++) { for(t=2;t&lt;x[i];t++) { if(x[i]%t==0) { prime=0; } } if(prime==1) { cout &lt;&lt; x[i] &lt;&lt; endl; } prime=1; } for(i=1; i&lt;=20; i++) // this is where i have problem. { if(x[i]% 2 == 0) { even++; } else { odd++; } } cout &lt;&lt; "Number of odd numbers: " &lt;&lt; odd &lt;&lt; "\n"; cout &lt;&lt; "Number of even numbers: " &lt;&lt; even &lt;&lt; "\n"; return 0 ; } </code></pre> <p>When i compile it shows even (40) and odd (10) for input of 0 till 19. Where it should show even 10(including the 0) and odd (10). Im not sure where am i doing it wrongly. I hope someone can help me improve the code.</p>
0debug
What does (void (^)(BOOL supported)) mean? : <p>as I am working myself into some new code, I came across a thing, where I couldnt find any explanation for in the web so far. So hopefully you can give me one.</p> <p>I have this method signature in Objective-C code:</p> <pre><code>-(void) supportsUrl: (NSString*) url callback:(void (^)(BOOL supported)) callback; </code></pre> <p>Can someone please tell me what it is about in the last parameter?</p> <p>Thanks a lot!</p>
0debug
I WANT TO KNOW HOW TO MAKE A FLOATING BUTTON IN ANDROID STUDIO THAT REMAINS ON THE SCREEN EVEN AFTER CLOSING ACTIVITY : I WANT TO KNOW HOW TO MAKE A FLOATING BUTTON OR ANYTHING EXTRA. IN ANDROID STUDIO THAT REMAINS ON THE SCREEN EVEN AFTER CLOSING ACTIVITY
0debug
Navigating between child routes Angular 2 : <p>I can't seem to be able to navigate between child routes.</p> <p>Router overview:</p> <pre><code>path: 'parent', component: parentComponent, children: [ { path: '', redirectTo: 'child1', pathMatch: 'full' }, { path: 'child1', component: child1Component }, { path: 'child2', component: child2Component }, { path: 'new/:type', component: child3Component }, { path: '**', component: PageNotFoundComponent } ] </code></pre> <p>i'm in the child1 component trying to navigate to the new/type route like so:</p> <pre><code>this._router.navigate(['new', objType], { relativeTo: this._route }); </code></pre> <p>But i keep getting Error: Cannot match any routes. URL Segment: 'new/asset'.</p> <p>If i manually insert the url it works fine.</p> <p>Help would be greatly appreciated, thanks!</p>
0debug
merge table php and table javascript : I have a table in php and I have another table in javascript . I would like to add Elements of the table php to elements javascript table. I tried with the push method : tabJS.push ( tabPHP ) ; but it does not work , is what you have ideas for my problem thank you
0debug
Internal compiler error: Classcast exception : <p>I am getting below error at the start of java file right at letter 'p' of package</p> <p>Internal compiler error: java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.MethodBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.FieldBinding at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveAnnotations(ASTNode.java:817)</p> <p>Project compiles fine from command prompt. but eclipse is showing this error.I am using jdk 8. any help is highly appreciated</p> <p>I tried restarting eclipse, cleaning project, installing different versions of eclipse etc.</p>
0debug
Please can you tell me what is incorrect in this line? : <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> I get a "Script error", if I try to run it. It is in a html document which is called from another program. I'm running windows 10, and my default web browser is Firefox 55.0.3 (64-bit)
0debug
get number's from user and put them in a list and find the biggest odd number : I'm a beginner in python 3 and I want to 1)ask 10 number from user and put them in a list and then 2)check the beggest odd number. the following code just put the last number in the value(number) and I have no idea about how to check for the beggest odd number for i in range(1,11): number = list((input(f"please enter the {i}th number: "))) print(number)
0debug
void icp_pit_init(uint32_t base, qemu_irq *pic, int irq) { int iomemtype; icp_pit_state *s; s = (icp_pit_state *)qemu_mallocz(sizeof(icp_pit_state)); s->base = base; s->timer[0] = arm_timer_init(40000000, pic[irq]); s->timer[1] = arm_timer_init(1000000, pic[irq + 1]); s->timer[2] = arm_timer_init(1000000, pic[irq + 2]); iomemtype = cpu_register_io_memory(0, icp_pit_readfn, icp_pit_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); }
1threat
Should i pass a parameter to the class constructor or every method that requires it : <p>I have a class that looks like the following</p> <pre><code>public class OrderBL { private _loggedInUserId; public OrderBL(int loggedInUserId) { _loggedInUserId = loggedInUserId; } public Order GetOrder() { //use logged in user id here } public List&lt;Order&gt; GetOrderList() { //use logged in user id here } public void DeleteOrder() { //use logged in user id here } public void SaveOrder(Order myOrder) { //DON'T use logged in user id here } } </code></pre> <p>Should i be passing the logged in user id to every method or pass it in once to the constructor like i have done?</p> <p>Most methods in my class require the logged in user id but not all.</p>
0debug
Conversion of a doc file to PDF using php : <p>I want to know how to convert document file to pdf using php or codeigniter. If anyone have any idea about the same please let me know.</p>
0debug
Please help me with this PROBLEM :( "Choose some element a of A and some element b of B such that a + b doesn't belong to A and doesn't belong to B" : readInts = fmap (map read.words) getLine readInts :: IO [Int] main = do putStrLn "List number of A: " num1 <- readInts let a = [] ++ num1 putStrLn "List number of B: " num2 <- readInts let b = [] ++ num2
0debug
static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; switch (tag) { case 0x1901: mxf->packages_count = avio_rb32(pb); if (mxf->packages_count >= UINT_MAX / sizeof(UID)) return -1; mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); if (!mxf->packages_refs) return -1; avio_skip(pb, 4); avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } return 0; }
1threat
keep the margin when the referenced view is gone in ConstraintLayout : <p>I have 2 TextViews as in the xml below. If I hide the <code>textView2</code> at runtime, I lose the bottom margin. How can I keep the bottom margin between <code>textView</code> and parent to be 16dp when the <code>textView2</code> is gone.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/textView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:text="abc" app:layout_constraintBottom_toTopOf="@+id/textView2" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginBottom="32dp" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:text="xyz" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView" app:layout_constraintVertical_chainStyle="packed"/&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre>
0debug
How to Do Histogram Equalization in Imagesc's 3 Parameters of Matlab? : Situation: do histogram of the presentation in `imagesc(time,potential,C)` by using `time`, `potetial` and/or `C`; do normalized histogram equalization in the histogram Proposal: I think `C` is the data for the histogram because `time` and `potential` are just equispaced-equidistant vectors for x- and y-axis, respectively Code and pseudocode time=linspace(0,50,100 + 1); potential=linspace(0,50,100 + 1); C=gallery('wilk',21); % tridiagonal matrix, eigenvalue problem, Wilkinson 1965 figure, imagesc(time,potential,C); %% Output: Tridiagonal image %% Histogram Equalization Pseudocode % Draw here the histogram of time, potential and/or C C=histogram_equalization(C,...); figure, imagesc(time,potential,C); %% Expected output: tridiagonal image after histogram equalization Observations - `C` is not an intensity image because `figure, imhist(C)` returns blank output - I may need to consider `time` and `potential` also when considering the histogram of `C`. However, they are just equally spaced vectors for the axes so it should not be necessary. Unsuccessful attempts - RockTheIT's [code][3] is based on the image handler (`hFig`) or reading .png images. You cannot just put `I=C`, although `I` is a matrix. Why? - `hist` attempt based on the thread [Difference between hist and imhist][4] gives blank image in `imagesc(x,y,C)` where I am trying to plot all contents of `C` for histogram C = hist(double(C(:)), 256); Signal Processing - Gonzales says the *normalized histogram is given* by $p(r_k) = r_k / M N$, for $k = 0,1,2,...,L-1$ where - intensity levels ranges in $[0,L-1]$, - $p(r_k)$ is an estimate of the probability of occurrence of intensity $r_k$ in an image, - $MN$ is the product of the pixel sizes in `time` and `potential`, respectively Sources 1. Gonzales, *Digital Image Processing* 3rd ed. Ch. 3 about the Mathematics of histograms. System: Linux Ubuntu 16.04 64 bit Matlab: 2016a Hardware: Macbook Air 2013-mid [1]: http://i.stack.imgur.com/3iURCs.jpg [2]: http://i.stack.imgur.com/3iURC.jpg [3]: http://www.rocktheit.com/2012/09/matlab-program-to-apply-histogram.html [4]: https://se.mathworks.com/matlabcentral/answers/146986-difference-between-hist-and-imhist
0debug
List NullPointerException Hibernate : <p>I having a error with my hibernate project. It gives me a NullPointerException when counts the size of my list(null) cause it breaks when doing the Query and doesnt set the 2 parameters that i pass, when i doint just with one parameter works perfectly. Thanks in advanced! Helppppp meeee! ahah I will show you:</p> <p>AlertsHelper</p> <pre><code>public List getAlertsList(int level, String Process) { List&lt;Dtalerts&gt; list = null; try { if(!this.session.isOpen()){ this.iniciarConexion(); } Query q = session.createQuery("from Dtalerts as dtalerts where dtalerts.level = :level AND dtalerts.Process = :Process"); //q.setParameter("Fh_alert", Fh_alert); q.setParameter("level", level); q.setParameter("Process", Process); list = (List&lt;Dtalerts&gt;) q.list(); } catch (Exception ex) { System.out.println("Excepcion " + ex); ex.printStackTrace(); } return list; } </code></pre> <p>Jsp</p> <pre><code>&lt;% if(request.getParameter("level")!=null){ int level = Integer.parseInt(request.getParameter("level")); String Process = request.getParameter("Process"); AlertsHelper helper = new AlertsHelper(); List alertList = helper.getAlertsList(level, Process); out.print("&lt;table border='1'&gt;"); out.print("&lt;tr&gt;&lt;th&gt;Level&lt;/th&gt;&lt;th&gt;Process&lt;/th&gt;&lt;/tr&gt;"); for(int i = 0; i &lt;alertList.size(); i++){ Dtalerts alerts = (Dtalerts) alertList.get(i); Id = alerts.getId(); level = alerts.getLevel(); Process = alerts.getProcess(); String Description = alerts.getDescription(); out.print("&lt;td&gt;&lt;a href='javascript:mostrarDatos(" + level + ",\"" + Process + ")'&gt;Seleccionar&lt;/a&gt;&lt;/td&gt;"); out.print("&lt;tr&gt;"); out.print("&lt;td&gt;" + level + "&lt;/td&gt;"); out.print("&lt;td&gt;" + Process + "&lt;/td&gt;"); out.print("&lt;td&gt;" + Description + "&lt;/td&gt;"); out.print("&lt;td&gt;" + Id + "&lt;/td&gt;"); out.print("&lt;/tr&gt;"); } out.print("&lt;/table&gt;"); }else{ out.print("introduce un id"); }%&gt; &lt;/form&gt; </code></pre>
0debug
void net_check_clients(void) { VLANState *vlan; VLANClientState *vc; int has_nic, has_host_dev; QTAILQ_FOREACH(vlan, &vlans, next) { QTAILQ_FOREACH(vc, &vlan->clients, next) { switch (vc->info->type) { case NET_CLIENT_TYPE_NIC: has_nic = 1; break; case NET_CLIENT_TYPE_SLIRP: case NET_CLIENT_TYPE_TAP: case NET_CLIENT_TYPE_SOCKET: case NET_CLIENT_TYPE_VDE: has_host_dev = 1; break; default: ; } } if (has_host_dev && !has_nic) fprintf(stderr, "Warning: vlan %d with no nics\n", vlan->id); if (has_nic && !has_host_dev) fprintf(stderr, "Warning: vlan %d is not connected to host network\n", vlan->id); } QTAILQ_FOREACH(vc, &non_vlan_clients, next) { if (!vc->peer) { fprintf(stderr, "Warning: %s %s has no peer\n", vc->info->type == NET_CLIENT_TYPE_NIC ? "nic" : "netdev", vc->name); } } }
1threat
document.write('<script src="evil.js"></script>');
1threat
If else statement for finding the index of a character in a string : <p>For some reason without the else statement the code finds the indexes of the characters in the string. However, when I add the else statement to declare if a character is not found. All it does is give me the else statement even if the character is in the string.</p> <pre><code>#Function takes a character and a string and returns the index of the character #found in the string. def whereIsItS(letter, word): #Start finding the index of characters in the string starting at 0. letInWord = 0 #For loop to find specific characters in a string. for l in word: #If the letter is found it returns the index of the letter. if l == letter: #Moves to the next character in the string. letInWord += 1 else: return "It is not there." #Returns the index of the character found the string. return word.index(letter) </code></pre> <p>I just can't seem to figure out why it works without the else statement, but not with the else statement.</p>
0debug
Node Callback from database query to express request : <p>I want the function below (listServers()) to callback data to be used in the express request below. But I am confused by the set up of a callback as I have got conflicting information from searching. </p> <p>The server runs listServers fine but seems to timeout when returning the value to the request.</p> <p>The output from me requesting / on the server is:</p> <pre><code>forEach length:1 forEach length:2 listServers length:2 ::ffff:*IP* - - [30/Nov/2016:09:31:19 +0000] "GET / HTTP/1.1" - - </code></pre> <p>Code:</p> <pre><code>var listServers = function (err, data) { var list=[]; db.all("SELECT * FROM Servers;", function(err, rows){ rows.forEach(function(e){ var confi = fs.readFileSync(paths.factorioDir + "server" + e.serverID + paths.conf); var conf = JSON.parse(confi); var item = {id: e.serverID, conf:conf}; list.push(item); console.log("forEach length:" + list.length); }); if (err) throw err; console.log("listServers length:" + list.length); data = list; return data; }); }; admin.get('/', function(req, res) { listServers(function(err, data){ console.log(data.length); servers = data; console.log("/ servers length"+ servers.length); var adminTemplate = pug.compileFile(__dirname + '/template.pug'); var context = { servers: servers }; var html = adminTemplate(context); res.send(html); }); }); </code></pre> <p>Full code is <a href="https://github.com/Bertieio/Factorio-Multi-Panel" rel="nofollow noreferrer">here</a></p>
0debug
static int omap_validate_local_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000; }
1threat
static inline int gen_neon_add(int size, TCGv t0, TCGv t1) { switch (size) { case 0: gen_helper_neon_add_u8(t0, t0, t1); break; case 1: gen_helper_neon_add_u16(t0, t0, t1); break; case 2: tcg_gen_add_i32(t0, t0, t1); break; default: return 1; } return 0; }
1threat
tweepy : ow get more than 100 different record per day per query using Twitter Standard API? : I'm trying to download a list of tweet using the standard API but what I get are always the same records. i.e. this is my request: ``` ApiSearch = api.search(q="#immigration", lang="en", result_type="mixed", count=100, until=untilDate, include_entities=False) ``` but if I run it now and then between 1 hour the result I get is the same. Is there something wrong in the settings of my "api.search", or did I misunderstood the limits of the Twitter Standard API? This is my code: ``` conn_str = ("DRIVER={PostgreSQL Unicode};" "DATABASE=TwitterLCL;" "UID=postgres;" "PWD=pswd;" "SERVER=localhost;" "PORT=5432;") consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth, wait_on_rate_limit=True) col_db_tweetTable01 = ['CREATED_AT', 'TWEET_ID', 'TEXT', 'USER_ID'] i = 0 while i <= 10000: time.sleep(2) i += 1 ApiSearch = api.search(q="#immigration", lang="en", result_type="mixed", count=100, until=None, include_entities=False) time.sleep(2) for res in range(0, len(ApiSearch)): db_tweetTable01DB = pd.DataFrame(columns = col_db_tweetTable01) #creates a new dataframe that's empty TWEET = ApiSearch[res]._json Created_At = None Created_At = TWEET.get("created_at") print("Created_At : "+Created_At) Tweet_Id = None Tweet_Id = TWEET.get("id_str") Text = None Text = TWEET.get("text") User_Id = TWEET.get("user").get("id_str") db_tweetTable01DB = db_tweetTable01DB.append({'CREATED_AT' : Created_At, 'TWEET_ID' : Tweet_Id, 'TEXT' : Text, 'USER_ID' : User_Id}, ignore_index=True) try: connStr = pyodbc.connect(conn_str) cursor = connStr.cursor() for index, row in db_tweetTable01DB.iterrows(): #print(row) cursor.execute("INSERT INTO public.db_tweettable01(CREATED_AT, TWEET_ID, TEXT, USER_ID) values (?, ?, ?, ?)", row['CREATED_AT'], row['TWEET_ID'], row['TEXT'], row['USER_ID']) connStr.commit() cursor.close() connStr.close() except pyodbc.Error as ex: sqlstate = ex.args[1] print(sqlstate) print("Tweet_Id : "+Tweet_Id) print("User_Id : "+User_Id) ``` Thanks for your help,
0debug
Why does P != "P" in my JSON response? : <p><strong>QUESTION:</strong></p> <p>For some strange reason, it seems "P" from my JSON is not equal to "P" but "P"=="P" returns true. This makes no sense.</p> <p>There must be some data type issue somewhere.</p> <p>How can I make sure <code>response.charAt(0) == "P"</code> returns <code>true</code> ?</p> <hr> <p><strong>CODE:</strong></p> <pre><code>$.ajax({ type: "POST", url: "/1/1", data: someData, }).done(function(response) { console.log("p" == "P"); //prints false console.log("P" == "P"); //prints true console.log("RESPONSE: "+response); //prints "Primary" console.log("RESPONSE FIRST LETTER: "+response.charAt(0)); //prints P console.log("RESPONSE BOOL P :"+response.charAt(0)=="P"); // //false for some reason, should be true // if (response.charAt[0] == "P") { console.log("1"); localStorage.setItem("error_msg_local", message); } else if (response.charAt[0] == "L") { localStorage.setItem("success_msg_local", message); console.log("2"); } else { localStorage.setItem("error_msg_local", "Internal error. Please try again."); console.log("3"); // 3 gets logged when it should have been 1 } }); </code></pre>
0debug
Error creating shaded jar: null: IllegalArgumentException : <p>I'm using ASM 6.1 in my project to generate Class files dynamically. But I have a problem when assembling a fat jar.</p> <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default-cli) on project uetlx: Error creating shaded jar: null: IllegalArgumentException -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default-cli) on project uetlx: Error creating shaded jar: null at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: null at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:540) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 20 more Caused by: java.lang.IllegalArgumentException at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source) at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source) at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source) at org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:415) at org.apache.maven.plugins.shade.DefaultShader.shadeSingleJar(DefaultShader.java:219) at org.apache.maven.plugins.shade.DefaultShader.shadeJars(DefaultShader.java:179) at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:104) at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:454) ... 22 more </code></pre> <p>What does it mean? Some confliting <code>objectweb.asm</code> version? What is the solution?</p>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
How do I convert my values to only 2 decimal places : <p>I have this so far but I'm needing to get my values at the most to 2 decimal places but for some reason I'm drawing a blank on how to do it right now.</p> <pre><code>{ public static double celciusToFahrenheit(double celcius) { double fahrenheit = (9.0 / 5) * celcius + 32; return fahrenheit; } public static double fahrenheitToCelcius(double fahrenheit) { double celcius = (5.0 / 9) * (fahrenheit - 32); return celcius; } public static void main(String[] args) { System.out.println("Celcius\tFahrenheit\t|\tFahrenheit\tCelcius"); for (int i = 0; i &lt; 10; i++ ) { double celcius = 40 - i; double convertedCelcius = celciusToFahrenheit(celcius); double fahrenheit = 120 - (i * 10); double convertedFahrenheit = fahrenheitToCelcius(fahrenheit); System.out.print(celcius + "\t" + convertedCelcius + "\t|\t" + fahrenheit + "\t" + convertedFahrenheit + "\n"); } } } </code></pre> <p>and my result looks like this</p> <pre><code>Celcius Fahrenheit | Fahrenheit Celcius 40.0 104.0 | 120.0 48.88888888888889 39.0 102.2 | 110.0 43.333333333333336 38.0 100.4 | 100.0 37.77777777777778 37.0 98.60000000000001 | 90.0 32.22222222222222 36.0 96.8 | 80.0 26.666666666666668 35.0 95.0 | 70.0 21.11111111111111 34.0 93.2 | 60.0 15.555555555555557 33.0 91.4 | 50.0 10.0 32.0 89.6 | 40.0 4.444444444444445 31.0 87.80000000000001 | 30.0 -1.1111111111111112 </code></pre>
0debug
Sql Server: Please help to write a query to get the result 94941 from the below string value : `<Host_In_Params>{"Zip_Code":"94941"}</Host_In_Params> `Please help to write a query to get the result 94941 from the above string value.
0debug
Reshape data in R: transpose : <p>How can I reshape the following data in R so that it is organized in rows?</p> <pre><code>1 0 0 1 0 0 0 1 0 </code></pre> <p>should become:</p> <pre><code>1 0 0 1 0 0 0 1 0 </code></pre> <p>Thanks</p>
0debug
void idct_put_altivec(uint8_t* dest, int stride, vector_s16_t* block) { POWERPC_TBL_DECLARE(altivec_idct_put_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE POWERPC_TBL_START_COUNT(altivec_idct_put_num, 1); void simple_idct_put(uint8_t *dest, int line_size, int16_t *block); simple_idct_put(dest, stride, (int16_t*)block); POWERPC_TBL_STOP_COUNT(altivec_idct_put_num, 1); #else vector_u8_t tmp; POWERPC_TBL_START_COUNT(altivec_idct_put_num, 1); IDCT #define COPY(dest,src) \ tmp = vec_packsu (src, src); \ vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest); \ vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest); COPY (dest, vx0) dest += stride; COPY (dest, vx1) dest += stride; COPY (dest, vx2) dest += stride; COPY (dest, vx3) dest += stride; COPY (dest, vx4) dest += stride; COPY (dest, vx5) dest += stride; COPY (dest, vx6) dest += stride; COPY (dest, vx7) POWERPC_TBL_STOP_COUNT(altivec_idct_put_num, 1); #endif }
1threat
How to change the color of each pixel of image using openCV : <p>I am new in OpenCV. I have a image what I want is to change the color of each and every pixel of image with any single color. I found that code but when I run this part of code then a exception is generated.</p> <pre><code>for (i = 0;i &lt; img1.rows;i++) { for (j = 0;j &lt; img1.cols;j++) { img1.at&lt;Vec3b&gt;(i, j) = Vec3b(255, 105, 240); } } </code></pre> <p>Can anyone please tell me the solution. Or what I found is that this take a lot of time for the conversion So if their is any other approach then please tell me.</p>
0debug
python: how to disable all file permissions : I am trying to disable a user from opening a file. The porpuse is that when a user will try to open a specific file, he would not be able to. Also, i want to be able to return the permissions and letting the user open the file. I tried to use $os.chmod but i can not undestand how to disable permissions.
0debug
void hpet_init(qemu_irq *irq) { int i, iomemtype; HPETState *s; dprintf ("hpet_init\n"); s = qemu_mallocz(sizeof(HPETState)); hpet_statep = s; s->irqs = irq; for (i=0; i<HPET_NUM_TIMERS; i++) { HPETTimer *timer = &s->timer[i]; timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer); } hpet_reset(s); vmstate_register(-1, &vmstate_hpet, s); qemu_register_reset(hpet_reset, s); iomemtype = cpu_register_io_memory(hpet_ram_read, hpet_ram_write, s); cpu_register_physical_memory(HPET_BASE, 0x400, iomemtype); }
1threat
Fatal error: Call to a member function getId() on null : <p>I have a error saying that,</p> <pre><code>Fatal error: Call to a member function getId() on null on line 63 </code></pre> <p>but how can i check the element, here is my code</p> <pre><code>54 public function edit($id) { 55 $form_group = $this-&gt;dm-&gt;find(Form_Group::class, $id); 56 if (empty($form_group)) { 57 $this-&gt;app-&gt;flash('error', 'Invalid record selected.'); 58 $this-&gt;app-&gt;redirect($this-&gt;app-&gt;urlFor('form-group-list')); 59 die; 60 } 61 62 $record_company = $form_group-&gt;getCompany(); 63 $enabled_modules = Common_Helper::get_enabled_modules($record_company-&gt;getId()); </code></pre>
0debug
i am trying to convert this javascript code to php code but not working : i want to convert this javascript code to php code function testPattern(iString) { var iPattern = /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Zz1-9A-Ja-j]{1}[0-9a-zA-Z]{1}/; var patt = new RegExp(iPattern), isPatternValid = patt.test(iString); return isPatternValid; } i tried this php code but not working function testPattern($iString) { $iPattern ="/[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Zz1-9A-Ja-j]{1}[0-9a-zA-Z]{1}/"; $isPatternValid = preg_match($ipattern, $istring); return $isPatternValid; }
0debug
document.getElementById('input').innerHTML = user_input;
1threat
why does this code give me error, when written between div tag : <pre><code>movies.map((movie)=&gt;( if(movie.name=='Harry Potter'){ setCount(count=5) } &lt;Movie name={movie.name} price={movie.price} key={movie.id}/&gt; )) </code></pre> <p>it is written in between div tag in react, what is the error of this code</p>
0debug
HTACCESS blocking images : Im working on a project and i want the links to be rewritten without my images not loading up on the index. My .HTACCESS file RewriteEngine On RewriteRule ^(|/)$ index.php?url=$1 RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?url=$1 RewriteRule ^([^/]+)/([^/]+)$ index.php?url=$1&page=$2 [NC,L] RewriteEngine on RewriteRule ^(.*)\.htm$ $1.php [NC] It cant pull a image from 127.0.0.1/ase/ts/
0debug
static void test_visitor_out_empty(TestOutputVisitorData *data, const void *unused) { QObject *arg; arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QNULL); g_assert(arg->refcnt == 2); qobject_decref(arg); }
1threat
static int disas_vfp_insn(CPUState * env, DisasContext *s, uint32_t insn) { uint32_t rd, rn, rm, op, i, n, offset, delta_d, delta_m, bank_mask; int dp, veclen; TCGv addr; TCGv tmp; TCGv tmp2; if (!arm_feature(env, ARM_FEATURE_VFP)) return 1; if (!s->vfp_enabled) { if ((insn & 0x0fe00fff) != 0x0ee00a10) return 1; rn = (insn >> 16) & 0xf; if (rn != ARM_VFP_FPSID && rn != ARM_VFP_FPEXC && rn != ARM_VFP_MVFR1 && rn != ARM_VFP_MVFR0) return 1; } dp = ((insn & 0xf00) == 0xb00); switch ((insn >> 24) & 0xf) { case 0xe: if (insn & (1 << 4)) { rd = (insn >> 12) & 0xf; if (dp) { int size; int pass; VFP_DREG_N(rn, insn); if (insn & 0xf) return 1; if (insn & 0x00c00060 && !arm_feature(env, ARM_FEATURE_NEON)) return 1; pass = (insn >> 21) & 1; if (insn & (1 << 22)) { size = 0; offset = ((insn >> 5) & 3) * 8; } else if (insn & (1 << 5)) { size = 1; offset = (insn & (1 << 6)) ? 16 : 0; } else { size = 2; offset = 0; } if (insn & ARM_CP_RW_BIT) { tmp = neon_load_reg(rn, pass); switch (size) { case 0: if (offset) tcg_gen_shri_i32(tmp, tmp, offset); if (insn & (1 << 23)) gen_uxtb(tmp); else gen_sxtb(tmp); break; case 1: if (insn & (1 << 23)) { if (offset) { tcg_gen_shri_i32(tmp, tmp, 16); } else { gen_uxth(tmp); } } else { if (offset) { tcg_gen_sari_i32(tmp, tmp, 16); } else { gen_sxth(tmp); } } break; case 2: break; } store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); if (insn & (1 << 23)) { if (size == 0) { gen_neon_dup_u8(tmp, 0); } else if (size == 1) { gen_neon_dup_low16(tmp); } for (n = 0; n <= pass * 2; n++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(rn, n, tmp2); } neon_store_reg(rn, n, tmp); } else { switch (size) { case 0: tmp2 = neon_load_reg(rn, pass); gen_bfi(tmp, tmp2, tmp, offset, 0xff); tcg_temp_free_i32(tmp2); break; case 1: tmp2 = neon_load_reg(rn, pass); gen_bfi(tmp, tmp2, tmp, offset, 0xffff); tcg_temp_free_i32(tmp2); break; case 2: break; } neon_store_reg(rn, pass, tmp); } } } else { if ((insn & 0x6f) != 0x00) return 1; rn = VFP_SREG_N(insn); if (insn & ARM_CP_RW_BIT) { if (insn & (1 << 21)) { rn >>= 1; switch (rn) { case ARM_VFP_FPSID: if (IS_USER(s) && arm_feature(env, ARM_FEATURE_VFP3)) return 1; tmp = load_cpu_field(vfp.xregs[rn]); break; case ARM_VFP_FPEXC: if (IS_USER(s)) return 1; tmp = load_cpu_field(vfp.xregs[rn]); break; case ARM_VFP_FPINST: case ARM_VFP_FPINST2: if (IS_USER(s) || arm_feature(env, ARM_FEATURE_VFP3)) return 1; tmp = load_cpu_field(vfp.xregs[rn]); break; case ARM_VFP_FPSCR: if (rd == 15) { tmp = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); tcg_gen_andi_i32(tmp, tmp, 0xf0000000); } else { tmp = tcg_temp_new_i32(); gen_helper_vfp_get_fpscr(tmp, cpu_env); } break; case ARM_VFP_MVFR0: case ARM_VFP_MVFR1: if (IS_USER(s) || !arm_feature(env, ARM_FEATURE_VFP3)) return 1; tmp = load_cpu_field(vfp.xregs[rn]); break; default: return 1; } } else { gen_mov_F0_vreg(0, rn); tmp = gen_vfp_mrs(); } if (rd == 15) { gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(s, rd, tmp); } } else { tmp = load_reg(s, rd); if (insn & (1 << 21)) { rn >>= 1; switch (rn) { case ARM_VFP_FPSID: case ARM_VFP_MVFR0: case ARM_VFP_MVFR1: break; case ARM_VFP_FPSCR: gen_helper_vfp_set_fpscr(cpu_env, tmp); tcg_temp_free_i32(tmp); gen_lookup_tb(s); break; case ARM_VFP_FPEXC: if (IS_USER(s)) return 1; tcg_gen_andi_i32(tmp, tmp, 1 << 30); store_cpu_field(tmp, vfp.xregs[rn]); gen_lookup_tb(s); break; case ARM_VFP_FPINST: case ARM_VFP_FPINST2: store_cpu_field(tmp, vfp.xregs[rn]); break; default: return 1; } } else { gen_vfp_msr(tmp); gen_mov_vreg_F0(0, rn); } } } } else { op = ((insn >> 20) & 8) | ((insn >> 19) & 6) | ((insn >> 6) & 1); if (dp) { if (op == 15) { rn = ((insn >> 15) & 0x1e) | ((insn >> 7) & 1); } else { VFP_DREG_N(rn, insn); } if (op == 15 && (rn == 15 || ((rn & 0x1c) == 0x18))) { rd = VFP_SREG_D(insn); } else { VFP_DREG_D(rd, insn); } if (op == 15 && (((rn & 0x1c) == 0x10) || ((rn & 0x14) == 0x14))) { rm = VFP_SREG_M(insn); } else { VFP_DREG_M(rm, insn); } } else { rn = VFP_SREG_N(insn); if (op == 15 && rn == 15) { VFP_DREG_D(rd, insn); } else { rd = VFP_SREG_D(insn); } rm = VFP_SREG_M(insn); } veclen = s->vec_len; if (op == 15 && rn > 3) veclen = 0; delta_m = 0; delta_d = 0; bank_mask = 0; if (veclen > 0) { if (dp) bank_mask = 0xc; else bank_mask = 0x18; if ((rd & bank_mask) == 0) { veclen = 0; } else { if (dp) delta_d = (s->vec_stride >> 1) + 1; else delta_d = s->vec_stride + 1; if ((rm & bank_mask) == 0) { delta_m = 0; } else { delta_m = delta_d; } } } if (op == 15) { switch (rn) { case 16: case 17: gen_mov_F0_vreg(0, rm); break; case 8: case 9: gen_mov_F0_vreg(dp, rd); gen_mov_F1_vreg(dp, rm); break; case 10: case 11: gen_mov_F0_vreg(dp, rd); gen_vfp_F1_ld0(dp); break; case 20: case 21: case 22: case 23: case 28: case 29: case 30: case 31: gen_mov_F0_vreg(dp, rd); break; default: gen_mov_F0_vreg(dp, rm); break; } } else { gen_mov_F0_vreg(dp, rn); gen_mov_F1_vreg(dp, rm); } for (;;) { switch (op) { case 0: gen_vfp_F1_mul(dp); gen_mov_F0_vreg(dp, rd); gen_vfp_add(dp); break; case 1: gen_vfp_mul(dp); gen_vfp_F1_neg(dp); gen_mov_F0_vreg(dp, rd); gen_vfp_add(dp); break; case 2: gen_vfp_F1_mul(dp); gen_mov_F0_vreg(dp, rd); gen_vfp_neg(dp); gen_vfp_add(dp); break; case 3: gen_vfp_mul(dp); gen_vfp_F1_neg(dp); gen_mov_F0_vreg(dp, rd); gen_vfp_neg(dp); gen_vfp_add(dp); break; case 4: gen_vfp_mul(dp); break; case 5: gen_vfp_mul(dp); gen_vfp_neg(dp); break; case 6: gen_vfp_add(dp); break; case 7: gen_vfp_sub(dp); break; case 8: gen_vfp_div(dp); break; case 14: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; n = (insn << 12) & 0x80000000; i = ((insn >> 12) & 0x70) | (insn & 0xf); if (dp) { if (i & 0x40) i |= 0x3f80; else i |= 0x4000; n |= i << 16; tcg_gen_movi_i64(cpu_F0d, ((uint64_t)n) << 32); } else { if (i & 0x40) i |= 0x780; else i |= 0x800; n |= i << 19; tcg_gen_movi_i32(cpu_F0s, n); } break; case 15: switch (rn) { case 0: break; case 1: gen_vfp_abs(dp); break; case 2: gen_vfp_neg(dp); break; case 3: gen_vfp_sqrt(dp); break; case 4: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp = gen_vfp_mrs(); tcg_gen_ext16u_i32(tmp, tmp); gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp, cpu_env); tcg_temp_free_i32(tmp); break; case 5: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp = gen_vfp_mrs(); tcg_gen_shri_i32(tmp, tmp, 16); gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp, cpu_env); tcg_temp_free_i32(tmp); break; case 6: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp = tcg_temp_new_i32(); gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); gen_mov_F0_vreg(0, rd); tmp2 = gen_vfp_mrs(); tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); gen_vfp_msr(tmp); break; case 7: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp = tcg_temp_new_i32(); gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp, tmp, 16); gen_mov_F0_vreg(0, rd); tmp2 = gen_vfp_mrs(); tcg_gen_ext16u_i32(tmp2, tmp2); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); gen_vfp_msr(tmp); break; case 8: gen_vfp_cmp(dp); break; case 9: gen_vfp_cmpe(dp); break; case 10: gen_vfp_cmp(dp); break; case 11: gen_vfp_F1_ld0(dp); gen_vfp_cmpe(dp); break; case 15: if (dp) gen_helper_vfp_fcvtsd(cpu_F0s, cpu_F0d, cpu_env); else gen_helper_vfp_fcvtds(cpu_F0d, cpu_F0s, cpu_env); break; case 16: gen_vfp_uito(dp, 0); break; case 17: gen_vfp_sito(dp, 0); break; case 20: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_shto(dp, 16 - rm, 0); break; case 21: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_slto(dp, 32 - rm, 0); break; case 22: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_uhto(dp, 16 - rm, 0); break; case 23: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_ulto(dp, 32 - rm, 0); break; case 24: gen_vfp_toui(dp, 0); break; case 25: gen_vfp_touiz(dp, 0); break; case 26: gen_vfp_tosi(dp, 0); break; case 27: gen_vfp_tosiz(dp, 0); break; case 28: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_tosh(dp, 16 - rm, 0); break; case 29: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_tosl(dp, 32 - rm, 0); break; case 30: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_touh(dp, 16 - rm, 0); break; case 31: if (!arm_feature(env, ARM_FEATURE_VFP3)) return 1; gen_vfp_toul(dp, 32 - rm, 0); break; default: printf ("rn:%d\n", rn); return 1; } break; default: printf ("op:%d\n", op); return 1; } if (op == 15 && (rn >= 8 && rn <= 11)) ; else if (op == 15 && dp && ((rn & 0x1c) == 0x18)) gen_mov_vreg_F0(0, rd); else if (op == 15 && rn == 15) gen_mov_vreg_F0(!dp, rd); else gen_mov_vreg_F0(dp, rd); if (veclen == 0) break; if (op == 15 && delta_m == 0) { while (veclen--) { rd = ((rd + delta_d) & (bank_mask - 1)) | (rd & bank_mask); gen_mov_vreg_F0(dp, rd); } break; } veclen--; rd = ((rd + delta_d) & (bank_mask - 1)) | (rd & bank_mask); if (op == 15) { rm = ((rm + delta_m) & (bank_mask - 1)) | (rm & bank_mask); gen_mov_F0_vreg(dp, rm); } else { rn = ((rn + delta_d) & (bank_mask - 1)) | (rn & bank_mask); gen_mov_F0_vreg(dp, rn); if (delta_m) { rm = ((rm + delta_m) & (bank_mask - 1)) | (rm & bank_mask); gen_mov_F1_vreg(dp, rm); } } } } break; case 0xc: case 0xd: if ((insn & 0x03e00000) == 0x00400000) { rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; if (dp) { VFP_DREG_M(rm, insn); } else { rm = VFP_SREG_M(insn); } if (insn & ARM_CP_RW_BIT) { if (dp) { gen_mov_F0_vreg(0, rm * 2); tmp = gen_vfp_mrs(); store_reg(s, rd, tmp); gen_mov_F0_vreg(0, rm * 2 + 1); tmp = gen_vfp_mrs(); store_reg(s, rn, tmp); } else { gen_mov_F0_vreg(0, rm); tmp = gen_vfp_mrs(); store_reg(s, rd, tmp); gen_mov_F0_vreg(0, rm + 1); tmp = gen_vfp_mrs(); store_reg(s, rn, tmp); } } else { if (dp) { tmp = load_reg(s, rd); gen_vfp_msr(tmp); gen_mov_vreg_F0(0, rm * 2); tmp = load_reg(s, rn); gen_vfp_msr(tmp); gen_mov_vreg_F0(0, rm * 2 + 1); } else { tmp = load_reg(s, rd); gen_vfp_msr(tmp); gen_mov_vreg_F0(0, rm); tmp = load_reg(s, rn); gen_vfp_msr(tmp); gen_mov_vreg_F0(0, rm + 1); } } } else { rn = (insn >> 16) & 0xf; if (dp) VFP_DREG_D(rd, insn); else rd = VFP_SREG_D(insn); if ((insn & 0x01200000) == 0x01000000) { offset = (insn & 0xff) << 2; if ((insn & (1 << 23)) == 0) offset = -offset; if (s->thumb && rn == 15) { addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, s->pc & ~2); } else { addr = load_reg(s, rn); } tcg_gen_addi_i32(addr, addr, offset); if (insn & (1 << 20)) { gen_vfp_ld(s, dp, addr); gen_mov_vreg_F0(dp, rd); } else { gen_mov_F0_vreg(dp, rd); gen_vfp_st(s, dp, addr); } tcg_temp_free_i32(addr); } else { int w = insn & (1 << 21); if (dp) n = (insn >> 1) & 0x7f; else n = insn & 0xff; if (w && !(((insn >> 23) ^ (insn >> 24)) & 1)) { return 1; } if (n == 0 || (rd + n) > 32 || (dp && n > 16)) { return 1; } if (rn == 15 && w) { return 1; } if (s->thumb && rn == 15) { addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, s->pc & ~2); } else { addr = load_reg(s, rn); } if (insn & (1 << 24)) tcg_gen_addi_i32(addr, addr, -((insn & 0xff) << 2)); if (dp) offset = 8; else offset = 4; for (i = 0; i < n; i++) { if (insn & ARM_CP_RW_BIT) { gen_vfp_ld(s, dp, addr); gen_mov_vreg_F0(dp, rd + i); } else { gen_mov_F0_vreg(dp, rd + i); gen_vfp_st(s, dp, addr); } tcg_gen_addi_i32(addr, addr, offset); } if (w) { if (insn & (1 << 24)) offset = -offset * n; else if (dp && (insn & 1)) offset = 4; else offset = 0; if (offset != 0) tcg_gen_addi_i32(addr, addr, offset); store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } } } break; default: return 1; } return 0; }
1threat
static void vnc_copy(VncState *vs, int src_x, int src_y, int dst_x, int dst_y, int w, int h) { vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); vnc_framebuffer_update(vs, dst_x, dst_y, w, h, VNC_ENCODING_COPYRECT); vnc_write_u16(vs, src_x); vnc_write_u16(vs, src_y); vnc_unlock_output(vs); vnc_flush(vs); }
1threat
How can I convert a Long value to date time and convert current time to Long kotlin? : <p>The Code A can convert a long value to date value, just like 2018.01.10</p> <ol> <li><p>I hope to get Date + Time value , such as 2018.01.10 23:11, how can I do with Kotlin? </p></li> <li><p>I hope to convert current time to a long value , how can I do with Kotlin? </p></li> </ol> <p>Thanks!</p> <p><strong>Code A</strong></p> <pre><code>fun Long.toDateString(dateFormat: Int = DateFormat.MEDIUM): String { val df = DateFormat.getDateInstance(dateFormat, Locale.getDefault()) return df.format(this) } </code></pre>
0debug
How to initialize an array in c# : <p>Hey i'm trying to initialize an array in c# and don't know why this doesn't work</p> <pre><code>Wave currentWave = new Wave( { {1, 1, 1}, {1, 1}, {1, 1, 1} }, {3, 2} ); private class Wave { private int currentLoad; private int[] aTimesToNextLoad; private int[][] aEnemieLoads; public Wave(int[][] aEnemiesToLoad, int[] aTimesToNextLoad) { this.aEnemieLoads = aEnemieLoads; this.aTimesToNextLoad = aTimesToNextLoad; } } </code></pre> <p>I get like 18 syntax errors with this. I have also tried using <code>new int[][] {...}</code>, then i get this message:</p> <p>Array initializers can only be used in a variable or field initializer. Try using a new expression instead</p> <p>What is the solution?</p>
0debug
How to return -1 value? : <p>Write a function called day_diff that takes four scalar positive integer inputs, month1, day1, month2, day2. These represents the birthdays of two children who were born in 2015. The function returns a positive integer scalar that is equal to the difference between the ages of the two children in days. Make sure to check that the input values are of the correct types and they represent valid dates. If they are erroneous, return -1. An example call to the function would be</p> <blockquote> <blockquote> <p>dd = day_diff(1,30,2,1); which would make dd equal 2. You are not allowed to use the built-in function datenum or datetime.</p> </blockquote> </blockquote> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function dd = day_diff(month1, day1, month2, day2) if (month1 &amp;&amp; month2 &gt; 0) || (month1 &amp;&amp; month2 &lt;= 12) if month1 == 1 &amp;&amp; month2 == 1 if day1 == day2 total1 = day1; total2 = day2; elseif day1 ~= day2 total1 = max(day1,day2); total2 = min(day1,day2); end elseif month1 == 1 &amp;&amp; month2 == 2 total1 = day1; total2 = day2 + 31; elseif (month1 == 2 &amp;&amp; day1 &lt;= 28) &amp;&amp; month2 == 1 total1 = day1 + 31; total2 = day2; elseif month1 == 1 &amp;&amp; month2 == 12 total1 = day1; total2 = day2 + 334; elseif month1 == 2 &amp;&amp; month2 == 3 total1 = day1 + 31; total2 = day2 + 59; elseif month1 == 7 &amp;&amp; month2 == 9 total1 = day1 + 181; total2 = day2 + 243; else return end end dd = (max(total1,total2)) - (min(total1,total2));</code></pre> </div> </div> </p>
0debug
Python enumerate reverse index only : <p>I am trying to reverse the index given by <code>enumerate</code> whilst retaining the original order of the list being enumerated.</p> <p>Assume I have the following:</p> <pre><code>&gt;&gt; range(5) [0, 1, 2, 3, 4] </code></pre> <p>If I enumerate this I would get the following:</p> <pre><code>&gt;&gt; list(enumerate(range(5))) [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] </code></pre> <p>However I want to reverse the index provided by enumerate so that I get:</p> <pre><code>[(4, 0), (3, 1), (2, 2), (1, 3), (0, 4)] </code></pre> <p>So far I have the following code:</p> <pre><code>reversed(list(enumerate(reversed(range(5))))) </code></pre> <p>I was just wondering if there was a neater way to do this?</p>
0debug
Interface vs 100% abstract class : <p>If we can have 100% abstract class with all abstract methods that will work equivalent to Interface.Why we have interface and how it is better than 100% abstract class???</p>
0debug
static inline void gen_op_evslw(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) { TCGv_i32 t0; int l1, l2; l1 = gen_new_label(); l2 = gen_new_label(); t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, arg2, 0x3F); tcg_gen_brcondi_i32(TCG_COND_GE, t0, 32, l1); tcg_gen_shl_i32(ret, arg1, t0); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_i32(ret, 0); gen_set_label(l2); tcg_temp_free_i32(t0); }
1threat
Finding values in one column with several different values in another column in R : I have a large data set with a column for the identity and a birthdate. Unfortunately, some id names were used for different individuals. `sample = data.frame("id" = c("val1", "val1", "val1", "val1", "val2", "val2", "val2", "val3", "val3", "val3", "val3"), "birthday" = c("1", "1", "1", "1", "2", "3", "4", "5", "6", "7", "7"))` Now I'm trying to find which id's have different birthdates to be able to rename them. I know I could do it with a for loop but I was wondering whether there is an easier & faster way? Or how would you deal with it? Thank you very much Nina
0debug
stream_push(StreamSlave *sink, uint8_t *buf, size_t len, uint32_t *app) { StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink); return k->push(sink, buf, len, app); }
1threat